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

PICARD-1092: Add support for preserving the SYLT tag #2373

Merged
merged 6 commits into from
Mar 23, 2024

Conversation

twodoorcoupe
Copy link
Contributor

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:
    Allow to preserve the SYLT tag. Also add support for reading and writing the SYLT tag of ID3.

Problem

Like @phw said in the comments of the ticket, besides preserving the SYLT tag, it would be nice if Picard could both read and write this tag.

Solution

As it was suggested, this solution converts the SYLT tag to the LRC format for display, and it converts the LRC format back into the SYLT tag when saving.

Action

picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
test/formats/test_id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty good in principle.

I appreciate that the intent of this PR is to preserve (and display) ID3 SYLT tags, however the same concept applies equally to other tagging formats so, in addition to the comments below, I would also like to see support for loading and saving the same syncedlyrics metadata from other formats.

picard/formats/id3.py Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
@zas zas requested a review from phw March 15, 2024 13:54
Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I appreciate your initiative very much. Adding synced lyrics support will need some work, so I hope you will stay with us to get this through. Not all need to be done as part of a single PR, but we at least need to identify what needs to be done next.

Most has already been said in the other reviews. I just want to stress three points:

  1. Converting LRC to/from SYLT really needs to go into separate functions with a set of tests that handles different cases, including invalid ones.

  2. Other formats should be handled as well. I don't know how this is currently done in those formats. Does anyone have some experience with synced lyrics used in Vorbis? Would we just store the LRC format there? ASF has this not useful gem in its documentation for WM/Lyrics_Synchronised:

    For more information about how to use synchronized lyrics, see the documentation for the technology you are using.

    However, I also think we can handle separate formats in separate PRs, especially if they are more complex. But then we should probably make sure the syncedlyrics tag is not yet written to all other formats to avoid issues later on.

  3. The syncedlyrics tag needs to handle language from the beginning. I would suggest to follow my proposal on PICARD-2844. We should get this right this time from the beginning and avoid the mistakes done with the comment and lyrics tags.

picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Show resolved Hide resolved
@twodoorcoupe
Copy link
Contributor Author

Thank you all for the reviews!

I've made the tag preserve the language, which should be easy to extend to the lyrics tag. Also made it preserve the timestamps for syllables.

Does anyone have some experience with synced lyrics used in Vorbis? Would we just store the LRC format there?

When I was trying to put together a plugin to download synced lyrics for this request on the forum, I found out that most players just store the classic LRC format there. But I had a doubt about the mapping, because most players I've come across use LYRICS for lyrics with timestamp and UNSYNCEDLYRICS for normal lyrics. Picard has LYRICS already mapped for normal lyrics, so I was wondering what would be best for synced lyrics.

Copy link
Contributor

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twodoorcoupe Please keep going - we are getting there.

picard/formats/id3.py Show resolved Hide resolved
picard/util/tags.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
@rdswift
Copy link
Collaborator

rdswift commented Mar 18, 2024

When this is all sorted out and merged, will we need to update the Tag Mapping information in the documentation? If so, the updates should be entered in a PR updating https://github.com/metabrainz/picard-docs/blob/master/tag_mapping.py in the metabrainz/picard-docs project.

zas
zas previously approved these changes Mar 21, 2024
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zas zas requested review from Sophist-UK and phw March 21, 2024 19:40
@twodoorcoupe
Copy link
Contributor Author

I made it so the tag is not written to other formats for now like @phw suggested.

phw
phw previously approved these changes Mar 22, 2024
Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twodoorcoupe This looks really good. I'm happy you tackled this issue. Let's merge this.

Would you be willing to update picard-docs as well, as @rdswift has outlined above?

@phw phw requested a review from zas March 22, 2024 07:14
@twodoorcoupe
Copy link
Contributor Author

Would you be willing to update picard-docs as well, as @rdswift has outlined above?

Will do right away.

zas
zas previously approved these changes Mar 22, 2024
@Sophist-UK
Copy link
Contributor

Do you want my review or not?

If you ask for it you might at least wait for me to do it before approving it.

@phw
Copy link
Member

phw commented Mar 22, 2024

@Sophist-UK Yes please, your review would be very welcomed here.

If you ask for it you might at least wait for me to do it before approving it.

Approval is after reviewing. I think this pull requests really benefits from multiple reviews. We don't need a competition who approves first. Currently this is still showing open review from you, so I would wait with merging until this is done. But if you don't want to review again or don't have time for it, just let us know.

Copy link
Contributor

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall excellent. Only a couple of quite minor points...

picard/formats/id3.py Outdated Show resolved Hide resolved
picard/formats/id3.py Outdated Show resolved Hide resolved
@twodoorcoupe twodoorcoupe dismissed stale reviews from zas and phw via 21ada91 March 22, 2024 16:47
zas
zas previously approved these changes Mar 22, 2024
Copy link
Contributor

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry.....

picard/formats/id3.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch about the exception when loading the file.

Thanks everyone for participating. I'll merge this now.

@phw phw merged commit cb5af09 into metabrainz:master Mar 23, 2024
41 checks passed
@twodoorcoupe twodoorcoupe deleted the synced_lyrics_tag branch May 7, 2024 11:53
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.

5 participants