python-mpv-jsonipc 1.2.1__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-mpv-jsonipc
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: Python API to MPV using JSON IPC
5
- Home-page: https://github.com/iwalton3/python-mpv-jsonipc
6
- Author: Izzie Walton
7
- Author-email: izzie@iwalton.com
8
- License: Apache-2.0
5
+ Author-email: Izzie Walton <izzie@iwalton.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/iwalton3/python-mpv-jsonipc
9
8
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: Apache Software License
11
9
  Classifier: Operating System :: OS Independent
12
10
  Requires-Python: >=3.6
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE.md
13
+ Dynamic: license-file
15
14
 
16
15
  # Python MPV JSONIPC
17
16
 
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "python-mpv-jsonipc"
7
+ version = "1.2.3"
8
+ description = "Python API to MPV using JSON IPC"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE.md"]
12
+ authors = [
13
+ { name = "Izzie Walton", email = "izzie@iwalton.com" },
14
+ ]
15
+ requires-python = ">=3.6"
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Operating System :: OS Independent",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/iwalton3/python-mpv-jsonipc"
23
+
24
+ [tool.setuptools]
25
+ py-modules = ["python_mpv_jsonipc"]
@@ -1,17 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-mpv-jsonipc
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: Python API to MPV using JSON IPC
5
- Home-page: https://github.com/iwalton3/python-mpv-jsonipc
6
- Author: Izzie Walton
7
- Author-email: izzie@iwalton.com
8
- License: Apache-2.0
5
+ Author-email: Izzie Walton <izzie@iwalton.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/iwalton3/python-mpv-jsonipc
9
8
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: Apache Software License
11
9
  Classifier: Operating System :: OS Independent
12
10
  Requires-Python: >=3.6
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE.md
13
+ Dynamic: license-file
15
14
 
16
15
  # Python MPV JSONIPC
17
16
 
@@ -1,7 +1,7 @@
1
1
  LICENSE.md
2
2
  README.md
3
+ pyproject.toml
3
4
  python_mpv_jsonipc.py
4
- setup.py
5
5
  python_mpv_jsonipc.egg-info/PKG-INFO
6
6
  python_mpv_jsonipc.egg-info/SOURCES.txt
7
7
  python_mpv_jsonipc.egg-info/dependency_links.txt
@@ -52,6 +52,7 @@ class WindowsSocket(threading.Thread):
52
52
  ipc_socket = "\\\\.\\pipe\\" + ipc_socket
53
53
  self.callback = callback
54
54
  self.quit_callback = quit_callback
55
+ self._stopping = False
55
56
 
56
57
  access = _winapi.GENERIC_READ | _winapi.GENERIC_WRITE
57
58
  limit = 5 # Connection may fail at first. Try 5 times.
@@ -72,9 +73,11 @@ class WindowsSocket(threading.Thread):
72
73
  self.callback = lambda data: None
73
74
 
74
75
  threading.Thread.__init__(self)
76
+ self.daemon = True
75
77
 
76
78
  def stop(self, join=True):
77
79
  """Terminate the thread."""
80
+ self._stopping = True
78
81
  if self.socket is not None:
79
82
  try:
80
83
  self.socket.close()
@@ -116,7 +119,9 @@ class WindowsSocket(threading.Thread):
116
119
  if self.quit_callback:
117
120
  self.quit_callback()
118
121
  except Exception as ex:
119
- log.error("Pipe connection died.", exc_info=1)
122
+ # Only log if not intentionally stopping
123
+ if not self._stopping:
124
+ log.error("Pipe connection died.", exc_info=1)
120
125
  if self.quit_callback:
121
126
  self.quit_callback()
122
127
 
@@ -137,6 +142,7 @@ class UnixSocket(threading.Thread):
137
142
  self.ipc_socket = ipc_socket
138
143
  self.callback = callback
139
144
  self.quit_callback = quit_callback
145
+ self._stopping = False
140
146
  self.socket = socket.socket(socket.AF_UNIX)
141
147
  self.socket.connect(self.ipc_socket)
142
148
 
@@ -144,9 +150,11 @@ class UnixSocket(threading.Thread):
144
150
  self.callback = lambda data: None
145
151
 
146
152
  threading.Thread.__init__(self)
153
+ self.daemon = True
147
154
 
148
155
  def stop(self, join=True):
149
156
  """Terminate the thread."""
157
+ self._stopping = True
150
158
  if self.socket is not None:
151
159
  try:
152
160
  self.socket.shutdown(socket.SHUT_WR)
@@ -184,7 +192,9 @@ class UnixSocket(threading.Thread):
184
192
  self.callback(json_data)
185
193
  data = b''
186
194
  except Exception as ex:
187
- log.error("Socket connection died.", exc_info=1)
195
+ # Only log if not intentionally stopping
196
+ if not self._stopping:
197
+ log.error("Socket connection died.", exc_info=1)
188
198
  if self.quit_callback:
189
199
  self.quit_callback()
190
200
 
@@ -258,9 +268,13 @@ class MPVProcess:
258
268
  prop_dict[key] = value
259
269
 
260
270
  def _mpv_fmt(self, data):
261
- if data == True:
271
+ # Use identity comparison so numeric arguments are preserved. In Python
272
+ # ``1 == True`` and ``0 == False``, so ``==`` would convert numeric
273
+ # options such as ``video-scale-x=1`` into ``--video-scale-x=yes``,
274
+ # which MPV rejects.
275
+ if data is True:
262
276
  return "yes"
263
- elif data == False:
277
+ elif data is False:
264
278
  return "no"
265
279
  else:
266
280
  return data
@@ -356,6 +370,7 @@ class EventHandler(threading.Thread):
356
370
  """Create an instance of the thread."""
357
371
  self.queue = queue.Queue()
358
372
  threading.Thread.__init__(self)
373
+ self.daemon = True
359
374
 
360
375
  def put_task(self, func, *args):
361
376
  """
@@ -1,25 +0,0 @@
1
- from setuptools import setup
2
- import os
3
-
4
- with open("README.md", "r") as fh:
5
- long_description = fh.read()
6
-
7
- setup(
8
- name="python-mpv-jsonipc",
9
- version="1.2.1",
10
- author="Izzie Walton",
11
- author_email="izzie@iwalton.com",
12
- description="Python API to MPV using JSON IPC",
13
- license="Apache-2.0",
14
- long_description=open("README.md").read(),
15
- long_description_content_type="text/markdown",
16
- url="https://github.com/iwalton3/python-mpv-jsonipc",
17
- py_modules=["python_mpv_jsonipc"],
18
- classifiers=[
19
- "Programming Language :: Python :: 3",
20
- "License :: OSI Approved :: Apache Software License",
21
- "Operating System :: OS Independent",
22
- ],
23
- python_requires=">=3.6",
24
- install_requires=[],
25
- )