mpv icon indicating copy to clipboard operation
mpv copied to clipboard

ytdl_hook: reverse order of tracks

Open christoph-heinrich opened this issue 3 years ago • 2 comments

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

christoph-heinrich avatar Jul 11 '22 19:07 christoph-heinrich

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.

sfan5 avatar Aug 01 '22 16:08 sfan5

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.

christoph-heinrich avatar Aug 27 '22 10:08 christoph-heinrich

Is there still interest in this? If so you'll need to rebase it onto the master as there are merge conflicts.

Traneptora avatar Nov 01 '22 02:11 Traneptora

It's rebased now.

christoph-heinrich avatar Nov 01 '22 13:11 christoph-heinrich

LGTM

Traneptora avatar Nov 01 '22 13:11 Traneptora