Esempio n. 1
0
 def Do_SEASON_SERIES(self):
     show = json.load(
         urllib.urlopen("http://api.myshows.ru/shows/" + self.params["id"]))
     film = PrepareString(show.get('ruTitle') or "") or PrepareString(
         show.get('title') or "")
     episodes = show['episodes']
     thumb = show.get('image')
     srt = []
     for eid in episodes:
         e = episodes[eid]
         title = e["title"]
         desc = e["airDate"] or ""
         title = __language__(30014) % (
             e['seasonNumber'], e['episodeNumber']) + (title and
                                                       (u": " + title))
         et = e.get('image') or thumb
         listItem = xbmcgui.ListItem(PrepareString(title), desc, et, et)
         q = "%s  %s  %s" % (film, e['seasonNumber'], e['episodeNumber'])
         q = q.encode('utf-8')
         srt.append(
             (int(e['seasonNumber']) * 1000 + int(e['episodeNumber']),
              self.GetURL(mode=SEARCH, query=q), listItem))
     for el in sorted(srt):
         _, q, i = el
         xbmcplugin.addDirectoryItem(self.handle, q, i, True)
Esempio n. 2
0
 def Do_SERIES(self):
     series = json.load(urllib.urlopen("http://api.myshows.ru/shows/top/all/"))
     for s in series:
         thumb = s.get('image') or ""
         names = (PrepareString(s.get('title') or ""), PrepareString(s.get('ruTitle') or ""))
         if all(names):
             listItem = xbmcgui.ListItem(" / ".join(names), str(s.get('year') or ""), thumb, thumb)
         else:
             listItem = xbmcgui.ListItem(names[0] or names[1], str(s.get('year') or ""), thumb, thumb)
         xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode=SEASON_SERIES, id=s['id']), listItem, True)
Esempio n. 3
0
 def Do_ALBUM(self):
     album = self.api.call("photos.get",
                           uid=self.params["user"],
                           aid=self.params["album"])
     photos = []
     for cameo in album:
         title = None
         if cameo["text"]:
             title = cameo["text"] + u" (" + unicode(
                 str(datetime.fromtimestamp(int(cameo["created"])))) + u")"
         else:
             title = unicode(
                 str(datetime.fromtimestamp(int(cameo["created"]))))
         title = PrepareString(title)
         e = (title, cameo.get("src_xxbig") or cameo.get("src_xbig")
              or cameo.get("src_big") or cameo["src"], cameo["src"])
         photos.append(e)
     for title, url, thumb in photos:
         listItem = xbmcgui.ListItem(
             title,
             "",
             thumb,
             thumb,
         )  #search history
         xbmcplugin.addDirectoryItem(self.handle, url, listItem, False)
Esempio n. 4
0
 def Do_SEASON_SERIES(self):
     srl = minidom.parse(
         urllib.urlopen("http://kinobaza.tv/film/%s?format=xml" %
                        self.params["id"]))
     film = srl.getElementsByTagName("film")[0]
     season = srl.getElementsByTagName("season")[int(self.params["season"])
                                                 - 1]
     season_num = season.attributes["number"].value
     for e in season.getElementsByTagName("episode"):
         if not (e.attributes["description"].value
                 or e.attributes["name"].value
                 or e.attributes["original_name"].value):
             continue
         n = e.attributes["number"].value
         thumb = self.params["thumb"]
         title = e.attributes["name"].value or e.attributes[
             "original_name"].value
         desc = e.attributes["description"].value
         title = __language__(30015) % n + (title and (u": " + title))
         listItem = xbmcgui.ListItem(PrepareString(title), desc, thumb,
                                     thumb)
         q = "%s  %s   %s" % (film.attributes["name"].value, season_num, n)
         q = q.encode('utf-8')
         xbmcplugin.addDirectoryItem(self.handle,
                                     self.GetURL(mode=SEARCH, query=q),
                                     listItem, True)
