forked from Hellowlol/nrk_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.py
71 lines (47 loc) · 2.03 KB
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import sys
from gooey import Gooey, GooeyParser
from nrkdl import NRK
nonbuffered_stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stdout = nonbuffered_stdout
"""
See https://github.com/chriskiehl/Gooey#installation-instructions
This gui does only work with py2
"""
@Gooey(monospace_display=True,
advanced=True,
default_size=(900, 600),
program_description='Download tvshows/movies from NRK/Super')
def main():
NRK = NRK(gui=True)
parser = GooeyParser()
parser.add_argument('-u', '--url', action='store', default=False,
required=False, widget='TextField', help='"url1 url2 url3"')
parser.add_argument('-e', '--encoding', default='latin-1',
required=False, help='Set encoding')
parser.add_argument('-save', '--save_path', default=False,
required=False, help='Download to this folder', widget='DirChooser')
parser.add_argument('-dr', '--dry_run', action='store_true', default=False,
required=False, help='Dry run, dont download anything')
parser.add_argument('-v', '--verbose', action='store_true', default=False,
required=False, help='Show ffmpeg output')
parser.add_argument('-w', '--workers', default=2,
required=False, help='Number of thread pool workers')
parser.add_argument('-st', '--subtitle', action='store_true', default=False,
required=False, help='Download subtitle for this media file?')
parser.add_argument('-if', '--input_file', default=False,
required=False, help='List of files to download', widget='FileChooser')
p = parser.parse_args()
NRK.dry_run = p.dry_run
NRK.verbose = p.verbose
NRK.subtitle = p.subtitle
NRK.cli = False
NRK.encoding = p.encoding
NRK.workers = int(p.workers)
if p.save_path:
NRK.SAVE_PATH = p.save_path
if p.input_file:
NRK._from_file(p.input_file)
if p.url:
NRK.parse_url(p.url)
main()