Package: jack Version: 3.1.1-7 Severity: wishlist Tags: patch When jack is started with the -Q --edit-cddb options and the user modifies the CDDB entry and opts to submit the new entry, jack asks for the category of the CD. However, this is not necessary since we previously obtained the category via CDDB. jack should just use this category since changing category with an updated entry will only lead to Bad Things anyway.
Here's a patch: diff -urN jack-3.1.1~/jack_freedb.py jack-3.1.1/jack_freedb.py --- jack-3.1.1~/jack_freedb.py 2005-10-23 09:20:31.000000000 +0100 +++ jack-3.1.1/jack_freedb.py 2005-10-23 09:22:56.000000000 +0100 @@ -685,33 +685,34 @@ return cat[x] -def do_freedb_submit(file, cd_id): +def do_freedb_submit(file, cd_id, cat=None): import httplib - hello = "hello=" + cf['_username'] + " " + cf['_hostname'] + " " + prog_name + " " + prog_version - print "Info: querying categories..." - url = "http://" + freedb_servers[cf['_freedb_server']]['host'] + "/~cddb/cddb.cgi?" + urllib.quote_plus("cmd=cddb lscat" + "&" + hello + "&proto=6", "=&") - f = urllib2.urlopen(url) - buf = f.readline() - if buf[0:3] == "500": - print "Info: LSCAT failed, using builtin categories..." - cat = choose_cat() - - elif buf[0:3] == "210": - cat = ["null", ] - while 1: - buf = f.readline() - if not buf: - break - buf = string.rstrip(buf) - if buf != ".": - cat.append(buf) - f.close() - cat = choose_cat(cat) + if not cat: + hello = "hello=" + cf['_username'] + " " + cf['_hostname'] + " " + prog_name + " " + prog_version + print "Info: querying categories..." + url = "http://" + freedb_servers[cf['_freedb_server']]['host'] + "/~cddb/cddb.cgi?" + urllib.quote_plus("cmd=cddb lscat" + "&" + hello + "&proto=6", "=&") + f = urllib2.urlopen(url) + buf = f.readline() + if buf[0:3] == "500": + print "Info: LSCAT failed, using builtin categories..." + cat = choose_cat() + + elif buf[0:3] == "210": + cat = ["null", ] + while 1: + buf = f.readline() + if not buf: + break + buf = string.rstrip(buf) + if buf != ".": + cat.append(buf) + f.close() + cat = choose_cat(cat) - else: - error("LSCAT failed: " + string.rstrip(buf) + f.read()) + else: + error("LSCAT failed: " + string.rstrip(buf) + f.read()) - print "OK, using `" + cat + "'." + print "OK, using category `" + cat + "'." email = freedb_servers[cf['_freedb_server']]['my_mail'] print "Your e-mail address is needed to send error messages to you." x = raw_input("enter your e-mail-address [" + email + "]: ") @@ -785,11 +786,12 @@ print "consider submitting via mail (" + progname + " -m). full error:\n" print err, msg -def do_freedb_mailsubmit(file, cd_id): +def do_freedb_mailsubmit(file, cd_id, cat=None): warning("Support for freedb submission via e-mail may be dropped in future versions. Please begin to use HTTP to submit your entries (--submit)") sendmail = '/usr/lib/sendmail -t' #sendmail = 'cat > /tmp/jack.test.mailsubmit' - cat = choose_cat() + if not cat: + cat = choose_cat() print "OK, using `" + cat + "'." if string.find(freedb_servers[cf['_freedb_server']]['my_mail'], "@") >= 1 and len(freedb_servers[cf['_freedb_server']]['my_mail']) > 3: return os.system("( echo 'To: " + freedb_servers[cf['_freedb_server']]['mail'] + "'; echo From: '" + freedb_servers[cf['_freedb_server']]['my_mail'] + "'; echo 'Subject: cddb " + cat + " " + cd_id + "' ; cat '" + file + "' ) | " + sendmail) diff -urN jack-3.1.1~/jack_prepare.py jack-3.1.1/jack_prepare.py --- jack-3.1.1~/jack_prepare.py 2005-10-23 09:20:31.000000000 +0100 +++ jack-3.1.1/jack_prepare.py 2005-10-23 09:21:10.000000000 +0100 @@ -461,7 +461,7 @@ return status -def freedb_submit(): +def freedb_submit(cat=None): "submit freedb data on user's request" if not is_submittable: error("can't submit in current state, please fix jack.freedb") @@ -471,9 +471,9 @@ error("invalid freedb file") else: if cf['_freedb_mailsubmit']: - jack_freedb.do_freedb_mailsubmit(cf['_freedb_form_file'], cd_id) + jack_freedb.do_freedb_mailsubmit(cf['_freedb_form_file'], cd_id, cat) else: - jack_freedb.do_freedb_submit(cf['_freedb_form_file'], cd_id) + jack_freedb.do_freedb_submit(cf['_freedb_form_file'], cd_id, cat) ### (9) do query on start @@ -516,7 +516,7 @@ x = raw_input("Would you like to submit these changes to the FreeDB server? (y/N) ") if string.upper(x[0]) == "Y": jack_freedb.update_revision(file) - freedb_submit() + freedb_submit(jack_progress.status_all['freedb_cat']) if cf['_query_on_start']: err, jack_tag.track_names, jack_tag.locale_names, freedb_rename, revision = jack_freedb.interpret_db_file(jack_ripstuff.all_tracks, todo, cf['_freedb_form_file'], verb = cf['_query_on_start'], dirs = 1) -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.12-1-686 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages jack depends on: ii cdparanoia 3a9.8-11 An audio extraction tool for sampl ii flac 1.1.2-3 Free Lossless Audio Codec - comman ii python 2.3.5-3 An interactive high-level object-o ii python-cddb 1.4-3 Python interface to CD-IDs and Fre ii python-eyed3 0.6.8-1 Python module for id3-tags manipul ii python-pyvorbis 1.3-1 A Python interface to the Ogg Vorb ii vorbis-tools 1.0.1-1.5 Several Ogg Vorbis Tools jack recommends no packages. -- no debconf information -- Martin Michlmayr http://www.cyrius.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]