Ivars 7 years ago
parent
commit
b12ee6f123

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


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


+ 13
- 3
sources/SourceBase.py View File

9
 import urllib2, urllib
9
 import urllib2, urllib
10
 import datetime, re, sys,os
10
 import datetime, re, sys,os
11
 import requests
11
 import requests
12
+from requests.packages.urllib3.exceptions import InsecureRequestWarning
13
+requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
12
 from collections import OrderedDict
14
 from collections import OrderedDict
13
 import ConfigParser
15
 import ConfigParser
14
 try:
16
 try:
64
         stream["type"] = stream_type(content[1]).encode("utf8")
66
         stream["type"] = stream_type(content[1]).encode("utf8")
65
         return[stream]
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
     def options_read(self):
77
     def options_read(self):
68
         if not ("options" in dir(self) and self.options): # process options only if self.options defined, self.config_file should be defined too
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
             return None
79
             return None
103
             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")
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
         try:
114
         try:
105
             if params:
115
             if params:
106
-                r = requests.post(url, data=params, headers=headers)
116
+                r = requests.post(url, data=params, headers=headers,verify=False)
107
             else:
117
             else:
108
-                r = requests.get(url, headers=headers)
118
+                r = requests.get(url, headers=headers,verify=False)
109
             return r.content
119
             return r.content
110
         except Exception as ex:
120
         except Exception as ex:
111
             if "read" in ex:
121
             if "read" in ex:
138
     data = data.lower()
148
     data = data.lower()
139
     m = re.search(r"^(\w+)://", data)
149
     m = re.search(r"^(\w+)://", data)
140
     prefix = m.group(1) if m else ""
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
         return "hls"
152
         return "hls"
143
     elif prefix == "http":
153
     elif prefix == "http":
144
         return "http"
154
         return "http"

BIN
sources/SourceBase.pyc View File


+ 30
- 21
sources/config.py View File

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

BIN
sources/config.pyc View File


+ 2
- 2
sources/iplayer.cfg View File

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

+ 33
- 8
sources/iplayer.py View File

239
         cmd = data.split("/")
239
         cmd = data.split("/")
240
         vid = cmd[1].split("?")[0]
240
         vid = cmd[1].split("?")[0]
241
         if cmd[0] == "live":
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
         else:
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
         url = "http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/format/json/mediaset/iptv-all/vpid/%s"%vid
247
         url = "http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/format/json/mediaset/iptv-all/vpid/%s"%vid
248
         print "vid=%s"%vid
248
         print "vid=%s"%vid
249
         print url
249
         print url
288
                     stream["lang"]="en"
288
                     stream["lang"]="en"
289
                     stream["subs"]=captions
289
                     stream["subs"]=captions
290
                     stream["order"]=int(s["bitrate"])
290
                     stream["order"]=int(s["bitrate"])
291
+                    stream["nfo"] = nfo
291
                     streams.append(stream)
292
                     streams.append(stream)
292
                 else:
293
                 else:
293
                     for cc in slist:
294
                     for cc in slist:
310
                         stream["lang"]="en"
311
                         stream["lang"]="en"
311
                         stream["subs"]=captions
312
                         stream["subs"]=captions
312
                         stream["order"]=int(bitrate)
313
                         stream["order"]=int(bitrate)
314
+                        stream["nfo"] = nfo
313
                         streams.append(stream)
315
                         streams.append(stream)
314
         if captions:
316
         if captions:
315
             for s in streams:
317
             for s in streams:
360
 
362
 
361
     def get_epg_video(self,vid):
363
     def get_epg_video(self,vid):
362
         data = "episodes/%s"%vid
364
         data = "episodes/%s"%vid
365
+        nfo = {}
363
         r = self.call(data)
366
         r = self.call(data)
364
         if "episodes" in r :
367
         if "episodes" in r :
365
             ep = r["episodes"][0]
368
             ep = r["episodes"][0]
371
             desc = desc
374
             desc = desc
372
             ver = ep["versions"][0]
375
             ver = ep["versions"][0]
373
             vid = ver["id"]
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
             first_broadcast = ver["first_broadcast"]
379
             first_broadcast = ver["first_broadcast"]
377
             desc =u"%s\n%s\%s\n%s\n%s"%(title,duration,remaining,first_broadcast,desc)
380
             desc =u"%s\n%s\%s\n%s\n%s"%(title,duration,remaining,first_broadcast,desc)
378
             img = ep["images"]["standard"].replace("{recipe}","512x288")
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
         else:
402
         else:
381
             raise Exception("No video info")
403
             raise Exception("No video info")
382
 
404
 
383
     def get_epg_live(self,channelid):
405
     def get_epg_live(self,channelid):
384
         data = "channels/%s/highlights?live=true"%channelid
406
         data = "channels/%s/highlights?live=true"%channelid
385
         r = self.call(data)
407
         r = self.call(data)
408
+        nfo = {}
386
         if "channel_highlights" in r and r["channel_highlights"]["elements"][0]["id"] == "live":
409
         if "channel_highlights" in r and r["channel_highlights"]["elements"][0]["id"] == "live":
387
             epg = r["channel_highlights"]["elements"][0]["initial_children"][0].copy()
410
             epg = r["channel_highlights"]["elements"][0]["initial_children"][0].copy()
388
             t1 = gt(epg['scheduled_start'])
411
             t1 = gt(epg['scheduled_start'])
403
             img = ""
426
             img = ""
404
             desc = title
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
     def get_channels(self):
431
     def get_channels(self):
409
         if self.ch:
432
         if self.ch:
465
     def _http_request(self, url,params = None, headers=None):
488
     def _http_request(self, url,params = None, headers=None):
466
         if not headers: headers = self.headers
489
         if not headers: headers = self.headers
467
         import requests
490
         import requests
491
+        from requests.packages.urllib3.exceptions import InsecureRequestWarning
492
+        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
468
         try:
493
         try:
469
             r = requests.get(url, headers=headers)
494
             r = requests.get(url, headers=headers)
470
             return r.content
495
             return r.content

BIN
sources/iplayer.pyc View File


+ 2
- 2
sources/ltc.cfg View File

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

+ 2
- 2
sources/ltc.py View File

902
             raise Exception(u"kļūda ielogojoties")
902
             raise Exception(u"kļūda ielogojoties")
903
         html = response.read()
903
         html = response.read()
904
         if not '"success":true' in html:
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
         self.session_id = session_id
907
         self.session_id = session_id
908
         self.headers2["Cookie"] = "%s; "%(self.session_id)
908
         self.headers2["Cookie"] = "%s; "%(self.session_id)
909
         self.error = ""
909
         self.error = ""

BIN
sources/ltc.pyc View File


+ 10
- 1
sources/streams.cfg View File

1
 [home]
1
 [home]
2
+Home
2
 My TV|config::my_tv|default|Mani TV kanāli (tiešraide)
3
 My TV|config::my_tv|default|Mani TV kanāli (tiešraide)
3
 My TV archive|config::my_archive|default|Mani TV arhīvu video
4
 My TV archive|config::my_archive|default|Mani TV arhīvu video
4
 My Video|config::my_video||Mani video
5
 My Video|config::my_video||Mani video
19
 USTVNow|ustvnow::home|http://watch.ustvnow.com/assets/ustvnow/img/ustvnow_og_image.png|USTVNow kanālu tiešraide
20
 USTVNow|ustvnow::home|http://watch.ustvnow.com/assets/ustvnow/img/ustvnow_og_image.png|USTVNow kanālu tiešraide
20
 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
 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
 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
 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
 [my_tv]
25
 [my_tv]
26
+My Tv
25
 ..return|back|default|Atgriezties atpakaļ
27
 ..return|back|default|Atgriezties atpakaļ
26
 LTV1|replay::tiesraide/ltv1/|http://replay.lsm.lv/resources/logo/large_ltv1.png|LTV1 tiesraide (video )
28
 LTV1|replay::tiesraide/ltv1/|http://replay.lsm.lv/resources/logo/large_ltv1.png|LTV1 tiesraide (video )
27
 LTV7|replay::tiesraide/ltv7/|http://replay.lsm.lv/resources/logo/large_ltv7.png|LTV7 tiesraide (video )
29
 LTV7|replay::tiesraide/ltv7/|http://replay.lsm.lv/resources/logo/large_ltv7.png|LTV7 tiesraide (video )
43
 Sport stream|rtmp://184.172.124.216/live/test111||
45
 Sport stream|rtmp://184.172.124.216/live/test111||
44
 
46
 
45
 [my_archive]
47
 [my_archive]
48
+My Archive
46
 ..return|back||Atgriezties atpakaļ
49
 ..return|back||Atgriezties atpakaļ
47
 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
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
 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
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
 Latest programs|euronews::content/getLatestPrograms?lang=en&byPage=40&page=1|http://pbs.twimg.com/profile_images/732665354242150400/tZsCnjuh_400x400.jpg|Latest programs
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
 [my_video]
60
 [my_video]
61
+My Video
58
 ..return|back||Atgriezties atpakaļ
62
 ..return|back||Atgriezties atpakaļ
59
 Все фильмы|filmix::films|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все фильмы
63
 Все фильмы|filmix::films|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все фильмы
60
 Все сериалы|filmix::serialy|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все сериалы
64
 Все сериалы|filmix::serialy|http://cs5324.vk.me/g33668783/a_903fcc63.jpg|Все сериалы
61
 
65
 
62
 [my_kids]
66
 [my_kids]
67
+My Kids
63
 ..return|back|default|Atgriezties atpakaļ
68
 ..return|back|default|Atgriezties atpakaļ
64
 Bērnu TV|config::my_kids_tv||Bērnu TV kanāli
69
 Bērnu TV|config::my_kids_tv||Bērnu TV kanāli
65
 Bērnu video|config::my_kids_video||Saglabātie bērnu video
70
 Bērnu video|config::my_kids_video||Saglabātie bērnu video
74
 SerialGURU multenes|serialguru::mult||SerialGURU multenes
79
 SerialGURU multenes|serialguru::mult||SerialGURU multenes
75
 
80
 
76
 [my_kids_tv]
81
 [my_kids_tv]
82
+My Kids TV
77
 ..return|back|default|Atgriezties atpakaļ
83
 ..return|back|default|Atgriezties atpakaļ
78
 Kidzone|ltc::content/live-streams/951?include=quality|https://manstv.lattelecom.tv/images/01_Bildes/02_Kanalu_raidijumu_default/kidzone2_new.png|Kidzone
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
 Nickelodeon|ltc::content/live-streams/302?include=quality|https://manstv.lattelecom.tv/images/01_Bildes/02_Kanalu_raidijumu_default/Nickelodeon.png|Nickelodeon
85
 Nickelodeon|ltc::content/live-streams/302?include=quality|https://manstv.lattelecom.tv/images/01_Bildes/02_Kanalu_raidijumu_default/Nickelodeon.png|Nickelodeon
86
 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.
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
 [my_kids_video]
94
 [my_kids_video]
95
+My Kids Video
89
 ..return|back|default|Atgriezties atpakaļ
96
 ..return|back|default|Atgriezties atpakaļ
90
 
97
 
91
 [my_radio]
98
 [my_radio]
99
+My Radio
92
 ..return|back|default|Atgriezties atpakaļ
100
 ..return|back|default|Atgriezties atpakaļ
93
 LR1|replay::tiesraide/lr1/|http://replay.lsm.lv/resources/logo/lr1_logo.png|LR1 tiesraide (audio)
101
 LR1|replay::tiesraide/lr1/|http://replay.lsm.lv/resources/logo/lr1_logo.png|LR1 tiesraide (audio)
94
 LR2|replay::tiesraide/lr2/|http://replay.lsm.lv/resources/logo/lr2_logo.png|LR2 tiesraide (audio)
102
 LR2|replay::tiesraide/lr2/|http://replay.lsm.lv/resources/logo/lr2_logo.png|LR2 tiesraide (audio)
98
 LR6|replay::tiesraide/lr6/|http://replay.lsm.lv/resources/logo/lr6_logo.png|LR6 tiesraide (audio)
106
 LR6|replay::tiesraide/lr6/|http://replay.lsm.lv/resources/logo/lr6_logo.png|LR6 tiesraide (audio)
99
 
107
 
100
 [mtg]
108
 [mtg]
109
+MTG
101
 ..return|back|default|Atgriezties atpakaļ
110
 ..return|back|default|Atgriezties atpakaļ
102
 Estonia (tv3play.ee)|mtgplay::home?country=ee||MTG Estonia media portal content
111
 Estonia (tv3play.ee)|mtgplay::home?country=ee||MTG Estonia media portal content
103
 Lithuania (play.tv3.lt/)|mtgplay::home?country=lt||MTG Lithuania media portal content
112
 Lithuania (play.tv3.lt/)|mtgplay::home?country=lt||MTG Lithuania media portal content

+ 2
- 2
sources/tvdom.cfg View File

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

+ 13
- 11
sources/tvdom.py View File

42
         self.options_read()
42
         self.options_read()
43
 
43
 
44
     def login(self,user="",password=""):
44
     def login(self,user="",password=""):
45
-        self.options_read()        
45
+        self.options_read()
46
         if not user: user=self.options["user"]
46
         if not user: user=self.options["user"]
47
         if not password: password = self.options["password"]
47
         if not password: password = self.options["password"]
48
         headers = headers2dict("""
48
         headers = headers2dict("""
57
         url = "https://tvdom.tv/infinity/on_register_user"
57
         url = "https://tvdom.tv/infinity/on_register_user"
58
         params = "email=%s&password=%s&remember=false&auth_type=login"%(user,password)
58
         params = "email=%s&password=%s&remember=false&auth_type=login"%(user,password)
59
         import requests
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
         js = json.loads(r.content)
63
         js = json.loads(r.content)
62
         if 'success' in r.content:
64
         if 'success' in r.content:
63
-            self.token = js["access_token"] 
65
+            self.token = js["access_token"]
64
             if 'PHPSESSID' in r.cookies:
66
             if 'PHPSESSID' in r.cookies:
65
                 self.session = r.cookies["PHPSESSID"]
67
                 self.session = r.cookies["PHPSESSID"]
66
             return True
68
             return True
98
                 title =  h.unescape(title.decode("utf8")).encode("utf8")
100
                 title =  h.unescape(title.decode("utf8")).encode("utf8")
99
                 img = "https://tvdom.tv"+item[2]
101
                 img = "https://tvdom.tv"+item[2]
100
                 data2 = "tiesraides/%s/"%item[1]
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
                 channels[item[1]]={"title":title,"img":img,"desc":desc}
104
                 channels[item[1]]={"title":title,"img":img,"desc":desc}
103
                 #content.append((title,self.name+"::"+data2,img,desc))
105
                 #content.append((title,self.name+"::"+data2,img,desc))
104
 
106
 
137
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
139
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
138
             desc = m.group(1) if m else title
140
             desc = m.group(1) if m else title
139
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
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
             m = re.search('var promo_image *= "([^"]+)', r, re.DOTALL)
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
             return (title,data2,img,desc)
145
             return (title,data2,img,desc)
144
 
146
 
145
         ### Search ###
147
         ### Search ###
196
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
198
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
197
             desc = m.group(1) if m else title
199
             desc = m.group(1) if m else title
198
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
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
             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
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
             i = r.find('<span class="slider-top-title"')
205
             i = r.find('<span class="slider-top-title"')
204
             if i>0: r = r[:i]
206
             if i>0: r = r[:i]
205
             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):
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
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
232
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
231
             desc = m.group(1) if m else title
233
             desc = m.group(1) if m else title
232
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
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
             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
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
             return (title,data2,img,desc)
238
             return (title,data2,img,desc)
237
 
239
 
238
 
240
 

BIN
sources/tvdom.pyc View File


+ 2
- 2
sources/ustvnow.cfg View File

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

+ 11
- 6
sources/ustvnow.py View File

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

BIN
sources/ustvnow.pyc View File


+ 2
- 2
sources/viaplay.cfg View File

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

+ 4
- 1
sources/viaplay.py View File

10
 except:
10
 except:
11
     import simplejson as json
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
 import datetime, time,re, sys,os
17
 import datetime, time,re, sys,os
15
 from collections import OrderedDict
18
 from collections import OrderedDict
16
 from SourceBase import SourceBase
19
 from SourceBase import SourceBase

BIN
sources/viaplay.pyc View File