mpv
mpv copied to clipboard
ytdl_hook: reverse order of tracks
Only matters when configuring ytdl_hook with all_formats=yes.
So far the tracks were ordered from worst to best quality.
Web players with quality selection always show the highest quality option at the top. Since tracks are usually listed with the first track at the top, that should also be the highest quality one.
yt-dlp/youtube-dl sorts it's formats from worst to best. Iterate in reverse to get best track first.
Conflicts with #10399
Doesn't yt-dlp always return just one track (of each) for mpv to use? In which cases does this make a difference?
Also the code should contain a comment explaining this and the commit message could be more verbose too.
Just noticed that I never wrote a comment after pushing the requested changes, sorry about that.
Doesn't yt-dlp always return just one track (of each) for mpv to use?
yt-dlp always returns all available formats, but only the requested ones (selected by yt-dlp based on configured format selection string and sorting) are used by ytdl_hook unless all_formats=yes is used.
In which cases does this make a difference?
Whenever the tracks are listed or cycled through while using all_formats=yes. For example the track list from uosc lists the tracks from best quality to worst quality with this change, otherwise it's the other way around. Changing that here makes more sense then just displaying them in reverse order, because then the tracks are still listed from the first index to the last. Otherwise that could be confusing when cycling through the tracks.
Also the code should contain a comment explaining this and the commit message could be more verbose too.
Comment and commit message have been changed, and this PR now mentions that this only matters with all_formats=yes.
Is there still interest in this? If so you'll need to rebase it onto the master as there are merge conflicts.
It's rebased now.
LGTM