summaryrefslogtreecommitdiff
path: root/debian/patches/42_cd_device_fallback.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/42_cd_device_fallback.patch')
-rw-r--r--debian/patches/42_cd_device_fallback.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/debian/patches/42_cd_device_fallback.patch b/debian/patches/42_cd_device_fallback.patch
new file mode 100644
index 0000000..5c40ad7
--- /dev/null
+++ b/debian/patches/42_cd_device_fallback.patch
@@ -0,0 +1,56 @@
+If the user doesn't specify a device and the default (/dev/cdrom) doesn't
+exist, it would be nice if jack could fall back to the device(s) listed in
+/proc/sys/dev/cdrom/info (at least on Linux). According to the
+linux-kernel mailing list, this is a stable interface.
+
+Debian #353551
+Depends on 21_fallback_ripper.patch
+
+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-07-02 20:09:50.000000000 +0200
++++ jack-3.1.1+cvs20050801/jack_checkopts.py 2006-07-02 20:10:24.000000000 +0200
+@@ -254,3 +254,44 @@
+ if not jack_utils.in_path(helper):
+ error("Helper %s '%s' not found on your system." % (t, helper))
+
++ # If the default CD device doesn't exist, see whether we can find another one
++ if ('cd_device' not in all_keys and cf["rip_from_device"]["val"] 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:
++ warning("%s." % message)
++ elif len(devices) == 1:
++ warning("%s, using %s." % (message, devices[0]))
++ cf.rupdate({'cd_device': {'val': devices[0]}}, "check")
++ 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")
++