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

Replace tone with ffmpeg for metadata and cover embedding #3111

Merged
merged 7 commits into from
Jul 6, 2024

Conversation

mikiher
Copy link
Contributor

@mikiher mikiher commented Jun 29, 2024

This is an early review for tone -> ffmpeg replacement.

  • No UI changes yet
  • Only m4b embedding has been tested (mp3 embedding will likely only add a couple of ffmpeg flags)

Please let me know if you have any comments up until now, and please don't merge yet.

@mikiher mikiher marked this pull request as ready for review June 29, 2024 17:09
@mikiher
Copy link
Contributor Author

mikiher commented Jun 30, 2024

Question: do we merge existing metadata with new one, or do we override existing metadata?
tone seems to merge.

Clarification:
"merge" means - tags that were not pupulated by abs remain unchanged.
'override" means - tags that were not pupulated by abs are removed.

@advplyr
Copy link
Owner

advplyr commented Jun 30, 2024

Can you give a specific example? I am interpreting this in a few different ways and not sure which one you are thinking of.

@mikiher
Copy link
Contributor Author

mikiher commented Jun 30, 2024

ok, suppose the original audio file had metadata tags a=1, b=2, and c=3, and abs has tags b=4, c=5, e=6.

then after embedding:

  • in "merge" the audio file has a=1, b=4, c=5, e=6
  • in "override" the audio file has b=4, c=5, e=6 (and no a=1)

@mikiher
Copy link
Contributor Author

mikiher commented Jun 30, 2024

In my second commit, I implemented "merge"

@mikiher
Copy link
Contributor Author

mikiher commented Jun 30, 2024

Another thing I noted: tone does not explicitly write track (so if it existed, it remains the same, and if it did not exist, it is not populated). Should we fix this?

@advplyr
Copy link
Owner

advplyr commented Jun 30, 2024

ok, suppose the original audio file had metadata tags a=1, b=2, and c=3, and abs has tags b=4, c=5, e=6.

then after embedding:

  • in "merge" the audio file has a=1, b=4, c=5, e=6
  • in "override" the audio file has b=4, c=5, e=6 (and no a=1)

In this case I think it makes sense to leave a=1 because the user may define additional meta tags on their own separate from the ones Abs uses.

The trickier case would be if a is a meta tag Abs uses but it is empty in Abs.
For example, if the book does not have a series in Abs but the audio file does have data in the meta tag that Abs uses for series. We could remove that tag from the audio file or leave it there.

@mikiher
Copy link
Contributor Author

mikiher commented Jun 30, 2024

The trickier case would be if a is a meta tag Abs uses but it is empty in Abs.
For example, if the book does not have a series in Abs but the audio file does have data in the meta tag that Abs uses for series. We could remove that tag from the audio file or leave it there.

I put code that removes any empty/null values from the ffmetadata object, so right now the behavior is that if the series tag is empty in abs and exists in the original file, the original will be kept.

@mikiher
Copy link
Contributor Author

mikiher commented Jul 2, 2024

OK, I think the code is ready for review now (and thanks for implementing track embedding).

I haven't cleaned up Tone from the code yet. I'll do that once we've ran the ffmpeg-based embedding in prod for a few weeks.

@mikiher
Copy link
Contributor Author

mikiher commented Jul 3, 2024

I also added some unit tests for the new functions in ffmpegHelpers.

@advplyr
Copy link
Owner

advplyr commented Jul 6, 2024

This was a long time coming. Thanks!

@advplyr advplyr merged commit 9a4c5a1 into advplyr:master Jul 6, 2024
4 checks passed
@mikiher
Copy link
Contributor Author

mikiher commented Jul 6, 2024 via email

@advplyr
Copy link
Owner

advplyr commented Jul 6, 2024

Yeah it makes sense to be cautious, I appreciate that. There was another similar endpoint tone-scan that is still in the docs that I removed a while ago so the docs need to be updated. With the new API docs that @nichwall has been working on we can do better at managing the API in general

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