Browse Source

piconas apakšfolderī

run (pikonas, tmp)
filmix search
viaplay search/sort
Ivars 7 years ago
parent
commit
1b0684e478

BIN
picons/al.jpg View File


BIN
picons/art-default.jpg View File


BIN
picons/back.png View File


BIN
picons/cinemalive.png View File


BIN
picons/euronews.png View File


BIN
picons/filmas.png View File


BIN
picons/filmix.png View File


BIN
picons/filmon.png View File


BIN
picons/folder.png View File


BIN
picons/folder2.png View File


BIN
picons/folder_search.png View File


BIN
picons/icon-default.png View File


BIN
picons/iplayer.png View File


BIN
picons/latvia1.png View File


BIN
picons/latvia7.png View File


BIN
picons/lmt.jpg View File


BIN
picons/lmt.png View File


BIN
picons/lr_1_lv.png View File


BIN
picons/lr_2_lv.png View File


BIN
picons/lr_3_lv.png View File


BIN
picons/movieplace.png View File


BIN
picons/my_archive.png View File


BIN
picons/my_kids.png View File


BIN
picons/my_radio.png View File


BIN
picons/my_tv.png View File


BIN
picons/my_video.png View File


BIN
picons/prefs.png View File


BIN
picons/replay.png View File


BIN
picons/riga24.png View File


BIN
picons/shortcut.png View File


BIN
picons/skaties.png View File


BIN
picons/tvdom.png View File


BIN
picons/tvplay.png View File


BIN
picons/ustvnow.png View File


BIN
picons/viaplay.jpg View File


BIN
picons/viaplay.png View File


BIN
picons/video.png View File


+ 421
- 319
project.wpr
File diff suppressed because it is too large
View File


+ 22
- 12
resolvers/cloudsany.py View File

41
     m = re.search('cloudsany\.\w+/i/(\w+)', url)
41
     m = re.search('cloudsany\.\w+/i/(\w+)', url)
42
     if not m:
42
     if not m:
43
         return stream
43
         return stream
44
-    vid=m.group(1)
44
+    vid = str(m.group(1))
45
 
45
 
46
     r = requests.get(url, headers=headers)
46
     r = requests.get(url, headers=headers)
47
     if r.status_code <> 200:
47
     if r.status_code <> 200:
57
 
57
 
58
 
58
 
59
     # Subtitles #
59
     # Subtitles #
60
-    sub = {}
60
+    subs = []
61
+    # https://cloudsany.com/subtitles/0w3y7su4c2ko.srt
62
+    # Latvian|label|srt|subtitles
63
+    #url_sub = "https://cloudsany.com/subtitles/%s.%s" % (vid, "srt")
64
+    url_sub = "https://cloudsany.com/subtitles/%s.srt" % vid
65
+    r2 = requests.head(url_sub)
61
     m = re.search(r"(\w+)\|label\|(\w+)\|(\w+)\|subtitles", p0)
66
     m = re.search(r"(\w+)\|label\|(\w+)\|(\w+)\|subtitles", p0)
62
-    if m:
63
-        url_sub = "https://cloudsany.com/subtitles/%s.%s" % (m.group(3), m.group(2))
67
+    if r2.status_code == 200 and m:
68
+        sub = {}
69
+        #url_sub = "https://cloudsany.com/subtitles/%s.%s" % (vid, "srt")
64
         url_title = m.group(1)
70
         url_title = m.group(1)
65
         print url_title
71
         print url_title
66
         sub["url"] = url_sub
72
         sub["url"] = url_sub
67
         sub["lang"] = m.group(1)
73
         sub["lang"] = m.group(1)
68
         sub["name"] = m.group(1)
74
         sub["name"] = m.group(1)
69
-        sub["type"] = "srt"
75
+        sub["type"] = m.group(2)
76
+        subs = [sub]
70
 
77
 
71
     # Stream URL
78
     # Stream URL
72
-    m = re.search(r"tracks\|(\w+)\|(\w+)\|(\w+)\|files\|(\w+)\|(\w+)\|(\w+)", p0)
73
-    if not m:
79
+    # co|sanii|dl1|file
80
+    m1 = re.search("\|(co)\|(\w+)\|(\w+)\|", p0)
81
+    # tracks|mp4|video|ut4dluxu56tyll|files
82
+    m2 = re.search(r"tracks\|(\w+)\|(\w+)\|(\w+)\|files", p0)
83
+    # 0://c.b.a/1t/6/1s/1r.1q
84
+    m3 = re.search(r"0://\w+\.\w+\.\w+/\w+/(\d+)/", r)
85
+    if not (m1 and m2 and m3):
74
         raise Exception("Can not find stream url")
