Skip to content

Commit

Permalink
tools v6.0.9
Browse files Browse the repository at this point in the history
obok added to other tools
  • Loading branch information
apprenticealf committed Mar 7, 2015
1 parent b1feca3 commit a30aace
Show file tree
Hide file tree
Showing 13 changed files with 604 additions and 114 deletions.
6 changes: 3 additions & 3 deletions DeDRM_Macintosh_Application/DeDRM.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
<key>CFBundleExecutable</key>
<string>droplet</string>
<key>CFBundleGetInfoString</key>
<string>DeDRM AppleScript 6.0.8. Written 2010–2013 by Apprentice Alf and others.</string>
<string>DeDRM AppleScript 6.0.9. Written 2010–2013 by Apprentice Alf and others.</string>
<key>CFBundleIconFile</key>
<string>DeDRM</string>
<key>CFBundleIdentifier</key>
<string>com.apple.ScriptEditor.id.707CCCD5-0C6C-4BEB-B67C-B6E866ADE85A</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0.8</string>
<string>6.0.9</string>
<key>CFBundleName</key>
<string>DeDRM</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>6.0.8</string>
<string>6.0.9</string>
<key>CFBundleSignature</key>
<string>dplt</string>
<key>LSRequiresCarbon</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<body>

<h1>DeDRM Plugin <span class="version">(v6.0.0)</span></h1>
<h1>DeDRM Plugin <span class="version">(v6.0.9)</span></h1>

<p>This plugin removes DRM from ebooks when they are imported into calibre. If you already have DRMed ebooks in your calibre library, you will need to remove them and import them again.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
# 6.0.6 - Fix up an incorrect function call
# 6.0.7 - Error handling for incomplete PDF metadata
# 6.0.8 - Fixes a Wine key issue and topaz support
# 6.0.9 - Ported to work with newer versions of Calibre (moved to Qt5). Still supports older Qt4 versions.

"""
Decrypt DRMed ebooks.
"""

PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 0, 8)
PLUGIN_VERSION_TUPLE = (6, 0, 9)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
# Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
Expand Down
76 changes: 41 additions & 35 deletions DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@
import os, traceback, json

# PyQT4 modules (part of calibre).
from PyQt4.Qt import (Qt, QWidget, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit,
try:
from PyQt5.Qt import (Qt, QWidget, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit,
QGroupBox, QPushButton, QListWidget, QListWidgetItem,
QAbstractItemView, QIcon, QDialog, QDialogButtonBox, QUrl, QString)
from PyQt4 import QtGui

QAbstractItemView, QIcon, QDialog, QDialogButtonBox, QUrl)
except ImportError:
from PyQt4.Qt import (Qt, QWidget, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit,
QGroupBox, QPushButton, QListWidget, QListWidgetItem,
QAbstractItemView, QIcon, QDialog, QDialogButtonBox, QUrl)
try:
from PyQt5 import Qt as QtGui
except ImportError:
from PyQt4 import QtGui

from zipfile import ZipFile

# calibre modules and constants.
from calibre.gui2 import (error_dialog, question_dialog, info_dialog, open_url,
choose_dir, choose_files)
choose_dir, choose_files, choose_save_file)
from calibre.utils.config import dynamic, config_dir, JSONConfig
from calibre.constants import iswindows, isosx

