tiny-dlna 0.7.0__tar.gz → 0.7.2__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiny-dlna
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: a tiny DLNA receiver
5
5
  Home-page: https://github.com/mitnk/tiny-dlna
6
6
  Author: mitnk
@@ -16,14 +16,8 @@ $ tiny-render
16
16
 
17
17
  This will activate a DLNA receiver named "Tiny Render", which can stream videos
18
18
  from apps like 虎牙直播, Bilibili, and other video platforms. Additionally, you
19
- can also use `nano-dlna` to play local videos (like in your RaspberryPi) on it.
20
-
21
- Note that [mpv](https://mpv.io/) needs to be installed on your system. On Mac,
22
- do following (for Windows, add the mpv's root into PATH):
23
-
24
- ```
25
- $ ln -sf /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin/
26
- ```
19
+ can also use `tiny-cli play` (see below) to play local videos (like in your
20
+ RaspberryPi) on it.
27
21
 
28
22
  ## Tiny DLNA Cli
29
23
 
@@ -38,7 +32,38 @@ $ tiny-cli play ~/Movies/foo/bar.mp4 -q TV
38
32
  ```
39
33
 
40
34
  If there is a `bar.srt` in the same directory, it will be served as long as
41
- the DLNA device supports subtitles.
35
+ the DLNA render supports subtitles.
36
+
37
+ ## Requirements for your System
38
+
39
+ ### For Render
40
+
41
+ For running the render, [mpv](https://mpv.io/) needs to be installed. On Mac,
42
+ you may do following:
43
+
44
+ ```
45
+ $ ln -sf /Applications/mpv.app/Contents/MacOS/mpv /usr/local/bin/
46
+ ```
47
+
48
+ For Windows, after installed mpv, add `mpv.exe`'s directory [into
49
+ PATH](https://stackoverflow.com/a/2571200/665869).
50
+
51
+ ### For Cli
52
+
53
+ On Windows, you need [config your current
54
+ user](https://stackoverflow.com/a/65504258/665869) to have permission to create
55
+ soft links:
56
+
57
+ 1. Open gpedit.msc
58
+ 2. Computer Configuration → Windows Settings → Security Settings → Local
59
+ Policies → User Rights Assignment → Create symbolic links
60
+ 3. Type the user name (checkout `whoami` command) and click “Check Names” then
61
+ OK.
62
+ 4. Reboot the computer
63
+
64
+ You can also use [Develper Mode](https://stackoverflow.com/a/76292992/665869) I
65
+ guess.
66
+
42
67
 
43
68
  ## Dev
44
69
 
@@ -40,7 +40,7 @@ Play video on the DLNA device having "TV" in its name.
40
40
 
41
41
  setup(
42
42
  name='tiny-dlna',
43
- version='0.7.0',
43
+ version='0.7.2',
44
44
  description='a tiny DLNA receiver',
45
45
  long_description=DESC,
46
46
  url='https://github.com/mitnk/tiny-dlna',
@@ -3,7 +3,6 @@ import json
3
3
  import logging
4
4
  import os.path
5
5
  import random
6
- import shutil
7
6
  import signal
8
7
  import socket
9
8
  import threading
@@ -27,7 +26,7 @@ MSEARCH_MSG = (
27
26
  'ST: urn:schemas-upnp-org:service:AVTransport:1\r\n'
28
27
  '\r\n'
29
28
  )
30
- DIR_LINKS = '~/.config/tiny-dlna/symlinks'
29
+ DIR_LINKS = os.path.join('~', '.config', 'tiny-dlna', 'symlinks')
31
30
 
32
31
 
33
32
  def _get_device_info(location):
@@ -171,10 +170,14 @@ def send_play(url_control):
171
170
 
172
171
  def send_stop(url_control):
173
172
  dir_links = os.path.expanduser(DIR_LINKS)
174
- try:
175
- shutil.rmtree(dir_links)
176
- except: # NOQA
177
- pass
173
+ if not os.path.isdir(dir_links):
174
+ return
175
+
176
+ for item in os.listdir(dir_links):
177
+ item_path = os.path.join(dir_links, item)
178
+ if os.path.islink(item_path):
179
+ os.unlink(item_path)
180
+
178
181
  send_dlna_command(url_control, XML_STOP, 'Stop')
179
182
 
180
183
 
@@ -185,15 +188,12 @@ def create_link(path_file):
185
188
  os.makedirs(dir_links, exist_ok=True)
186
189
 
187
190
  path_link = os.path.join(dir_links, name_file)
188
- if os.path.exists(path_link):
189
- if os.path.islink(path_link):
190
- os.remove(path_link)
191
- else:
192
- logger.error('failed to create softlink')
193
- exit(1)
194
-
195
- os.symlink(path_file, path_link)
196
- logger.info(f'created softlink: {path_link}')
191
+ if os.path.islink(path_link):
192
+ os.unlink(path_link)
193
+
194
+ path_abs = os.path.abspath(path_file)
195
+ os.symlink(path_abs, path_link)
196
+ logger.info(f'created softlink: {path_abs} --> {path_link}')
197
197
 
198
198
 
199
199
  def get_control_url(args):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiny-dlna
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: a tiny DLNA receiver
5
5
  Home-page: https://github.com/mitnk/tiny-dlna
6
6
  Author: mitnk
File without changes