mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
b8fce28cb7
commit
47bf99c214
@ -1,23 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, tempfile, shutil, time
|
||||
from threading import Thread, Event
|
||||
from polyglot.builtins import map
|
||||
|
||||
from qt.core import (QFileSystemWatcher, QObject, Qt, pyqtSignal, QTimer, QApplication, QCursor)
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
from qt.core import (
|
||||
QApplication, QCursor, QFileSystemWatcher, QObject, Qt, QTimer, pyqtSignal
|
||||
)
|
||||
from threading import Event, Thread
|
||||
|
||||
from calibre import prints
|
||||
from calibre.db.adding import filter_filename, compile_rule
|
||||
from calibre.db.adding import compile_rule, filter_filename
|
||||
from calibre.ebooks import BOOK_EXTENSIONS
|
||||
from calibre.gui2 import gprefs
|
||||
from calibre.gui2.dialogs.duplicates import DuplicatesQuestion
|
||||
from calibre.utils.tdir_in_cache import tdir_in_cache
|
||||
from polyglot.builtins import map
|
||||
|
||||
AUTO_ADDED = frozenset(BOOK_EXTENSIONS) - {'pdr', 'mbp', 'tan'}
|
||||
|
||||
@ -84,9 +84,9 @@ class Worker(Thread):
|
||||
shutil.rmtree(self.tdir, ignore_errors=True)
|
||||
|
||||
def auto_add(self):
|
||||
from calibre.utils.ipc.simple_worker import fork_job, WorkerError
|
||||
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
||||
from calibre.ebooks.metadata.meta import metadata_from_filename
|
||||
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
||||
from calibre.utils.ipc.simple_worker import WorkerError, fork_job
|
||||
|
||||
files = [x for x in os.listdir(self.path) if
|
||||
# Must not be in the process of being added to the db
|
||||
@ -254,7 +254,9 @@ class AutoAdder(QObject):
|
||||
from calibre.ebooks.metadata.tag_mapper import map_tags
|
||||
mi.tags = map_tags(mi.tags, gprefs['tag_map_on_add_rules'])
|
||||
if gprefs.get('author_map_on_add_rules'):
|
||||
from calibre.ebooks.metadata.author_mapper import map_authors, compile_rules
|
||||
from calibre.ebooks.metadata.author_mapper import (
|
||||
compile_rules, map_authors
|
||||
)
|
||||
new_authors = map_authors(mi.authors, compile_rules(gprefs['author_map_on_add_rules']))
|
||||
if new_authors != mi.authors:
|
||||
mi.authors = new_authors
|
||||
|
Loading…
x
Reference in New Issue
Block a user