File: mb-submit-disc

package info (click to toggle)
python-musicbrainz2 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 648 kB
  • ctags: 881
  • sloc: python: 4,624; xml: 999; makefile: 14
file content (40 lines) | stat: -rwxr-xr-x 872 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/env python
# 
# Helper script to calculate a MusicBrainz DiscID and a disc submission URL.
#
# Usage:
#	mb-submit-disc [device]
#
# $Id$
#
import sys
import musicbrainz2.disc as mbdisc

if len(sys.argv) == 1:
	device = None
elif len(sys.argv) == 2:
	device = sys.argv[1]
if len(sys.argv) > 2:
	print >>sys.stderr, 'Usage: %s [device]' % sys.argv[0]
	sys.exit(1);

try:
	# Read the disc in the given drive. If no device name is given, use
	# the default one.
	#
	if device is None:
		disc = mbdisc.readDisc()
	else:
		disc = mbdisc.readDisc(device)
except mbdisc.DiscError, e:
	print "%s: Couldn't read disc: %s" % (sys.argv[0], e)
	print >>sys.stderr, "Is there an Audio CD in the drive?"
	sys.exit(1)

print 'MusicBrainz DiscID:', disc.id
print

print 'You can use the following URL to submit this disc to MB:'
print ' ', mbdisc.getSubmissionUrl(disc)

# EOF