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

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

+ 13
- 6
ContentSources.py View File

12
 from sources.SourceBase import stream_type
12
 from sources.SourceBase import stream_type
13
 import util
13
 import util
14
 
14
 
15
+show_hidden = False  # Ja True, tad vienalga radā hidden sources (noder izstradē)
15
 
16
 
16
 class ContentSources(object):
17
 class ContentSources(object):
17
     """Wrapper for content sources plugin"""
18
     """Wrapper for content sources plugin"""
61
     def get_content(self,data):
62
     def get_content(self,data):
62
         source = data.split("::")[0]
63
         source = data.split("::")[0]
63
         if source in self.plugins:
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
                         item2=[]
74
                         item2=[]
69
                         for el in item:
75
                         for el in item:
70
                             if isinstance(el,unicode):
76
                             if isinstance(el,unicode):
71
                                 el = el.encode("utf8")
77
                                 el = el.encode("utf8")
72
                             item2.append(el)
78
                             item2.append(el)
73
-                        content[i]=tuple(item2)
79
+                        content.append(tuple(item2))
74
                 else:
80
                 else:
75
                     item2=[]
81
                     item2=[]
76
-                    for el in content:
82
+                    for el in content0:
77
                         if isinstance(el,unicode):
83
                         if isinstance(el,unicode):
78
                             el = el.encode("utf8")
84
                             el = el.encode("utf8")
79
                         item2.append(el)
85
                         item2.append(el)
161
 
167
 
162
 if __name__ == "__main__":
168
 if __name__ == "__main__":
163
 
169
 
170
+    show_hidden = False
164
     sources = ContentSources("sources")
171
     sources = ContentSources("sources")
165
     if len(sys.argv)>1:
172
     if len(sys.argv)>1:
166
         data= sys.argv[1]
173
         data= sys.argv[1]

+ 1
- 1
PlayStream.py View File

6
 # Used fragments of code from enigma2-plugin-tv3play by Taapat (https://github.com/Taapat/enigma2-plugin-tv3play)
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
 __id__ = "playstream"
10
 __id__ = "playstream"
11
 __title__ = "PlayStream"
11
 __title__ = "PlayStream"
12
 __author__ = "ivars777@gmail.com"
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
+**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
 **0.6v** (26.06.2017)
19
 **0.6v** (26.06.2017)
2
 - [bugfix] Kļuda ar SSL pythonā <2.7.9
20
 - [bugfix] Kļuda ar SSL pythonā <2.7.9
3
 
21
 

+ 1
- 0
content

1
+Subproject commit 82f74e9379b371001390a46985b9e3035df186bf

+ 6
- 1
playstreamproxy.py View File

56
             ct = "application/vnd.apple.mpegurl"
56
             ct = "application/vnd.apple.mpegurl"
57
         elif ".ts" in self.path.lower():
57
         elif ".ts" in self.path.lower():
58
             ct = "video/MP2T"
58
             ct = "video/MP2T"
59
-        elif ".mp4" in ".ts" in self.path.lower():
59
+        elif ".mp4" in self.path.lower():
60
             ct = "video/mp4"
60
             ct = "video/mp4"
61
         else:
61
         else:
62
             ct = "text/html"
62
             ct = "text/html"
394
             print_headers(r.headers)
394
             print_headers(r.headers)
395
         return r
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
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
402
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
398
     """Handle requests in a separate thread."""
403
     """Handle requests in a separate thread."""
399
 
404
 

+ 17
- 3
util.py View File

134
         stream = streams[0]
134
         stream = streams[0]
135
 
135
 
136
     stream = stream_change(stream)
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
     img = stream["img"]
139
     img = stream["img"]
140
     url = stream["url"]
140
     url = stream["url"]
141
     suburl = ""
141
     suburl = ""
145
         print "\n**Download subtitles %s - %s"%(title,suburl)
145
         print "\n**Download subtitles %s - %s"%(title,suburl)
146
         subs = urllib2.urlopen(suburl).read()
146
         subs = urllib2.urlopen(suburl).read()
147
         if subs:
147
         if subs:
148
-            fname0 = re.sub("[/\n\r\t,]","_",title)
148
+            fname0 = re.sub("[/\n\r\t,:\?]","_",title)
149
             subext = ".srt"
149
             subext = ".srt"
150
             subfile = os.path.join("",fname0+subext)
150
             subfile = os.path.join("",fname0+subext)
151
             if ".xml" in suburl:
151
             if ".xml" in suburl:
179
         #a = raw_input("*** Error, continue")
179
         #a = raw_input("*** Error, continue")
180
     return
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
 def check_version(package,url="http://feed.blue.lv/Packages"):
196
 def check_version(package,url="http://feed.blue.lv/Packages"):
183
     "Return current package version from OPKG feed"
197
     "Return current package version from OPKG feed"
184
     url = "http://feed.blue.lv/Packages"
198
     url = "http://feed.blue.lv/Packages"