|
@@ -8,8 +8,8 @@ usage: %s start|stop|restart|manualstart [options]
|
8
|
8
|
-s WSGI_SERVER - wsgi server - wsgiref,cheroot,mtwsgi,waitress...
|
9
|
9
|
-d - debug printout
|
10
|
10
|
-r - remote debug mode (ptvsd)"""
|
11
|
|
-
|
12
|
|
-__version__ = "0.1a"
|
|
11
|
+
|
|
12
|
+__version__ = "0.1b"
|
13
|
13
|
|
14
|
14
|
import os, sys, time
|
15
|
15
|
import urllib,urlparse, urllib2, requests
|
|
@@ -44,7 +44,7 @@ DEBUG = False
|
44
|
44
|
PORT_NUMBER = 8881
|
45
|
45
|
REDIRECT = False
|
46
|
46
|
CACHE = True
|
47
|
|
-KEY = ["0000","1111"]
|
|
47
|
+KEY = ["1234","3786"]
|
48
|
48
|
SERVER = "wsgiref"
|
49
|
49
|
WORKERS = 10
|
50
|
50
|
LTC_USER = "user"
|
|
@@ -96,7 +96,7 @@ def set_globals():
|
96
|
96
|
s.set("token", token, expire=3600*24*1) # pēc 1d ekspirejas
|
97
|
97
|
print "** %s: token=%s" % (request.remote_addr,token)
|
98
|
98
|
else:
|
99
|
|
- print "Can not login"
|
|
99
|
+ print "Can not login %s/%s"%(LTC_USER, LTC_PASSWORD)
|
100
|
100
|
raise bottle.HTTPError(500, "Can not login")
|
101
|
101
|
|
102
|
102
|
# @app.route('/playstream/<url:re:.*>')
|
|
@@ -252,7 +252,6 @@ def get_archive(key, ch, ts):
|
252
|
252
|
response.content_type = r2.headers["content-type"] # 'application/vnd.apple.mpegurl' #
|
253
|
253
|
return content
|
254
|
254
|
|
255
|
|
-
|
256
|
255
|
def live_get_stream_url(ch):
|
257
|
256
|
global s, token, headers0
|
258
|
257
|
if ch in s:
|
|
@@ -294,7 +293,6 @@ def epg_get_stream_url(epgid):
|
294
|
293
|
s.set(epgid, stream_url0, expire=3600*24*7, read=False)
|
295
|
294
|
return str(stream_url)
|
296
|
295
|
|
297
|
|
-
|
298
|
296
|
def refresh_live_chunklist_url(ch):
|
299
|
297
|
global s, token, headers0
|
300
|
298
|
stream_url = live_get_stream_url(ch)
|
|
@@ -309,8 +307,8 @@ def refresh_live_chunklist_url(ch):
|
309
|
307
|
stream_url2 = base2 + rest2 # chunlist url
|
310
|
308
|
s.set("m"+ch, mediaid, expire=3600*24*7, read=False)
|
311
|
309
|
s.set("c"+ch, stream_url2, expire=3600*24*7, read=False)
|
312
|
|
-
|
313
|
|
-
|
|
310
|
+ return stream_url2,mediaid
|
|
311
|
+
|
314
|
312
|
def refresh_epg_chunklist_url(stream_url):
|
315
|
313
|
global s, token, headers0
|
316
|
314
|
r = requests.get(stream_url)
|