tags 349368 + patch pending
thanks

* Anthony DeRobertis <[EMAIL PROTECTED]> [2006-01-22 11:05]:
> [EMAIL PROTECTED]:Complete Orchestral Works (Disc 6)$ jack 
> Traceback (most recent call last):
...
>   File "/usr/lib/python2.3/site-packages/jack_freedb.py", line 76, in 
> interpret_db_file
>     new_dirs, new_dir = jack_utils.mkdirname(track_names, cf['_dir_template'])
>   File "/usr/lib/python2.3/site-packages/jack_utils.py", line 177, in 
> mkdirname
>     x = jack_misc.multi_replace(i, replace_list, unusable_charmap)
...
> AttributeError: 'NoneType' object has no attribute 'replace'

> Going in to multi_replace:
> 
> rules = 
>       (('%a', 'Richard Strauss'),
>       ('%l', 'Complete Orchestral Works (Disc 6)'), ('%y', '-1'),
>       ('%g', None)) 
> s = %g
> 
> My config file contains:
>       dir_template:%g/%a/%l
> 
> There needs to be an error message when I forget -G instead of an
> exception backtrace.

Yes, now you get the following:

9417:[EMAIL PROTECTED]: ~/tmp/jack] jack -Q -t 1
This is jack 3.1.1 (C)2004 Arne Zellentin <[EMAIL PROTECTED]>
 *info* matching dir found: /home/tbm/tmp/jack/-1/various_artists
 *info* querying...
As a reminder, the following options are used to specify how the resulting 
files are named:
    %a: artist
    %l: album title
    %g: album genre - individual track genres are unsupported
 *error* %g is not set but used in dir_template.

Unfortunately, there's no easy way to match %g to a command line
option, but I think printing the help information for dir_template
should be enough to tell people what %g/&y/etc mean.

BTW, Arne, another buglet: %y is supported but not listed there.


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
@@ -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 int(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