Last active
December 24, 2015 13:09
-
-
Save JonnyJD/6802761 to your computer and use it in GitHub Desktop.
This shows a disc in a drive on musicbrainz.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Copyright 2009-2013 Johannes Dewender ( brainz at JonnyJD.net ) | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
# | |
# usage: ./showrelease.py [device] | |
import sys | |
import os | |
import re | |
import discid | |
# gather arguments | |
if len(sys.argv) > 1: | |
device = sys.argv[1] | |
else: | |
device = discid.get_default_device() | |
# get disc ID | |
try: | |
disc = discid.read(device) | |
url = disc.submission_url | |
id_ = disc.id | |
except discid.DiscError as exc: | |
print("DiscID calculation failed: %s" % exc) | |
sys.exit(1) | |
print('DiscID:\t\t %s' % id_) | |
# open firefox | |
try: | |
os.execlp('firefox', 'firefox', url) | |
except OSError as exc: | |
print("Couldn't open the url in firefox: %s" % e) | |
sys.exit(1) | |
# vim:set shiftwidth=4 smarttab expandtab: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment