mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalogs: Do not erase any tags the user adds to a catalog book entry when the catalog is re-generated. Fixes #1262875 [Enhancement request: Ability to customize epub catalogue tag](https://bugs.launchpad.net/calibre/+bug/1262875)
This commit is contained in:
parent
416237a2a5
commit
049253f8d7
@ -256,18 +256,20 @@ def add_catalog(cache, path, title, dbapi=None):
|
||||
try:
|
||||
mi = get_metadata(stream, fmt)
|
||||
mi.authors = ['calibre']
|
||||
except:
|
||||
except Exception:
|
||||
mi = Metadata(title, ['calibre'])
|
||||
mi.title, mi.authors = title, ['calibre']
|
||||
mi.author_sort = 'calibre' # The MOBI/AZW3 format sets author sort to date
|
||||
mi.tags = [_('Catalog')]
|
||||
mi.pubdate = mi.timestamp = utcnow()
|
||||
if fmt == 'mobi':
|
||||
mi.cover, mi.cover_data = None, (None, None)
|
||||
if db_id is None:
|
||||
mi.tags = [_('Catalog')]
|
||||
db_id = cache._create_book_entry(mi, apply_import_tags=False)
|
||||
new_book_added = True
|
||||
else:
|
||||
if not mi.tags or _('Catalog') not in mi.tags:
|
||||
mi.tags.append(_('Catalog'))
|
||||
cache._set_metadata(db_id, mi)
|
||||
cache.add_format(db_id, fmt, stream, dbapi=dbapi) # Can't keep write lock since post-import hooks might run
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user