Browse Source

playstreamproxy kļūdas labojums

Ivars 8 years ago
parent
commit
c61aa61aa4

+ 2
- 1
ContentSources.py View File

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

+ 0
- 1
PlayStream.py View File

304
             if self.subtitle_window.shown:
304
             if self.subtitle_window.shown:
305
                 self.subtitle_window.hide()
305
                 self.subtitle_window.hide()
306
 
306
 
307
-
308
         # 	struct SubtitleTrack
307
         # 	struct SubtitleTrack
309
         #	int type;
308
         #	int type;
310
         #	int pid;
309
         #	int pid;

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


+ 3
- 0
changelog.md View File

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

+ 2
- 2
imake.bat View File

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

+ 29
- 29
playstreamproxy.py View File

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