Browse Source

ltc info update u.c.

Ivars 7 years ago
parent
commit
557dc6cd95
2 changed files with 539 additions and 475 deletions
  1. 518
    463
      project.wpr
  2. 21
    12
      sources/ltc.py

+ 518
- 463
project.wpr
File diff suppressed because it is too large
View File


+ 21
- 12
sources/ltc.py View File

99
         elif path == 'viss/search/': #TODO vod/search/{q}
99
         elif path == 'viss/search/': #TODO vod/search/{q}
100
             r = self.call2(data)
100
             r = self.call2(data)
101
             if "cat=movies" in data:
101
             if "cat=movies" in data:
102
-                result = re.findall(' class="forward-link" href="/([^"]+)"><img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r)
102
+                result = re.findall('class="forward-link" href="/([^"]+)">(<div class="new-movie">Premiere</div>)*<img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r, re.MULTILINE)
103
                 for item in result:
103
                 for item in result:
104
-                    title = item[2]
104
+                    title = item[3]
105
+                    if not item[1]:
106
+                        title = title + "[P]"
105
                     data2 = item[0][0:-1]
107
                     data2 = item[0][0:-1]
106
-                    img = "https://www.lattelecom.tv" + item[1]
108
+                    img = "https://www.lattelecom.tv" + item[2]
107
                     desc = title
109
                     desc = title
108
                     content.append((title,self.name+"::"+data2,img,desc))
110
                     content.append((title,self.name+"::"+data2,img,desc))
109
                 return content
111
                 return content
112
 
114
 
113
         ### Tiešraides kanānālu saraksts ###
115
         ### Tiešraides kanānālu saraksts ###
114
         elif data=="tiesraide":
116
         elif data=="tiesraide":
115
-            r = self.call2(data)
116
-            m = re.search("var xprs_ides_array = (.+);", r, re.MULTILINE)
117
-            if m:
118
-                js=json.loads(m.group(1))
119
-            else:
120
-                raise Exception("Error reading channel list")
117
+            #r = self.call2(data)
118
+            #m = re.search("var xprs_ides_array = (.+);", r, re.MULTILINE)
119
+            #if m:
120
+            #    js=json.loads(m.group(1))
121
+            #else:
122
+            #    raise Exception("Error reading channel list")
123
+            r = self.call2("program-snippet.json")
124
+            try:
125
+                js = json.loads(r)
126
+            except:
127
+                js = {}
121
             for item in self.get_channels():
128
             for item in self.get_channels():
122
                 if item["live"]=='0':continue
129
                 if item["live"]=='0':continue
123
                 title = item["name"]
130
                 title = item["name"]
124
                 data2 = "content/live-streams/%s?include=quality"%item["id"]
131
                 data2 = "content/live-streams/%s?include=quality"%item["id"]
125
-                if item['xprs_id'] in js:
126
-                    epg = js[item['xprs_id']]
132
+                if item["xprs_id"] in js:
133
+                    epg = js[item["xprs_id"]]
127
                     desc = "%s - %s (%s-%s)"%(title,epg[0]["t"],epg[0]["hs"],epg[0]["he"])
134
                     desc = "%s - %s (%s-%s)"%(title,epg[0]["t"],epg[0]["hs"],epg[0]["he"])
128
-                    img = "https://www.lattelecom.tv" + epg[0]["p"]
135
+                    #img = "https://www.lattelecom.tv" + epg[0]["p"]
136
+                    img = "https://manstv.lattelecom.tv/"+ item['broadcast_default_picture']
129
                 else:
137
                 else:
130
                     img = "https://manstv.lattelecom.tv/"+ item['broadcast_default_picture']
138
                     img = "https://manstv.lattelecom.tv/"+ item['broadcast_default_picture']
131
                     desc = title
139
                     desc = title
431
                     t1 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_start"])).strftime('%H:%M')
439
                     t1 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_start"])).strftime('%H:%M')
432
                     t2 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_stop"])).strftime('%H:%M')
440
                     t2 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_stop"])).strftime('%H:%M')
433
                     title = "%s (%s-%s)"%(title,t1,t2)
441
                     title = "%s (%s-%s)"%(title,t1,t2)
442
+                    img = "https://manstv.lattelecom.tv/cache/" + r2["items"][0]["url"]
434
                     desc = r2["items"][0]["description"]
443
                     desc = r2["items"][0]["description"]
435
                 else:
444
                 else:
436
                     title = ch["name"]
445
                     title = ch["name"]