Ivars 7 years ago
parent
commit
7e3bf40dd0
8 changed files with 1531 additions and 700 deletions
  1. 3
    0
      .gitmodules
  2. 13
    6
      ContentSources.py
  3. 1
    1
      PlayStream.py
  4. 1472
    689
      PlayStream.wpr
  5. 18
    0
      changelog.md
  6. 1
    0
      content
  7. 6
    1
      playstreamproxy.py
  8. 17
    3
      util.py

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
1
+[submodule "content"]
2
+	path = content
3
+	url = http://root@git.blue.lv/home/content.git

+ 13
- 6
ContentSources.py View File

@@ -12,6 +12,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
12 12
 from sources.SourceBase import stream_type
13 13
 import util
14 14
 
15
+show_hidden = False  # Ja True, tad vienalga radā hidden sources (noder izstradē)
15 16
 
16 17
 class ContentSources(object):
17 18
     """Wrapper for content sources plugin"""
@@ -61,19 +62,24 @@ class ContentSources(object):
61 62
     def get_content(self,data):
62 63
         source = data.split("::")[0]
63 64
         if source in self.plugins:
64
-            content = self.plugins[source].get_content(data)
65
-            if content:
66
-                if isinstance(content,list):
67
-                    for i,item in enumerate(content):
65
+            content0 = self.plugins[source].get_content(data)
66
+            if content0:
67
+                content = []
68
+                if isinstance(content0,list):
69
+                    for i,item in enumerate(content0):
70
+                        source2 = item[1].split("::")[0]
71
+                        if not (source2 == "back" or item[1].startswith("http") or item[1].startswith("rtmp")):
72
+                            if source2 not in self.plugins or (not show_hidden and "hidden" in dir(self.plugins[source2]) and self.plugins[source2].hidden):
73
+                                continue
68 74
                         item2=[]
69 75
                         for el in item:
70 76
                             if isinstance(el,unicode):
71 77
                                 el = el.encode("utf8")
72 78
                             item2.append(el)
73
-                        content[i]=tuple(item2)
79
+                        content.append(tuple(item2))
74 80
                 else:
75 81
                     item2=[]
76
-                    for el in content:
82
+                    for el in content0:
77 83
                         if isinstance(el,unicode):
78 84
                             el = el.encode("utf8")
79 85
                         item2.append(el)
@@ -161,6 +167,7 @@ class ContentSources(object):
161 167
 
162 168
 if __name__ == "__main__":
163 169
 
170
+    show_hidden = False
164 171
     sources = ContentSources("sources")
165 172
     if len(sys.argv)>1:
166 173
         data= sys.argv[1]

+ 1
- 1
PlayStream.py View File

@@ -6,7 +6,7 @@
6 6
 # Used fragments of code from enigma2-plugin-tv3play by Taapat (https://github.com/Taapat/enigma2-plugin-tv3play)
7 7
 #
8 8
 
9
-__version__ = "0.6v"
9
+__version__ = "0.7e"
10 10
 __id__ = "playstream"
11 11
 __title__ = "PlayStream"
12 12
 __author__ = "ivars777@gmail.com"

+ 1472
- 689
PlayStream.wpr
File diff suppressed because it is too large
View File


+ 18
- 0
changelog.md View File

@@ -1,3 +1,21 @@
1
+**0.7e** (13.09.2017)
2
+- [bugfix] Salabots lattelecom.tv (bija pamainīts web formāts)
3
+
4
+
5
+**0.7c** (03.09.2017)
6
+- [bugfix] Salabots filmix (pamainīts direct url avots uz html5 + dekodēšana kods)
7
+
8
+**0.7b** (27.08.2017)
9
+- [bugfix] Izlabota kļūda, ja iekš streams.cfg ir links uz neesošu pluginu
10
+
11
+**0.7a** (26.08.2017)
12
+- [change] Salabots TVDom atbilstoši jaunajam API
13
+- [bugfix] Salabots Euronews
14
+- [change] Nestrādājošie avoti noslēpti menu, kad tiks salaboti parādīsies atkal
15
+
16
+**0.6w** (22.07.2017)
17
+- [change] Sataisīts izmainītais Filmix.me
18
+
1 19
 **0.6v** (26.06.2017)
2 20
 - [bugfix] Kļuda ar SSL pythonā <2.7.9
3 21
 

+ 1
- 0
content

@@ -0,0 +1 @@
1
+Subproject commit 82f74e9379b371001390a46985b9e3035df186bf

+ 6
- 1
playstreamproxy.py View File

@@ -56,7 +56,7 @@ class StreamHandler(BaseHTTPRequestHandler):
56 56
             ct = "application/vnd.apple.mpegurl"
57 57
         elif ".ts" in self.path.lower():
58 58
             ct = "video/MP2T"
59
-        elif ".mp4" in ".ts" in self.path.lower():
59
+        elif ".mp4" in self.path.lower():
60 60
             ct = "video/mp4"
61 61
         else:
62 62
             ct = "text/html"
@@ -394,6 +394,11 @@ class StreamHandler(BaseHTTPRequestHandler):
394 394
             print_headers(r.headers)
395 395
         return r
396 396
 
397
+    def address_string(self):
398
+        host, port = self.client_address[:2]
399
+        #return socket.getfqdn(host)
400
+        return host
401
+
397 402
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
398 403
     """Handle requests in a separate thread."""
399 404
 

+ 17
- 3
util.py View File

@@ -134,8 +134,8 @@ def play_video(streams):
134 134
         stream = streams[0]
135 135
 
136 136
     stream = stream_change(stream)
137
-    title = stream["name"] if not "nfo" in stream else nfo2title(stream["nfo"])
138
-    desc = stream["desc"] if not "nfo" in stream else nfo2desc(stream["nfo"])
137
+    title = stream["name"] if not "nfo" in stream or not stream["nfo"] else nfo2title(stream["nfo"])
138
+    desc = stream["desc"] if not "nfo" in stream or not stream["nfo"] else nfo2desc(stream["nfo"])
139 139
     img = stream["img"]
140 140
     url = stream["url"]
141 141
     suburl = ""
@@ -145,7 +145,7 @@ def play_video(streams):
145 145
         print "\n**Download subtitles %s - %s"%(title,suburl)
146 146
         subs = urllib2.urlopen(suburl).read()
147 147
         if subs:
148
-            fname0 = re.sub("[/\n\r\t,]","_",title)
148
+            fname0 = re.sub("[/\n\r\t,:\?]","_",title)
149 149
             subext = ".srt"
150 150
             subfile = os.path.join("",fname0+subext)
151 151
             if ".xml" in suburl:
@@ -179,6 +179,20 @@ def player(url, title = "", suburl= "",headers={}):
179 179
         #a = raw_input("*** Error, continue")
180 180
     return
181 181
 
182
+def stream_type(data):
183
+    data = data.lower()
184
+    m = re.search(r"^(\w+)://", data)
185
+    prefix = m.group(1) if m else ""
186
+    if prefix in ("http","https"):
187
+        if ".m3u8" in data:
188
+            return "hls"
189
+        elif ".mpd" in data:
190
+            return "dash"
191
+        else:
192
+            return "http"
193
+    else:
194
+        return prefix
195
+
182 196
 def check_version(package,url="http://feed.blue.lv/Packages"):
183 197
     "Return current package version from OPKG feed"
184 198
     url = "http://feed.blue.lv/Packages"