mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a tweak telling the content server to give the client a path computed from a template (the value of the tweak). This can happen only if the client sets the device_compatible flag.
This commit is contained in:
parent
44b77cdb85
commit
9f9fc233be
@ -572,3 +572,14 @@ restrict_output_formats = None
|
|||||||
# numbers.
|
# numbers.
|
||||||
# The value can be between 50 and 99
|
# The value can be between 50 and 99
|
||||||
content_server_thumbnail_compression_quality = 75
|
content_server_thumbnail_compression_quality = 75
|
||||||
|
|
||||||
|
#: Set the template for the file name supplied by the content server
|
||||||
|
# Setting this tweak will make the content server supply the template's value
|
||||||
|
# when a book's metadata is requested in "device compatible" mode. The client
|
||||||
|
# can use this value as part of the path for the book when downloaded. Note
|
||||||
|
# that the save_template_title_series_sorting tweak is used to control title
|
||||||
|
# and series values.
|
||||||
|
# Examples:
|
||||||
|
# content_server_path_for_client = "{title}-{author}"
|
||||||
|
# content_server_path_for_client = "{title_sort}-{:'series_sort()'||-}{author_sort}"
|
||||||
|
content_server_path_for_client = ''
|
||||||
|
@ -191,7 +191,14 @@ class AjaxServer(object):
|
|||||||
else:
|
else:
|
||||||
series = ''
|
series = ''
|
||||||
data['_series_sort_'] = series
|
data['_series_sort_'] = series
|
||||||
|
if tweaks['content_server_path_for_client']:
|
||||||
|
import posixpath
|
||||||
|
from calibre.devices.utils import create_upload_path
|
||||||
|
from calibre.utils.filenames import ascii_filename as sanitize
|
||||||
|
data['_filename_'] = create_upload_path(mi, '',
|
||||||
|
tweaks['content_server_path_for_client'],
|
||||||
|
sanitize, path_type=posixpath)
|
||||||
|
print('filename', data['_filename_'])
|
||||||
return data, mi.last_modified
|
return data, mi.last_modified
|
||||||
|
|
||||||
@Endpoint(set_last_modified=False)
|
@Endpoint(set_last_modified=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user