From e9a155cf04002723604203268c05e2d43fc71523 Mon Sep 17 00:00:00 2001 From: Tangent Date: Wed, 6 Nov 2024 17:17:58 -0700 Subject: [PATCH] close #29 different file name option --- README.md | 2 ++ make-epub.lua | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3985602..8c013e7 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The JSON config spec has two major variations ("Book" and "Anthology"). The following is shared: - `authors`: (Optional) Array of Strings: Author names. First in the list is used as a byline in the final output. (Legacy: An `author` string works as well. If this exists, it will be first.) - `title`: (Optional) String: Title of book. +- `base_file_name`: (Optional) String: Alternate final file name. (Default: "`title` by `author`" or just "`title`".) - `keywords`: Array of Strings: Keywords/Tags. (I'm not sure what the difference is in the final output so it goes in both.) - `sections`: \! See "Book"/"Anthology" variations. (I call LitErotica's stories sections - because they are often part of a larger whole.) - `page_counts`: Array of Integers: The number of pages on LitErotica per "story". (I call them sections because this script was made to put together story series originally.) @@ -39,6 +40,7 @@ Example: { "authors": ["Name"], "title": "Book", + "base_file_name": "Book", "keywords": ["erotica", "fantasy"], "base_url": "https://www.literotica.com/s/title-ch-", "first_section_url": "https://www.literotica.com/s/title", diff --git a/make-epub.lua b/make-epub.lua index 867f601..5db7564 100755 --- a/make-epub.lua +++ b/make-epub.lua @@ -23,6 +23,7 @@ Configuration example(s): { "authors": ["Name"], "title": "Book", + "base_file_name": "Book", "keywords": ["erotica", "fantasy"], "base_url": "https://www.literotica.com/s/title-ch-", "first_section_url": "https://www.literotica.com/s/title", @@ -269,7 +270,7 @@ local function get_base_file_name(config) base_file_name = "Book" end - return make_safe_file_name(base_file_name) + return make_safe_file_name(config.base_file_name or base_file_name) end -- NOTE deprecated (order of operations had to be changed, see #25)