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

[FFmpegMetadata] Store release_year in the metadata #32310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion youtube_dl/postprocessor/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def add(meta_list, info_list=None):
# 4. http://atomicparsley.sourceforge.net/mpeg-4files.html
Copy link
Contributor

Choose a reason for hiding this comment

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

The add() function above could be improved based on yt-dlp (import T(), traverse_obj(), txt_or_none(), variadic() from ..utils):

        def add(meta_list, info_list=None):
            if not meta_list:
                return
            meta_list = variadic(meta_list)
            info_list = variadic(info_list) if info_list else meta_list
            value = traverse_obj(info, (info_list, T(txt_or_none), any))
            if value not in (None, ''):
                value = value.replace('\0', '') # nul character cannot be passed in command line
                metadata.update((meta_f, value) for meta_f in meta_list)


add('title', ('track', 'title'))
add('date', 'upload_date')
add('date', ('release_year', 'upload_date'))
Copy link
Contributor

Choose a reason for hiding this comment

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

This will set a year rather than the yyyymmdd value if both items are available. Shouldn't they be reversed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think not. This field called "Year" in most media players.

add(('description', 'comment'), 'description')
add('purl', 'webpage_url')
add('track', 'track_number')
Expand Down
Loading