Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional arg to use a temporary directory when converting files #99

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

whispy
Copy link

@whispy whispy commented Dec 28, 2024

Hey y'all! I have a use-case where I want to automate some steps that happen after epub -> audio conversion is completed for the entire book. I can imagine other users would have similar use cases (e.g. move completed audiobook to remote location, manually trigger a scan on Audiobookshelf to import the audiobook immediately, or generally run any post-processing on the completed audiobook).

Why this method?
Mainly because it seemed like the easiest and most versatile. Using a temporary directory when converting the files, and then moving them all at once to a final output directory allows users to choose how to trigger/act on the final output. Now users can watch the output directory and wait for any files to be there (instead of before, when they would have to figure out a way to know how many files would be produced and then wait for all files in the book to be there before beginning post-processing).

High-Level Changes

  • Added temporary directory support with --use_temp_dir flag
  • When flag is included in command:
    • Output files (including output_text .txt files, if specified) are written a sub-folder in the tmp directory.
    • The sub-folder is named based on the book's name.
    • When the conversion completes, all output files are copied to the output folder. The sub-folder in the tmp directory and all its files are removed.
  • When flag is not included in command:
    • No changes from default behavior (all files written directly to output)
  • The location of tmp is in the working directory. This is not configurable. (I originally made it configurable, but then decided this wasn't useful and removed it)

(I did not include any updates noting this change in the README. Happy to do so, or let the maintainers update as they desire.)

@p0n1
Copy link
Owner

p0n1 commented Jan 17, 2025

Thank you for your contribution, it seems meaningful. Let's wait and see if other users have this need as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants