mpv icon indicating copy to clipboard operation
mpv copied to clipboard

show youtube playlist

Open dev-r34per opened this issue 7 years ago • 13 comments

If i play a youtube playlist with mpv how can i see all the different videos? I do:

mpv https://www.youtube.com/watch?v=DamuE8TM3xo&list=PLGLfVvz_LVvQ9S8YSV0iDsuEU8v11yP9M

this gives me only the first video as can be seen with

CTRL+p script-message osc-playlist

dev-r34per avatar Feb 20 '19 21:02 dev-r34per

Either: mpv --ytdl-raw-options="yes-playlist=" https://www.youtube.com/watch?v=DamuE8TM3xo&list=PLGLfVvz_LVvQ9S8YSV0iDsuEU8v11yP9M

Or: Feed mpv the the actual playlist link from youtube in the form of https://www.youtube.com/playlist?list=<id>

garoto avatar Feb 20 '19 22:02 garoto

Relevant issue for IINA (which uses mpv): https://github.com/iina/iina/issues/2328

donut avatar Mar 04 '19 23:03 donut

This is working as intended, it's not a bug.

wiiaboo avatar Aug 08 '19 23:08 wiiaboo

... Hi garoto. I use F2 script-message osc-playlist 3. This show me the playlist 3 seconds when I press F2. I would like to press again the same F2 key to disappear the playlist instead the time in seconds. I tried some commands but I couldn't. I used combinations with toggle and cycle but nothing worked. Some help?

jimmy-1000 avatar Mar 16 '22 03:03 jimmy-1000

You can use this script:

local duration = 3
local time

mp.add_key_binding('F2', function ()
    if time and mp.get_time() - time < duration then
        mp.command('script-message osc-playlist 0')
        time = nil
    else
        mp.commandv('script-message', 'osc-playlist', duration)
        time = mp.get_time()
    end
end)

It should be placed in ~~/scripts with a .lua extension.

guidocella avatar Mar 16 '22 17:03 guidocella

You can use this script:

local duration = 3
local time

mp.add_key_binding('F2', function ()
    if time and mp.get_time() - time < duration then
        mp.command('script-message osc-playlist 0')
        time = nil
    else
        mp.commandv('script-message', 'osc-playlist', duration)
        time = mp.get_time()
    end
end)

It should be placed in ~~/scripts with a .lua extension.

Thanks but sadly it doesn't have what I looking for. This script has the same function that F2 script-message osc-playlist 3. I want to press F2 to show playlist and press F2 again to quit from such playlist (no timer)

jimmy-1000 avatar Mar 16 '22 19:03 jimmy-1000

That's literally what this script does. Did you remove F2 from input.conf?

guidocella avatar Mar 16 '22 19:03 guidocella

That's literally what this script does. Did you remove F2 from input.conf?

Yes, even I edited your lua and changed the key binding to another, for example "a" key and the result is the same, the playlist last 3 seconds and quit.

jimmy-1000 avatar Mar 16 '22 21:03 jimmy-1000

local enabled = false

mp.add_key_binding('F2', function ()
    mp.commandv('script-message', 'osc-playlist', enabled and 0 or 999)
    enabled = not enabled
end)

guidocella avatar Mar 16 '22 22:03 guidocella

Damn, this version is super neat.

garoto avatar Mar 16 '22 22:03 garoto

What's the purpose of and 0 or 999?

hrxn avatar Mar 16 '22 22:03 hrxn

local enabled = false

mp.add_key_binding('F2', function ()
    mp.commandv('script-message', 'osc-playlist', enabled and 0 or 999)
    enabled = not enabled
end)

Thanks! This works perfect 👌 Oh I need to learn Lua language.

jimmy-1000 avatar Mar 16 '22 23:03 jimmy-1000

What's the purpose of and 0 or 999?

It evaluates to a playlist duration or 999 seconds if it's not enabled, or 0 if it's already enabled, thus hiding it.

guidocella avatar Mar 17 '22 07:03 guidocella