Skip to content

Commit

Permalink
Fix seeking for mpv <0.33.0 on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
po5 committed Apr 30, 2023
1 parent 6cc936c commit b0d498d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ No dependencies, no background thumbnail generation hogging your CPU.
Customizable sizes, interval between thumbnails, cropping support, respects applied video filters.
Supports web videos e.g. YouTube (disabled by default), mixed aspect ratio videos.

This script makes an effort to run on mpv versions as old as 0.29.0.
Note that most custom UIs will not support vintage mpv builds, consider updating if you're having issues.
This script makes an effort to run on mpv versions as old as 0.29.0 (Windows, Linux) and 0.33.0 (Mac).
Note that most custom UIs will not support vintage mpv builds, update before submitting an issue and mention if behavior is the same.
Support for <0.33.0 on Linux requires socat.

## Usage
Once the lua file is in your scripts directory, and you are using a UI that supports thumbfast, you are done.
Expand Down
10 changes: 9 additions & 1 deletion thumbfast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ mp.options = require "mp.options"
mp.options.read_options(options, "thumbfast")

local pre_0_30_0 = mp.command_native_async == nil
local pre_0_33_0 = true

function subprocess(args, async, callback)
callback = callback or function() end
Expand Down Expand Up @@ -392,7 +393,7 @@ local function spawn(time)
table.insert(args, "--macos-app-activation-policy=accessory")
end

if os_name == "Windows" then
if os_name == "Windows" or pre_0_33_0 then
table.insert(args, "--input-ipc-server="..options.socket)
else
local client_script_path = options.socket..".run"
Expand Down Expand Up @@ -439,6 +440,9 @@ local function run(command)
local file = nil
if os_name == "Windows" then
file = io.open("\\\\.\\pipe\\"..options.socket, "r+")
elseif pre_0_33_0 then
subprocess({"/usr/bin/env", "sh", "-c", "echo '" .. command .. "' | socat - " .. options.socket})
return
else
file = io.open(options.socket, "r+")
end
Expand Down Expand Up @@ -723,4 +727,8 @@ mp.register_script_message("clear", clear)
mp.register_event("file-loaded", file_load)
mp.register_event("shutdown", shutdown)

mp.add_hook("on_before_start_file", 0, function()
pre_0_33_0 = false
end)

mp.register_idle(watch_changes)

0 comments on commit b0d498d

Please sign in to comment.