86
         raise Exception("Can not find stream url")
75
-    #https://dl4.sanii.co/files/8/80mbh8zjyuh61n/video.mp4
76
-    # 0://1v.1u.1t/1s/2/1r/1q.1p
77
-    num = re.search(r"0://1\w\.1\w\.1\w/1\w/(\d+)", r).group(1)
87
+    # https://dl1.sanii.co/files/6/ut4dluxu56tyll/video.mp4
78
     url = "https://%s.%s.%s/files/%s/%s/%s.%s" % (
88
     url = "https://%s.%s.%s/files/%s/%s/%s.%s" % (
79
-        m.group(6), m.group(5), m.group(4), num, m.group(3), m.group(2), m.group(1))
89
+        m1.group(3), m1.group(2), m1.group(1), m3.group(1), m2.group(3), m2.group(2), m2.group(1))
80
     print url
90
     print url
81
 
91
 
82
     s = util.item()
92
     s = util.item()
84
     s["type"] = util.stream_type(s["url"])
94
     s["type"] = util.stream_type(s["url"])
85
     s["resolver"] = __name__
95
     s["resolver"] = __name__
86
     #s["lang"] = lang
96
     #s["lang"] = lang
87
-    s["subs"] = [sub]
97
+    s["subs"] = subs
88
     s["name"] = url
98
     s["name"] = url
89
     return [s]
99
     return [s]
90
 
100
 

+ 6
- 4
run.py View File

11
 
11
 
12
 import PIL, StringIO
12
 import PIL, StringIO
13
 from PIL import ImageTk, Image
13
 from PIL import ImageTk, Image
14
-import requests, urllib2
14
+import requests, urllib2, tempfile
15
 
15
 
16
 from ContentSources import ContentSources
16
 from ContentSources import ContentSources
17
 from sources.SourceBase import stream_type
17
 from sources.SourceBase import stream_type
36
             self.sources = sources
36
             self.sources = sources
37
         else:
37
         else:
38
             self.sources = ContentSources("sources", cfg_file)
38
             self.sources = ContentSources("sources", cfg_file)
39
-        self.picons_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "picons")
40
-        self.tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp")
39
+        self.picons_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "picons")
40
+        #self.tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp")
41
+        self.tmp_path = os.path.join(tempfile.gettempdir(), "playstream")
41
         if not os.path.exists(self.tmp_path):
42
         if not os.path.exists(self.tmp_path):
42
             os.mkdir(self.tmp_path)
43
             os.mkdir(self.tmp_path)
43
         self.history = []
44
         self.history = []
125
             if not self.sources.is_video(data):
126
             if not self.sources.is_video(data):
126
                 if "{0}" in data:
127
                 if "{0}" in data:
127
                     a = tkd.askstring("Search", "Search for")
128
                     a = tkd.askstring("Search", "Search for")
128
-                    cur2 = (cur2[0],cur2[1].format(a),cur2[2],cur2[3])
129
+                    cur2 = (cur2[0],cur2[1].format(a.encode("utf8")),cur2[2],cur2[3])
129
                 self.history.append((self.cur, cs))
130
                 self.history.append((self.cur, cs))
130
                 self.cur = self.content[cs]
131
                 self.cur = self.content[cs]
131
                 self.cur_index = 0
132
                 self.cur_index = 0
466
             self.listbox2.pack(side=LEFT, fill=BOTH, expand=1)
467
             self.listbox2.pack(side=LEFT, fill=BOTH, expand=1)
467
             scrollbar3.pack(side=LEFT, fill=Y)
468
             scrollbar3.pack(side=LEFT, fill=Y)
468
             for i,s in enumerate(self.subs):
469
             for i,s in enumerate(self.subs):
470
+                if not len(s):continue
469
                 item = ("%s - %s"%(s["lang"],s["name"])).encode("utf8")
471
                 item = ("%s - %s"%(s["lang"],s["name"])).encode("utf8")
470
                 self.listbox2.insert(END, item)
472
                 self.listbox2.insert(END, item)
471
             #self.listbox2.bind('<Double-1> ', self.list_select)
473
             #self.listbox2.bind('<Double-1> ', self.list_select)

+ 11
- 7
sources/filmix.py View File

73
             if len(plist) < 2:
73
             if len(plist) < 2:
74
                 return content
74
                 return content
75
             import requests
75
             import requests
