Coder Social home page Coder Social logo

mpv-copytime's People

Contributors

arieleg avatar maxigaz avatar mbway avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar

mpv-copytime's Issues

Copying to clipboard fails under Sway if both xclip and wl-copy are installed

I use wl-copy with Sway and xclip with i3 under Arch Linux. I generally prefer using Sway, but I can't use it all the time because certain applications only work properly on i3.

Under Sway, when mpv is run as a native Wayland application, pressing the key combination defined in mp.add_key_binding at the end of the script doesn't actually copy the current time to the clipboard; it only shows the OSD message, 'Copied to Clipboard: [timecode]'

My knowledge in Lua is rather limited, but by looking at the script, I've been able to find that it only checks whether each supported clipboard manager exists in an if-else statement. In my case, xclip is available (the first part of the if statement) and so xclip -silent -in -selection clipboard is run, but it doesn't work under Wayland.

I wonder how to solve this. One idea is to check the current value of the environment variable $XDG_SESSION_TYPE. If it is wayland, use wl-copy, and if it is x11, use xclip.

Launch PowerShell with -NoProfile

Hey, launching PowerShell with the -NoProfile argument makes it launch faster since it does not have to look for a profile / load one if it finds one

You could also check if pwsh.exe is found in path, and use it if it exists for an even faster startup

I would have made a PR but I don't know anything about lua

About the CopyTime scripts

Hi, this is a really helpful script, thank you so so so much for sharing this! Just two questions, maybe you could help some:

  1. How to add something like space in the final text, like: "The time is HH:MM:SS." ? I tried to edit the js script, it works but no spaces are generated, not sure why. I mean, my result keep being "ThetimeisHH:MM:SS.".

  2. When it's working, I don't know why but I have to wait for about 2~3 secs until the new copied text finally replace the previous one. I mean, how to speed up the process a bit?

Thanks again for these great scripts!

How can set up this function in GNU/Linux?

I try to do follow the instructions but i don't get any result. The command [Ctrl + Alt + C] it's not functional in my operating system.

I install PowerShell on Linux.

Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux

Unable to invoke function

Found that the hotkey binding does not work on my Win 10 system unless I add Ctrl+c script-binding copyTime to %AppData%\mpv\input.conf.

I know the script loads the functions because of the trace message I added at the bottom, and that the function also works because using tilde (~) I can execute the function explicitly using the console and this command: script-message copyTime.

I had installed mpv.net which seems to have added entries to that file, so I downloaded a fresh copy from https://github.com/mpv-player/mpv/raw/master/etc/input.conf.

I tried other hotkeys such as c, C, and Ctrl+C by duplicating the script's hotkey line at the end, but none of them work..

I do not have programs such as AutoHotKey running at the moment. I do have the PowerToys normal and Awake programs running, but should not interfere. I even tested with that component disabled, and encountered the same, negative result.
Don't think Steam interferes either, as it only provides desktop input configuration for controllers.

Otherwise this script works on my other machines with other OSs, and another Windows one, and I thought even this one before, where I've only installed controller drivers and AHK, so not sure what would break it..

I tried updating to mpv-x86_64-20220619-git-c1a46ec from https://sourceforge.net/projects/mpv-player-windows/files/ and my old version 0.33 I think, but thta did not help either.

mp.add_key_binding("Ctrl+C", "copyTime", copyTime)
mp.add_key_binding("Ctrl+c", "copyTime", copyTime)
mp.add_key_binding("c", "copyTime", copyTime)
mp.add_key_binding("C", "copyTime", copyTime)
mp.osd_message("script end copyTime")
> mpv --input-test --force-window --idle
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
[copyTime] No supported clipboard command found
[input] Key c is bound to:
[input] (nothing)
[input] Key C is bound to:
[input] 1.  'script-binding copyTime/copyTime' in section {input_copyTime} in <api>:1 (default)
[input] Key Ctrl+c is bound to:
[input] 1.  'quit 4' in <builtin>:1 (default)
[input] Key Ctrl+C is bound to:
[input] (nothing)

The program stays open when I press that combination, as you can see continued message output.

Now seeing in my %AppData%\mpv\mpv.conf, commenting a line to #input-default-bindings = no improved my bindings in general, made Ctrl+c quit the program, and now only C works to copy the time..

Adding Ctrl+c ignore to input.conf at least stops the quit functionality..

mpv-copyTime does not work properly when seconds counter is between 30 and 60

When the second counter in video is between 30 and 60, the "copied to clipboard" time value displayed on the screen is incorrectly incremented to the next minute. The problem is demonstrated in this video: https://youtu.be/TDMy5ifh1d8

In the video, I repetitively press ctrl-C. As you can see, the "copied to clipboard" value is correct up to 29 seconds. After 29 seconds the "copied to clipboard" is one minute greater than it should be.

It looks like the divmod function needs a math.floor() around the "a/b".

local function divmod(a, b)
return math.floor(a / b), a % b
end

Thanks for the useful code.

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.