File tree Expand file tree Collapse file tree 5 files changed +176
-0
lines changed Expand file tree Collapse file tree 5 files changed +176
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Created by https://www.gitignore.io/api/python
3
+ # Edit at https://www.gitignore.io/?templates=python
4
+
5
+ # ## Python ###
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__ /
8
+ * .py [cod ]
9
+ * $py.class
10
+
11
+ # C extensions
12
+ * .so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build /
17
+ develop-eggs /
18
+ dist /
19
+ downloads /
20
+ eggs /
21
+ .eggs /
22
+ lib /
23
+ lib64 /
24
+ parts /
25
+ sdist /
26
+ var /
27
+ wheels /
28
+ pip-wheel-metadata /
29
+ share /python-wheels /
30
+ * .egg-info /
31
+ .installed.cfg
32
+ * .egg
33
+ MANIFEST
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ * .manifest
39
+ * .spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov /
47
+ .tox /
48
+ .nox /
49
+ .coverage
50
+ .coverage. *
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ * .cover
55
+ .hypothesis /
56
+ .pytest_cache /
57
+
58
+ # Translations
59
+ * .mo
60
+ * .pot
61
+
62
+ # Scrapy stuff:
63
+ .scrapy
64
+
65
+ # Sphinx documentation
66
+ docs /_build /
67
+
68
+ # PyBuilder
69
+ target /
70
+
71
+ # pyenv
72
+ .python-version
73
+
74
+ # pipenv
75
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
76
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
77
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
78
+ # install all needed dependencies.
79
+ # Pipfile.lock
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ * .sage.py
86
+
87
+ # Spyder project settings
88
+ .spyderproject
89
+ .spyproject
90
+
91
+ # Rope project settings
92
+ .ropeproject
93
+
94
+ # Mr Developer
95
+ .mr.developer.cfg
96
+ .project
97
+ .pydevproject
98
+
99
+ # mkdocs documentation
100
+ /site
101
+
102
+ # mypy
103
+ .mypy_cache /
104
+ .dmypy.json
105
+ dmypy.json
106
+
107
+ # Pyre type checker
108
+ .pyre /
109
+
110
+ # End of https://www.gitignore.io/api/python
Original file line number Diff line number Diff line change
1
+ {
2
+ "ard" : " https://mcdn.daserste.de/daserste/de/master.m3u8" ,
3
+ "tagesschau24" : " https://tagesschau-lh.akamaihd.net/i/tagesschau_3@66339/master.m3u8" ,
4
+ "3sat" : " https://zdfhls18-i.akamaihd.net/hls/live/744751/dach/high/master.m3u8" ,
5
+ "ard alpha" : " https://brlive-lh.akamaihd.net/i/bralpha_germany@119899/master.m3u8" ,
6
+ "arte" : " https://artelive-lh.akamaihd.net/i/artelive_de@393591/master.m3u8"
7
+ }
Original file line number Diff line number Diff line change
1
+ #!/bin/python
2
+
3
+ import subprocess
4
+ from time import sleep
5
+ import json
6
+ from flask import Flask , render_template , request
7
+
8
+ app = Flask (__name__ )
9
+ vlc_process = None
10
+
11
+ def get_stream_url (channel ):
12
+ with open ("config.json" ) as urls_file :
13
+ urls_json = json .load (urls_file )
14
+ return urls_json [channel ]
15
+
16
+ def get_stream_list ():
17
+ with open ("config.json" ) as urls_file :
18
+ urls_json = json .load (urls_file )
19
+ result = list (urls_json .keys ())
20
+ print (result )
21
+ return result
22
+
23
+ @app .route ('/' )
24
+ def select ():
25
+ return render_template ("channel_selector.html" , channels = get_stream_list ())
26
+
27
+ @app .route ('/test' ,methods = ["GET" ,"POST" ])
28
+ def test_run ():
29
+ global vlc_process
30
+ if vlc_process :
31
+ print ("Kill!" )
32
+ vlc_process .kill ()
33
+
34
+ channel = request .form ["channel" ]
35
+ channel = channel .lower ()
36
+ print ("requested channel" ,channel )
37
+
38
+ print ("Running..." )
39
+ stream_url = get_stream_url (channel )
40
+ vlc_process = subprocess .Popen (["cvlc" , stream_url ])
41
+ print ("wait..." )
42
+ return render_template ("channel_selector.html" , channels = get_stream_list ())
43
+
44
+ if __name__ == "__main__" :
45
+ app .run (host = '0.0.0.0' , debug = True )
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < title > Hailing up the selector!</ title >
3
+ < form action ="test " method ="post ">
4
+ {% for item in channels %}
5
+ < button type ="submit " name ="channel " value ={{item}} > {{item}}</ button > < br />
6
+ {% endfor %}
7
+ </ form >
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < title > Hello from Flask</ title >
3
+ {% if name %}
4
+ < h1 > Hello {{ name }}!</ h1 >
5
+ {% else %}
6
+ < h1 > Hello, World!</ h1 >
7
+ {% endif %}
You can’t perform that action at this time.
0 commit comments