76
-            ses = requests.session()
77
-            r = ses.get(self.url+data)
76
+            #ses = requests.session()
77
+            r = requests.get(self.url+data)
78
+            cookie = r.cookies["FILMIXNET"]
78
             url = "https://filmix.me/engine/ajax/sphinx_search.php"
79
             url = "https://filmix.me/engine/ajax/sphinx_search.php"
79
             headers = headers2dict("""
80
             headers = headers2dict("""
80
-                User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
81
-                Content-Type: application/x-www-form-urlencoded; charset=UTF-8
82
-            """)
83
-            data = "scf=fx&story=%s&search_start=0&do=search&subaction=search" % (plist[1].replace(" ", "+"))
84
-            r = ses.post(url, data, headers=headers)
81
+User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
82
+X-Requested-With: XMLHttpRequest
83
+Content-Type: application/x-www-form-urlencoded; charset=UTF-8
84
+Cookie: FILMIXNET=%s
85
+"""% cookie)
86
+            #data = "scf=fx&story=%s&search_start=0&do=search&subaction=search" % (plist[1].replace(" ", "+"))
87
+            data = "sdc=fx&story=%s&do=search&subaction=search"% (plist[1].replace(" ", "+"))
88
+            r = requests.post(url, data, headers=headers)
85
             #r = r.content.decode("cp1251").encode("utf8")
89
             #r = r.content.decode("cp1251").encode("utf8")
86
             content = self.process_list(r.content, content)
90
             content = self.process_list(r.content, content)
87
             return content
91
             return content

+ 16
- 15
sources/ltc.py View File

81
 
81
 
82
         if clist=="home":
82
         if clist=="home":
83
             content.extend([
83
             content.extend([
84
-                ("Search TV", "ltc::search/{0}","","Search in TV archive"),
85
-                ("Search Video", "ltc::viss/search/?cat=movies&q={0}","","Search in video"),
86
-                ("Live streams", "ltc::tiesraide","","TV live streams"),
87
-                ("Archive", "ltc::arhivs","","TV live archive"),
88
-                ("Video", "ltc::videonoma","","Video on demand"),
84
+                #("Meklēt TV arhīvā", "ltc::search/{0}","","Meklēt TV arhīvā"), #TODO
85
+                ("Meklēt filmas", "ltc::viss/search/?cat=movies&q={0}","","Meklēt filmu sadaļā"),
86
+                ("Meklēt seriālus", "ltc::viss/search/?cat=series&q={0}","","Meklēt seriālu sadaļā"),
87
+                ("TV tiešraides", "ltc::tiesraide","","TV tiesraides"),
88
+                ("TV arhīvs", "ltc::arhivs","","TV arhīvs atseviškiem kanāliem"),
89
+                ("Videonoma", "ltc::videonoma","","Filmas (ari Priemiere) un seriāli"),
89
             ])
90
             ])
90
             return content
91
             return content
91
 
92
 
99
             r = self.call2(data)
100
             r = self.call2(data)
100
             if "cat=movies" in data:
101
             if "cat=movies" in data:
