Browse Source

sasinhronizēts ar strādājošo versiju (iespējamās kļūdas novērstas)

Ivars 5 years ago
parent
commit
5c6928d2f6
1 changed files with 6 additions and 8 deletions
  1. 6
    8
      ltcproxy.py

+ 6
- 8
ltcproxy.py View File

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