Sfoglia il codice sorgente

ltc info update u.c.

Ivars 7 anni fa
parent
commit
557dc6cd95
2 ha cambiato i file con 539 aggiunte e 475 eliminazioni
  1. 518
    463
      project.wpr
  2. 21
    12
      sources/ltc.py

+ 518
- 463
project.wpr
File diff soppresso perché troppo grande
Vedi File


+ 21
- 12
sources/ltc.py Vedi File

@@ -99,11 +99,13 @@ Accept-Language: en-US,en;q=0.8
99 99
         elif path == 'viss/search/': #TODO vod/search/{q}
100 100
             r = self.call2(data)
101 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 103
                 for item in result:
104
-                    title = item[2]
104
+                    title = item[3]
105
+                    if not item[1]:
106
+                        title = title + "[P]"
105 107
                     data2 = item[0][0:-1]
106
-                    img = "https://www.lattelecom.tv" + item[1]
108
+                    img = "https://www.lattelecom.tv" + item[2]
107 109
                     desc = title
108 110
                     content.append((title,self.name+"::"+data2,img,desc))
109 111
                 return content
@@ -112,20 +114,26 @@ Accept-Language: en-US,en;q=0.8
112 114
 
113 115
         ### Tiešraides kanānālu saraksts ###
114 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 128
             for item in self.get_channels():
122 129
                 if item["live"]=='0':continue
123 130
                 title = item["name"]
124 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 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 137
                 else:
130 138
                     img = "https://manstv.lattelecom.tv/"+ item['broadcast_default_picture']
131 139
                     desc = title
@@ -431,6 +439,7 @@ Accept-Language: en-US,en;q=0.8
431 439
                     t1 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_start"])).strftime('%H:%M')
432 440
                     t2 = datetime.datetime.fromtimestamp(int(r2["items"][0]["unix_stop"])).strftime('%H:%M')
433 441
                     title = "%s (%s-%s)"%(title,t1,t2)
442
+                    img = "https://manstv.lattelecom.tv/cache/" + r2["items"][0]["url"]
434 443
                     desc = r2["items"][0]["description"]
435 444
                 else:
436 445
                     title = ch["name"]