Esempio n. 5
0
 def AddAudioEntry(self, a):
     title = a.get("artist")
     if title:
         title += u" : "
     title += a.get("title")
     d = unicode(datetime.timedelta(seconds=int(a["duration"])))
     title = d + u" - " + title
     listItem = xbmcgui.ListItem(PrepareString(title))
     xbmcplugin.addDirectoryItem(self.handle, a["url"], listItem, False)
Esempio n. 6
0
 def Do_TOP_DOWNLOADS(self):
     html = urllib.urlopen("http://kinobaza.tv/ratings/top-downloadable").read()
     regex = re.compile(r'<img width="60" src="(.*?)" alt="(.*?)" class="poster-pic" />.*?<span class="english">(.*?)</span>',re.UNICODE|re.DOTALL)
     r = regex.findall(html)
     for thumb, ru, en in r:
         thumb = thumb.replace('60.jpg','207.jpg')
         title = ru.decode("utf-8") + " / " + en.decode('utf-8')
         listItem = xbmcgui.ListItem(PrepareString(title) , en, thumb, thumb)
         q= ru + " " + en.replace("(","").replace(")","")
         xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode=SEARCH,query=q), listItem, True)
Esempio n. 7
0
    def Do_ALBUM_VIDEO(self):
        self.prevPage()
        owner_id = self.params.get("owner_id") or ""
        v = self.api.call("video.getAlbums", owner_id=owner_id)
        if v['items']:
            for a in v['items']:
		title = PrepareString(a["title"])
		listItem = xbmcgui.ListItem(title, "")
		xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode="VIDEO_ALBUM_LIST", album_id=a["album_id"], owner_id=owner_id), listItem, True)
        self.nextPage(v)
Esempio n. 8
0
 def Do_SERIES(self):
     html = urllib.urlopen("http://kinobaza.tv/series").read()
     r = re.compile(
         r'<img width="207" src="(.*?)" alt="(.*?)" class="poster-pic" />.*?<a href="http://kinobaza.tv/film/(.*?)/.*?span class="english">(.*?)</span>',
         re.DOTALL)
     res = r.findall(html)
     for thumb, ru, id, en in res:
         listItem = xbmcgui.ListItem(PrepareString(ru), en, thumb, thumb)
         xbmcplugin.addDirectoryItem(
             self.handle, self.GetURL(mode=SEASONS, id=id, thumb=thumb),
             listItem, True)
Esempio n. 9
0
 def ProcessFoundEntry(self, a):
     duration = str(datetime.timedelta(seconds=int(a["duration"])))
     title = duration + " - " + PrepareString(a["title"])
     videos = base64.encodestring(json.dumps(a["files"]))
     thumb = a.get("thumb") or a.get("image")
     listItem = xbmcgui.ListItem(title, a["description"], thumb, thumb)
     listItem.setInfo(type = "Video", infoLabels = {
         "title"     : title
         ,"duration" : duration
         ,"tagline"  : a["description"]
         } )
     xbmcplugin.addDirectoryItem(self.handle, self.GetURL(mode=SEARCH_RESULT, thumb=thumb, v=videos, title=a["title"].encode('utf-8')),
                                 listItem, True)
Esempio n. 10
0
    def AddAudioEntry(self, a):
        title = a.get("artist")
        if title:
            title += u" : "
        title += a.get("title")
        d = unicode(datetime.timedelta(seconds=int(a["duration"])))
        listTitle = d + u" - " + title
        listitem = xbmcgui.ListItem(PrepareString(listTitle))
        xbmc.log(str(a), xbmc.LOGDEBUG)
        listitem.setInfo(type='Music',
                         infoLabels={
                             'title': a.get("title") or "",
                             'artist': a.get("artist") or "",
                             'album': a.get("artist") or "",
                             'duration': a.get('duration') or 0
                         })
        listitem.setProperty('mimetype', 'audio/mpeg')

        xbmcplugin.addDirectoryItem(self.handle, a["url"], listitem, False)