Keep the article in {title} and {series}
The default template is now {title_sort} - {authors}. It gives the same name as Calibre's default.
This commit is contained in:
+1
-1
@@ -472,7 +472,7 @@ def test_settings(client, monkeypatch, tmp_path):
|
||||
"pause_uploads": False,
|
||||
"ingest_available": True,
|
||||
"personal_ini": "[defaults]\nis_adult:true\n",
|
||||
"download_template": "{title} - {authors}",
|
||||
"download_template": "{title_sort} - {authors}",
|
||||
"download_date_format": "%b, %Y",
|
||||
"story_jobs_hours": 36,
|
||||
"story_jobs_count": 10,
|
||||
|
||||
@@ -160,9 +160,13 @@ def test_download_template_names_the_file(client, story):
|
||||
assert client.get("/api/config").json["download_fields"]["id"].startswith("The CWA book ID")
|
||||
saved = client.put("/api/settings", json={"download_template": " {series:|| - }{title} - {id} "}, headers=H)
|
||||
assert saved.json["download_template"] == "{series:|| - }{title} - {id}"
|
||||
assert f'filename="Saga, The - Book, The - {sid}.epub"' in download_name(client, sid)
|
||||
assert f'filename="The Saga - The Book - {sid}.epub"' in download_name(client, sid)
|
||||
# The default moves the article to the end, as Calibre's default does.
|
||||
client.put("/api/settings", json={"download_template": ""}, headers=H)
|
||||
assert 'filename="Book, The - Ann Writer.epub"' in download_name(client, sid)
|
||||
# The ID is that of the CWA book, when the story has one.
|
||||
o.store.update_story(sid, calibre_id=77, pinned={"title": "Caf\u00e9", "series": ["", None]})
|
||||
client.put("/api/settings", json={"download_template": "{series:|| - }{title} - {id}"}, headers=H)
|
||||
name = download_name(client, sid)
|
||||
assert 'filename="Cafe - 77.epub"' in name and "filename*=UTF-8''Caf%C3%A9%20-%2077.epub" in name
|
||||
# A template with folders gives the name of the file alone.
|
||||
@@ -170,7 +174,7 @@ def test_download_template_names_the_file(client, story):
|
||||
assert "filename*=UTF-8''Caf%C3%A9.epub" in download_name(client, sid)
|
||||
# An empty template restores the default.
|
||||
saved = client.put("/api/settings", json={"download_template": " "}, headers=H).json
|
||||
assert saved["download_template"] == "{title} - {authors}"
|
||||
assert saved["download_template"] == "{title_sort} - {authors}"
|
||||
assert "filename*=UTF-8''Caf%C3%A9%20-%20Ann%20Writer.epub" in download_name(client, sid)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user