Expand Down Expand Up @@ -267,7 +275,7 @@ def __init__(self, parent, key_type_name, plugin_keys, create_key, keyfile_ext =

def getwineprefix(self):
if self.wineprefix is not None:
return unicode(self.wp_lineedit.text().toUtf8(), 'utf8').strip()
return unicode(self.wp_lineedit.text()).strip()
return u""

def populate_list(self):
Expand Down Expand Up @@ -316,7 +324,7 @@ def rename_key(self):
if d.result() != d.Accepted:
# rename cancelled or moot.
return
keyname = unicode(self.listy.currentItem().text().toUtf8(),'utf8')
keyname = unicode(self.listy.currentItem().text())
if not question_dialog(self, "{0} {1}: Confirm Rename".format(PLUGIN_NAME, PLUGIN_VERSION), u"Do you really want to rename the {2} named <strong>{0}</strong> to <strong>{1}</strong>?".format(keyname,d.key_name,self.key_type_name), show_copy_button=False, default_yes=False):
return
self.plugin_keys[d.key_name] = self.plugin_keys[keyname]
Expand All @@ -328,7 +336,7 @@ def rename_key(self):
def delete_key(self):
if not self.listy.currentItem():
return
keyname = unicode(self.listy.currentItem().text().toUtf8(), 'utf8')
keyname = unicode(self.listy.currentItem().text())
if not question_dialog(self, "{0} {1}: Confirm Delete".format(PLUGIN_NAME, PLUGIN_VERSION), u"Do you really want to delete the {1} <strong>{0}</strong>?".format(keyname, self.key_type_name), show_copy_button=False, default_yes=False):
return
if type(self.plugin_keys) == dict:
Expand All @@ -352,9 +360,10 @@ def get_help_file_resource():
open_url(QUrl(url))

def migrate_files(self):
dynamic[PLUGIN_NAME + u"config_dir"] = config_dir
files = choose_files(self, PLUGIN_NAME + u"config_dir",
u"Select {0} files to import".format(self.key_type_name), [(u"{0} files".format(self.key_type_name), [self.keyfile_ext])], False)
unique_dlg_name = PLUGIN_NAME + u"import {0} keys".format(self.key_type_name).replace(' ', '_') #takes care of automatically remembering last directory
caption = u"Select {0} files to import".format(self.key_type_name)
filters = [(u"{0} files".format(self.key_type_name), [self.keyfile_ext])]
files = choose_files(self, unique_dlg_name, caption, filters, all_files=False)
counter = 0
skipped = 0
if files:
Expand Down Expand Up @@ -408,17 +417,14 @@ def export_key(self):
r = error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
_(errmsg), show=True, show_copy_button=False)
return
filter = QString(u"{0} Files (*.{1})".format(self.key_type_name, self.keyfile_ext))
keyname = unicode(self.listy.currentItem().text().toUtf8(), 'utf8')
if dynamic.get(PLUGIN_NAME + 'save_dir'):
defaultname = os.path.join(dynamic.get(PLUGIN_NAME + 'save_dir'), u"{0}.{1}".format(keyname , self.keyfile_ext))
else:
defaultname = os.path.join(os.path.expanduser('~'), u"{0}.{1}".format(keyname , self.keyfile_ext))
filename = unicode(QtGui.QFileDialog.getSaveFileName(self, u"Save {0} File as...".format(self.key_type_name), defaultname,
u"{0} Files (*.{1})".format(self.key_type_name,self.keyfile_ext), filter))
keyname = unicode(self.listy.currentItem().text())
unique_dlg_name = PLUGIN_NAME + u"export {0} keys".format(self.key_type_name).replace(' ', '_') #takes care of automatically remembering last directory
caption = u"Save {0} File as...".format(self.key_type_name)
filters = [(u"{0} Files".format(self.key_type_name), [u"{0}".format(self.keyfile_ext)])]
defaultname = u"{0}.{1}".format(keyname, self.keyfile_ext)
filename = choose_save_file(self, unique_dlg_name, caption, filters, all_files=False, initial_filename=defaultname)
if filename:
dynamic[PLUGIN_NAME + 'save_dir'] = os.path.split(filename)[0]
with file(filename, 'w') as fname:
with file(filename, 'wb') as fname:
if self.binary_file:
fname.write(self.plugin_keys[keyname].decode('hex'))
elif self.json_file:
Expand Down Expand Up @@ -458,7 +464,7 @@ def __init__(self, parent=None,):
self.resize(self.sizeHint())

def accept(self):
if self.key_ledit.text().isEmpty() or unicode(self.key_ledit.text()).isspace():
if not unicode(self.key_ledit.text()) or unicode(self.key_ledit.text()).isspace():
errmsg = u"Key name field cannot be empty!"
return error_dialog(None, "{0} {1}".format(PLUGIN_NAME, PLUGIN_VERSION),
_(errmsg), show=True, show_copy_button=False)
Expand All @@ -479,7 +485,7 @@ def accept(self):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()



Expand Down Expand Up @@ -553,7 +559,7 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
Expand All @@ -562,11 +568,11 @@ def key_value(self):

@property
def user_name(self):
return unicode(self.name_ledit.text().toUtf8(), 'utf8').strip().lower().replace(' ','')
return unicode(self.name_ledit.text()).strip().lower().replace(' ','')

@property
def cc_number(self):
return unicode(self.cc_ledit.text().toUtf8(), 'utf8').strip().replace(' ', '').replace('-','')
return unicode(self.cc_ledit.text()).strip().replace(' ', '').replace('-','')


def accept(self):
Expand Down Expand Up @@ -634,7 +640,7 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
Expand All @@ -643,11 +649,11 @@ def key_value(self):

@property
def user_name(self):
return unicode(self.name_ledit.text().toUtf8(), 'utf8').strip().lower().replace(' ','')
return unicode(self.name_ledit.text()).strip().lower().replace(' ','')

@property
def cc_number(self):
return unicode(self.cc_ledit.text().toUtf8(), 'utf8').strip().replace(' ', '').replace('-','')
return unicode(self.cc_ledit.text()).strip().replace(' ', '').replace('-','')


def accept(self):
Expand Down Expand Up @@ -719,7 +725,7 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
Expand Down Expand Up @@ -792,7 +798,7 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
Expand Down Expand Up @@ -841,11 +847,11 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

def accept(self):
if len(self.key_name) == 0 or self.key_name.isspace():
Expand Down Expand Up @@ -889,11 +895,11 @@ def __init__(self, parent=None,):

@property
def key_name(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

@property
def key_value(self):
return unicode(self.key_ledit.text().toUtf8(), 'utf8').strip()
return unicode(self.key_ledit.text()).strip()

def accept(self):
if len(self.key_name) == 0 or self.key_name.isspace():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<body>

<h1>DeDRM Plugin <span class="version">(v6.0.0)</span></h1>
<h1>DeDRM Plugin <span class="version">(v6.0.9)</span></h1>

<p>This plugin removes DRM from ebooks when they are imported into calibre. If you already have DRMed ebooks in your calibre library, you will need to remove them and import them again.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
# 6.0.6 - Fix up an incorrect function call
# 6.0.7 - Error handling for incomplete PDF metadata
# 6.0.8 - Fixes a Wine key issue and topaz support
# 6.0.9 - Ported to work with newer versions of Calibre (moved to Qt5). Still supports older Qt4 versions.

"""
Decrypt DRMed ebooks.
"""

PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 0, 8)
PLUGIN_VERSION_TUPLE = (6, 0, 9)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
# Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
Expand Down
Loading

0 comments on commit a30aace

Please sign in to comment.