mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
This commit is contained in:
parent
dfb7199931
commit
d7c0d543fe
@ -32,6 +32,11 @@ def get_metadata(stream):
|
||||
match = pat.search(src)
|
||||
if match:
|
||||
title = match.group(1)
|
||||
else:
|
||||
pat = re.compile('<title>([^<>]+?)</title>', re.IGNORECASE)
|
||||
match = pat.search(src)
|
||||
if match:
|
||||
title = match.group(1)
|
||||
|
||||
# Author
|
||||
author = None
|
||||
|
@ -39,8 +39,6 @@ def get_metadata(stream, stream_type='lrf'):
|
||||
|
||||
name = os.path.basename(stream.name) if hasattr(stream, 'name') else ''
|
||||
base = metadata_from_filename(name)
|
||||
if not base.title:
|
||||
base.title = name if name else 'Unknown'
|
||||
if not base.authors:
|
||||
base.authors = ['Unknown']
|
||||
base.smart_update(mi)
|
||||
@ -77,5 +75,7 @@ def metadata_from_filename(name):
|
||||
mi.authors = authors
|
||||
except IndexError:
|
||||
pass
|
||||
if not mi.title:
|
||||
mi.title = name
|
||||
return mi
|
||||
|
Loading…
x
Reference in New Issue
Block a user