diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-03-25 16:43:09 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-03-25 16:43:09 +0530 |
commit | a62114c91f2070c8c8453d117f3d81dc113e41ff (patch) | |
tree | f266e87af29a08c01f82bc32dd7d463d8ec4441a /mpv | |
parent | af120ab348f2e1a5a39dec035ed9dcf84189a64e (diff) | |
download | dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.gz dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.bz2 dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.zip |
dotfile update
Diffstat (limited to 'mpv')
-rw-r--r-- | mpv/input.conf | 5 | ||||
-rw-r--r-- | mpv/mpv.conf | 2 | ||||
-rw-r--r-- | mpv/script_modules/mpvSockets/LICENSE | 21 | ||||
-rw-r--r-- | mpv/script_modules/mpvSockets/README.md | 76 | ||||
-rw-r--r-- | mpv/script_modules/mpvSockets/mpvSockets.lua | 36 | ||||
-rw-r--r-- | mpv/scripts/modules.lua | 3 |
6 files changed, 0 insertions, 143 deletions
diff --git a/mpv/input.conf b/mpv/input.conf deleted file mode 100644 index d614b15..0000000 --- a/mpv/input.conf +++ /dev/null @@ -1,5 +0,0 @@ -l seek 5 -h seek -5 -j seek -60 -k seek 60 -S cycle sub diff --git a/mpv/mpv.conf b/mpv/mpv.conf deleted file mode 100644 index 43fb7e2..0000000 --- a/mpv/mpv.conf +++ /dev/null @@ -1,2 +0,0 @@ -no-osc -script-opts=ytdl_hook-ytdl_path=/usr/bin/yt-dlp diff --git a/mpv/script_modules/mpvSockets/LICENSE b/mpv/script_modules/mpvSockets/LICENSE deleted file mode 100644 index c5551bb..0000000 --- a/mpv/script_modules/mpvSockets/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Wis - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/mpv/script_modules/mpvSockets/README.md b/mpv/script_modules/mpvSockets/README.md deleted file mode 100644 index 9d3e1fb..0000000 --- a/mpv/script_modules/mpvSockets/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# mpvSockets -create one sockets per mpv instance (with the instance's process **ID** (PID), (**unique**)), instead of one socket for the last started instance - -dangling sockets for crashed or killed instances is an issue, -not sure if this script should handle/remove them or the clients/users, or both. - -# Installation -Download the single script file to your mpv-scripts-directory -## Linux / unixes: -``` bash -curl "https://raw.githubusercontent.com/wis/mpvSockets/master/mpvSockets.lua" --create-dirs -o "$Your_Mpv_Scripts_Directory_Location/mpvSockets.lua" -``` -if you're on Linux, most likely the location is `~/.config/mpv/scripts`, so run this before: -``` bash -$Your_Mpv_Scripts_Directory_Location=$HOME/config/mpv/scripts -``` -## Windows (untested) -powershell: -``` powershell -Invoke-WebRequest -OutFile "$env:LOCALAPPDATA\mpv\scripts\mpvSockets.lua" "https://raw.githubusercontent.com/wis/mpvSockets/master/mpvSockets.lua" -``` - -# Usage, with Mpv's [JSON IPC](https://github.com/mpv-player/mpv/blob/master/DOCS/man/ipc.rst) -## Linux / unixes (unix sockets): -a script that pauses all running mpv instances: -bash: -``` bash -#!/bin/bash -for i in $(ls /tmp/mpvSockets/*); do - echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"; -done -# Socat is a command line based utility that establishes two bidirec-tional byte streams and transfers data between them. -# available on Linux and FreeBSD, propably most unixes. you can also use -``` - -## Windows (named pipes): -quote from https://mpv.io/manual/stable/#command-prompt-example -> Unfortunately, it's not as easy to test the IPC protocol on Windows, since Windows ports of socat (in Cygwin and MSYS2) don't understand named pipes. In the absence of a simple tool to send and receive from bidirectional pipes, the echo command can be used to send commands, but not receive replies from the command prompt. -> -> Assuming mpv was started with: -> -> `mpv file.mkv --input-ipc-server=\\.\pipe\mpvsocket` -> You can send commands from a command prompt: -> -> `echo show-text ${playback-time} >\\.\pipe\mpvsocket` -To be able to simultaneously read and write from the IPC pipe, like on Linux, it's necessary to write an external program that uses overlapped file I/O (or some wrapper like .NET's NamedPipeClientStream.) - -powershell client writer and reader (untested): -``` powershell -# socat.ps1 -# usage: socat.ps1 <Pipe-name> <Message> -$sockedName = args[0] -$message = args[1] - -$npipeClient = new-object System.IO.Pipes.NamedPipeClientStream('.', $socketName, [System.IO.Pipes.PipeDirection]::InOut, [System.IO.Pipes.PipeOptions]::None, [System.Security.Principal.TokenImpersonationLevel]::Impersonation) - -$pipeReader = $pipeWriter = $null -try { - $npipeClient.Connect() - $pipeReader = new-object System.IO.StreamReader($npipeClient) - $pipeWriter = new-object System.IO.StreamWriter($npipeClient) - $pipeWriter.AutoFlush = $true - - $pipeWriter.WriteLine($message) - - while (($data = $pipeReader.ReadLine()) -ne $null) { - $data - } -} -catch { - "An error occurred that could not be resolved." -} -finally { - $npipeClient.Dispose() -} -```
\ No newline at end of file diff --git a/mpv/script_modules/mpvSockets/mpvSockets.lua b/mpv/script_modules/mpvSockets/mpvSockets.lua deleted file mode 100644 index df8d078..0000000 --- a/mpv/script_modules/mpvSockets/mpvSockets.lua +++ /dev/null @@ -1,36 +0,0 @@ --- mpvSockets, one socket per instance, removes socket on exit - -local utils = require 'mp.utils' - -local function get_temp_path() - local directory_seperator = package.config:match("([^\n]*)\n?") - local example_temp_file_path = os.tmpname() - - -- remove generated temp file - pcall(os.remove, example_temp_file_path) - - local seperator_idx = example_temp_file_path:reverse():find(directory_seperator) - local temp_path_length = #example_temp_file_path - seperator_idx - - return example_temp_file_path:sub(1, temp_path_length) -end - -tempDir = get_temp_path() - -function join_paths(...) - local arg={...} - path = "" - for i,v in ipairs(arg) do - path = utils.join_path(path, tostring(v)) - end - return path; -end - -ppid = utils.getpid() -os.execute("mkdir " .. join_paths(tempDir, "mpvSockets") .. " 2>/dev/null") -mp.set_property("options/input-ipc-server", join_paths(tempDir, "mpvSockets", ppid)) - -function shutdown_handler() - os.remove(join_paths(tempDir, "mpvSockets", ppid)) -end -mp.register_event("shutdown", shutdown_handler) diff --git a/mpv/scripts/modules.lua b/mpv/scripts/modules.lua deleted file mode 100644 index 703f372..0000000 --- a/mpv/scripts/modules.lua +++ /dev/null @@ -1,3 +0,0 @@ -local mpv_config_dir_path = require("mp").command_native({"expand-path", "~~/"}) -function load(relative_path) dofile(mpv_config_dir_path .. "/script_modules/" .. relative_path) end -load("mpvSockets/mpvSockets.lua") |