summaryrefslogtreecommitdiff
path: root/debian/patches/72_upd_progress_renamed.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/72_upd_progress_renamed.patch')
-rw-r--r--debian/patches/72_upd_progress_renamed.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/debian/patches/72_upd_progress_renamed.patch b/debian/patches/72_upd_progress_renamed.patch
new file mode 100644
index 0000000..a28c7f2
--- /dev/null
+++ b/debian/patches/72_upd_progress_renamed.patch
@@ -0,0 +1,72 @@
+Make --upd-progress work even after files have been renamed by
+looking for both the generic and the FreeDB based name. Debian #351460
+
+Depends on 71_freedb_filename_cleanup.patch.
+
+diff -urN a/jack_functions.py jack-3.1.1+cvs20050801/jack_functions.py
+--- a/jack_functions.py 2006-02-05 15:54:03.000000000 +0000
++++ jack-3.1.1+cvs20050801/jack_functions.py 2006-02-05 16:24:54.000000000 +0000
+@@ -24,6 +24,7 @@
+ import string
+ import sys
+ import os
++import locale
+
+ import jack_TOCentry
+ import jack_CDTime
+@@ -31,6 +32,7 @@
+ import jack_TOC
+ import jack_mp3
+ import jack_helpers
++import jack_freedb
+
+ from jack_globals import *
+
+@@ -461,3 +463,14 @@
+
+ import jack_version
+ error("illegal genre. Try '" + jack_version.prog_name + " --id3-genre help' for a list.")
++
++def check_file(num, i, ext):
++ "Check if a song exists, either with a generic name or with the FreeDB name"
++ if os.path.exists(i[NAME] + ext):
++ return i[NAME]
++ elif jack_freedb.names_available:
++ s = jack_freedb.filenames[num].encode(locale.getpreferredencoding(), "replace")
++ if os.path.exists(s + ext):
++ return s
++ return None
++
+diff -urN a/jack_prepare.py jack-3.1.1+cvs20050801/jack_prepare.py
+--- a/jack_prepare.py 2006-02-05 15:54:03.000000000 +0000
++++ jack-3.1.1+cvs20050801/jack_prepare.py 2006-02-05 16:24:34.000000000 +0000
+@@ -331,19 +331,25 @@
+ "update progress file at user's request (operation mode)"
+
+ if cf['_upd_progress']:
++ # users may still have a valid jack.freedb file lying around
++ if not jack_freedb.names_available:
++ 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 = 0, dirs = 1)
++
+ for i in todo:
+ num = i[NUM]
+ if not status[num]['dae']:
+- if os.path.exists(i[NAME] + ".wav"):
++ filename = jack_functions.check_file(num, i, ".wav")
++ if filename:
+ status[num]['dae'] = " * [ simulated ]"
+ jack_functions.progress(num, "dae", status[num]['dae'])
+ if not status[num]['enc']:
+- if os.path.exists(i[NAME] + ext):
++ filename = jack_functions.check_file(num, i, ext)
++ if filename:
+ if ext == ".mp3":
+- x = jack_mp3.mp3format(i[NAME] + ext)
++ x = jack_mp3.mp3format(filename + ext)
+ temp_rate = x['bitrate']
+ elif ext == ".ogg" and ogg:
+- x = ogg.vorbis.VorbisFile(i[NAME] + ext)
++ x = ogg.vorbis.VorbisFile(filename + ext)
+ temp_rate = int(x.raw_total(0) * 8 / x.time_total(0) / 1000 + 0.5)
+ else:
+ error("don't know how to handle %s files." % ext)