mirror of
https://github.com/janeczku/calibre-web.git
synced 2024-11-30 09:07:17 +02:00
Revert "Epub series metadata"
This commit is contained in:
parent
4dc6150d77
commit
77b3cc2fd0
16
cps/epub.py
16
cps/epub.py
@ -68,18 +68,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
||||
else:
|
||||
epub_metadata['language'] = ""
|
||||
|
||||
series = tree.xpath("/pkg:package/pkg:metadata/pkg:meta[@name='calibre:series']/@content", namespaces=ns)
|
||||
if len(series) > 0:
|
||||
epub_metadata['series'] = series[0]
|
||||
else:
|
||||
epub_metadata['series'] = ''
|
||||
|
||||
series_id = tree.xpath("/pkg:package/pkg:metadata/pkg:meta[@name='calibre:series_index']/@content", namespaces=ns)
|
||||
if len(series_id) > 0:
|
||||
epub_metadata['series_id'] = series_id[0]
|
||||
else:
|
||||
epub_metadata['series_id'] = '1'
|
||||
|
||||
coversection = tree.xpath("/pkg:package/pkg:manifest/pkg:item[@id='cover-image']/@href", namespaces=ns)
|
||||
coverfile = None
|
||||
if len(coversection) > 0:
|
||||
@ -114,6 +102,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
|
||||
cover=coverfile,
|
||||
description=epub_metadata['description'],
|
||||
tags="",
|
||||
series=epub_metadata['series'].encode('utf-8').decode('utf-8'),
|
||||
series_id=epub_metadata['series_id'].encode('utf-8').decode('utf-8'),
|
||||
series="",
|
||||
series_id="",
|
||||
languages=epub_metadata['language'])
|
||||
|
20
cps/web.py
20
cps/web.py
@ -2928,17 +2928,13 @@ def upload():
|
||||
|
||||
title = meta.title
|
||||
author = meta.author
|
||||
series = meta.series
|
||||
series_index = meta.series_id
|
||||
|
||||
title_dir = helper.get_valid_filename(title, False)
|
||||
author_dir = helper.get_valid_filename(author, False)
|
||||
data_name = title_dir
|
||||
filepath = config.config_calibre_dir + os.sep + author_dir + os.sep + title_dir
|
||||
saved_filename = filepath + os.sep + data_name + meta.extension
|
||||
|
||||
if series_index == '':
|
||||
series_index = 1
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
try:
|
||||
os.makedirs(filepath)
|
||||
@ -2971,14 +2967,6 @@ def upload():
|
||||
db_author = db.Authors(author, helper.get_sorted_author(author), "")
|
||||
db.session.add(db_author)
|
||||
|
||||
db_series = None
|
||||
is_series = db.session.query(db.Series).filter(db.Series.name == series).first()
|
||||
if is_series:
|
||||
db_series = is_series
|
||||
elif series != '':
|
||||
db_series = db.Series(series, "")
|
||||
db.session.add(db_series)
|
||||
|
||||
# add language actually one value in list
|
||||
input_language = meta.languages
|
||||
db_language = None
|
||||
@ -2992,11 +2980,9 @@ def upload():
|
||||
db.session.add(db_language)
|
||||
# combine path and normalize path from windows systems
|
||||
path = os.path.join(author_dir, title_dir).replace('\\', '/')
|
||||
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 1, 1),
|
||||
series_index, datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
||||
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 1, 1), 1,
|
||||
datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
||||
db_book.authors.append(db_author)
|
||||
if db_series:
|
||||
db_book.series.append(db_series)
|
||||
if db_language is not None:
|
||||
db_book.languages.append(db_language)
|
||||
db_data = db.Data(db_book, meta.extension.upper()[1:], file_size, data_name)
|
||||
|
Loading…
Reference in New Issue
Block a user