* Dan Jacobson <[EMAIL PROTECTED]> [2006-01-14 05:08]:
> # jack
> This is jack 3.1.1 (C)2004 Arne Zellentin <[EMAIL PROTECTED]>
>  *info* maybe cdparanoia is not installed?
>  *error* could not read CD's TOC.

jack only tries the default ripper helper and fails even though
another helper is installed.  If the default is not available and the
user hasn't specified a ripper, jack should fall back to one that is
installed.

Patch:
Fallback to an installed ripper when the default one is not available and
the user has not specified one.

You now get:

10749:[EMAIL PROTECTED]: ~/tmp/jack] jack -Q -t 1
This is jack 3.1.1 (C)2004 Arne Zellentin <[EMAIL PROTECTED]>
 *warning* Using ripper cdda2wav since default ripper cdparanoia is not
           available.

or

10757:[EMAIL PROTECTED]: ~/tmp/jack] jack -Q -t 1
This is jack 3.1.1 (C)2004 Arne Zellentin <[EMAIL PROTECTED]>
 *error* No valid ripper found on your system.



diff -urN jack-3.1.1~/jack jack-3.1.1/jack
--- jack-3.1.1~/jack    2006-01-23 23:40:49.000000000 +0000
+++ jack-3.1.1/jack     2006-01-23 23:41:52.000000000 +0000
@@ -84,7 +84,7 @@
 debug("user_cf: " + `user_cf`)
 debug("argv_cf: " + `argv_cf`)
 
-jack_checkopts.check_rc(global_cf, user_cf, argv_cf)
+jack_checkopts.check_rc(cf, global_cf, user_cf, argv_cf)
 jack_checkopts.consistency_check(cf)
 
 if cf['save_args']['val'] == 1:
diff -urN jack-3.1.1~/jack_checkopts.py jack-3.1.1/jack_checkopts.py
--- jack-3.1.1~/jack_checkopts.py       2006-01-23 23:40:49.000000000 +0000
+++ jack-3.1.1/jack_checkopts.py        2006-01-24 00:04:35.000000000 +0000
@@ -219,9 +219,22 @@
 # Checks concerning options specified by the user (in the global or user rc
 # files or the command line), i.e. options/values that are not the default
 # jack options from jack_config.
-def check_rc(global_cf, user_cf, argv_cf):
+def check_rc(cf, global_cf, user_cf, argv_cf):
 
     all_keys = global_cf.keys() + user_cf.keys() + argv_cf.keys()
     if 'base_dir' not in all_keys:
         warning("You have no standard location set, putting files into the 
current directory. Please consider setting base_dir in ~/.jack3rc.")
 
+    # Check if the default ripper is installed, and if not, look for another 
one
+    if 'ripper' not in all_keys:
+        default_ripper = cf["ripper"]["val"]
+        if not jack_utils.in_path(default_ripper):
+            rippers = [i for i in jack_helpers.helpers if 
jack_helpers.helpers[i]["type"] == "ripper" and 
jack_helpers.helpers[i].has_key("toc_cmd")]
+            for cmd in rippers:
+                if jack_utils.in_path(cmd):
+                    warning("Using ripper %s since default ripper %s is not 
available." % (cmd, default_ripper))
+                    cf["ripper"]["val"] = cmd
+                    break
+            else:
+                error("No valid ripper found on your system.")
+
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 23:40:49.000000000 +0000
+++ jack-3.1.1/jack_utils.py    2006-01-24 00:04:35.000000000 +0000
@@ -207,6 +207,13 @@
     new_path.append(base)
     new_path.reverse()
 
+def in_path(file):
+    "check if a file is an executable in PATH"
+    for path in os.environ.get("PATH", "").split(os.path.pathsep):
+        p = os.path.join(path, file)
+        if (os.path.isfile(p) and os.access(p, os.X_OK)): return True
+    return False
+
 def ex_edit(file):
     editor = "/usr/bin/sensible-editor"
     if os.environ.has_key("EDITOR"):

-- 
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