Commit graph

30 commits

Author SHA1 Message Date
Damien Elmes
6b979ddf54 Fix mpv being left around on abrupt termination (#4042)
Closes #4015
2025-06-01 13:16:28 +07:00
Marvin Kopf
e201b7aaf4 offload mpv callback registration to background thread to avoid UI blocking (#4038)
Instantiating `MPV(MPVBase)` triggers multiple synchronous `command()` calls to the mpv process during callback registration. These calls block the main thread and degrade startup performance. This change defers registration via `taskman.run_in_background`.
2025-05-30 13:05:06 +07:00
Damien Elmes
29c56ac4c3 Skip ytdl flag on macOS ARM
Fixes sounds failing to play in the packaged build on macOS.
2025-05-15 19:04:26 +10:00
Damien Elmes
ededde7eb3 Disable YouTube DL in mpv
mpv looks for ytdl on the path, which includes the CWD on Windows.
A malicious shared deck could place an executable called yt-dlp.exe in the
media folder, which mpv would then helpfully invoke the first time
a YouTube link was encountered.

A big thank you to Michael Lappas for the report.
2025-05-10 19:31:06 +10:00
kelciour
d1bf47b801 Fix mpv loadfile syntax change 2 (#3711)
* Revert "Fix mpv loadfile syntax change (#3105)"

This reverts commit a9c44967ea.

* Fix mpv loadfile syntax change 2
2025-01-10 19:16:08 +11:00
David Culley
59fb88588d Update type annotations to use | operator (#3323)
* refactor: update to `|` operator

* refactor: add missing type hint

* refactor: enable `|` operator for older versions

* refactor: remove obsolete import
2024-07-26 18:15:39 +07:00
kelciour
a9c44967ea Fix mpv loadfile syntax change (#3105) 2024-03-31 07:46:59 +01:00
virinci
8d0d28e3a2 Fix ModuleNotFoundError: No module named 'distutils' (#2723) 2023-10-11 14:12:18 +10:00
kelciour
88109bdab6 Fix two mpv issues on Windows (#2294)
* Fix mpv with two Windows accounts at the same time

Closes #2203

* Add a workaround for audio cut off early on Windows

Closes #1730
2023-01-03 11:59:39 +10:00
Damien Elmes
0e4c02eac1 update platform checks (eg isWin -> is_win) + devMode 2021-11-25 09:06:16 +10:00
Damien Elmes
3c1729e91b run pyupgrade over codebase [python upgrade required]
This adds Python 3.9 and 3.10 typing syntax to files that import
attributions from __future___. Python 3.9 should be able to cope with
the 3.10 syntax, but Python 3.8 will no longer work.

On Windows/Mac, install the latest Python 3.9 version from python.org.
There are currently no orjson wheels for Python 3.10 on Windows/Mac,
which will break the build unless you have Rust installed separately.

On Linux, modern distros should have Python 3.9 available already. If
you're on an older distro, you'll need to build Python from source first.
2021-10-04 15:05:48 +10:00
kelciour
3962de958a A possible fix for "mpv timed out, restarting"
https://forums.ankiweb.net/t/anki-wont-open-mpv-timed-out/7579/6
2021-08-18 00:47:04 +03:00
kelciour
723981d1a9 workaround for audio tracks get clipped at the end 2021-06-07 01:45:59 +03:00
kelciour
8152d3fb25 fix audio is paused unusual
closes #1164
2021-06-07 01:09:44 +03:00
Damien Elmes
42a44875ab convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
8729edffbb update to latest black 2020-08-31 13:29:28 +10:00
Damien Elmes
aeca369c9b update to latest isort, pylint and pytest 2020-08-31 12:05:36 +10:00
Damien Elmes
204db71586 fix new pylint raise-missing-from lint 2020-08-31 12:04:14 +10:00
kelciour
6f8585b98a Add --no-autoload-files option to mpv 2020-07-23 14:28:47 +03:00
kelciour
66d69c3460 Fix "make check" by defining dummy _register_callbacks method in MPVBase 2020-06-27 13:07:46 +03:00
kelciour
39eec24c3d Fix no sound after mpv restart 2020-06-27 03:46:40 +03:00
kelciour
88103d29cf Replace default mpv quit keybindings if mpv version is >= 0.30
4614d432a8
2020-06-27 03:46:40 +03:00
kelciour
fa635cfe17 Reset pause mode when switching to the next file 2020-06-20 02:04:35 +03:00
Damien Elmes
87fcaf9bfe remove unused import 2020-06-09 14:14:12 +10:00
Damien Elmes
d62ba1e713 fix mistaken qconnect replacement 2020-06-09 10:20:16 +10:00
Damien Elmes
eb49062617 apply mpv fix
c0d9544812
2020-05-27 09:19:20 +10:00
Damien Elmes
4d33b2d8f7 use qconnect everywhere, and fix some typing issues
a step towards check_untyped_defs in aqt, but there's still 100+
issues to resolve
2020-05-04 13:23:08 +10:00
Damien Elmes
52a41d9a8e formatting fixes 2020-01-21 20:39:25 +10:00
Damien Elmes
0df9837a66 fix mpv args
https://anki.tenderapp.com/discussions/ankidesktop/38186-mpvprocesserror-unable-to-start-process
2020-01-21 19:29:50 +10:00
Damien Elmes
2a00e0a6b0 tweaking the folder names again
hopefully that's the last of it
2020-01-03 07:48:38 +10:00
Renamed from anki-qt/aqt/mpv.py (Browse further)