diff -Nru cdemu-client-3.1.0/CMakeLists.txt cdemu-client-3.2.0/CMakeLists.txt --- cdemu-client-3.1.0/CMakeLists.txt 2017-06-10 21:29:17.000000000 +0000 +++ cdemu-client-3.2.0/CMakeLists.txt 2018-07-07 19:55:02.000000000 +0000 @@ -19,6 +19,7 @@ # Dependencies find_package (IntlTool 0.21 REQUIRED) find_package (Gettext 0.15 REQUIRED) +find_package (PkgConfig REQUIRED) if (POST_INSTALL_HOOKS) find_program (UPDATE_DESKTOP_DATABASE_EXECUTABLE NAMES update-desktop-database) @@ -36,9 +37,33 @@ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) +# determine the bash-completion install path +pkg_check_modules(BASH_COMPLETION bash-completion) +if (BASH_COMPLETION_FOUND) + # pkg_get_variable() was introduced in CMake 3.4, but for now, we + # need to support older versions as well. + if (${CMAKE_VERSION} VERSION_LESS "3.4.0") + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=completionsdir bash-completion + OUTPUT_VARIABLE def_completionsdir + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + pkg_get_variable(def_completionsdir bash-completion completionsdir) + endif() +else() + # Fall back to the old path + set(def_completionsdir ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d) +endif() + +set(CMAKE_INSTALL_COMPLETIONSDIR "${def_completionsdir}" + CACHE PATH "bash shell completions (${def_completionsdir})") + install ( FILES data/cdemu-bash-completion.sh - DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d + DESTINATION ${CMAKE_INSTALL_COMPLETIONSDIR} + # the completion filename must match executable name for autoloading + # to work (bash-completion 2.0) + RENAME cdemu ) install ( diff -Nru cdemu-client-3.1.0/data/cdemu-bash-completion.sh cdemu-client-3.2.0/data/cdemu-bash-completion.sh --- cdemu-client-3.1.0/data/cdemu-bash-completion.sh 2017-06-10 21:29:17.000000000 +0000 +++ cdemu-client-3.2.0/data/cdemu-bash-completion.sh 2018-07-07 19:55:02.000000000 +0000 @@ -112,7 +112,7 @@ return 0 ;; "--medium-type") - local medium_types="cdr74 cdr80 cdr90 cdr99 dvd+r" + local medium_types="cdr74 cdr80 cdr90 cdr99 dvd+r bdr" COMPREPLY=( $(compgen -W "${medium_types}" -- ${cur}) ) return 0 ;; diff -Nru cdemu-client-3.1.0/debian/changelog cdemu-client-3.2.0/debian/changelog --- cdemu-client-3.1.0/debian/changelog 2017-06-10 11:00:00.000000000 +0000 +++ cdemu-client-3.2.0/debian/changelog 2018-07-07 11:00:00.000000000 +0000 @@ -1,3 +1,8 @@ +cdemu-client (3.2.0-1ubuntu1~artful1~ppa1) artful; urgency=low + * Updated to 3.2.0 + * Use python3 + -- Rok Mandeljc Sat, 7 Jul 2018 12:00:00 +0100 + cdemu-client (3.1.0-1ubuntu1~artful1~ppa1) artful; urgency=low * Updated to 3.1.0. -- Rok Mandeljc Sat, 10 Jun 2017 12:00:00 +0100 diff -Nru cdemu-client-3.1.0/debian/control cdemu-client-3.2.0/debian/control --- cdemu-client-3.1.0/debian/control 2017-06-10 11:00:00.000000000 +0000 +++ cdemu-client-3.2.0/debian/control 2018-07-07 11:00:00.000000000 +0000 @@ -4,14 +4,14 @@ Homepage: http://cdemu.sourceforge.net/ Maintainer: Henrik Stokseth Build-Depends: debhelper (>= 9) -Build-Depends-Indep: python (>= 2.6.6-3), intltool, cmake (>= 2.8.5), dh-python -X-Python-Version: >= 2.6.6 +Build-Depends-Indep: python3 (>= 3.4.0), intltool, cmake (>= 2.8.5), dh-python, bash-completion, pkg-config +X-Python3-Version: >= 3.4.0 Standards-Version: 3.9.7 Package: cdemu-client Architecture: all -Depends: python (>= 2.6.6-3), python-gi (>= 3.0.0), gir1.2-glib-2.0, cdemu-daemon (>= 3.0.0), ${python:Depends}, ${misc:Depends} +Depends: python3 (>= 3.4.0), python3-gi (>= 3.0.0), gir1.2-glib-2.0, cdemu-daemon (>= 3.0.0), ${python3:Depends}, ${misc:Depends} Recommends: bash-completion, gcdemu (>= 3.0.0) Description: Command-line client to control CDEmu daemon This is cdemu-client, a command-line client for controlling the diff -Nru cdemu-client-3.1.0/debian/rules cdemu-client-3.2.0/debian/rules --- cdemu-client-3.1.0/debian/rules 2017-06-10 11:00:00.000000000 +0000 +++ cdemu-client-3.2.0/debian/rules 2018-07-07 11:00:00.000000000 +0000 @@ -9,5 +9,5 @@ dh_auto_configure -- "-DPOST_INSTALL_HOOKS:BOOL=OFF" %: - dh $@ --with python2 + dh $@ --with python3 diff -Nru cdemu-client-3.1.0/man/cdemu.1 cdemu-client-3.2.0/man/cdemu.1 --- cdemu-client-3.1.0/man/cdemu.1 2017-06-10 21:29:17.000000000 +0000 +++ cdemu-client-3.2.0/man/cdemu.1 2018-07-07 19:55:02.000000000 +0000 @@ -62,14 +62,6 @@ Allows an encoding for text-based image format (such as CUE) to be specified. This might be needed if the image descriptor file contains non-ASCII characters and does not use Unicode. - -.B --dvd-report-css -Mark the DVD image as CSS-encrypted. This influences the generation of fake -Disc Structure 0x01, and as such works only with images of DVD videos that do -not provide this information (most images, with exception of perhaps mds/mdf, don't). -Enabling this option allows images of CSS-encrypted DVDs (e.g. created using 'dd' -or 'readcd' without running through a CSS decryption step when creating the image) -to be played by a deCSS-enabled Linux media player. .TP .B create-blank [options] --writer_id= Creates blank recordable disc in the specified device. \fBdevice\fR is the number @@ -131,6 +123,18 @@ desired device, or \fIall\fR. \fBnew-value\fR is the new value to be set. If this argument is omitted, currently set value is displayed. .TP +.B dvd-report-css [new-value] +Report the loaded DVD as CSS-encrypted. \fBdevice\fR is the number of the +desired device, or \fIall\fR. \fBnew-value\fR is the new value to be set. +If this argument is omitted, currently set value is displayed. + +This flag influences the generation of fake Disc Structure 0x01, and as +such works only with images of DVD videos that do not provide this +information (most images, with exception of perhaps mds/mdf, don't). +Enabling this option allows images of CSS-encrypted DVDs (e.g. created using 'dd' +or 'readcd' without running through a CSS decryption step when creating the image) +to be played by a deCSS-enabled Linux media player. +.TP .B device-id [new-vendor-id] [new-product-id] [new-revision] [new-vendor-specific] Displays/sets device ID. \fBdevice\fR is the number of the desired device. \fBnew-vendor-id\fR is the new vendor ID string to be set (8 characters max). @@ -174,7 +178,8 @@ cdemu load 0 ~/image.daa --password=seeninplain .TP .B Loading a raw image of a CSS-encrypted DVD created by 'dd', so it can be played by mplayer: - cdemu load 0 ~/image.iso --dvd-report-css=true + cdemu load 0 ~/image.iso + cdemu dvd-report-css 0 1 .TP .B Creating a blank recordable disc: DVD+R SL with ISO image writer: cdemu create-blank --writer-id=WRITER-ISO --medium-type=dvd+r 0 ~/output-image.iso diff -Nru cdemu-client-3.1.0/README cdemu-client-3.2.0/README --- cdemu-client-3.1.0/README 2017-06-10 21:29:17.000000000 +0000 +++ cdemu-client-3.2.0/README 2018-07-07 19:55:02.000000000 +0000 @@ -1,5 +1,5 @@ CDEmu client -3.1.0 +3.2.0 ~~~~~ Table of Contents: @@ -26,11 +26,16 @@ 2. Requirements: ~~~~~~~~~~~~~~~~ - - Python >= 2.6 - - PyGObject >= 3.0.0 (glib and gio modules are required) + + - CMake >= 2.8.5 - IntlTool >= 0.21 - GetText >= 0.15 + - Python3 >= 3.4 (default) or Python2 >= 2.7 + - PyGObject >= 3.0.0 + + - GLib, GIO >= 2.28 GIR + 3. Installation: ~~~~~~~~~~~~~~~~ @@ -60,7 +65,8 @@ the password using standard input without echo) Loading a raw image of a CSS-encrypted DVD created by 'dd', so it can be played by mplayer: - cdemu load 0 ~/image.iso --dvd-report-css=true + cdemu load 0 ~/image.iso + cdemu dvd-report-css 0 1 Creating a blank recordable disc: DVD+R SL with ISO image writer: cdemu create-blank --writer-id=WRITER-ISO --medium-type=dvd+r 0 ~/output-image.iso diff -Nru cdemu-client-3.1.0/src/cdemu cdemu-client-3.2.0/src/cdemu --- cdemu-client-3.1.0/src/cdemu 2017-06-10 21:29:17.000000000 +0000 +++ cdemu-client-3.2.0/src/cdemu 2018-07-07 19:55:02.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # cdemu: command-line CDEmu client @@ -41,7 +41,7 @@ # *** Globals *** app_name = "cdemu" -app_version = "3.1.0" +app_version = "3.2.0" supported_daemon_interface_version = [ 7, 0 ] # I18n @@ -53,12 +53,18 @@ # Set process name -if sys.platform == "linux2": - # Set process name. Only works on Linux >= 2.1.57. +# "linux2" is for python2, "linux" is for python3 +if sys.platform == "linux" or sys.platform == "linux2": + # Process name must be a byte string... + if isinstance(app_name, bytes): + app_name_bytes = app_name + else: + app_name_bytes = app_name.encode('utf-8') + try: import ctypes libc = ctypes.CDLL("libc.so.6") - libc.prctl(15, app_name, 0, 0, 0) # 15 = PR_SET_NAME + libc.prctl(15, app_name_bytes, 0, 0, 0) # 15 = PR_SET_NAME except Exception: pass @@ -115,7 +121,6 @@ parser.add_argument("image_file", type=str, nargs="+", help=_("image file(s)")) parser.add_argument("--password", type=str, help=_("password for encrypted images")) parser.add_argument("--encoding", type=str, help=_("encoding for text-based images")) - parser.add_argument("--dvd-report-css", action="store_true", help=_("flag the DVD disc as CSS-encoded")) def __call__ (self, proxy, arguments): # We need to pass absolute filenames to daemon @@ -127,8 +132,6 @@ parser_params["encoding"] = GLib.Variant("s", arguments.encoding) if hasattr(arguments, "password"): parser_params["password"] = GLib.Variant("s", arguments.password) - if hasattr(arguments, "dvd_report_css"): - parser_params["dvd-report-css"] = GLib.Variant("b", arguments.dvd_report_css) # Particular device vs. any device if arguments.device == "any": @@ -192,7 +195,7 @@ parser.add_argument("device", type=str, help=_("device")) parser.add_argument("image_file", type=str, help=_("image filename/basename")) parser.add_argument("--writer-id", type=str, nargs="?", required=True, help=_("ID of image writer to use")) - parser.add_argument("--medium-type", type=str, nargs="?", choices=['cdr74', 'cdr80', 'cdr90', 'cdr99', 'dvd+r'], help=_("medium type")) + parser.add_argument("--medium-type", type=str, nargs="?", choices=['cdr74', 'cdr80', 'cdr90', 'cdr99', 'dvd+r', 'bdr'], help=_("medium type")) parser.add_argument("--param", type=str, nargs="?", action='append', help=_("additional writer parameter(s)")) def __call__ (self, proxy, arguments): @@ -290,7 +293,10 @@ valid_parameters[parameter_entry[0]] = parameter_entry # Now, go over given parameters and validate them - for key,value in parameters.items(): + # NOTE: we need to use list(parameters.items()) because we may + # change the dictionary (pop() call during validation), and that + # raises error in python3 + for key,value in list(parameters.items()): try: parameter_entry = valid_parameters[key] except KeyError as e: @@ -834,6 +840,86 @@ ######################################################################## +# DVD report CSS # +######################################################################## +class cmd_dvd_report_css (object): + def __init__ (self, subparsers): + name = "dvd-report-css" + description_msg = _("") + help_msg = _("displays/sets DVD report CSS/CPPM flag") + + parser = subparsers.add_parser(name, description=description_msg, help=help_msg, formatter_class=argparse.ArgumentDefaultsHelpFormatter, argument_default=argparse.SUPPRESS) + parser.set_defaults(command_function=self) + + parser.add_argument("device", type=str, help=_("device")) + parser.add_argument("new_value", nargs="?", type=str, help=_("new value")) + + def __call__ (self, proxy, arguments): + # Set DVD report CSS flag + if hasattr(arguments, "new_value"): + try: + enabled = str2bool(arguments.new_value) + except ValueError: + raise CDEmuError(_("String '%s' is not a number") % (arguments[1])) + + if arguments.device == "all": + try: + num_devices = proxy.GetNumberOfDevices() + except GLib.Error as e: + raise CDEmuError(_("Failed to get number of devices: %s") % (e)) + + print(_("Setting DVD report CSS/CPPM flag of all devices to %i.") % (enabled)) + for device in range(0, num_devices): + try: + proxy.DeviceSetOption(device, "dvd-report-css", GLib.Variant("b", enabled)) + except GLib.Error as e: + print_warning(_("Failed to set DVD report CSS/CPPM flag of device %i to %i: %s") % (device, enabled, e)) + continue + else: + try: + device = int(arguments.device, 0) + except ValueError: + raise CDEmuError(_("String '%s' is not a number") % (arguments.device)) + + print(_("Setting DVD report CSS/CPPM flag of device %i to %i.") % (device, enabled)) + try: + proxy.DeviceSetOption(device, "dvd-report-css", GLib.Variant("b", enabled)) + except GLib.Error as e: + raise CDEmuError(_("Failed to set DVD report CSS/CPPM flag of device %i to %i: %s") % (device, enabled, e)) + + # Get DVD report CSS flag + else: + # Particular device vs. all devices + if arguments.device == "all": + try: + num_devices = proxy.GetNumberOfDevices() + except GLib.Error as e: + raise CDEmuError(_("Failed to get number of devices: %s") % (e)) + + print_header(_("Devices' DVD report CSS/CPPM flag:")) + print("%-5s %-10s" % (_("DEV"), _("ENABLED"))) + + for device in range(0, num_devices): + try: + enabled = proxy.DeviceGetOption(device, "dvd-report-css") + except GLib.Error as e: + print_warning(_("Failed to get DVD report CSS/CPPM flag of device %i: %s") % (device, e)) + continue + + print("%-5s %i" % (device, enabled)) + else: + try: + device = int(arguments.device, 0) + enabled = proxy.DeviceGetOption(device, "dvd-report-css") + except GLib.Error as e: + raise CDEmuError(_("Failed to get DVD report CSS/CPPM flag of device %i: %s") % (device, e)) + except ValueError: + raise CDEmuError(_("String '%s' is not a number") % (arguments.device)) + + print(_("DVD report CSS/CPPM flag of device %i: %i") % (device, enabled)) + + +######################################################################## # Device ID # ######################################################################## class cmd_device_id (object): @@ -897,7 +983,7 @@ for device in range(0, num_devices): try: values = proxy.DeviceGetOption(device, "device-id") - device_id = map(str, values) + device_id = list(map(str, values)) except GLib.Error as e: print_warning(_("Failed to get device ID of device %i: %s") % (device, e)) continue @@ -907,7 +993,7 @@ try: device = int(arguments.device, 0) values = proxy.DeviceGetOption(device, "device-id") - device_id = map (str, values) + device_id = list(map(str, values)) except GLib.Error as e: raise CDEmuError(_("Failed to get device ID of device %i: %s") % (device, e)) except ValueError: @@ -1223,6 +1309,7 @@ cmd_dpm_emulation(subparsers) # DPM emulation cmd_tr_emulation(subparsers) # TR emulation cmd_bad_sector_emulation(subparsers) # Bad sector emulation + cmd_dvd_report_css(subparsers) # DVD report CSS/CPPM cmd_device_id(subparsers) # Device ID cmd_enum_parsers(subparsers) # Enumerate parsers cmd_enum_writers(subparsers) # Enumerate writers