See my portfolio for more.
observeroftime / mpv-scripts Goto Github PK
View Code? Open in Web Editor NEWMy personal mpv scripts
Home Page: https://observeroftime.github.io/mpv-scripts/
License: BSD Zero Clause License
My personal mpv scripts
Home Page: https://observeroftime.github.io/mpv-scripts/
License: BSD Zero Clause License
See my portfolio for more.
Zenity sort of works in MacOS but a native solution with AppleScript would be preferable.
misc.lua
Mplug is a script manager for mpv
No response
No response
clipshot.lua
Most likely will work if it detects Mac OS but it's returning xclip which is Linux. This is on a Mac OS Monterey 12.6.8
2.890][v][cplayer] Starting screenshot: '/tmp/mpv-screenshot.jpeg'
[ 2.891][d][cplayer] Run command: script-binding, flags=73, args=[name="clipshot/clipshot-subs"]
[ 2.892][v][screenshot] using 2 threads for scaling
[ 2.915][v][screenshot] Using zimg.
[ 2.924][d][screenshot] mapped color params:
[ 2.924][d][screenshot] trc = iec61966-2-1
[ 2.924][d][screenshot] primaries = bt709
[ 2.924][d][screenshot] range = pc
[ 2.924][d][screenshot] colorspace = bt470bg
[ 2.924][d][screenshot] chroma_location = center
[ 2.945][i][cplayer] Screenshot: '/tmp/mpv-screenshot.jpeg'
[ 2.946][d][cplayer] Run command: run, flags=64, args=[command="xclip", args="-sel", args="c", args="-t", args="image/jpeg", args="-i", args="/tmp/mpv-screenshot.jpeg"]
If I manually do it it works just fine
osascript -e 'set the clipboard to (read (POSIX file "/Users/username/Desktop/mpv-shot0001.jpg") as JPEG picture)'
osascript -e 'clipboard info'
JPEG picture, 32754, «class 8BPS», 884810, GIF picture, 124456, «class jp2 », 100608, TIFF picture, 2081938, «class PNGf», 220769, «class BMP », 2080134, «class TPIC», 712791
I use this clipshot on Linux Mint and it works great.
Not sure how to use SmartCopyPaste code to change it to get Wayland and not just Linux.
if not o.device or o.device == 'auto' then
if os.getenv('windir') ~= nil then
o.device = 'windows'
elseif os.execute '[ -d "/Applications" ]' == 0 and os.execute '[ -d "/Library" ]' == 0 or os.execute '[ -d "/Applications" ]' == true and os.execute '[ -d "/Library" ]' == true then
o.device = 'mac'
else
o.device = 'linux'
end
-- this code was taken from mpv's console.lua:
-- https://github.com/mpv-player/mpv/blob/master/player/lua/console.lua
local function detect_platform()
local o = {}
-- Kind of a dumb way of detecting the platform but whatever
if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
return 'windows'
elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then
return 'macos'
elseif os.getenv('WAYLAND_DISPLAY') then
return 'wayland'
end
return 'x11'
end
No response
0.36
No response
clipshot.lua
Line 32 is section for MacOS
No response
0.35.1
can't find
clipshot.lua
Hello there. Hope you're doing well. Thank you for creating this script; it's very handy.
However, I had trouble using it. After pressing the shortcut, when I tried to paste it into applications (e.g., Obsidian) with Ctrl-v
there's nothing to paste.
I found the cause. The following works:
NAME = "mpv-screenshot.png"
SHOT = "/tmp/" .. NAME
CMD = { "xclip", "-sel", "c", "-t", "image/png", "-i", SHOT }
The following doesn't work:
NAME = "mpv-screenshot.jpeg"
SHOT = "/tmp/" .. NAME
CMD = { "xclip", "-sel", "c", "-t", "image/jpeg", "-i", SHOT }
For both extensions, screenshots are created in /tmp/
, but only the png version above are copied to clipboard.
Same issue with xclip 0.13 and manual compilation from xclip/master.
Should we fall back to using png
when it's Xorg?
Thanks:)
mpv 0.34.1-dirty
5.4.4
clipshot.lua
Image is created in temp folder, but doesn't go to clipboard.
I have Win11x64 22631.3296.
I tried enabling logs and got this, the most relevant line, as I believe, is:
[ 15.820][e][cplayer] Starting subprocess failed: init
Here is full logs:
output.txt
I tried another script at https://github.com/zc62/mpv-scripts/blob/master/screenshot-to-clipboard.js and it does work.
mpv.net 7.1.1.0 (03.02.2024), mpv v0.37.0-152-gbd5d8e41 (11.01.2024)
5.4.4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.