Przeglądaj źródła

Pēdējā strādājošā versija

Ivars 4 lat temu
rodzic
commit
e9d1e7dac3
2 zmienionych plików z 9 dodań i 9 usunięć
  1. 9
    9
      ltcproxy.py
  2. 0
    0
      ltcproxy0.cfg

+ 9
- 9
ltcproxy.py Wyświetl plik

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
37
 if not os.path.exists(cache_dir):
37
 if not os.path.exists(cache_dir):
38
     os.mkdir(cache_dir)
38
     os.mkdir(cache_dir)
39
 
39
 
40
+CFG_FILE = "ltcproxy.cfg" # TODO - iespēja uzdot kā parametru
40
 config = ConfigParser.ConfigParser()
41
 config = ConfigParser.ConfigParser()
41
-proxy_cfg_file = os.path.join(cur_directory, "ltcproxy.cfg")
42
+proxy_cfg_file = os.path.join(cur_directory, CFG_FILE)
42
 
43
 
43
 DEBUG = False
44
 DEBUG = False
44
 PORT_NUMBER = 8881
45
 PORT_NUMBER = 8881
45
 REDIRECT = False
46
 REDIRECT = False
46
 CACHE = True
47
 CACHE = True
47
-KEY = ["0000","1111"]
48
+KEY = ["0000","00000"]
48
 SERVER = "wsgiref"
49
 SERVER = "wsgiref"
49
 WORKERS = 10
50
 WORKERS = 10
50
 LTC_USER = "user"
51
 LTC_USER = "user"
96
             s.set("token", token, expire=3600*24*1) #  pēc 1d ekspirejas
97
             s.set("token", token, expire=3600*24*1) #  pēc 1d ekspirejas
97
             print "** %s: token=%s" % (request.remote_addr,token)
98
             print "** %s: token=%s" % (request.remote_addr,token)
98
         else:
99
         else:
99
-            print "Can not login"
100
+            print "Can not login %s/%s"%(LTC_USER, LTC_PASSWORD)
100
             raise bottle.HTTPError(500, "Can not login")
101
             raise bottle.HTTPError(500, "Can not login")
101
 
102
 
102
 # @app.route('/playstream/<url:re:.*>')
103
 # @app.route('/playstream/<url:re:.*>')
252
     response.content_type = r2.headers["content-type"] # 'application/vnd.apple.mpegurl' #
253
     response.content_type = r2.headers["content-type"] # 'application/vnd.apple.mpegurl' #
253
     return content
254
     return content
254
 
255
 
255
-
256
 def live_get_stream_url(ch):
256
 def live_get_stream_url(ch):
257
     global s, token, headers0
257
     global s, token, headers0
258
     if ch in s:
258
     if ch in s:
294
         s.set(epgid, stream_url0, expire=3600*24*7, read=False)
294
         s.set(epgid, stream_url0, expire=3600*24*7, read=False)
295
     return str(stream_url)
295
     return str(stream_url)
296
 
296
 
297
-
298
 def refresh_live_chunklist_url(ch):
297
 def refresh_live_chunklist_url(ch):
299
     global s, token, headers0
298
     global s, token, headers0
300
     stream_url = live_get_stream_url(ch)
299
     stream_url = live_get_stream_url(ch)
309
     stream_url2 = base2 + rest2 # chunlist url
308
     stream_url2 = base2 + rest2 # chunlist url
310
     s.set("m"+ch, mediaid, expire=3600*24*7, read=False)
309
     s.set("m"+ch, mediaid, expire=3600*24*7, read=False)
311
     s.set("c"+ch, stream_url2, expire=3600*24*7, read=False)
310
     s.set("c"+ch, stream_url2, expire=3600*24*7, read=False)
312
-    
313
-    
311
+    return stream_url2,mediaid
312
+
314
 def refresh_epg_chunklist_url(stream_url):
313
 def refresh_epg_chunklist_url(stream_url):
315
     global s, token, headers0
314
     global s, token, headers0
316
     r = requests.get(stream_url)
315
     r = requests.get(stream_url)
443
 # Run WSGI server
442
 # Run WSGI server
444
 def start(server,port):
443
 def start(server,port):
445
     print "*** Starting ltcproxy ***"
444
     print "*** Starting ltcproxy ***"
445
+    print "LTC_USER: %s"% LTC_USER
446
     options = {}
446
     options = {}
447
     if server == "mtwsgi":
447
     if server == "mtwsgi":
448
         import mtwsgi
448
         import mtwsgi

ltcproxy.cfg → ltcproxy0.cfg Wyświetl plik