Browse Source

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

Ivars 5 years ago
parent
commit
e9d1e7dac3
2 changed files with 9 additions and 9 deletions
  1. 9
    9
      ltcproxy.py
  2. 0
    0
      ltcproxy0.cfg

+ 9
- 9
ltcproxy.py View File

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

ltcproxy.cfg → ltcproxy0.cfg View File