tools v5.6.2
This commit is contained in:
@@ -1,4 +1 @@
|
||||
echo off
|
||||
set PWD=%~dp0
|
||||
cd /d %PWD%DeDRM_lib && start /min python DeDRM_app.pyw %*
|
||||
exit
|
||||
chcp 65001 > nul && set PWD=%~dp0 && cd /d %~dp0DeDRM_lib && start /min python DeDRM_app.pyw %*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# DeDRM.pyw, version 5.6.1
|
||||
# DeDRM.pyw, version 5.6.2
|
||||
# By some_updates and Apprentice Alf
|
||||
|
||||
import sys
|
||||
@@ -10,7 +10,7 @@ sys.path.append(os.path.join(sys.path[0],"lib"))
|
||||
import sys, os
|
||||
import codecs
|
||||
|
||||
from argv_utils import add_cp65001_codec, set_utf8_default_encoding, utf8_argv
|
||||
from argv_utils import add_cp65001_codec, set_utf8_default_encoding, unicode_argv
|
||||
add_cp65001_codec()
|
||||
set_utf8_default_encoding()
|
||||
|
||||
@@ -46,7 +46,7 @@ class QueuedUTF8Stream:
|
||||
def __getattr__(self, attr):
|
||||
return getattr(self.stream, attr)
|
||||
|
||||
__version__ = '5.6.1'
|
||||
__version__ = '5.6.2'
|
||||
|
||||
class DrmException(Exception):
|
||||
pass
|
||||
@@ -567,7 +567,7 @@ def processPDB(q, infile, outdir, rscpath):
|
||||
sys.exit(rv)
|
||||
|
||||
|
||||
def main(argv=utf8_argv()):
|
||||
def main(argv=unicode_argv()):
|
||||
apphome = os.path.dirname(argv[0])
|
||||
apphome = os.path.abspath(apphome)
|
||||
|
||||
|
||||
@@ -6,12 +6,15 @@ import locale
|
||||
import codecs
|
||||
|
||||
# get sys.argv arguments and encode them into utf-8
|
||||
def utf8_argv():
|
||||
def unicode_argv():
|
||||
if sys.platform.startswith('win'):
|
||||
# Uses shell32.GetCommandLineArgvW to get sys.argv as a list of Unicode
|
||||
# strings.
|
||||
|
||||
# Versions 2.x of Python don't support Unicode in sys.argv on
|
||||
# Windows, with the underlying Windows API instead replacing multi-byte
|
||||
# characters with '?'. So use shell32.GetCommandLineArgvW to get sys.argv
|
||||
# as a list of Unicode strings and encode them as utf-8
|
||||
# characters with '?'.
|
||||
|
||||
|
||||
from ctypes import POINTER, byref, cdll, c_int, windll
|
||||
from ctypes.wintypes import LPCWSTR, LPWSTR
|
||||
@@ -30,23 +33,16 @@ def utf8_argv():
|
||||
if argc.value > 0:
|
||||
# Remove Python executable and commands if present
|
||||
start = argc.value - len(sys.argv)
|
||||
return [argv[i].encode('utf-8') for i in
|
||||
return [argv[i] for i in
|
||||
xrange(start, argc.value)]
|
||||
# if we don't have any arguments at all, just pass back script name
|
||||
# this should never happen
|
||||
return None
|
||||
return [u"DeDRM.py"]
|
||||
else:
|
||||
argv = []
|
||||
argvencoding = sys.stdin.encoding
|
||||
if argvencoding == None:
|
||||
argvencoding = sys.getfilesystemencoding()
|
||||
if argvencoding == None:
|
||||
argvencoding = 'utf-8'
|
||||
for arg in sys.argv:
|
||||
if type(arg) == unicode:
|
||||
argv.append(arg.encode('utf-8'))
|
||||
else:
|
||||
argv.append(arg.decode(argvencoding).encode('utf-8'))
|
||||
return argv
|
||||
argvencoding = "utf-8"
|
||||
return [arg if (type(arg) == unicode) else unicode(arg,argvencoding) for arg in sys.argv]
|
||||
|
||||
|
||||
def add_cp65001_codec():
|
||||
|
||||
@@ -15,10 +15,10 @@ from __future__ import with_statement
|
||||
# from <http://www.python.org/download/> and PyCrypto from
|
||||
# <http://www.voidspace.org.uk/python/modules.shtml#pycrypto> (make sure to
|
||||
# install the version for Python 2.6). Save this script file as
|
||||
# ineptepub.pyw and double-click on it to run it.
|
||||
# ineptpdf.pyw and double-click on it to run it.
|
||||
#
|
||||
# Mac OS X users: Save this script file as ineptepub.pyw. You can run this
|
||||
# program from the command line (pythonw ineptepub.pyw) or by double-clicking
|
||||
# Mac OS X users: Save this script file as ineptpdf.pyw. You can run this
|
||||
# program from the command line (pythonw ineptpdf.pyw) or by double-clicking
|
||||
# it when it has been associated with PythonLauncher.
|
||||
|
||||
# Revision history:
|
||||
@@ -49,13 +49,14 @@ from __future__ import with_statement
|
||||
# 7.10 - Various tweaks to fix minor problems.
|
||||
# 7.11 - More tweaks to fix minor problems.
|
||||
# 7.12 - Revised to allow use in calibre plugins to eliminate need for duplicate code
|
||||
# 7.13 - Fixed erroneous mentions of ineptepub
|
||||
|
||||
"""
|
||||
Decrypts Adobe ADEPT-encrypted PDF files.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = "7.12"
|
||||
__version__ = "7.13"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -115,7 +116,7 @@ def unicode_argv():
|
||||
start = argc.value - len(sys.argv)
|
||||
return [argv[i] for i in
|
||||
xrange(start, argc.value)]
|
||||
return [u"ineptepub.py"]
|
||||
return [u"ineptpdf.py"]
|
||||
else:
|
||||
argvencoding = sys.stdin.encoding
|
||||
if argvencoding == None:
|
||||
|
||||
Reference in New Issue
Block a user