*sigh*  I forgot to add an 'import' to the patch.  Here's it again.

Print an error if the information for dir_template cannot be filled in


diff -urN jack-3.1.1~/jack_config.py jack-3.1.1/jack_config.py
--- jack-3.1.1~/jack_config.py  2006-01-23 11:52:09.000000000 +0000
+++ jack-3.1.1/jack_config.py   2006-01-23 11:52:47.000000000 +0000
@@ -173,7 +173,8 @@
         'doc': """specify how the resulting files are named:
     %a: artist
     %l: album title
-    %g: album genre - individual track genres are unsupported""",
+    %g: album genre - individual track genres are unsupported
+    %y: album year - individual track years are unsupported""",
         'long': 'AUTO',
         },
     'char_filter': {
diff -urN jack-3.1.1~/jack_utils.py jack-3.1.1/jack_utils.py
--- jack-3.1.1~/jack_utils.py   2006-01-23 11:52:09.000000000 +0000
+++ jack-3.1.1/jack_utils.py    2006-01-23 12:07:44.000000000 +0000
@@ -27,6 +27,7 @@
 import jack_globals
 import jack_misc
 import jack_term
+import jack_config
 
 from jack_globals import *
 
@@ -170,10 +170,18 @@
     dirs = template.split(os.path.sep)
         
     dirs2 = []
+    replace_list = (("%a", names[0][0].encode(cf['_charset'], "replace")),
+                    ("%l", names[0][1].encode(cf['_charset'], "replace")),
+                    ("%y", `cf['_id3_year']`), ("%g", cf['_id3_genre_txt']))
+    for a, b in replace_list:
+        if a in dirs and (not b or (a == "%y" and b in ("-1", "0"))):
+            # printing the doc string of jack_config.cf is a bit of a hack,
+            # but there's currently no other way to find out what the
+            # variables (%g, %y, etc) stand for.
+            print "As a reminder, the following options are used to",
+            print jack_config.cf['dir_template']['doc']
+            error("%s is not set but used in dir_template." % a)
     for i in dirs:
-        replace_list = (("%a", names[0][0].encode(cf['_charset'], "replace")),
-                        ("%l", names[0][1].encode(cf['_charset'], "replace")),
-                        ("%y", `cf['_id3_year']`), ("%g", 
cf['_id3_genre_txt']))
         x = jack_misc.multi_replace(i, replace_list, unusable_charmap)
         exec("x = x" + cf['_char_filter'])
         dirs2.append(x)



-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to