Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JL doesn't capture text copied with Anacreon's script #71

Closed
NeonGooRoo opened this issue Nov 20, 2023 · 4 comments
Closed

JL doesn't capture text copied with Anacreon's script #71

NeonGooRoo opened this issue Nov 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@NeonGooRoo
Copy link

I know it may seem weird but I discovered that it could be very convenient to use JL instead if clipboard inserter page while watching Anime with Anacreon's script. The problem is that JL doesn't capture text copied by the script well. It either has a huge delay or just skips lines for seemingly no reason. What could be the reason?

@rampaa
Copy link
Owner

rampaa commented Nov 20, 2023

Tested it with the latest version of mpv and animecards_35.lua script (I am assuming this is the script you are referring as the "Anacreon's script") but couldn't reproduce the problem on my end.

Link says the following:

Windows 7 users: Update to the latest version of PowerShell for proper clipboard insertion.

If the script is lagging on Windows: This is a powershell issue ( see here). To solve this run the following in an admin powershell:
Set-Alias ngen (Join-Path ([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe)
ngen update

If it's not a PowerShell problem, then it might be caused by another program (maybe the Clipboard Inserter plugin?) polling and blocking the clipboard constantly. If that's the case, sending the subtitle via a WebSocket (e.g., https://github.com/kuroahna/mpv_websocket) ought to solve the problem.

In any case, it doesn't seem like a JL bug, so closing.

@rampaa rampaa closed this as completed Nov 20, 2023
@rampaa rampaa added the question Further information is requested label Nov 20, 2023
@rampaa
Copy link
Owner

rampaa commented Nov 20, 2023

It turns out I couldn't reproduce the problem on my end because I had another mpv plugin that copied the text to my clipboard correctly🤦‍♂️ (namely https://github.com/Ajatt-Tools/mpvacious). So if aforementioned solutions don't help (and if you don't want to use a WebSocket for whatever reason) then maybe give mpvacious a try.

rampaa added a commit that referenced this issue Nov 20, 2023
…e if it's copied from a WPF TextBox.

Earlier workaround was to check the time between two copies and discard the second result if the difference was less than 5 ms. This approach however was not very reliable because the double copy bug could occur after 5 ms if the copied text was long enough. And even more importantly, some scripts that copy the text to clipboard seem to do their job in an (at least seemingly) spammy manner and the aforementioned workaround prevents JL from getting the text from clipboard reliably when those scripts are used to copy the text to clipboard.

The new workaround is using a handcrafted copy function instead of relying WPF TextBox's built-in copy command.

Fixes #71.
@rampaa rampaa added bug Something isn't working and removed question Further information is requested labels Nov 20, 2023
@rampaa
Copy link
Owner

rampaa commented Nov 20, 2023

I managed to make JL play nice with the aforementioned script. See 851a03d for more details.

The fix will be included in the next version of JL. In the meanwhile you may use the alternatives I've mentioned above.

@NeonGooRoo
Copy link
Author

Thank you, king

rampaa added a commit that referenced this issue Nov 25, 2023
…e if it's copied from a WPF TextBox.

Earlier workaround was to check the time between two copies and discard the second result if the difference was less than 5 ms. This approach however was not very reliable because the double copy bug could occur after 5 ms if the copied text was long enough. And even more importantly, some scripts that copy the text to clipboard seem to do their job in an (at least seemingly) spammy manner and the aforementioned workaround prevents JL from getting the text from clipboard reliably when those scripts are used to copy the text to clipboard.

The new workaround is using a handcrafted copy function instead of relying WPF TextBox's built-in copy command.

Fixes #71.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants