Browse Source

playstreamproxy kļūdas labojums

Ivars 8 years ago
parent
commit
c61aa61aa4

+ 2
- 1
ContentSources.py View File

@@ -181,7 +181,8 @@ if __name__ == "__main__":
181 181
             if streams:
182 182
                 util.play_video(streams)
183 183
             else:
184
-                print "**No stream to play - %s "%(cur2[1])
184
+                print "**No stream to play - %s "%(
185
+                    cur2[1])
185 186
                 raw_input("Press any key")
186 187
             #import os
187 188
             #os.system('"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "%s"'%cur2[1])

+ 0
- 1
PlayStream.py View File

@@ -304,7 +304,6 @@ class PSPlayer(MoviePlayer):
304 304
             if self.subtitle_window.shown:
305 305
                 self.subtitle_window.hide()
306 306
 
307
-
308 307
         # 	struct SubtitleTrack
309 308
         #	int type;
310 309
         #	int pid;

+ 386
- 406
PlayStream.wpr
File diff suppressed because it is too large
View File


+ 3
- 0
changelog.md View File

@@ -1,4 +1,7 @@
1 1
 
2
+**0.5u** (19.01.2016):
3
+- kļūdas labojums atverot hqq u.c. strīmus
4
+
2 5
 **0.5t** (19.01.2016):
3 6
 - Konfigurācijas logs, tmp folder uzdošana, opcija notīrīt tmp folderi pie iziešanas
4 7
 - Sīki labojumi

+ 2
- 2
imake.bat View File

@@ -2,7 +2,7 @@
2 2
 :=== Parameters ===
3 3
 
