uosc icon indicating copy to clipboard operation
uosc copied to clipboard

Input/Write URL (a option in Menu & in Subtitles/Audio Button)

Open alexpandain opened this issue 2 years ago • 13 comments
trafficstars

image image

alexpandain avatar Apr 05 '23 13:04 alexpandain

Sure. No objections, but no ETA either :)

tomasklaen avatar Apr 05 '23 15:04 tomasklaen

Waiting

aicynide avatar Nov 03 '23 19:11 aicynide

Here's a script that does what you want, but note that pasting in search menus is not currently supported.

-- open-url.lua

mp.utils = require "mp.utils"

mp.register_script_message("open-url:", function(path)
    mp.commandv("script-message-to", "uosc", "close-menu", "open-url")
    mp.commandv("loadfile", path)
end)

mp.add_forced_key_binding("F10", "open-url", function()
    local script_name = mp.get_script_name()
    local json = mp.utils.format_json({
        type = "open-url",
        title = "http://www.example.com/stream.avi",
        items = {
            {
            title = "Enter a network URL and press Ctrl+Enter",
            value = "ignore",
            muted = true,
            selectable = false
            }
        },
        on_search = {"script-message-to", script_name, "open-url:"},
        palette = true,
        search_style = "palette",
        search_debounce = "submit"
    }) or "{}"
    mp.commandv("script-message-to", "uosc", "open-menu", json)
end)

Doesn't handle loading links as extra tracks but that's a trivial change if you want that.
Replace loadfile with sub-add, audio-add or video-add.

po5 avatar Nov 04 '23 01:11 po5

Just an update: I don't want to add more loading items to subtitle/audio menus, especially not for something like this that won't be used by almost anyone, so it'll have to be as an alt action on the "Load {type}" item, which depends on menu item buttons, which is not implemented yet.

tomasklaen avatar Nov 04 '23 07:11 tomasklaen

There's still no button or UI so I'll keep this open, but thanks to the commit above, in 5.1 you'll be able to paste in subtitle/audio/video track select menus to automatically load whatever path/url is in the clipboard as current menu track type.

tomasklaen avatar Nov 04 '23 11:11 tomasklaen

I hope one day you support typing URL also like vlc

aicynide avatar Nov 10 '23 22:11 aicynide

funny thing is mpv-android let you load subtitle/audio by typing URL. Check mpv-android app, it even support typing video URL

aicynide avatar Nov 10 '23 22:11 aicynide

Just in case, as a tip to the OP, showing that the need for this is rather limited. Dragging and dropping an url on mpv window does it.

image

I guess this question is asked in Windows but in Linux you can do it by copying the link and in a terminal writing mpv and pasting.

And more specifically in Plasma if we associate html files to mpv, copying the link will open the list of applications associated with html.

cipricus avatar Nov 13 '23 13:11 cipricus

typing URL like vlc should be added

aicynide avatar Apr 20 '24 19:04 aicynide

I'm clueless why does typing URL like any guide video player software like VLC,Potplayer,Mpc-hc not possible

aicynide avatar Apr 20 '24 19:04 aicynide

Patiently waiting @tomasklaen

aicynide avatar May 11 '24 10:05 aicynide

Waiting

aicynide avatar May 17 '24 22:05 aicynide

@aicynide Stop being annoying, just use the script from po5's comment.

christoph-heinrich avatar May 17 '24 23:05 christoph-heinrich