tiny-dlna 0.7.2__tar.gz → 0.8.0__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.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Hugo Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiny-dlna
3
- Version: 0.7.2
4
- Summary: a tiny DLNA receiver
3
+ Version: 0.8.0
4
+ Summary: a tiny DLNA sender & receiver
5
5
  Home-page: https://github.com/mitnk/tiny-dlna
6
6
  Author: mitnk
7
7
  License: MIT
8
8
  Keywords: dlna
9
+ License-File: LICENSE
9
10
 
10
11
 
11
12
  Home Page: https://github.com/mitnk/tiny-dlna
12
13
 
13
- A tiny DLNA receiver.
14
+ A tiny DLNA sender & receiver.
14
15
 
15
16
  Install
16
17
  -------
@@ -28,7 +29,7 @@ Usages
28
29
 
29
30
  This will activate a DLNA receiver named "Tiny Render", which can stream videos
30
31
  from apps like 虎牙直播, Bilibili, and other video platforms. Additionally, you
31
- can also use `nano-dlna` to play local videos (like in your RaspberryPi) on it.
32
+ can also use `tiny-cli` to play local videos (like in your RaspberryPi) on it.
32
33
 
33
34
  Note: mpv needs to be installed on your system.
34
35
 
@@ -42,4 +43,4 @@ List available DLNA devices.
42
43
 
43
44
  $ tiny-cli play ~/Movies/foo/bar.mp4 -q 'TV'
44
45
 
45
- Play video on the DLNA device having "TV" in its name.
46
+ Play a video on the DLNA device having "TV" in its name.
@@ -1,12 +1,14 @@
1
1
  # Tiny DLNA
2
2
 
