tags 353551 + patch pending
thanks

diff -urN jack-3.1.1+cvs20050801~/jack_checkopts.py 
jack-3.1.1+cvs20050801/jack_checkopts.py
--- jack-3.1.1+cvs20050801~/jack_checkopts.py   2006-02-20 23:40:15.000000000 
+0000
+++ jack-3.1.1+cvs20050801/jack_checkopts.py    2006-02-21 00:12:12.000000000 
+0000
@@ -247,3 +247,42 @@
             else:
                 error("No valid ripper found on your system.")
 
+    # If the default CD device doesn't exist, see whether we can find another 
one
+    if 'cd_device' not in all_keys and not 
os.path.exists(cf["cd_device"]["val"]):
+        default = cf["cd_device"]["val"]
+        devices = []
+        # All CD devices can be found in /proc on Linux
+        cdrom_info = "/proc/sys/dev/cdrom/info"
+        if os.path.exists(cdrom_info):
+            try:
+                info = open(cdrom_info, "r")
+            except (IOError, OSError):
+                pass
+            else:
+                for line in info.readlines():
+                    if line.startswith("drive name:"):
+                        devices = ["/dev/" + x for x in 
line.rstrip().split("\t")[2:]]
+                        break
+                info.close()
+        message = "Default CD device %s does not exist" % default
+        if not devices:
+            error("%s." % message)
+        elif len(devices) == 1:
+            warning("%s, using %s." % (message, devices[0]))
+        else:
+            warning("%s but there are several CD devices." % message)
+            for i in range(len(devices)):
+                print "%2d" % (i+1) + ".) " + devices[i]
+            input = 0
+            while input <= 0 or input > len(devices):
+                try:
+                    input = raw_input("Please choose: ")
+                except KeyboardInterrupt:
+                    sys.exit(0)
+                if input.isdigit():
+                    input = int(input)
+                else:
+                    input = 0
+            devices[0] = devices[input-1]
+        cf.rupdate({'cd_device': {'val': devices[0]}}, "check")
+

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