mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Revert "Probable workaround for mpv failing after a few days on macOS"
This reverts commit fa4fc3e15a
.
Issue turned out to be a packaging problem, and this should not be
required as the socket should be held open even if removed.
This commit is contained in:
parent
2068c2424d
commit
d98912ca6b
2 changed files with 4 additions and 22 deletions
|
@ -1382,14 +1382,7 @@ title="{}" {}>{}</button>""".format(
|
|||
True,
|
||||
parent=self,
|
||||
)
|
||||
if not is_win:
|
||||
self.progress.timer(
|
||||
12 * 60 * 1000,
|
||||
self.temp_file_workarounds,
|
||||
repeat=True,
|
||||
requiresCollection=False,
|
||||
parent=self,
|
||||
)
|
||||
self.progress.timer(12 * 60 * 1000, self.refresh_certs, False, parent=self)
|
||||
|
||||
def onRefreshTimer(self) -> None:
|
||||
if self.state == "deckBrowser":
|
||||
|
@ -1405,20 +1398,15 @@ title="{}" {}>{}</button>""".format(
|
|||
if elap > minutes * 60:
|
||||
self.maybe_auto_sync_media()
|
||||
|
||||
def temp_file_workarounds(self) -> None:
|
||||
import certifi
|
||||
|
||||
from aqt.sound import mpvManager
|
||||
|
||||
def refresh_certs(self) -> None:
|
||||
# The requests library copies the certs into a temporary folder on startup,
|
||||
# and chokes when the file is later missing due to temp file cleaners.
|
||||
# Work around the issue by accessing them once every 12 hours.
|
||||
import certifi
|
||||
|
||||
with open(certifi.where(), "rb") as f:
|
||||
f.read()
|
||||
|
||||
# Prevent the mpv socket from being removed
|
||||
mpvManager.bump_socket_mtime()
|
||||
|
||||
# Backups
|
||||
##########################################################################
|
||||
|
||||
|
|
|
@ -404,12 +404,6 @@ class MpvManager(MPV, SoundOrVideoPlayer):
|
|||
self.default_argv += [f"--config-dir={base_path}"]
|
||||
super().__init__(window_id=None, debug=False)
|
||||
|
||||
def bump_socket_mtime(self) -> None:
|
||||
"Update mtime on socket to prevent temp file cleaners from removing it."
|
||||
path = Path(self._sock_filename)
|
||||
if path.exists():
|
||||
os.utime(path, None)
|
||||
|
||||
def on_init(self) -> None:
|
||||
# if mpv dies and is restarted, tell Anki the
|
||||
# current file is done
|
||||
|
|
Loading…
Reference in a new issue