tools v4.0

New calibre plugin interface (0.7.55)
Dropped unswindle.pyw
Added Android patch
This commit is contained in:
Apprentice Alf
2011-06-16 06:59:20 +01:00
parent 529dd3f160
commit 4f34a9a196
87 changed files with 3336 additions and 4559 deletions

View File

@@ -31,10 +31,15 @@
# 0.0.1 - Initial release
# 0.0.2 - updated to distinguish it from earlier non-openssl version
# 0.0.3 - removed added psyco code as it is not supported under Calibre's Python 2.7
# 0.0.4 - minor typos fixed
# 0.0.5 - updated to the new calibre plugin interface
import sys, os
from calibre.customize import FileTypePlugin
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.constants import iswindows, isosx
from calibre_plugins.erdrpdb2pml import erdr2pml
class eRdrDeDRM(FileTypePlugin):
name = 'eReader PDB 2 PML' # Name of the plugin
@@ -42,16 +47,14 @@ class eRdrDeDRM(FileTypePlugin):
Credit given to The Dark Reverser for the original standalone script.'
supported_platforms = ['linux', 'osx', 'windows'] # Platforms this plugin will run on
author = 'DiapDealer' # The author of this plugin
version = (0, 0, 4) # The version number of this plugin
version = (0, 0, 5) # The version number of this plugin
file_types = set(['pdb']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
minimum_calibre_version = (0, 7, 55)
def run(self, path_to_ebook):
from calibre.ptempfile import PersistentTemporaryDirectory
from calibre.constants import iswindows, isosx
global bookname, erdr2pml
import erdr2pml
infile = path_to_ebook
bookname = os.path.splitext(os.path.basename(infile))[0]

View File

@@ -58,8 +58,9 @@
# 0.17 - added support for pycrypto's DES as well
# 0.18 - on Windows try PyCrypto first and OpenSSL next
# 0.19 - Modify the interface to allow use of import
# 0.20 - modify to allow use inside new interface for calibre plugins
__version__='0.19'
__version__='0.20'
class Unbuffered:
def __init__(self, stream):
@@ -71,32 +72,50 @@ class Unbuffered:
return getattr(self.stream, attr)
import sys
sys.stdout=Unbuffered(sys.stdout)
import struct, binascii, getopt, zlib, os, os.path, urllib, tempfile
if 'calibre' in sys.modules:
inCalibre = True
else:
inCalibre = False
Des = None
if sys.platform.startswith('win'):
# first try with pycrypto
import pycrypto_des
if inCalibre:
from calibre_plugins.erdrpdb2pml import pycrypto_des
else:
import pycrypto_des
Des = pycrypto_des.load_pycrypto()
if Des == None:
# they try with openssl
import openssl_des
if inCalibre:
from calibre_plugins.erdrpdb2pml import openssl_des
else:
import openssl_des
Des = openssl_des.load_libcrypto()
else:
# first try with openssl
import openssl_des
if inCalibre:
from calibre_plugins.erdrpdb2pml import openssl_des
else:
import openssl_des
Des = openssl_des.load_libcrypto()
if Des == None:
# then try with pycrypto
import pycrypto_des
if inCalibre:
from calibre_plugins.erdrpdb2pml import pycrypto_des
else:
import pycrypto_des
Des = pycrypto_des.load_pycrypto()
# if that did not work then use pure python implementation
# of DES and try to speed it up with Psycho
if Des == None:
import python_des
if inCalibre:
from calibre_plugins.erdrpdb2pml import python_des
else:
import python_des
Des = python_des.Des
# Import Psyco if available
try:
@@ -480,5 +499,6 @@ def main(argv=None):
if __name__ == "__main__":
sys.stdout=Unbuffered(sys.stdout)
sys.exit(main())