mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
fix mpv warnings
This commit is contained in:
parent
81d4b77ee1
commit
576c2b38b2
1 changed files with 5 additions and 0 deletions
|
@ -118,6 +118,7 @@ class MPVBase:
|
||||||
if hasattr(self, "_proc"):
|
if hasattr(self, "_proc"):
|
||||||
try:
|
try:
|
||||||
self._proc.terminate()
|
self._proc.terminate()
|
||||||
|
self._proc.wait()
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -165,6 +166,7 @@ class MPVBase:
|
||||||
self._sock = socket.socket(socket.AF_UNIX)
|
self._sock = socket.socket(socket.AF_UNIX)
|
||||||
self._sock.connect(self._sock_filename)
|
self._sock.connect(self._sock_filename)
|
||||||
except (FileNotFoundError, ConnectionRefusedError):
|
except (FileNotFoundError, ConnectionRefusedError):
|
||||||
|
self._sock.close()
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
@ -174,6 +176,8 @@ class MPVBase:
|
||||||
def _stop_socket(self):
|
def _stop_socket(self):
|
||||||
"""Clean up the socket.
|
"""Clean up the socket.
|
||||||
"""
|
"""
|
||||||
|
if hasattr(self, "_sock"):
|
||||||
|
self._sock.close()
|
||||||
if hasattr(self, "_sock_filename"):
|
if hasattr(self, "_sock_filename"):
|
||||||
try:
|
try:
|
||||||
os.remove(self._sock_filename)
|
os.remove(self._sock_filename)
|
||||||
|
@ -378,6 +382,7 @@ class MPVBase:
|
||||||
self._stop_process()
|
self._stop_process()
|
||||||
self._stop_thread()
|
self._stop_thread()
|
||||||
self._stop_socket()
|
self._stop_socket()
|
||||||
|
self._stop_process()
|
||||||
|
|
||||||
|
|
||||||
class MPV(MPVBase):
|
class MPV(MPVBase):
|
||||||
|
|
Loading…
Reference in a new issue