Giter VIP home page Giter VIP logo

mpv-scripts's Introduction

mpv-scripts's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mpv-scripts's Issues

Not detecting Mac OS

Script(s)

clipshot.lua

Description

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.

Possible Fix

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

Some more detect OS code

-- 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

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

0.36

Lua version

No response

clipshot mistakes Windows for Mac

Script(s)

clipshot.lua

Description

Line 32 is section for MacOS

Possible Fix

No response

Steps to Reproduce

  • Copy clipshot.lua to the scripts folder
  • Play mpv
    Error: [ 0.085][f][clipshot] Lua error: ...op/apps/mpv/current/portable_config/scripts/clipshot.lua:32: attempt to concatenate a nil value

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

0.35.1

Lua version

can't find

screenshot created but not copied to clipboard with `jpeg` but `png` works

Script(s)

clipshot.lua

Description

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.

Possible Fix

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.

Steps to Reproduce

Same issue with xclip 0.13 and manual compilation from xclip/master.

Should we fall back to using png when it's Xorg?

Thanks:)

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

mpv 0.34.1-dirty

Lua version

5.4.4

Screenshot created but not copied to clipboard

Script(s)

clipshot.lua

Description

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.

Possible Fix

Steps to Reproduce

  1. Open video file
  2. Press any clipshot hotkey (c, C, Alt+c)
  3. See OSD message about screenshot being copeid to clipboard
  4. Check clipboard (via Clipdiary, Windows stock clipboard manager or just pasting into any app)
    Expected result: screenshot can be pasted from clipboard to any app
    Actual result: there is no screenshot in clipboard, but file is created in temp folder. Tried changing jpeg to png, same result.

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

mpv.net 7.1.1.0 (03.02.2024), mpv v0.37.0-152-gbd5d8e41 (11.01.2024)

Lua version

5.4.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.