tools v5.6.2

This commit is contained in:
Apprentice Alf
2013-02-07 10:28:25 +00:00
parent 490ee4e5d8
commit 748bd2d471
13 changed files with 65 additions and 67 deletions

View File

@@ -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 %*

View File

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

View File

@@ -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():

View File

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

View File

@@ -1,7 +1,7 @@
ReadMe_DeDRM_v5.6_WinApp
ReadMe_DeDRM_v5.6.2_WinApp
========================
DeDRM_v5.6_WinApp is a pure python drag and drop application that allows users to drag and drop ebooks or folders of ebooks onto the DeDRM_Drop_Target to have the DRM removed. It repackages all the "tools" python software in one easy to use program that remembers preferences and settings.
DeDRM_v5.6.2_WinApp is a pure python drag and drop application that allows users to drag and drop ebooks or folders of ebooks onto the DeDRM_Drop_Target to have the DRM removed. It repackages all the "tools" python software in one easy to use program that remembers preferences and settings.
It will work without manual configuration for Kindle for PC ebooks and Adobe Adept epub and pdf ebooks.
@@ -16,16 +16,16 @@ Once these preferences have been set, the user can simply drag and drop ebooks o
This program requires that a 32 bit version of Python 2.X (tested with Python 2.5 through Python 2.7) and PyCrypto be installed on your computer before it will work. See below for where to get theese programs for Windows.
NB Although the individual scripts have been updated to work with unicode file names, the Windows DeDRM script has not yet been updated for technical reasons. Therefore, if you try to use it with paths or file names that contain non-ASCII characters, it might not work.
As from version 5.6.2, the DeDRM application should work correctly with file names containing non-ASCII characters.
Installation
------------
0. If you don't already have a correct version of Python and PyCrypto installed, follow the "Installing Python on Windows" and "Installing PyCrypto on Windows" sections below before continuing.
1. Drag the DeDRM_5.6 folder from tools_v5.6/DeDRM_Applications/Windows to your "My Documents" folder.
1. Drag the DeDRM_5.6.2 folder from tools_v5.6.2/DeDRM_Applications/Windows to your "My Documents" folder.
2. Open the DeDRM_5.6 folder you've just dragged, and make a short-cut of the DeDRM_Drop_Target.bat file (right-click/Create Shortcut). Drag the shortcut file onto your Desktop.
2. Open the DeDRM_5.6.2 folder you've just dragged, and make a short-cut of the DeDRM_Drop_Target.bat file (right-click/Create Shortcut). Drag the shortcut file onto your Desktop.
3. To set the preferences simply double-click on your just created short-cut.