mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News and / tag use name from template for filename.
This commit is contained in:
parent
b7022494cc
commit
77e832d4a4
@ -867,27 +867,25 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
fname = sanitize(fname)
|
fname = sanitize(fname)
|
||||||
ext = os.path.splitext(fname)[1]
|
ext = os.path.splitext(fname)[1]
|
||||||
|
|
||||||
if special_tag is None:
|
from calibre.library.save_to_disk import get_components
|
||||||
from calibre.library.save_to_disk import get_components
|
extra_components = get_components(template, mdata, fname)
|
||||||
extra_components = get_components(template, mdata, fname)
|
extra_components[-1] = sanitize(self.filename_callback(extra_components[-1]+ext, mdata))
|
||||||
extra_components[-1] = extra_components[-1] = sanitize(self.filename_callback(extra_components[-1]+ext, mdata))
|
|
||||||
else:
|
if special_tag:
|
||||||
|
name = extra_components[-1]
|
||||||
|
extra_components = []
|
||||||
tag = special_tag
|
tag = special_tag
|
||||||
if tag.startswith(_('News')):
|
if tag.startswith(_('News')):
|
||||||
extra_components.append('News')
|
extra_components.append('News')
|
||||||
c = sanitize(mdata.title if mdata.title else '')
|
|
||||||
#c = c.split('[')[0].strip()
|
|
||||||
if c:
|
|
||||||
extra_components.append(c)
|
|
||||||
else:
|
else:
|
||||||
for c in tag.split('/'):
|
for c in tag.split('/'):
|
||||||
c = sanitize(c)
|
c = sanitize(c)
|
||||||
if not c: continue
|
if not c: continue
|
||||||
extra_components.append(c)
|
extra_components.append(c)
|
||||||
extra_components.append(sanitize(self.filename_callback(fname, mdata)))
|
extra_components.append(name)
|
||||||
|
|
||||||
if not use_subdirs:
|
if not use_subdirs:
|
||||||
extra_components = extra_components[:1]
|
extra_components = extra_components[-1:]
|
||||||
|
|
||||||
if not extra_components:
|
if not extra_components:
|
||||||
fname = sanitize(self.filename_callback(fname, mdata))
|
fname = sanitize(self.filename_callback(fname, mdata))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user