4 4
 if ()==(%1%) (
5
-    set ver=0.5t
5
+    set ver=0.5v
6 6
 	rem echo Please provide version
7 7
 	rem pause
8 8
 	rem GOTO:EOF
@@ -40,7 +40,7 @@ VideoDownload.py
40 40
 enigma2_api.py
41 41
 resolver.py
42 42
 util.py
43
-streamproxy.py
43
+playstreamproxy.py
44 44
 offline.mp4
45 45
 demjson.py
46 46
 locale\*.*

+ 29
- 29
playstreamproxy.py View File

@@ -1,5 +1,5 @@
1 1
 #!/usr/bin/python
2
-""" 
2
+"""
3 3
 StreamProxy daemon (based on Livestream daemon)
4 4
 Ensures persistent cookies, User-Agents and others tricks to play protected HLS/DASH streams
5 5
 """
@@ -41,10 +41,10 @@ class StreamHandler(BaseHTTPRequestHandler):
41 41
         SPLIT_CODE = "%7E"
42 42
         EQ_CODE = "%3D"
43 43
         COL_CODE = "%3A"
44
-        
44
+
45 45
         p = self.path.split("~")
46 46
         url = urllib.unquote(p[0][1:])
47
-        url = url.replace(COL_CODE, ":")       
47
+        url = url.replace(COL_CODE, ":")
48 48
         headers = headers2dict("""
49 49
         User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4
50 50
         """)
@@ -56,7 +56,7 @@ class StreamHandler(BaseHTTPRequestHandler):
56 56
             self.fetch_url2(self.wfile, url, headers)
57 57
         except Exception as e:
58 58
             print "Got Exception: ", str(e)
59
-        
59
+
60 60
     def fetch_offline(self,wfile):
61 61
         self.send_response(200)
62 62
         self.send_header("Server", "StreamProxy")
@@ -64,18 +64,18 @@ class StreamHandler(BaseHTTPRequestHandler):
64 64
         self.end_headers()
65 65
         self.wfile.write(open("offline.mp4", "rb").read())
66 66
         self.wfile.close()
67
-        
68
-    
67
+
68
+
69 69
     def fetch_url2(self, wfile, url, headers):
70 70
         if DEBUG: print "\n***********************************************************"
71 71
         self.log_message("fetch_url: %s", url)
72 72
         #self.log_message("headers: %s", headers)
73
-        
73
+
74 74
         base_url = "/".join(url.split("/")[0:-1])
75 75
         if base_url not in sessions:
76 76
             sessions[base_url] = requests.Session()
77 77
             #cj = cookielib.CookieJar()
78
-            #sessions[base_url] = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))    
78
+            #sessions[base_url] = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
79 79
         else:
80 80
             pass
81 81
         ses = sessions[base_url]
@@ -90,7 +90,7 @@ class StreamHandler(BaseHTTPRequestHandler):
90 90
         code = r.status_code #r.status_code
91 91
         if DEBUG: print "**Response:", code #r.status_code
92 92
         if DEBUG: print "**Response headers: "
93
-        for h in r.headers: 
93
+        for h in r.headers:
94 94
             if DEBUG: print h,"=",r.headers[h]
95 95
         self.send_response(code)
96 96
         if DEBUG: print "**Return headers:"
@@ -102,7 +102,7 @@ class StreamHandler(BaseHTTPRequestHandler):
102 102
             self.send_header(h, r.headers[h])
103 103
             if DEBUG:print h,"=",r.headers[h]
104 104
         self.end_headers()
105
-        
105
+
106 106
         CHUNK_SIZE = 4 * 1024
107 107
         if code == 200:
108 108
             #while True:
@@ -115,20 +115,20 @@ class StreamHandler(BaseHTTPRequestHandler):
115 115
             for chunk in r.iter_content(1024):
116 116
                 try:
117 117
                     #print "#",
118
-                    wfile.write(chunk) 
118
+                    wfile.write(chunk)
119 119
                 except Exception as e:
120 120
                     print "Exception: ", str(e)
121 121
                     return
122 122
             if DEBUG: print "  = file downloaded = "
123 123
             time.sleep(2)
124 124
             #self.wfile.close()
125
-            
126
-            
125
+
126
+
127 127
         else:
128 128
             print code
129 129
             self.fetch_offline(wfile)
130 130
             pass
131
-  
131
+
132 132
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
133 133
     """Handle requests in a separate thread."""
134 134
 
@@ -156,33 +156,33 @@ class Daemon:
156 156
 
157 157
     def daemonize(self):
158 158
         """
159
-        do the UNIX double-fork magic, see Stevens' "Advanced 
159
+        do the UNIX double-fork magic, see Stevens' "Advanced
160 160
         Programming in the UNIX Environment" for details (ISBN 0201563177)
161 161
         http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
162 162
         """
163
-        try: 
164
-            pid = os.fork() 
163
+        try:
164
+            pid = os.fork()
165 165
             if pid > 0:
166 166
                 # exit first parent
167
-                sys.exit(0) 
168
-        except OSError, e: 
167
+                sys.exit(0)
168
+        except OSError, e:
169 169
             sys.stderr.write("fork #1 failed: %d (%s)\n" % (e.errno, e.strerror))
170 170
             sys.exit(1)
171 171
 
172 172
         # decouple from parent environment
173
-        os.chdir("/") 
174
-        os.setsid() 
175
-        os.umask(0) 
173
+        os.chdir("/")
174
+        os.setsid()
175
+        os.umask(0)
176 176
 
177 177
         # do second fork
178
-        try: 
179
-            pid = os.fork() 
178
+        try:
179
+            pid = os.fork()
180 180
             if pid > 0:
181 181
                 # exit from second parent
182
-                sys.exit(0) 
183
-        except OSError, e: 
182
+                sys.exit(0)
183
+        except OSError, e:
184 184
             sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
185
-            sys.exit(1) 
185
+            sys.exit(1)
186 186
 
187 187
         # redirect standard file descriptors
188 188
         sys.stdout.flush()
@@ -240,7 +240,7 @@ class Daemon:
240 240
             sys.stderr.write(message % self.pidfile)
241 241
             return # not an error in a restart
242 242
 
243
-        # Try killing the daemon process	
243
+        # Try killing the daemon process
244 244
         try:
245 245
             while 1:
246 246
                 os.kill(pid, SIGTERM)
@@ -272,7 +272,7 @@ class ProxyDaemon(Daemon):
272 272
         start()
273 273
 
274 274
 if __name__ == "__main__":
275
-    daemon = ProxyDaemon("/var/run/streamproxy.pid")
275
+    daemon = ProxyDaemon("/var/run/playstreamproxy.pid")
276 276
     if len(sys.argv) == 2:
277 277
         if "start" == sys.argv[1]:
278 278
             daemon.start()

BIN
release/enigma2-plugin-extensions-playstream_0.5t.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.5u.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.5v.ipk View File


+ 1
- 1
resolver.py View File

@@ -71,7 +71,7 @@ def resolve(url):
71 71
     value = resolver.resolve(url)
72 72
     if not value:
73 73
         return []
74
-    default = item()
74
+    default = util.item()
75 75
     for i in value:
76 76
         i["resolver"] = resolver.__name__
77 77
         if 'name' not in i.keys():

BIN
sources/SourceBase.pyc View File


BIN
sources/ltc.pyc View File


BIN
sources/replay.pyc View File