kopia lustrzana https://github.com/noDRM/DeDRM_tools
Porównaj commity
3 Commity
a30405bebf
...
3151dbbd98
Autor | SHA1 | Data |
---|---|---|
NoDRM | 3151dbbd98 | |
NoDRM | 08e7ac79ca | |
NoDRM | a711954323 |
|
@ -86,3 +86,4 @@ List of changes since the fork of Apprentice Harper's repository:
|
|||
- Obok: Add new setting option "Add new entry" for duplicate books to always add them to the Calibre database as a new book. Fixes #148.
|
||||
- Obok: Fix where changing the Calibre UI language to some languages would cause the "duplicate book" setting to reset.
|
||||
- Fix Python3 bug in stylexml2css.php script, fixes #232.
|
||||
- PDF: Ignore invalid PDF objids unless the script is running in strict mode. Fixes some PDFs, apparently. Fixes #233.
|
||||
|
|
|
@ -1831,7 +1831,19 @@ class PDFDocument(object):
|
|||
try:
|
||||
obj = objs[i]
|
||||
except IndexError:
|
||||
raise PDFSyntaxError('Invalid object number: objid=%r' % (objid))
|
||||
# This IndexError used to just raise an exception.
|
||||
# Unfortunately that seems to break some PDFs, see this issue:
|
||||
# https://github.com/noDRM/DeDRM_tools/issues/233
|
||||
# I'm not sure why this is the case, but lets try only raising that exception
|
||||
# when in STRICT mode, and make it a warning otherwise.
|
||||
if STRICT:
|
||||
raise PDFSyntaxError('Invalid object number: objid=%r' % (objid))
|
||||
|
||||
print('Invalid object number: objid=%r' % (objid))
|
||||
print("Continuing anyways?")
|
||||
print("If the resulting PDF is corrupted, please open a bug report.")
|
||||
return None
|
||||
|
||||
if isinstance(obj, PDFStream):
|
||||
obj.set_objid(objid, 0)
|
||||
else:
|
||||
|
|
|
@ -312,11 +312,17 @@ class KoboLibrary(object):
|
|||
if sys.getwindowsversion().major > 5:
|
||||
if 'LOCALAPPDATA' in os.environ.keys():
|
||||
# Python 2.x does not return unicode env. Use Python 3.x
|
||||
self.kobodir = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
|
||||
if sys.version_info[0] == 2:
|
||||
self.kobodir = winreg.ExpandEnvironmentStrings(u"%LOCALAPPDATA%")
|
||||
else:
|
||||
self.kobodir = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
|
||||
if (self.kobodir == u""):
|
||||
if 'USERPROFILE' in os.environ.keys():
|
||||
# Python 2.x does not return unicode env. Use Python 3.x
|
||||
self.kobodir = os.path.join(winreg.ExpandEnvironmentStrings("%USERPROFILE%"), "Local Settings", "Application Data")
|
||||
if sys.version_info[0] == 2:
|
||||
self.kobodir = os.path.join(winreg.ExpandEnvironmentStrings(u"%USERPROFILE%"), "Local Settings", "Application Data")
|
||||
else:
|
||||
self.kobodir = os.path.join(winreg.ExpandEnvironmentStrings("%USERPROFILE%"), "Local Settings", "Application Data")
|
||||
self.kobodir = os.path.join(self.kobodir, "Kobo", "Kobo Desktop Edition")
|
||||
elif sys.platform.startswith('darwin'):
|
||||
self.kobodir = os.path.join(os.environ['HOME'], "Library", "Application Support", "Kobo", "Kobo Desktop Edition")
|
||||
|
|
Ładowanie…
Reference in New Issue