gvellut / jncep

Command-line tool to generate EPUB files for J-Novel Club pre-pub novels
GNU General Public License v3.0
43 stars 11 forks source link

[Feature request] suppress part naming in volumes for use with Kavita #44

Closed AnAngryBrit closed 8 months ago

AnAngryBrit commented 11 months ago

In addition to #39 in order to get full compatibility with Kavita the part naming of volumes needs to be suppressed as generating volumes with different file name but the same metadata will only allow the first volume generated to be accessed without manual file wrangling.

Kavita when executing a library refresh is able to recognise that there is additional content (parts) in an existing file and will update the volume to show that there is additional unread segments and update your bookmark to load the new part.

I am not sure of the best place in which to do this. in my local testing I have updated line 271 of core.py as follows title = f"{title_base}" from title = f"{title_base} [{part_segment}]"

this results in epubs with only the volume in the name "Hell_Mode_Volume_7_parts_1_to_4.epub" vs "Hell_Mode_Volume_7.epub"

I am happy to create a PR with a switch that does this. I would appreciate some discussion on this one around suggested option name and what your willingness to include this might be.

Thanks, AnAngryBrit

gvellut commented 11 months ago

Thank you for your feedback.

Something to that effect will be implemented as part of https://github.com/gvellut/jncep/issues/29 (either as custom name templates or flags to specify how the default name gets transformed). So it will be a bit more general than what you want (I think the folder name you implemented already could fit in that as well).

Not sure when it will be done though, so if you already have a PR, you can send it and I will include it. For the option name, set it to what you want and I will change it if needed.

AnAngryBrit commented 11 months ago

additional part naming comes from core.py line 234 for when the first part of a new volume is created. _process_single_epub_content .... title = f"{part.raw_data.title}{suffix}" does this come directly from j-novel?

todo: add way manipulate this or edit it post assignment.

gvellut commented 8 months ago

Sorry, I had not seen your question. The raw_data attributes come from the JNC API response: when I parse the response, I copy some attributes to the main object for easy access but not all; The whole response is put there.

Anyway, I got around to implement a feature that should answer your request. It allows the renaming of the output EPUB title, its filename or its folder name (using the --subfolder option). It is a bit complex in order to satisfy all use cases (from the orignal renaming issue #29 + some things I needed). I will document it for the next release.

AnAngryBrit commented 8 months ago

no worries, I figured that it was coming from the API but since the output was predictable I put in a very dirty hack to solve my issue. title = f"{part.raw_data.title[:-6]}{suffix}" not especially proud of that one. I see there are lots changes going in to make naming more dynamic, since you mentioned that you were working on something I didn't put in too much effort. looking forward to the next release.