Browse Source

[bug] filmix get_streams

Ivars 7 years ago
parent
commit
a3e7639840
5 changed files with 19 additions and 13 deletions
  1. 1
    1
      ContentSources.py
  2. 1
    1
      PlayStream.py
  3. BIN
      release/enigma2-plugin-extensions-playstream_0.6k.ipk
  4. 15
    9
      sources/filmix.py
  5. 2
    2
      util.py

+ 1
- 1
ContentSources.py View File

176
     while True:
176
     while True:
177
         print
177
         print
178
         for i,item in enumerate(content):
178
         for i,item in enumerate(content):
179
-            s = "%i: %s - %s %s %s "%(i,item[0],item[1],item[2],item[3])
179
+            s = "%i: %s - %s %s"%(i,item[0],item[1],item[2])
180
             print s #.encode(sys.stdout.encoding,"replace")
180
             print s #.encode(sys.stdout.encoding,"replace")
181
 
181
 
182
         while True:
182
         while True:

+ 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.6j"
9
+__version__ = "0.6k"
10
 __id__ = "playstream"
10
 __id__ = "playstream"
11
 __title__ = "PlayStream"
11
 __title__ = "PlayStream"
12
 __author__ = "ivars777@gmail.com"
12
 __author__ = "ivars777@gmail.com"

BIN
release/enigma2-plugin-extensions-playstream_0.6k.ipk View File


+ 15
- 9
sources/filmix.py View File

110
                 if translations[pl].startswith("http"):
110
                 if translations[pl].startswith("http"):
111
                     continue
111
                     continue
112
                 pl_link = translations[pl]
112
                 pl_link = translations[pl]
113
+                lang = pl.encode("utf8")
113
                 break
114
                 break
114
             else:
115
             else:
115
                 raise Exception("No episodes list found!")
116
                 raise Exception("No episodes list found!")
222
         desc = desc0 =  util.unescape(m.group(1).strip()) if m else ""
223
         desc = desc0 =  util.unescape(m.group(1).strip()) if m else ""
223
         m = re.search('itemprop="contentUrl" content="(.+?)"', r, re.IGNORECASE | re.DOTALL)
224
         m = re.search('itemprop="contentUrl" content="(.+?)"', r, re.IGNORECASE | re.DOTALL)
224
         if not m:
225
         if not m:
225
-        #    #raise Exception("Can not find video link")
226
-            return []
226
+            raise Exception("Can not find video link")
227
+            #return []
227
         video_link = m.group(1)
228
         video_link = m.group(1)
228
         series = True if video_link == '{video-link}' else False
229
         series = True if video_link == '{video-link}' else False
229
         vid = plist[1]
230
         vid = plist[1]
230
         js = self.get_movie_info(vid)
231
         js = self.get_movie_info(vid)
231
-        if js["message"]["translations"]["flash"]:
232
-            video_link = js["message"]["translations"]["flash"].values()[0].encode("utf8")
233
-            video_link = self.decode_uppod_text(video_link)
234
-            lang = js["message"]["translations"]["flash"].keys()[0].encode("utf8") # TODO process several players/streams
232
+        translations = js["message"]["translations"]["flash"]
233
+        for pl in translations:
234
+            if translations[pl].startswith("http"):
235
+                continue
236
+            pl_link = translations[pl]
237
+            lang = pl.encode("utf8")
238
+            break
235
         else:
239
         else:
236
-            return []
240
+            raise Exception("No episodes list found!")
241
+        if not pl_link.startswith("http"):
242
+            pl_link = self.decode_uppod_text(pl_link)
237
 
243
 
238
         if not series : # Filma
244
         if not series : # Filma
239
-            url0 = video_link
245
+            url0 = pl_link
240
             streams2 = self.get_streams2(url0)
246
             streams2 = self.get_streams2(url0)
241
             for st in streams2:
247
             for st in streams2:
242
                 stream = util.item()
248
                 stream = util.item()
249
             return streams
255
             return streams
250
 
256
 
251
         else: # Seriāls
257
         else: # Seriāls
252
-            pl_link = video_link
258
+            #pl_link = video_link
253
             js = self._http_request(pl_link)
259
             js = self._http_request(pl_link)
254
             js = self.decode_uppod_text(js)
260
             js = self.decode_uppod_text(js)
255
             js = json.loads(js)
261
             js = json.loads(js)

+ 2
- 2
util.py View File

104
     desc += ddd("actor","Actors")
104
     desc += ddd("actor","Actors")
105
     desc += ddd("language","Languages")
105
     desc += ddd("language","Languages")
106
     desc += ddd("quality","Quality")
106
     desc += ddd("quality","Quality")
107
-    return desc.encode("utf8")
107
+    return desc.encode("utf8") if isinstance(desc,unicode) else desc
108
 
108
 
109
 def nfo2title(nfo):
109
 def nfo2title(nfo):
110
     if not "title" in nfo:
110
     if not "title" in nfo:
114
         title +=" ~ "+nfo["originaltitle"]
114
         title +=" ~ "+nfo["originaltitle"]
115
     if "year" in nfo and nfo["year"]:
115
     if "year" in nfo and nfo["year"]:
116
         title += " (%s)"%nfo["year"]
116
         title += " (%s)"%nfo["year"]
117
-    return title.encode("utf8")
117
+    return title.encode("utf8") if isinstance(title,unicode) else title
118
 
118
 
119
 def play_video(streams):
119
 def play_video(streams):
120
     if len(streams)>1:
120
     if len(streams)>1: