Ivars il y a 7 ans
Parent
révision
b12ee6f123

BIN
release/enigma2-plugin-extensions-playstream_0.6a.ipk Voir le fichier


BIN
release/enigma2-plugin-extensions-playstream_0.6b.ipk Voir le fichier


+ 13
- 3
sources/SourceBase.py Voir le fichier

@@ -9,6 +9,8 @@
9 9
 import urllib2, urllib
10 10
 import datetime, re, sys,os
11 11
 import requests
12
+from requests.packages.urllib3.exceptions import InsecureRequestWarning
13
+requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
12 14
 from collections import OrderedDict
13 15
 import ConfigParser
14 16
 try:
@@ -64,6 +66,14 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
64 66
         stream["type"] = stream_type(content[1]).encode("utf8")
65 67
         return[stream]
66 68
 
69
+    def get_epg(self,data):
70
+        ### Normally to be overrided in child class
71
+        return [self.get_info(data)]
72
+
73
+    def get_info(self,data):
74
+        streams = self.get_streams(data)
75
+        return streams[0] if streams else {}
76
+
67 77
     def options_read(self):
68 78
         if not ("options" in dir(self) and self.options): # process options only if self.options defined, self.config_file should be defined too
69 79
             return None
@@ -103,9 +113,9 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
103 113
             headers = self.headers if "headers" in dir(self) else headers2dict("User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0")
104 114
         try:
105 115
             if params:
106
-                r = requests.post(url, data=params, headers=headers)
116
+                r = requests.post(url, data=params, headers=headers,verify=False)
107 117
             else:
108
-                r = requests.get(url, headers=headers)
118
+                r = requests.get(url, headers=headers,verify=False)
109 119
             return r.content
110 120
         except Exception as ex:
111 121
             if "read" in ex:
@@ -138,7 +148,7 @@ def stream_type(data):
138 148
     data = data.lower()
139 149
     m = re.search(r"^(\w+)://", data)
140 150
     prefix = m.group(1) if m else ""
141
-    if prefix in ("http","https") and "m3u8" in data:
151
+    if prefix in ("http","https") and ".m3u8" in data:
142 152
         return "hls"
143 153
     elif prefix == "http":
144 154
         return "http"

BIN
sources/SourceBase.pyc Voir le fichier


+ 30
- 21
sources/config.py Voir le fichier

@@ -11,15 +11,16 @@ from SourceBase import SourceBase
11 11
 
12 12
 os.path.dirname(os.path.abspath(__file__))
13 13
 class Source(SourceBase):
14
-    
14
+
15 15
     def __init__(self,country="lv"):
16 16
         self.name = "config"
17 17
         self.country=country
18 18
         cur_directory = os.path.dirname(os.path.abspath(__file__))
19 19
         self.streams_file = os.path.join(cur_directory,"streams.cfg")
20 20
         self.lists = collections.OrderedDict()
21
+        self.titles = {}
21 22
         self.read_streams()
22
-         
23
+
23 24
     def get_content(self, data):
24 25
         self.read_streams()
25 26
         if "::" in data:
@@ -30,7 +31,7 @@ class Source(SourceBase):
30 31
 
31 32
     def is_video(self,data):
32 33
         return False
33
-    
34
+
34 35
     def read_streams(self):
35 36
         for line in open(self.streams_file,"r"):
36 37
             r = re.search("^\[(\w+)\]", line)
@@ -38,12 +39,14 @@ class Source(SourceBase):
38 39
                 name = r.group(1)
39 40
                 self.lists[name] = []
40 41
             else:
41
-                if len(line)<10 or line[0] in ("#"): continue
42
+                if line[0] in ("#"): continue
42 43
                 items = tuple(line.strip().split("|"))
43
-                if len(items)<2:
44
-                    continue
45
-                self.lists[name].append(items)
46
-                
44
+                if not items[0]: continue
45
+                if len(items)==1:
46
+                    self.titles[name] = items[0]
47
+                else:
48
+                    self.lists[name].append(items)
49
+
47 50
     def write_streams(self):
48 51
         f = open(self.streams_file,"w")
49 52
         for l in self.lists.keys():
@@ -52,48 +55,54 @@ class Source(SourceBase):
52 55
                 f.write("%s|%s|%s|%s\n"%(item[0],item[1],item[2],item[3]))
53 56
             f.write("\n")
54 57
         f.close()
55
-    
58
+
56 59
     def get_lists(self):
57 60
         return self.lists.keys()
58
-    
61
+
59 62
     def get_list_items(self,name):
60 63
         return self.lists[name]
61
-    
64
+
65
+    def get_title(self,name):
66
+        if name in self.titles:
67
+            return self.titles[name]
68
+        else:
69
+            return name
70
+
62 71
     def add_list(self,name):
63 72
         if not name in self.lists.keys():
64 73
             self.lists[name] = []
65
-            
74
+
66 75
     def del_list(self,name):
67 76
         if name in self.lists.keys():
68 77
             del self.lists[name]
69
-            
78
+
70 79
     def add_item(self,name,item,pos=None):
71 80
         if name in self.lists.keys():
72 81
             if pos==None:
73 82
                 self.lists[name].append(item)
74 83
             else:
75 84
                 self.lists[name].insert(pos,item)
76
-                
85
+
77 86
     def del_item(self,name,pos):
78 87
         self.lists[name].pop(pos)
79
-    
88
+
80 89
     def replace_item(self,name,item,pos):
81 90
         self.lists[name][pos]=item
82
-            
83
-                           
91
+
92
+
84 93
 if __name__ == "__main__":
85 94
     c = Source()
86 95
     content = c.get_content("home")
87 96
     for item in content: print item
88 97
     #c.del_item("home",0)
89 98
     #c.del_list("favorites")
90
-    
99
+
91 100
     #c.add_item("home",("My Streams","config::favorites","","Mani saglabātie TV kanāli un video"),0)
92 101
     c.replace_item("home",("My Streams","config::my_streams","default","Mani saglabātie TV kanāli un video"),0)
93 102
     #c.add_list("favorites")
94
-    #c.add_item("favorites",("..return","back","","Atgriezties atpakaļ"))    
103
+    #c.add_item("favorites",("..return","back","","Atgriezties atpakaļ"))
95 104
     #c.add_item("favorites",("LTV1","http://streamltv.cloudy.services/ltv/LTV02.smil/playlist.m3u8","picons/latvia1.png", "Latvijas televīzijas 1.kanāls"))
96
-    
105
+
97 106
     c.write_streams()
98 107
     for item in content: print item
99
-    
108
+

BIN
sources/config.pyc Voir le fichier


+ 2
- 2
sources/iplayer.cfg Voir le fichier

@@ -1,4 +1,4 @@
1 1
 [iplayer]
2
-user = lietotajs
3
-password = parole
2
+user = ivars777@gmail.com
3
+password = kaskade7
4 4
 

+ 33
- 8
sources/iplayer.py Voir le fichier

@@ -239,11 +239,11 @@ Connection: Keep-Alive
239 239
         cmd = data.split("/")
240 240
         vid = cmd[1].split("?")[0]
241 241
         if cmd[0] == "live":
242
-            title,img,desc = self.get_epg_live(vid)
242
+            title,img,desc,nfo = self.get_epg_live(vid)
243 243
         else:
244
-            data_ = "episodes/%s"%vid
245
-            r = self.call(data_)
246
-            title,img,desc,vid = self.get_epg_video(vid)
244
+            #data_ = "episodes/%s"%vid
245
+            #r = self.call(data_)
246
+            title,img,desc,vid,nfo = self.get_epg_video(vid)
247 247
         url = "http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/format/json/mediaset/iptv-all/vpid/%s"%vid
248 248
         print "vid=%s"%vid
249 249
         print url
@@ -288,6 +288,7 @@ Connection: Keep-Alive
288 288
                     stream["lang"]="en"
289 289
                     stream["subs"]=captions
290 290
                     stream["order"]=int(s["bitrate"])
291
+                    stream["nfo"] = nfo
291 292
                     streams.append(stream)
292 293
                 else:
293 294
                     for cc in slist:
@@ -310,6 +311,7 @@ Connection: Keep-Alive
310 311
                         stream["lang"]="en"
311 312
                         stream["subs"]=captions
312 313
                         stream["order"]=int(bitrate)
314
+                        stream["nfo"] = nfo
313 315
                         streams.append(stream)
314 316
         if captions:
315 317
             for s in streams:
@@ -360,6 +362,7 @@ Connection: Keep-Alive
360 362
 
361 363
     def get_epg_video(self,vid):
362 364
         data = "episodes/%s"%vid
365
+        nfo = {}
363 366
         r = self.call(data)
364 367
         if "episodes" in r :
365 368
             ep = r["episodes"][0]
@@ -371,18 +374,38 @@ Connection: Keep-Alive
371 374
             desc = desc
372 375
             ver = ep["versions"][0]
373 376
             vid = ver["id"]
374
-            remaining = ver["availability"]["remaining"]["text"]
375
-            duration = ver["duration"]
377
+            remaining = ver["availability"]["end"].split("T")[0] #["remaining"]["text"]
378
+            duration = ver["duration"]["text"]
376 379
             first_broadcast = ver["first_broadcast"]
377 380
             desc =u"%s\n%s\%s\n%s\n%s"%(title,duration,remaining,first_broadcast,desc)
378 381
             img = ep["images"]["standard"].replace("{recipe}","512x288")
379
-            return title.encode("utf8"),img.encode("utf8"),desc.encode("utf8"),vid.encode("utf8")
382
+
383
+            #Create nfo dictionary
384
+            tt = lambda dd,k,d: dd[k] if k in dd else d
385
+            nfo_type = "tvshow" if True else "movie"
386
+            t = OrderedDict()
387
+            t["title"] = title
388
+            t["originaltitle"] = tt(ep,"original_title","")
389
+            t["thumb"] = img
390
+            t["id"] = vid
391
+            t["outline"] = ep["synopses"]["small"] if "small" in ep["synopses"] else ep["synopses"]["editorial"] if "editorial" in ep["synopses"] else ""
392
+            t["plot"] = ep["synopses"]["large"] if "large" in ep["synopses"] else ep["synopses"]["medium"] if "medium" in ep["synopses"] else p["synopses"]["small"] if "small" in ep["synopses"] else title
393
+            t["tagline"] = ep["synopses"]["editorial"] if "editorial" in ep["synopses"] else ""
394
+            t["runtime"] = tt(ver["duration"],"text","")
395
+            t["premiered"] = tt(ep,"release_date","")
396
+            t["aired"] = ver["availability"]["start"].split("T")[0] if "start" in ver["availability"] else ""
397
+            if "parent_position" in ep: t["episode"] = ep["parent_position"]
398
+
399
+            nfo[nfo_type] = t
400
+
401
+            return title.encode("utf8"),img.encode("utf8"),desc.encode("utf8"),vid.encode("utf8"),nfo
380 402
         else:
381 403
             raise Exception("No video info")
382 404
 
383 405
     def get_epg_live(self,channelid):
384 406
         data = "channels/%s/highlights?live=true"%channelid
385 407
         r = self.call(data)
408
+        nfo = {}
386 409
         if "channel_highlights" in r and r["channel_highlights"]["elements"][0]["id"] == "live":
387 410
             epg = r["channel_highlights"]["elements"][0]["initial_children"][0].copy()
388 411
             t1 = gt(epg['scheduled_start'])
@@ -403,7 +426,7 @@ Connection: Keep-Alive
403 426
             img = ""
404 427
             desc = title
405 428
 
406
-        return title.encode("utf8"),img.encode("utf8"),desc.encode("utf8")
429
+        return title.encode("utf8"),img.encode("utf8"),desc.encode("utf8"),nfo
407 430
 
408 431
     def get_channels(self):
409 432
         if self.ch:
@@ -465,6 +488,8 @@ Connection: Keep-Alive
465 488
     def _http_request(self, url,params = None, headers=None):
466 489
         if not headers: headers = self.headers
467 490
         import requests
491
+        from requests.packages.urllib3.exceptions import InsecureRequestWarning
492
+        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
468 493
         try:
469 494
             r = requests.get(url, headers=headers)
470 495
             return r.content

BIN
sources/iplayer.pyc Voir le fichier


+ 2
- 2
sources/ltc.cfg Voir le fichier

@@ -1,4 +1,4 @@
1 1
 [ltc]
2
-user = lietotajs
3
-password = parole
2
+user = ivars777
3
+password = kaskade7
4 4
 

+ 2
- 2
sources/ltc.py Voir le fichier

@@ -902,8 +902,8 @@ Referer: https://www.lattelecom.tv/
902 902
             raise Exception(u"kļūda ielogojoties")
903 903
         html = response.read()
904 904
         if not '"success":true' in html:
905
-            err = re.search('"error":"(.+?)"').group(1) if re.search('"error":"(.+?)"') else ""
906
-            raise Exception(u"Kļūda ielogojoties - %s"%err)
905
+            err = re.search('"error":"(.+?)"',html).group(1) if re.search('"error":"(.+?)"',html) else ""
906
+            raise Exception(u"Kļūda ielogojoties - %s"%err.decode("utf8"))
907 907
         self.session_id = session_id
908 908
         self.headers2["Cookie"] = "%s; "%(self.session_id)
909 909
         self.error = ""

BIN
sources/ltc.pyc Voir le fichier


+ 10
- 1
sources/streams.cfg Voir le fichier

@@ -1,4 +1,5 @@
1 1
 [home]
2
+Home
2 3
 My TV|config::my_tv|default|Mani TV kanāli (tiešraide)
3 4
 My TV archive|config::my_archive|default|Mani TV arhīvu video
4 5
 My Video|config::my_video||Mani video
@@ -19,9 +20,10 @@ SerialGURU.ru|serialguru::home|http://serialguru.ru/images/xlogo_new.png.pagespe
19 20
 USTVNow|ustvnow::home|http://watch.ustvnow.com/assets/ustvnow/img/ustvnow_og_image.png|USTVNow kanālu tiešraide
20 21
 FilmOn|filmon::home|http://behindthegloves.com/wp-content/uploads/2016/01/FilmOn-logo1.jpg|FilmOn - tiešraides un video (dažādās valodās)
21 22
 MTGPlay|config::mtg|https://www.mtg.com/wp-content/uploads/2015/11/MTG-Logo-Medium-Red-PNG.png|Other countries MTG media portals content
22
-
23
+Filmas.lv|filmas::home|https://www.filmas.lv/wp-content/uploads/2013/06/LVfilmas-logo-jauns21.png|Filmas.lv - Latvijas filmas
23 24
 
24 25
 [my_tv]
26
+My Tv
25 27
 ..return|back|default|Atgriezties atpakaļ
26 28
 LTV1|replay::tiesraide/ltv1/|http://replay.lsm.lv/resources/logo/large_ltv1.png|LTV1 tiesraide (video )
27 29
 LTV7|replay::tiesraide/ltv7/|http://replay.lsm.lv/resources/logo/large_ltv7.png|LTV7 tiesraide (video )
@@ -43,6 +45,7 @@ Canadian live (FilmOn)|filmon::group?id=44|https://static.filmon.com/assets/grou
43 45
 Sport stream|rtmp://184.172.124.216/live/test111||
44 46
 
45 47
 [my_archive]
48
+My Archive
46 49
 ..return|back||Atgriezties atpakaļ
47 50
 LTV arhīvs LV|replay::visi/jaunakie/?source=ltv&lang=lv|http://replay.lsm.lv/apple-touch-icon.png|LTV1, LTV2 pārraižu arhīvs LV
48 51
 LTV arhīvs RU|replay::vse/novie/?source=ltv&lang=ru|http://replay.lsm.lv/apple-touch-icon.png|LTV1, LTV2 pārraižu arhīvs RU
@@ -55,11 +58,13 @@ Category - News|euronews::content/getVertical?lang=en&byPage=40&page=1&vId=1|htt
55 58
 Latest programs|euronews::content/getLatestPrograms?lang=en&byPage=40&page=1|http://pbs.twimg.com/profile_images/732665354242150400/tZsCnjuh_400x400.jpg|Latest programs
56 59
 
57 60
 [my_video]
61
+My Video
58 62
 ..return|back||Atgriezties atpakaļ
59 63
 Все фильмы|filmix::films|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все фильмы
60 64
 Все сериалы|filmix::serialy|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все сериалы
61 65
 
62 66
 [my_kids]
67
+My Kids
63 68
 ..return|back|default|Atgriezties atpakaļ
64 69
 Bērnu TV|config::my_kids_tv||Bērnu TV kanāli
65 70
 Bērnu video|config::my_kids_video||Saglabātie bērnu video
@@ -74,6 +79,7 @@ Filmix bērnu seriāli|filmix::detskij/s7|http://cs5324.vk.me/g33668783/a_903fcc
74 79
 SerialGURU multenes|serialguru::mult||SerialGURU multenes
75 80
 
76 81
 [my_kids_tv]
82
+My Kids TV
77 83
 ..return|back|default|Atgriezties atpakaļ
78 84
 Kidzone|ltc::content/live-streams/951?include=quality|https://manstv.lattelecom.tv/images/01_Bildes/02_Kanalu_raidijumu_default/kidzone2_new.png|Kidzone
79 85
 Nickelodeon|ltc::content/live-streams/302?include=quality|https://manstv.lattelecom.tv/images/01_Bildes/02_Kanalu_raidijumu_default/Nickelodeon.png|Nickelodeon
@@ -86,9 +92,11 @@ CBBC (FilmOn)|filmon::channel?id=29|http://static.filmon.com/assets/channels/29/
86 92
 Om Nom (FilmOn)|filmon::channel?id=3824|http://static.filmon.com/assets/channels/3824/big_logo.png|The series chronicles Om Nom's adventures with a young boy named Evan, beginning  with the little monster's mysterious appearance on the boy's doorstep in Episode 1. The animation series goes on to reveal Om Nom's mischievous, yet endearing personality as he and Evan bond over day-to-day activities such as playing games, exploring house-hold items and celebrating holidays.
87 93
 
88 94
 [my_kids_video]
95
+My Kids Video
89 96
 ..return|back|default|Atgriezties atpakaļ
90 97
 
91 98
 [my_radio]
99
+My Radio
92 100
 ..return|back|default|Atgriezties atpakaļ
93 101
 LR1|replay::tiesraide/lr1/|http://replay.lsm.lv/resources/logo/lr1_logo.png|LR1 tiesraide (audio)
94 102
 LR2|replay::tiesraide/lr2/|http://replay.lsm.lv/resources/logo/lr2_logo.png|LR2 tiesraide (audio)
@@ -98,6 +106,7 @@ LR5|replay::tiesraide/lr5/|http://replay.lsm.lv/resources/logo/lr5_logo.png|LR5
98 106
 LR6|replay::tiesraide/lr6/|http://replay.lsm.lv/resources/logo/lr6_logo.png|LR6 tiesraide (audio)
99 107
 
100 108
 [mtg]
109
+MTG
101 110
 ..return|back|default|Atgriezties atpakaļ
102 111
 Estonia (tv3play.ee)|mtgplay::home?country=ee||MTG Estonia media portal content
103 112
 Lithuania (play.tv3.lt/)|mtgplay::home?country=lt||MTG Lithuania media portal content

+ 2
- 2
sources/tvdom.cfg Voir le fichier

@@ -1,4 +1,4 @@
1 1
 [tvdom]
2
-user = lietotajs
3
-password = parole
2
+user = ivars777@gmail.com
3
+password = kaskade7
4 4
 

+ 13
- 11
sources/tvdom.py Voir le fichier

@@ -42,7 +42,7 @@ class Source(SourceBase):
42 42
         self.options_read()
43 43
 
44 44
     def login(self,user="",password=""):
45
-        self.options_read()        
45
+        self.options_read()
46 46
         if not user: user=self.options["user"]
47 47
         if not password: password = self.options["password"]
48 48
         headers = headers2dict("""
@@ -57,10 +57,12 @@ Referer: https://tvdom.tv/
57 57
         url = "https://tvdom.tv/infinity/on_register_user"
58 58
         params = "email=%s&password=%s&remember=false&auth_type=login"%(user,password)
59 59
         import requests
60
-        r = requests.post(url, data=params, headers=headers)	
60
+        from requests.packages.urllib3.exceptions import InsecureRequestWarning
61
+        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
62
+        r = requests.post(url, data=params, headers=headers)
61 63
         js = json.loads(r.content)
62 64
         if 'success' in r.content:
63
-            self.token = js["access_token"] 
65
+            self.token = js["access_token"]
64 66
             if 'PHPSESSID' in r.cookies:
65 67
                 self.session = r.cookies["PHPSESSID"]
66 68
             return True
@@ -98,7 +100,7 @@ Referer: https://tvdom.tv/
98 100
                 title =  h.unescape(title.decode("utf8")).encode("utf8")
99 101
                 img = "https://tvdom.tv"+item[2]
100 102
                 data2 = "tiesraides/%s/"%item[1]
101
-                desc = "%s\n%s\n%s"%(title,item[3],item[4])		    
103
+                desc = "%s\n%s\n%s"%(title,item[3],item[4])
102 104
                 channels[item[1]]={"title":title,"img":img,"desc":desc}
103 105
                 #content.append((title,self.name+"::"+data2,img,desc))
104 106
 
@@ -137,9 +139,9 @@ Referer: https://tvdom.tv/
137 139
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
138 140
             desc = m.group(1) if m else title
139 141
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
140
-            desc = m.group(1) if m else title 
142
+            desc = m.group(1) if m else title
141 143
             m = re.search('var promo_image *= "([^"]+)', r, re.DOTALL)
142
-            img = m.group(1) if m else ""            
144
+            img = m.group(1) if m else ""
143 145
             return (title,data2,img,desc)
144 146
 
145 147
         ### Search ###
@@ -196,10 +198,10 @@ Referer: https://tvdom.tv/
196 198
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
197 199
             desc = m.group(1) if m else title
198 200
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
199
-            desc = m.group(1) if m else title 
201
+            desc = m.group(1) if m else title
200 202
             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
201
-            img = m.group(1) if m else ""            
202
-            content.append((title,self.name+"::"+data2,img,desc)) 
203
+            img = m.group(1) if m else ""
204
+            content.append((title,self.name+"::"+data2,img,desc))
203 205
             i = r.find('<span class="slider-top-title"')
204 206
             if i>0: r = r[:i]
205 207
             for item in re.findall('<div class="col-md-9 redirect-to-url same-event" data-href="/([^"]+)">.+?image" src="([^"]+)".+?<h3 class="same-title">([^<]+)</h3>.*?<h5 class="same-online">([^<]+)</h5>', r, re.DOTALL):
@@ -230,9 +232,9 @@ Referer: https://tvdom.tv/
230 232
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
231 233
             desc = m.group(1) if m else title
232 234
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
233
-            desc = m.group(1) if m else title 
235
+            desc = m.group(1) if m else title
234 236
             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
235
-            img = m.group(1) if m else ""            
237
+            img = m.group(1) if m else ""
236 238
             return (title,data2,img,desc)
237 239
 
238 240
 

BIN
sources/tvdom.pyc Voir le fichier


+ 2
- 2
sources/ustvnow.cfg Voir le fichier

@@ -1,4 +1,4 @@
1 1
 [ustvnow]
2
-user = lietotajs
3
-password = parole
2
+user = ivars777@gmail.com
3
+password = kaskade7
4 4
 

+ 11
- 6
sources/ustvnow.py Voir le fichier

@@ -12,6 +12,7 @@ except:
12 12
 
13 13
 import urllib2, urllib
14 14
 import datetime, re, sys,os
15
+import traceback
15 16
 from collections import OrderedDict
16 17
 from SourceBase import SourceBase
17 18
 
@@ -43,9 +44,9 @@ class Source(SourceBase):
43 44
         self.options_read()
44 45
 
45 46
     def login(self,user="",password=""):
47
+        self.options_read()
46 48
         if not user: user=self.options["user"]
47 49
         if not password: password = self.options["password"]
48
-        self.options_read()        
49 50
         headers = headers2dict("""
50 51
         Host: m-api.ustvnow.com
51 52
         Accept-Language: en-US,en;q=0.5
@@ -64,9 +65,9 @@ class Source(SourceBase):
64 65
             return False
65 66
 
66 67
     def get_content(self, data):
67
-        print "[tvdom] get_content:", data
68
+        print "[ustvnow] get_content:", data
68 69
         if "::" in data:
69
-            data = data.split("::")[1] 
70
+            data = data.split("::")[1]
70 71
         path = data.split("?")[0]
71 72
         clist = path.split("/")[0]
72 73
         params = data[data.find("?"):] if "?" in data else ""
@@ -100,7 +101,7 @@ class Source(SourceBase):
100 101
             if not self.r:
101 102
                 return content
102 103
             for item in self.r["results"]:
103
-                if item["order"] == 1:    
104
+                if item["order"] == 1:
104 105
                     title = item["stream_code"]
105 106
                     title =  h.unescape(title.decode("utf8")).encode("utf8")
106 107
                     img = "http://m-api.ustvnow.com/"+item["prg_img"] #item["img"]
@@ -116,6 +117,10 @@ class Source(SourceBase):
116 117
             if not r:
117 118
                 return ("No stream found %s"%data,"","","No stream found")
118 119
             r = json.loads(r)
120
+            if not "r" in dir(self):
121
+                if not self.token:
122
+                    self.login()
123
+                self.r = self.call("live/channelguide?token=%s"%self.token)
119 124
             if self.r:
120 125
                 ch = qs["scode"]
121 126
                 for item in self.r["results"]:
@@ -129,8 +134,8 @@ class Source(SourceBase):
129 134
                 title = data
130 135
             data2 = r["stream"]
131 136
             desc = title
132
-            img = ""          
133
-            return (title,data2,img,desc)               
137
+            img = "" # img TODO
138
+            return (title,data2,img,desc)
134 139
 
135 140
     def is_video(self,data):
136 141
         if "::" in data:

BIN
sources/ustvnow.pyc Voir le fichier


+ 2
- 2
sources/viaplay.cfg Voir le fichier

@@ -1,5 +1,5 @@
1 1
 [viaplay]
2
-user = change_user
3
-password = change_password
2
+user = ivars777@gmail.com
3
+password = kaskade7
4 4
 device = 
5 5
 

+ 4
- 1
sources/viaplay.py Voir le fichier

@@ -10,7 +10,10 @@ try:
10 10
 except:
11 11
     import simplejson as json
12 12
 
13
-import requests, urlparse, urllib
13
+import requests
14
+from requests.packages.urllib3.exceptions import InsecureRequestWarning
15
+requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
16
+import urlparse, urllib
14 17
 import datetime, time,re, sys,os
15 18
 from collections import OrderedDict
16 19
 from SourceBase import SourceBase

BIN
sources/viaplay.pyc Voir le fichier