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

Live Streams won't resume unless no time saved #23

Open
mrfragger opened this issue Nov 1, 2024 · 0 comments
Open

Live Streams won't resume unless no time saved #23

mrfragger opened this issue Nov 1, 2024 · 0 comments

Comments

@mrfragger
Copy link

mrfragger commented Nov 1, 2024

Save a bookmark with pos = 0

If you save a bookmark for a live stream it won't resume as it's trying to play whatever timestamp the stream was at. Solution is save it as 0. Kinda involved but added the following code and it works great.

-- Quickly saves a bookmark no time without bringing up the menu

function quickSaveNoTime()
    if not active then
        loadBookmarks()
        local slot = addBookmarkNoTime()
        if slot > 0 then mp.osd_message("Saved new bookmark at slot " .. slot) end
    end
end
function addBookmarkNoTime(name)
    local bookmark = makeBookmarkNoTime(name)
    if bookmark == nil then
        abort(styleOn .. "{\\c&H0000FF&}{\\b1}Can't find the media file to create the bookmark for")
        return -1
    end
    table.insert(bookmarks, bookmark)

    if #bookmarks == 1 then currentSlot = 1 end

    calcPages()
    saveBookmarks()
    displayBookmarks()
    return #bookmarks
end
function makeBookmarkNoTime(bname)
    local chaptername = mp.get_property("chapter-metadata/title") or ""
    if mp.get_property("path") ~= nil then
        if bname == nil then bname = mp.get_property("media-title") .. " #" .. chaptername .. " @ (Live Stream)" end
        local bookmark = {
            name = parseName(bname),
            pos = 0,
            -- pos = mp.get_property_number("time-pos"),
            path = parsePath(mp.get_property("path")),
            version = 2
        }
        return bookmark
    else
        return nil
    end
end

mp.register_script_message("bookmarker-quick-save-notime", quickSaveNoTime)

then in input.conf

B script-message bookmarker-quick-save #! [History Chapters Bookmarks] > Save Bookmark
Alt+b script-message bookmarker-quick-save-notime #! [History Chapters Bookmarks] > Save Bookmark no time (live streams)
b script-message playlist-play-index=none ; script-message bookmarker-menu #! [History Chapters Bookmarks] > Bookmarker Menu
Meta+b script-message bookmarker-quick-load #! [History Chapters Bookmarks] > Play Last Bookmark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant