diff options
author | Paweł Jastrzębski <pawelj@iosphe.re> | 2019-03-06 16:16:26 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2019-03-06 16:16:26 +0100 |
commit | c07a9657ef19e3f422424ece4e0c1c41eb092746 (patch) | |
tree | 0f59264949c62aff888cdc5d1fd46214dc43c597 /kindlecomicconverter | |
parent | Added PW4 profile (close #293) (diff) | |
download | kcc-c07a9657ef19e3f422424ece4e0c1c41eb092746.tar.gz kcc-c07a9657ef19e3f422424ece4e0c1c41eb092746.tar.bz2 kcc-c07a9657ef19e3f422424ece4e0c1c41eb092746.zip |
Removed MCD support
Diffstat (limited to 'kindlecomicconverter')
-rw-r--r-- | kindlecomicconverter/KCC_gui.py | 18 | ||||
-rw-r--r-- | kindlecomicconverter/KCC_ui_editor.py | 8 | ||||
-rwxr-xr-x | kindlecomicconverter/comic2ebook.py | 19 | ||||
-rwxr-xr-x | kindlecomicconverter/image.py | 14 | ||||
-rw-r--r-- | kindlecomicconverter/metadata.py | 13 |
5 files changed, 10 insertions, 62 deletions
diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 91910be..bce06ed 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -24,6 +24,7 @@ from urllib.request import urlopen, urlretrieve, Request from time import sleep from shutil import move from subprocess import STDOUT, PIPE +# noinspection PyUnresolvedReferences from PyQt5 import QtGui, QtCore, QtWidgets, QtNetwork from xml.dom.minidom import parse from xml.sax.saxutils import escape @@ -887,6 +888,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow): self.targetDirectory = '' self.sentry = Client(release=__version__) if sys.platform.startswith('win'): + # noinspection PyUnresolvedReferences from psutil import BELOW_NORMAL_PRIORITY_CLASS self.p = Process(os.getpid()) self.p.nice(BELOW_NORMAL_PRIORITY_CLASS) @@ -935,7 +937,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow): "Kobo Aura ONE": {'PVOptions': False, 'ForceExpert': False, 'DefaultFormat': 1, 'DefaultUpscale': True, 'Label': 'KoAO'}, "Kobo Forma": {'PVOptions': False, 'ForceExpert': False, 'DefaultFormat': 1, - 'DefaultUpscale': True, 'Label': 'KoF'}, + 'DefaultUpscale': True, 'Label': 'KoF'}, "Other": {'PVOptions': False, 'ForceExpert': True, 'DefaultFormat': 1, 'DefaultUpscale': False, 'Label': 'OTHER'}, "Kindle 1": {'PVOptions': False, 'ForceExpert': False, 'DefaultFormat': 0, @@ -1084,11 +1086,8 @@ class KCCGUI_MetaEditor(KCC_ui_editor.Ui_editorDialog): self.editorWidget.setEnabled(True) self.okButton.setEnabled(True) self.statusLabel.setText('Separate authors with a comma.') - for field in (self.seriesLine, self.volumeLine, self.numberLine, self.muidLine): - if field.objectName() == 'muidLine': - field.setText(self.parser.data['MUid']) - else: - field.setText(self.parser.data[field.objectName().capitalize()[:-4]]) + for field in (self.seriesLine, self.volumeLine, self.numberLine): + field.setText(self.parser.data[field.objectName().capitalize()[:-4]]) for field in (self.writerLine, self.pencillerLine, self.inkerLine, self.coloristLine): field.setText(', '.join(self.parser.data[field.objectName().capitalize()[:-4] + 's'])) if self.seriesLine.text() == '': @@ -1098,12 +1097,9 @@ class KCCGUI_MetaEditor(KCC_ui_editor.Ui_editorDialog): self.seriesLine.setText(file.split('\\')[-1].split('/')[-1].split('.')[0]) def saveData(self): - for field in (self.volumeLine, self.numberLine, self.muidLine): + for field in (self.volumeLine, self.numberLine): if field.text().isnumeric() or self.cleanData(field.text()) == '': - if field.objectName() == 'muidLine': - self.parser.data['MUid'] = self.cleanData(field.text()) - else: - self.parser.data[field.objectName().capitalize()[:-4]] = self.cleanData(field.text()) + self.parser.data[field.objectName().capitalize()[:-4]] = self.cleanData(field.text()) else: self.statusLabel.setText(field.objectName().capitalize()[:-4] + ' field must be a number.') break diff --git a/kindlecomicconverter/KCC_ui_editor.py b/kindlecomicconverter/KCC_ui_editor.py index 56dc07d..5deba91 100644 --- a/kindlecomicconverter/KCC_ui_editor.py +++ b/kindlecomicconverter/KCC_ui_editor.py @@ -66,13 +66,6 @@ class Ui_editorDialog(object): self.coloristLine = QtWidgets.QLineEdit(self.editorWidget) self.coloristLine.setObjectName("coloristLine") self.gridLayout.addWidget(self.coloristLine, 6, 1, 1, 1) - self.label_8 = QtWidgets.QLabel(self.editorWidget) - self.label_8.setOpenExternalLinks(True) - self.label_8.setObjectName("label_8") - self.gridLayout.addWidget(self.label_8, 7, 0, 1, 1) - self.muidLine = QtWidgets.QLineEdit(self.editorWidget) - self.muidLine.setObjectName("muidLine") - self.gridLayout.addWidget(self.muidLine, 7, 1, 1, 1) self.verticalLayout.addWidget(self.editorWidget) self.optionWidget = QtWidgets.QWidget(editorDialog) self.optionWidget.setObjectName("optionWidget") @@ -117,7 +110,6 @@ class Ui_editorDialog(object): self.label_5.setText(_translate("editorDialog", "Penciller:")) self.label_6.setText(_translate("editorDialog", "Inker:")) self.label_7.setText(_translate("editorDialog", "Colorist:")) - self.label_8.setText(_translate("editorDialog", "<html><head/><body><p><a href=\"https://github.com/ciromattia/kcc/wiki/Manga-Cover-Database-support\"><span style=\" text-decoration: underline; color:#0000ff;\">MUid:</span></a></p></body></html>")) self.okButton.setText(_translate("editorDialog", "Save")) self.cancelButton.setText(_translate("editorDialog", "Cancel")) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 6e5de47..90c9872 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -23,8 +23,6 @@ import sys from time import strftime, gmtime from copy import copy from glob import glob, escape -from json import loads -from urllib.request import Request, urlopen from re import sub from stat import S_IWRITE, S_IREAD, S_IEXEC from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED @@ -648,7 +646,6 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber): def getComicInfo(path, originalpath): xmlPath = os.path.join(path, 'ComicInfo.xml') options.authors = ['KCC'] - options.remoteCovers = {} options.chapters = [] options.summary = '' titleSuffix = '' @@ -683,8 +680,6 @@ def getComicInfo(path, originalpath): options.authors.sort() else: options.authors = ['KCC'] - if xml.data['MUid']: - options.remoteCovers = getCoversFromMCB(xml.data['MUid']) if xml.data['Bookmarks']: options.chapters = xml.data['Bookmarks'] if xml.data['Summary']: @@ -692,20 +687,6 @@ def getComicInfo(path, originalpath): os.remove(xmlPath) -def getCoversFromMCB(mangaid): - covers = {} - try: - jsonRaw = urlopen(Request('http://mcd.iosphe.re/api/v1/series/' + mangaid + '/', - headers={'User-Agent': 'KindleComicConverter/' + __version__})) - jsonData = loads(jsonRaw.read().decode('utf-8')) - for volume in jsonData['Covers']['a']: - if volume['Side'] == 'front': - covers[int(volume['Volume'])] = volume['Raw'] - except Exception: - return {} - return covers - - def getDirectorySize(start_path='.'): total_size = 0 for dirpath, _, filenames in os.walk(start_path): diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index 6d44b4f..0c26bf8 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -20,12 +20,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import os -from io import BytesIO -from urllib.request import Request, urlopen -from urllib.parse import quote from PIL import Image, ImageOps, ImageStat, ImageChops, ImageFilter from .shared import md5Checksum -from . import __version__ class ProfileData: @@ -347,15 +343,7 @@ class Cover: self.tomeid = 1 else: self.tomeid = tomeid - if self.tomeid in self.options.remoteCovers: - try: - source = urlopen(Request(quote(self.options.remoteCovers[self.tomeid]).replace('%3A', ':', 1), - headers={'User-Agent': 'KindleComicConverter/' + __version__})).read() - self.image = Image.open(BytesIO(source)) - except Exception: - self.image = Image.open(source) - else: - self.image = Image.open(source) + self.image = Image.open(source) self.process() def process(self): diff --git a/kindlecomicconverter/metadata.py b/kindlecomicconverter/metadata.py index 2189a6a..e93ca27 100644 --- a/kindlecomicconverter/metadata.py +++ b/kindlecomicconverter/metadata.py @@ -18,7 +18,6 @@ import os from xml.dom.minidom import parse, Document -from re import compile from tempfile import mkdtemp from shutil import rmtree from . import comicarchive @@ -35,7 +34,6 @@ class MetadataParser: 'Inkers': [], 'Colorists': [], 'Summary': '', - 'MUid': '', 'Bookmarks': []} self.rawdata = None self.format = None @@ -67,11 +65,6 @@ class MetadataParser: self.data[field + 's'].append(person) self.data[field + 's'] = list(set(self.data[field + 's'])) self.data[field + 's'].sort() - if len(self.rawdata.getElementsByTagName('ScanInformation')) != 0: - coverId = compile('(MCD\\()(\\d+)(\\))')\ - .search(self.rawdata.getElementsByTagName('ScanInformation')[0].firstChild.nodeValue) - if coverId: - self.data['MUid'] = coverId.group(2) if len(self.rawdata.getElementsByTagName('Page')) != 0: for page in self.rawdata.getElementsByTagName('Page'): if 'Bookmark' in page.attributes and 'Image' in page.attributes: @@ -84,8 +77,7 @@ class MetadataParser: for row in (['Series', self.data['Series']], ['Volume', self.data['Volume']], ['Number', self.data['Number']], ['Writer', ', '.join(self.data['Writers'])], ['Penciller', ', '.join(self.data['Pencillers'])], ['Inker', ', '.join(self.data['Inkers'])], - ['Colorist', ', '.join(self.data['Colorists'])], ['Summary', self.data['Summary']], - ['ScanInformation', 'MCD(' + self.data['MUid'] + ')' if self.data['MUid'] else '']): + ['Colorist', ', '.join(self.data['Colorists'])], ['Summary', self.data['Summary']]): if self.rawdata.getElementsByTagName(row[0]): node = self.rawdata.getElementsByTagName(row[0])[0] if row[1]: @@ -106,8 +98,7 @@ class MetadataParser: for row in (['Series', self.data['Series']], ['Volume', self.data['Volume']], ['Number', self.data['Number']], ['Writer', ', '.join(self.data['Writers'])], ['Penciller', ', '.join(self.data['Pencillers'])], ['Inker', ', '.join(self.data['Inkers'])], - ['Colorist', ', '.join(self.data['Colorists'])], ['Summary', self.data['Summary']], - ['ScanInformation', 'MCD(' + self.data['MUid'] + ')' if self.data['MUid'] else '']): + ['Colorist', ', '.join(self.data['Colorists'])], ['Summary', self.data['Summary']]): if row[1]: main = doc.createElement(row[0]) root.appendChild(main) |