3
+ [![PyPI](https://img.shields.io/pypi/v/tiny-dlna.svg)](https://pypi.org/project/tiny-dlna/)
4
+
3
5
  ## Install
4
6
 
5
7
  ```
6
8
  $ pip install tiny-dlna
7
9
  ```
8
10
 
9
- ## Tiny DLNA Render
11
+ ## Usage for Tiny DLNA Render
10
12
 
11
13
  Just to support subtitles.
12
14
 
@@ -19,7 +21,13 @@ from apps like 虎牙直播, Bilibili, and other video platforms. Additionally,
19
21
  can also use `tiny-cli play` (see below) to play local videos (like in your
20
22
  RaspberryPi) on it.
21
23
 
22
- ## Tiny DLNA Cli
24
+ ### Save video streaming into a file (Stream Recording)
25
+
26
+ ```
27
+ $ tiny-render --dump-to ~/Movie/lol-msi-2024.mp4
28
+ ```
29
+
30
+ ## Usage for Tiny DLNA Cli
23
31
 
24
32
  List available DLNA devices:
25
33
  ```
@@ -3,7 +3,7 @@ from setuptools import setup
3
3
  DESC = """
4
4
  Home Page: https://github.com/mitnk/tiny-dlna
5
5
 
6
- A tiny DLNA receiver.
6
+ A tiny DLNA sender & receiver.
7
7
 
8
8
  Install
9
9
  -------
@@ -21,7 +21,7 @@ Usages
21
21
 
22
22
  This will activate a DLNA receiver named "Tiny Render", which can stream videos
23
23
  from apps like 虎牙直播, Bilibili, and other video platforms. Additionally, you
24
- can also use `nano-dlna` to play local videos (like in your RaspberryPi) on it.
24
+ can also use `tiny-cli` to play local videos (like in your RaspberryPi) on it.
25
25
 
26
26
  Note: mpv needs to be installed on your system.
27
27
 
@@ -35,13 +35,13 @@ List available DLNA devices.
35
35
 
36
36
  $ tiny-cli play ~/Movies/foo/bar.mp4 -q 'TV'
37
37
 
38
- Play video on the DLNA device having "TV" in its name.
38
+ Play a video on the DLNA device having "TV" in its name.
39
39
  """
40
40
 
41
41
  setup(
42
42
  name='tiny-dlna',
43
- version='0.7.2',
44
- description='a tiny DLNA receiver',
43
+ version='0.8.0',
44
+ description='a tiny DLNA sender & receiver',
45
45
  long_description=DESC,
46
46
  url='https://github.com/mitnk/tiny-dlna',
47
47
  author='mitnk',
@@ -2,6 +2,7 @@ import argparse
2
2
  import html
3
3
  import logging
4
4
  import re
5
+ import os.path
5
6
  import subprocess
6
7
  import threading
7
8
  import time
@@ -19,9 +20,13 @@ class MPVRenderer:
19
20
  def __init__(self):
20
21
  self.process = None
21
22
 
22
- def play_media(self, url, title=None, srt=None):
23
+ def play_media(self, url, title=None, srt=None, dump_to=None):
23
24
  self.stop_media() # Stop any existing media
24
25
  cmd = ['mpv', url]
26
+
27
+ if dump_to:
28
+ path_abs = os.path.abspath(dump_to)
29
+ cmd.append(f'--stream-record={path_abs}')
25
30
  if title:
26
31
  cmd.append('--title={}'.format(title))
27
32
  if srt:
@@ -42,6 +47,7 @@ _DATA = {
42
47
  'CURRENT_URI': '',
43
48
  'CURRENT_SRT': '',
44
49
  'VIDEO_TITLE': '',
50
+ 'DUMP_TO': None,
45
51
  'STARTED_AT': 0,
46
52
  }
47
53
 
@@ -165,8 +171,9 @@ def control():
165
171
  url = _DATA['CURRENT_URI']
166
172
  srt = _DATA['CURRENT_SRT']
167
173
  title = _DATA['VIDEO_TITLE']
174
+ dump_to = _DATA['DUMP_TO']
168
175
  logger.debug(f'action: Play: {url}')
169
- renderer.play_media(url, title, srt)
176
+ renderer.play_media(url, title, srt, dump_to)
170
177
  return Response(XML_PLAY_DONE, mimetype="text/xml")
171
178
 
172
179
  elif is_getpos(request):
@@ -212,6 +219,7 @@ def main():
212
219
  parser.add_argument('--http-logs', action='store_true', help='Enable server logs')
213
220
  parser.add_argument('--verbose', '-v', action='store_true', help='Enable debug logs')
214
221
  parser.add_argument('--name', type=str, default='Tiny Render', help='Change render name')
222
+ parser.add_argument('--dump-to', type=str, help='dump streaming to a file')
215
223
 
216
224
  args = parser.parse_args()
217
225
 
@@ -227,6 +235,9 @@ def main():
227
235
  if args.verbose:
228
236
  logger.setLevel(logging.DEBUG)
229
237
 
238
+ if args.dump_to:
239
+ _DATA['DUMP_TO'] = args.dump_to
240
+
230
241
  port = 59876
231
242
  ssdp = SSDPServer(port)
232
243
  ssdp.start()
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiny-dlna
3
- Version: 0.7.2
4
- Summary: a tiny DLNA receiver
3
+ Version: 0.8.0
4
+ Summary: a tiny DLNA sender & receiver
5
5
  Home-page: https://github.com/mitnk/tiny-dlna
6
6
  Author: mitnk
7
7
  License: MIT
8
8
  Keywords: dlna
9
+ License-File: LICENSE
9
10
 
10
11
 
11
12
  Home Page: https://github.com/mitnk/tiny-dlna
12
13
 
13
- A tiny DLNA receiver.
14
+ A tiny DLNA sender & receiver.
14
15
 
15
16
  Install
16
17
  -------
@@ -28,7 +29,7 @@ Usages
28
29
 
29
30
  This will activate a DLNA receiver named "Tiny Render", which can stream videos
30
31
  from apps like 虎牙直播, Bilibili, and other video platforms. Additionally, you
31
- can also use `nano-dlna` to play local videos (like in your RaspberryPi) on it.
32
+ can also use `tiny-cli` to play local videos (like in your RaspberryPi) on it.
32
33
 
33
34
  Note: mpv needs to be installed on your system.
34
35
 
@@ -42,4 +43,4 @@ List available DLNA devices.
42
43
 
43
44
  $ tiny-cli play ~/Movies/foo/bar.mp4 -q 'TV'
44
45
 
45
- Play video on the DLNA device having "TV" in its name.
46
+ Play a video on the DLNA device having "TV" in its name.
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  setup.py
3
4
  tiny_dlna/__init__.py
File without changes