From 8f298de58ee9232994a6a0ac699b363407b58ab1 Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Mon, 2 Apr 2018 19:57:46 +0530 Subject: [PATCH] Cleanup optional imports Disable the multiprocessing module on Windows Update translations --- lector/parsers/comicbooks.py | 2 +- lector/parsers/pdf.py | 10 +- lector/resources/translations/Lector_de.ts | 362 ++++++++++++------- lector/resources/translations/Lector_es.ts | 359 ++++++++++++------- lector/resources/translations/Lector_fr.ts | 359 ++++++++++++------- lector/resources/translations/SAMPLE.ts | 396 +++++++++++---------- lector/sorter.py | 26 +- 7 files changed, 901 insertions(+), 613 deletions(-) diff --git a/lector/parsers/comicbooks.py b/lector/parsers/comicbooks.py index 17c5e48..3e91629 100644 --- a/lector/parsers/comicbooks.py +++ b/lector/parsers/comicbooks.py @@ -54,7 +54,7 @@ class ParseCOMIC: return title def get_author(self): - return None + return 'Unknown' def get_year(self): creation_time = time.ctime(os.path.getctime(self.filename)) diff --git a/lector/parsers/pdf.py b/lector/parsers/pdf.py index 228f873..7fc70a1 100644 --- a/lector/parsers/pdf.py +++ b/lector/parsers/pdf.py @@ -22,12 +22,7 @@ import os from PyQt5 import QtCore from bs4 import BeautifulSoup -proceed = True -try: - import popplerqt5 -except ImportError: - print('python-poppler-qt5 is not installed. Pdf files will not work.') - proceed = False +import popplerqt5 class ParsePDF: @@ -37,9 +32,6 @@ class ParsePDF: self.metadata = None def read_book(self): - if not proceed: - return - self.book = popplerqt5.Poppler.Document.load(self.filename) if not self.book: return diff --git a/lector/resources/translations/Lector_de.ts b/lector/resources/translations/Lector_de.ts index aa2d6b6..6099996 100644 --- a/lector/resources/translations/Lector_de.ts +++ b/lector/resources/translations/Lector_de.ts @@ -10,113 +10,123 @@ Fullscreen - Vollbild + Vollbild - + Add bookmark Lesezeichen hinzufügen Bookmarks - Lesezeichen + Lesezeichen - + Reset profile Profil zurücksetzen - + Font size Schriftgröße - + Increase padding - + Decrease padding - + Increase line spacing Zeilenabstand vergrößern - + Decrease line spacing Zeilenabstand verkleinern - + Left align text Text linksbündig ausrichten - + Right align text Text rechtsbündig ausrichten - + Center align text Text zentrieren - + Justify text Blocksatz - + Background color Hintergrund - + Zoom in Vergrößern - + Zoom Out Verkleinern - + Fit Width An Fensterbreite anpassen - + Best Fit - + Original size Original Größe - + Search... Suchen... - + Table of Contents Inhaltsverzeichnis + + + Bookmarks (Ctrl + B) + + + + + Fullscreen (F11) + + DefinitionsUI - + No definitions found in Keine Definition gefunden in @@ -139,12 +149,12 @@ Aussprache des Root-Wortes abspielen - + Settings Einstellungen - + Library Bibliothek @@ -154,17 +164,17 @@ Schalter - + Startup: Refresh library Start: Bibliothek neu laden - + Remember open files Offen Dateien merken - + Generate tags from files Tags aus Dateien generieren @@ -174,27 +184,27 @@ Wörterbuch: - + Cover shadows Cover Schatten - + Enabling reduces startup time and memory usage Aktivierung verringert die benötigte Zeit zum Starten und die Speicher Nutzung - + Load covers only when needed Cover nur laden wenn benötigt - + Greatly reduces page transition time at the cost of more memory Drastische verkürzung der Seitenübergangszeit auf Kosten des Speichers - + Cache comic / pdf pages Comic / PDF Seiten zwischenspeichern @@ -204,7 +214,7 @@ Neustarten um Änderungen zu übernehmen - + Icon theme: Symbol Thema: @@ -219,12 +229,12 @@ He&ll - + Scan Library Bibliothek scannen - + Close Schließen @@ -279,61 +289,126 @@ Abbrechen - + Horizontal scrolling with Alt + Scroll Reopen book to see changes - + Hide scrollbars when reading - + Restart application to see changes - + &Dark - + L&ight - + Reading - - Dictionary language: + + Consider book read at percent + + + + + Dictionary language + + + + + Scroll speed + + + + + + + + + + + - + + + + + ⬆ + + + + + ⬇ + + + + + Foreground + + + + + Highlight + + + + + Bold + + + + + Italic + + + + + Underline + + + + + Text + + + + + Comic/PDF Library - + Author Autor - + Year Jahr - + manually added Manuell hinzugefügt - + books @@ -341,50 +416,85 @@ Reopen book to see changes LibraryToolBar - + Add book Buch hinzufügen - + Delete book Buch löschen - + Library background color Hintergrund der Bibliothek - + Settings Einstellungen - + View as covers Als Cover anzeigen - + View as table Als Tabelle anzeigen - + Filter library Bibliothek filtern - + Search for Title, Author, Tags... Suche nach Titel, Autor, Tags... - + Sort by Sortieren nach + + + Scan Library + Bibliothek scannen + + + + Title + Titel + + + + Author + Autor + + + + Year + Jahr + + + + Newest + Neueste + + + + Last Read + Zuletzt gelesen + + + + Progress + + MainWindow @@ -399,90 +509,98 @@ Reopen book to see changes Bibliothek + + Main_BookToolBarUI + + + Toggle distraction free mode (Ctrl + D) + Ablenkungsfreien Modus ein-/ausschalten (Strg + D) + + Main_UI Toggle distraction free mode (Ctrl + D) - Ablenkungsfreien Modus ein-/ausschalten (Strg + D) + Ablenkungsfreien Modus ein-/ausschalten (Strg + D) Scan library - Biblothek scannen + Biblothek scannen - + Add books to database Bücher zur Datenbank hinzufügen - + eBooks eBooks - + Adding books... Bücher werden hinzugefügt... - + Confirm deletion Löschen bestätigen - + Save changes and start library scan Änderungen speichern & Bibliotheksscan starten - + Books Bücher - + Start reading Lesen - + Edit Bearbeiten - + Delete Löschen - + Mark read Als gelesen kennzeichnen - + Mark unread Als ungelesen kennzeichnen - + Manually Added Manuell hinzugefügt Save page as... - Seite speichern als... + Seite speichern als... Images - Bilder + Bilder - + books @@ -503,12 +621,12 @@ Reopen book to see changes PliantQGraphicsScene - + Select new cover Neues Cover auswählen - + Images Bilder @@ -518,159 +636,129 @@ Reopen book to see changes Save page as... - Seite speichern als... + Seite speichern als... Zoom in (+) - Vergrößern (+) + Vergrößern (+) Zoom out (-) - Verkleinern (-) + Verkleinern (-) Fit width (W) - An Fensterbreite anpassen - - - - Best fit (B) - + An Fensterbreite anpassen Original size (O) - Original Größe (O) + Original Größe (O) Toggle distraction free mode Ablenkungsfreien Modus ein-/ausschalten - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - PliantQTextBrowser Define - Definieren + Definieren Search - Suchen + Suchen Toggle distraction free mode Ablenkungsfreien Modus ein-/ausschalten - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - SettingsUI - + English Englisch - + Spanish Spanisch - + Hindi Hindi - + Save changes and start library scan Änderungen speichern & Bibliotheksscan starten - + Library scan in progress... Bibliotheksscan in Arbeit... - + Checking library folders Bibliotheksverzeichnisse werden überprüft - + Parsing files Dateien werden analysiert - + Library Bibliothek - + Switches Schalter - + About Über + + + Annotations + + Tab - + Bookmarks Lesezeichen - + New bookmark Lesezeichen hinzufügen - + Edit Bearbeiten - + Delete Löschen @@ -678,34 +766,34 @@ Reopen book to see changes TableProxyModel - + Title Titel - + Author Autor - + Year Jahr - + Last Read Zuletzt gelesen - + Tags Tags Newest - Neueste + Neueste diff --git a/lector/resources/translations/Lector_es.ts b/lector/resources/translations/Lector_es.ts index 4601268..699f9a8 100644 --- a/lector/resources/translations/Lector_es.ts +++ b/lector/resources/translations/Lector_es.ts @@ -10,113 +10,123 @@ Fullscreen - Pantalla completa + Pantalla completa - + Add bookmark Añadir un marcador Bookmarks - Marcadores + Marcadores - + Reset profile Restablecer el perfil - + Font size Tamaño del texto - + Increase padding Aumentar el espaciado - + Decrease padding Reducir el espaciado - + Increase line spacing Aumentar el interlineado - + Decrease line spacing Reducir el interlineado - + Left align text Alinear el texto a la izquierda - + Right align text Alinear el texto a la derecha - + Center align text Centrar el texto - + Justify text Justificar el texto - + Background color Color del fondo - + Zoom in Ampliar - + Zoom Out Reducir - + Fit Width Ajustar a la anchura - + Best Fit Ajuste perfecto - + Original size Tamaño original - + Search... Buscar… - + Table of Contents Sumario + + + Bookmarks (Ctrl + B) + + + + + Fullscreen (F11) + + DefinitionsUI - + No definitions found in No se encontró ninguna definición en @@ -139,12 +149,12 @@ Reproducir la pronunciación de la palabra raíz - + Settings Configuración - + Library Biblioteca @@ -154,17 +164,17 @@ Modificadores - + Startup: Refresh library Inicio: actualizar la biblioteca - + Remember open files Recordar los archivos abiertos - + Generate tags from files Generar etiquetas a partir de los archivos @@ -174,27 +184,27 @@ Diccionario: - + Cover shadows Sombras en las cubiertas - + Enabling reduces startup time and memory usage Activar esta opción reduce el tiempo de inicio y el uso de memoria - + Load covers only when needed Cargar las cubiertas solo cuando se necesiten - + Greatly reduces page transition time at the cost of more memory Reduce en gran medida el tiempo de transición de las páginas a costa de más memoria - + Cache comic / pdf pages Almacenar en antememoria las páginas de cómics/PDF @@ -204,7 +214,7 @@ Reinicie la aplicación para ver los cambios - + Icon theme: Tema de iconos: @@ -219,12 +229,12 @@ &Claro - + Scan Library Explorar la biblioteca - + Close Cerrar @@ -279,61 +289,126 @@ Cancelar - + Horizontal scrolling with Alt + Scroll Reopen book to see changes - + Hide scrollbars when reading - + Restart application to see changes - + &Dark - + L&ight - + Reading - - Dictionary language: + + Consider book read at percent + + + + + Dictionary language + + + + + Scroll speed + + + + + + + + + + + - + + + + + ⬆ + + + + + ⬇ + + + + + Foreground + + + + + Highlight + + + + + Bold + + + + + Italic + + + + + Underline + + + + + Text + + + + + Comic/PDF Library - + Author Autor - + Year Año - + manually added añadido manualmente - + books @@ -341,50 +416,85 @@ Reopen book to see changes LibraryToolBar - + Add book Añadir un libro - + Delete book Eliminar el libro - + Library background color Color de fondo de la biblioteca - + Settings Configuración - + View as covers Ver como cubiertas - + View as table Ver como tabla - + Filter library Filtrar la biblioteca - + Search for Title, Author, Tags... Buscar títulos, autores, etiquetas… - + Sort by Ordenar por + + + Scan Library + Explorar la biblioteca + + + + Title + Título + + + + Author + Autor + + + + Year + Año + + + + Newest + Más recientes + + + + Last Read + Última lectura + + + + Progress + + MainWindow @@ -399,90 +509,98 @@ Reopen book to see changes Biblioteca + + Main_BookToolBarUI + + + Toggle distraction free mode (Ctrl + D) + Alternar el modo de concentración (Ctrl + D) + + Main_UI Toggle distraction free mode (Ctrl + D) - Alternar el modo de concentración (Ctrl + D) + Alternar el modo de concentración (Ctrl + D) Scan library - Explorar la biblioteca + Explorar la biblioteca - + Add books to database Añadir libros a la base de datos - + eBooks Libros electrónicos - + Adding books... Añadiendo los libros… - + Confirm deletion Confirmar la eliminación - + Save changes and start library scan Guardar cambios e iniciar exploración de biblioteca - + Books Libros - + Start reading Comenzar a leer - + Edit Editar - + Delete Eliminar - + Mark read Marcar como leído - + Mark unread Marcar como no leído - + Manually Added Añadido manualmente Save page as... - Guardar la página como… + Guardar la página como… Images - Imágenes + Imágenes - + books @@ -503,12 +621,12 @@ Reopen book to see changes PliantQGraphicsScene - + Select new cover Seleccione una cubierta nueva - + Images Imágenes @@ -518,32 +636,32 @@ Reopen book to see changes Save page as... - Guardar la página como… + Guardar la página como… Zoom in (+) - Ampliar (+) + Ampliar (+) Zoom out (-) - Reducir (-) + Reducir (-) Fit width (W) - Ajustar a la anchura (W) + Ajustar a la anchura (W) Best fit (B) - Ajuste perfecto (B) + Ajuste perfecto (B) Original size (O) - Tamaño original (O) + Tamaño original (O) @@ -555,33 +673,18 @@ Reopen book to see changes Table of Contents Sumario - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - PliantQTextBrowser Define - Definir + Definir Search - Buscar + Buscar @@ -593,94 +696,84 @@ Reopen book to see changes Table of Contents Sumario - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - SettingsUI - + English Inglés - + Spanish Español - + Hindi Hindi - + Save changes and start library scan Guardar cambios e iniciar exploración de biblioteca - + Library scan in progress... Se está explorando la biblioteca… - + Checking library folders Comprobando las carpetas de la biblioteca - + Parsing files Procesando los archivos - + Library Biblioteca - + Switches Modificadores - + About Acerca de + + + Annotations + + Tab - + Bookmarks Marcadores - + New bookmark Marcador nuevo - + Edit Editar - + Delete Eliminar @@ -688,34 +781,34 @@ Reopen book to see changes TableProxyModel - + Title Título - + Author Autor - + Year Año - + Last Read Última lectura - + Tags Etiquetas Newest - Más recientes + Más recientes diff --git a/lector/resources/translations/Lector_fr.ts b/lector/resources/translations/Lector_fr.ts index ca814e9..22cb11d 100644 --- a/lector/resources/translations/Lector_fr.ts +++ b/lector/resources/translations/Lector_fr.ts @@ -10,113 +10,123 @@ Fullscreen - Plein écran + Plein écran - + Add bookmark Ajouter un marque page Bookmarks - Marque-pages + Marque-pages - + Reset profile Réinitialiser le profil - + Font size Taille de la police - + Increase padding Augmenter la marge - + Decrease padding Diminuer la marge - + Increase line spacing Augmenter l'espacement des lignes - + Decrease line spacing Diminuer l'espacement des lignes - + Left align text Aligner le texte à gauche - + Right align text Aligner le texte à droite - + Center align text Centrer le texte - + Justify text Justifier le texte - + Background color Couleur d'arrière-plan - + Zoom in Zoom avant - + Zoom Out Zoom arrière - + Fit Width Ajuster à la largeur - + Best Fit Meilleur ajustement - + Original size Taille d'origine - + Search... Rechercher… - + Table of Contents Sommaire + + + Bookmarks (Ctrl + B) + + + + + Fullscreen (F11) + + DefinitionsUI - + No definitions found in Aucune définitions trouvées dans @@ -139,12 +149,12 @@ Lire la prononciation de la racine - + Settings Options - + Library Bibliothèque @@ -154,17 +164,17 @@ Options - + Startup: Refresh library Au démarrage: Rafraîchir la bibliothèque - + Remember open files Se souvenir des fichiers ouverts - + Generate tags from files Générer des étiquettes à partir des fichiers @@ -174,27 +184,27 @@ Dictionnaire: - + Cover shadows Ombres des couverture - + Enabling reduces startup time and memory usage Si activé, réduit le temps de chargement et l'utilisation de la mémoire - + Load covers only when needed Charger les couvertures seulement quand nécessaire - + Greatly reduces page transition time at the cost of more memory Réduit grandement le temps de transition des pages contre plus d'utilisation de la mémoire - + Cache comic / pdf pages Mettre en cache les pages de bande dessinée / pdf @@ -204,7 +214,7 @@ Redémarrer pour voir les modifications - + Icon theme: Thème d'icones: @@ -219,12 +229,12 @@ C&lair - + Scan Library Analyser la bibliothèque - + Close Fermer @@ -279,61 +289,126 @@ Annuler - + Horizontal scrolling with Alt + Scroll Reopen book to see changes - + Hide scrollbars when reading - + Restart application to see changes - + &Dark - + L&ight - + Reading - - Dictionary language: + + Consider book read at percent + + + + + Dictionary language + + + + + Scroll speed + + + + + + + + + + + - + + + + + ⬆ + + + + + ⬇ + + + + + Foreground + + + + + Highlight + + + + + Bold + + + + + Italic + + + + + Underline + + + + + Text + + + + + Comic/PDF Library - + Author Auteur - + Year Année - + manually added manuellement ajouté - + books @@ -341,50 +416,85 @@ Reopen book to see changes LibraryToolBar - + Add book Ajouter un livre - + Delete book Supprimer un livre - + Library background color Couleur d'arrière-plan de la bibliothèque - + Settings Options - + View as covers Vue par couvertures - + View as table Vue par table - + Filter library Filtrer la bibliothèque - + Search for Title, Author, Tags... Rechercher par Titre, Auteur, Étiquettes… - + Sort by Trier par + + + Scan Library + Analyser la bibliothèque + + + + Title + Titre + + + + Author + Auteur + + + + Year + Année + + + + Newest + Nouveau + + + + Last Read + Lu pour la dernière fois + + + + Progress + + MainWindow @@ -399,90 +509,98 @@ Reopen book to see changes Bibliothèque + + Main_BookToolBarUI + + + Toggle distraction free mode (Ctrl + D) + Basculer en mode sans distraction (Ctrl + D) + + Main_UI Toggle distraction free mode (Ctrl + D) - Basculer en mode sans distraction (Ctrl + D) + Basculer en mode sans distraction (Ctrl + D) Scan library - Analyser la bibliothèque + Analyser la bibliothèque - + Add books to database Ajouter des livres à la base de données - + eBooks eBooks - + Adding books... Ajout des livres… - + Confirm deletion Confirmez la suppression - + Save changes and start library scan Enregistrer les modifications et démarrer l'analyse de la bibliothèque - + Books Livres - + Start reading Commencer à lire - + Edit Modifier - + Delete Supprimer - + Mark read Marquer comme lu - + Mark unread Marquer comme non-lu - + Manually Added Manuellement ajouté Save page as... - Enregistrerla page sous… + Enregistrerla page sous… Images - Images + Images - + books @@ -503,12 +621,12 @@ Reopen book to see changes PliantQGraphicsScene - + Select new cover Choisissez une nouvelle couverture - + Images Images @@ -518,159 +636,134 @@ Reopen book to see changes Save page as... - Enregistrerla page sous… + Enregistrerla page sous… Zoom in (+) - Zoom avant (+) + Zoom avant (+) Zoom out (-) - Zoom arrière (-) + Zoom arrière (-) Fit width (W) - Ajuster à la largeur (W) + Ajuster à la largeur (W) Best fit (B) - Meilleur ajustement (B) + Meilleur ajustement (B) Original size (O) - Taille d'origine (O) + Taille d'origine (O) Toggle distraction free mode Basculer en mode sans distraction - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - PliantQTextBrowser Define - Définir + Définir Search - Rechercher + Rechercher Toggle distraction free mode Basculer en mode sans distraction - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - SettingsUI - + English Anglais - + Spanish Espagnol - + Hindi Hindi - + Save changes and start library scan Enregistrer les modifications et démarrer l'analyse de la bibliothèque - + Library scan in progress... Analyse de la bibliothèque en cours… - + Checking library folders Vérification des dossiers de la bibliothèque - + Parsing files Lecture des fichiers - + Library Bibliothèque - + Switches Options - + About À propos + + + Annotations + + Tab - + Bookmarks Marque-pages - + New bookmark Nouveau marque-page - + Edit Modifier - + Delete Supprimer @@ -678,34 +771,34 @@ Reopen book to see changes TableProxyModel - + Title Titre - + Author Auteur - + Year Année - + Last Read Lu pour la dernière fois - + Tags Étiquettes Newest - Nouveau + Nouveau diff --git a/lector/resources/translations/SAMPLE.ts b/lector/resources/translations/SAMPLE.ts index 41034c1..49fff69 100644 --- a/lector/resources/translations/SAMPLE.ts +++ b/lector/resources/translations/SAMPLE.ts @@ -9,114 +9,114 @@ - Fullscreen - - - - Add bookmark - - Bookmarks - - - - + Reset profile - + Font size - + Increase padding - + Decrease padding - + Increase line spacing - + Decrease line spacing - + Left align text - + Right align text - + Center align text - + Justify text - + Background color - + Zoom in - + Zoom Out - + Fit Width - + Best Fit - + Original size - + Search... - + Table of Contents + + + Bookmarks (Ctrl + B) + + + + + Fullscreen (F11) + + DefinitionsUI - + No definitions found in @@ -139,67 +139,67 @@ - + Settings - + Library - + Startup: Refresh library - + Remember open files - + Generate tags from files - + Cover shadows - + Enabling reduces startup time and memory usage - + Load covers only when needed - + Greatly reduces page transition time at the cost of more memory - + Cache comic / pdf pages - + Icon theme: - + Scan Library - + Close @@ -249,61 +249,126 @@ - + Horizontal scrolling with Alt + Scroll Reopen book to see changes - + Hide scrollbars when reading - + Restart application to see changes - + &Dark - + L&ight - + Reading - - Dictionary language: + + Consider book read at percent + + + + + Dictionary language + + + + + Scroll speed + + + + + + + + + + + - + + + + + ⬆ + + + + + ⬇ + + + + + Foreground + + + + + Highlight + + + + + Bold + + + + + Italic + + + + + Underline + + + + + Text + + + + + Comic/PDF Library - + Author - + Year - + manually added - + books @@ -311,50 +376,85 @@ Reopen book to see changes LibraryToolBar - + Add book - + Delete book - + Library background color - + Settings - + View as covers - + View as table - + Filter library - + Search for Title, Author, Tags... - + Sort by + + + Scan Library + + + + + Title + + + + + Author + + + + + Year + + + + + Newest + + + + + Last Read + + + + + Progress + + MainWindow @@ -370,89 +470,77 @@ Reopen book to see changes - Main_UI + Main_BookToolBarUI - + Toggle distraction free mode (Ctrl + D) + + + Main_UI - - Scan library - - - - + Add books to database - + eBooks - + Adding books... - + Confirm deletion - + Save changes and start library scan - + Books - + Start reading - + Edit - + Delete - + Mark read - + Mark unread - + Manually Added - - Save page as... - - - - - Images - - - - + books @@ -473,164 +561,99 @@ Reopen book to see changes PliantQGraphicsScene - + Select new cover - + Images PliantQGraphicsView - - - Save page as... - - - - - Zoom in (+) - - - - - Zoom out (-) - - - - - Fit width (W) - - - - - Best fit (B) - - - - - Original size (O) - - - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - PliantQTextBrowser - - - Define - - - - - Search - - - - - Exit fullscreen - - - - - Distraction Free mode - - - - - Exit Distraction Free mode - - SettingsUI - + English - + Spanish - + Hindi - + Save changes and start library scan - + Library scan in progress... - + Checking library folders - + Parsing files - + Library - + Switches - + About + + + Annotations + + Tab - + Bookmarks - + New bookmark - + Edit - + Delete @@ -638,34 +661,29 @@ Reopen book to see changes TableProxyModel - + Title - + Author - + Year - + Last Read - + Tags - - - Newest - - diff --git a/lector/sorter.py b/lector/sorter.py index b5e5bca..5c802f4 100644 --- a/lector/sorter.py +++ b/lector/sorter.py @@ -17,7 +17,7 @@ # along with this program. If not, see . # INSTRUCTIONS -# Every parser is supposed to have the following methods, even if they return None: +# Every parser is supposed to have the following methods. None returns are not allowed. # read_book() # get_title() # get_author() @@ -40,17 +40,20 @@ import pickle import hashlib import threading -from multiprocessing import Pool, Manager +# The multiprocessing module does not work correctly on Windows +if os.uname().sysname == 'Windows': + from multiprocessing.dummy import Pool, Manager +else: + from multiprocessing import Pool, Manager + from PyQt5 import QtCore, QtGui from lector import database -from lector.parsers.pdf import ParsePDF from lector.parsers.epub import ParseEPUB from lector.parsers.mobi import ParseMOBI from lector.parsers.comicbooks import ParseCOMIC sorter = { - 'pdf': ParsePDF, 'epub': ParseEPUB, 'mobi': ParseMOBI, 'azw': ParseMOBI, @@ -60,6 +63,13 @@ sorter = { 'cbz': ParseCOMIC, 'cbr': ParseCOMIC} +# The following imports are for optional dependencies +try: + from lector.parsers.pdf import ParsePDF + sorter['pdf'] = ParsePDF +except ImportError: + print('python-poppler-qt5 is not installed. Pdf files will not work.') + available_parsers = [i for i in sorter] progressbar = None # This is populated by __main__ progress_emitter = None # This is to be made into a global variable @@ -185,13 +195,8 @@ class BookSorter: # Reduce the size of the incoming image # if one is found title = book_ref.get_title() - author = book_ref.get_author() - if not author: - author = 'Unknown' - year = book_ref.get_year() - isbn = book_ref.get_isbn() tags = None @@ -213,8 +218,7 @@ class BookSorter: # get_contents() returns a tuple. Index 1 is a collection of # special settings that depend on the kind of data being parsed. # Currently, this includes: - # Only images included images_only BOOL Specify only paths to images - # File will not be cached on exit + # Only images included images_only BOOL Book contains only images content = all_content[0] images_only = all_content[1]['images_only']