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 progress and fixes to m4b and embed tools #3182

Merged
merged 4 commits into from
Jul 20, 2024

Conversation

mikiher
Copy link
Contributor

@mikiher mikiher commented Jul 20, 2024

This adds progress indicators to the embed and m4b tools, and fixes some issues in those tools.

The main changes:

  • Both embed and m4b tools now show both task and per-track progress in percent
    • In the m4b tool, the per-track progress is calculated according to track durations and ffmpeg progress timemark.
    • The task progress is shown on the button instead of the spinner.
    • The track and task progress are persisted in the store, so they're rememberd when the user leaves and comes back to the tool page.
    • In the m4b tool, since there are two operations happening sequentially (m4b merging and embedding), I made the merging account for 95% of the progress (since it's usually takes much longer), and embedding acount for 5%. This was just just an arbitrary decision.
  • Now checking writability of the directory (in m4b and embed) and write access to the audio files (in embed), before running ffmpeg. This fixes [Bug]: M4B conversion does not check if it has permissions to move/create files before proceeding #3143
  • Fixed issue that caused metadata not to be properly embedded after merging, in the m4b tool.
  • Added a TaskFailed indicator to the embed tool UI (it always showed success up until now, even if embedding failed).
  • Removed the redundant worker_threads logic from AbMergeManager, and moved the merging code mergeAudioFiles() in ffmpegHelpers.js
  • Tightened error handling, especially around file system operations.

@mikiher mikiher marked this pull request as ready for review July 20, 2024 10:07
@advplyr
Copy link
Owner

advplyr commented Jul 20, 2024

Working great, thanks!

@advplyr advplyr merged commit 9cd0ac8 into advplyr:master Jul 20, 2024
5 checks passed
@mikiher mikiher deleted the ffmpeg-progress branch July 21, 2024 06:28
@kuldan5853
Copy link

Works indeed great - could the % complete also be added to the "ongoing tasks" view? (Top right dot circle icon) I think that place was missed.

@advplyr
Copy link
Owner

advplyr commented Aug 21, 2024

I forgot about this in my review but for files in the root folder that are single-file books the LibraryItem.path will be the path to the audio file.
This is only handling cases where the LibraryItem.path is a folder. For single-file books the LibraryItem.isFile is set to true.

Bug reported #3323

@mikiher
Copy link
Contributor Author

mikiher commented Aug 22, 2024 via email

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.

[Bug]: M4B conversion does not check if it has permissions to move/create files before proceeding
3 participants