#!/usr/bin/env python from __future__ import print_function import sys, os path = os.environ.get('CALIBRE_PYTHON_PATH', '/usr/lib/calibre') if path not in sys.path: sys.path.insert(0, path) sys.resources_location = os.environ.get('CALIBRE_RESOURCES_PATH', '/usr/share/calibre') sys.extensions_location = os.environ.get('CALIBRE_EXTENSIONS_PATH', '/usr/lib/calibre/calibre/plugins') sys.executables_location = os.environ.get('CALIBRE_EXECUTABLES_PATH', '/usr/bin') from calibre_plugins import dedrm def decrypt(input_filename, output_filename): plugin = dedrm.DeDRM('DeDRM_calibre_plugin/DeDRM_plugin.zip') plugin.initialize() os.rename(plugin.run(input_filename), output_filename) if __name__ == '__main__': try: decrypt(sys.argv[1], sys.argv[2]) except IndexError: print( 'Usage:', sys.argv[0], '', '', File=sys.stderr)