101
                 result = re.findall('class="forward-link" href="/([^"]+)">(<div class="new-movie">Premiere</div>)*<img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r, re.MULTILINE)
102
                 result = re.findall('class="forward-link" href="/([^"]+)">(<div class="new-movie">Premiere</div>)*<img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r, re.MULTILINE)
102
-                for item in result:
103
-                    title = item[3]
104
-                    if not item[1]:
105
-                        title = title + "[P]"
106
-                    data2 = item[0][0:-1]
107
-                    img = "https://www.shortcut.lv" + item[2]
108
-                    desc = title
109
-                    content.append((title,self.name+"::"+data2,img,desc))
110
-                return content
111
             else:
103
             else:
112
-                return content
104
+                result = re.findall('class="forward-link" href="/([^"]+)">(<div class="new-movie">Premiere</div>)*<img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r, re.MULTILINE)
105
+            for item in result:
106
+                title = item[3]
107
+                if not item[1]:
108
+                    title = title + "[P]"
109
+                data2 = item[0][0:-1]
110
+                img = "https://www.shortcut.lv" + item[2]
111
+                desc = title
112
+                content.append((title,self.name+"::"+data2,img,desc))
113
+            return content
113
 
114
 
114
         ### Tiešraides kanānālu saraksts ###
115
         ### Tiešraides kanānālu saraksts ###
115
         elif data=="tiesraide":
116
         elif data=="tiesraide":

+ 11
- 8
sources/mtgplay.py View File

67
 
67
 
68
         if clist=="home":
68
         if clist=="home":
69
             content.extend([
69
             content.extend([
70
-                #("Search", "mtgplay::meklet?country=%s&term={0}"%self.country,"","Search videos"), ### TODO
70
+                ("Search", "mtgplay::search?country=%s&term={0}"%self.country,"","Search videos"), ### TODO
71
                 ("TV Live", "mtgplay::videos?country=%s&order=title&type=live"%self.country,"","TV live streams(not always available)"),
71
                 ("TV Live", "mtgplay::videos?country=%s&order=title&type=live"%self.country,"","TV live streams(not always available)"),
72
                 ("Last videos", "mtgplay::videos?country=%s&order=-airdate"%self.country,"","Last aired videos"),
72
                 ("Last videos", "mtgplay::videos?country=%s&order=-airdate"%self.country,"","Last aired videos"),
73
                 ("Categories", "mtgplay::categories?country=%s&order=name"%self.country,"","Categories"),
73
                 ("Categories", "mtgplay::categories?country=%s&order=name"%self.country,"","Categories"),
74
                 ("Channels", "mtgplay::channels?country=%s&order=id"%self.country,"","TV channels"),
74
                 ("Channels", "mtgplay::channels?country=%s&order=id"%self.country,"","TV channels"),
75
-                ("Programs by name", "mtgplay::formats?country=%s&order=-title"%self.country,"","Programs by name"),
75
+                ("Programs by name", "mtgplay::formats?country=%s&order=title"%self.country,"","Programs by name"),
76
                 ("Programs by popularity", "mtgplay::formats?country=%s&order=-popularity"%self.country,"","Programs by popularity")
76
                 ("Programs by popularity", "mtgplay::formats?country=%s&order=-popularity"%self.country,"","Programs by popularity")
77
             ])
77
             ])
78
             return content
78
             return content
88
                 content.append(("Previous page", self.name+"::"+data2.encode("utf8"),"", "Goto previous page"))
88
                 content.append(("Previous page", self.name+"::"+data2.encode("utf8"),"", "Goto previous page"))
89
 
89
 
90
             if "_embedded" in r:
90
             if "_embedded" in r:
91
+                if clist == "search":
92
+                    clist = "formats"
91
                 for item in r["_embedded"][clist]:
93
                 for item in r["_embedded"][clist]:
92
                     if "title" in item:
94
                     if "title" in item:
93
                         title = item["title"]
95
                         title = item["title"]
144
                         #if "country" in qs: data2 += "&country="+qs["country"]
146
                         #if "country" in qs: data2 += "&country="+qs["country"]
145
                         #if "category" in qs: data2 += "&category="+qs["category"]
147
                         #if "category" in qs: data2 += "&category="+qs["category"]
146
                         #if "channel" in qs: data2 += "&channel="+qs["channel"]
148
                         #if "channel" in qs: data2 += "&channel="+qs["channel"]
147
-                        data2 += "&order=title"
148
-                        air_at = item["latest_video"]["publish_at"] if "publish_at" in item["latest_video"] else ""
149
-                        air_at = air_at[0:16].replace("T"," ") if air_at else ""
150
-                        if air_at:
151
-                            desc = "Last video: %s\n"%air_at + desc
149
+                        data2 += "&order=-id"
150
+                        if "lastest_video" in item:
151
+                            air_at = item["latest_video"]["publish_at"] if "publish_at" in item["latest_video"] else ""
152
+                            air_at = air_at[0:16].replace("T"," ") if air_at else ""
153
+                            if air_at:
154
+                                desc = "Last video: %s\n"%air_at + desc
152
 
155
 
153
                     ### Seasons ###
156
                     ### Seasons ###
154
                     elif clist == "seasons":
157
                     elif clist == "seasons":
157
                         #if "country" in qs: data2 += "&country="+qs["country"]
160
                         #if "country" in qs: data2 += "&country="+qs["country"]
158
                         #if "category" in qs: data2 += "&category="+qs["category"]
161
                         #if "category" in qs: data2 += "&category="+qs["category"]
159
                         #if "channel" in qs: data2 += "&channel="+qs["channel"]
162
                         #if "channel" in qs: data2 += "&channel="+qs["channel"]
160
-                        data2 += "&order=title"
163
+                        data2 += "&order=-id"
161
 
164
 
162
                         summary = item["summary"] if "summary" in item and item["summary"] else ""
165
                         summary = item["summary"] if "summary" in item and item["summary"] else ""
163
                         try:
166
                         try: