def monitor_livetv(self):
     '''
         for livetv we are not notified when the program changes
         so we have to monitor that ourself
     '''
     if self.monitoring_stream:
         # another monitoring already in progress...
         return
     last_title = ""
     while not self.abortRequested() and xbmc.getCondVisibility("Player.HasVideo"):
         self.monitoring_stream = True
         li_title = xbmc.getInfoLabel("Player.Title").decode('utf-8')
         if li_title and li_title != last_title:
             all_props = []
             last_title = li_title
             self.reset_win_props()
             li_channel = xbmc.getInfoLabel("VideoPlayer.ChannelName").decode('utf-8')
             # pvr artwork
             if xbmc.getCondVisibility("Skin.HasSetting(SkinHelper.EnablePVRThumbs)"):
                 li_genre = xbmc.getInfoLabel("VideoPlayer.Genre").decode('utf-8')
                 pvrart = self.artutils.get_pvr_artwork(li_title, li_channel, li_genre)
                 all_props = prepare_win_props(pvrart, u"SkinHelper.Player.")
             # pvr channellogo
             all_props.append(("SkinHelper.Player.ChannelLogo", self.artutils.get_channellogo(li_channel)))
             if last_title == li_title:
                 process_method_on_list(self.set_win_prop, all_props)
         self.waitForAbort(2)
     self.monitoring_stream = False
 def monitor_livetv(self):
     '''
         for livetv we are not notified when the program changes
         so we have to monitor that ourself
     '''
     if self.monitoring_stream:
         # another monitoring already in progress...
         return
     last_title = ""
     while not self.abortRequested() and xbmc.getCondVisibility(
             "Player.HasVideo"):
         self.monitoring_stream = True
         li_title = xbmc.getInfoLabel("Player.Title").decode('utf-8')
         if li_title and li_title != last_title:
             all_props = []
             last_title = li_title
             self.reset_win_props()
             li_channel = xbmc.getInfoLabel(
                 "VideoPlayer.ChannelName").decode('utf-8')
             # pvr artwork
             if xbmc.getCondVisibility(
                     "Skin.HasSetting(SkinHelper.EnablePVRThumbs)"):
                 li_genre = xbmc.getInfoLabel("VideoPlayer.Genre").decode(
                     'utf-8')
                 pvrart = self.artutils.get_pvr_artwork(
                     li_title, li_channel, li_genre)
                 all_props = prepare_win_props(pvrart,
                                               u"SkinHelper.Player.")
             # pvr channellogo
             all_props.append(("SkinHelper.Player.ChannelLogo",
                               self.artutils.get_channellogo(li_channel)))
             if last_title == li_title:
                 process_method_on_list(self.set_win_prop, all_props)
         self.waitForAbort(2)
     self.monitoring_stream = False
    def set_music_properties(self):
        '''sets the window props for a playing song'''
        li_title = xbmc.getInfoLabel("MusicPlayer.Title").decode('utf-8')
        li_title_org = li_title
        li_artist = xbmc.getInfoLabel("MusicPlayer.Artist").decode('utf-8')
        li_album = xbmc.getInfoLabel("MusicPlayer.Album").decode('utf-8')
        li_disc = xbmc.getInfoLabel("MusicPlayer.DiscNumber").decode('utf-8')
        li_plot = xbmc.getInfoLabel("MusicPlayer.Comment").decode('utf-8')

        if not li_artist:
            # fix for internet streams
            for splitchar in [" - ", "-", ":", ";"]:
                if splitchar in li_title:
                    li_artist = li_title.split(splitchar)[0].strip()
                    li_title = li_title.split(splitchar)[1].strip()
                    break

        if xbmc.getCondVisibility(
                "Skin.HasSetting(SkinHelper.EnableMusicArt)") and li_artist:
            result = self.artutils.get_music_artwork(li_artist, li_album,
                                                     li_title, li_disc)
            if result.get("extendedplot") and li_plot:
                li_plot = li_plot.replace('\n', ' ').replace('\r', '').rstrip()
                result["extendedplot"] = "%s -- %s" % (result["extendedplot"],
                                                       li_plot)
            all_props = prepare_win_props(result, u"SkinHelper.Player.")
            if li_title_org == xbmc.getInfoLabel("MusicPlayer.Title").decode(
                    'utf-8'):
                process_method_on_list(self.set_win_prop, all_props)
    def set_music_properties(self):
        '''sets the window props for a playing song'''
        li_title = xbmc.getInfoLabel("MusicPlayer.Title").decode('utf-8')
        li_title_org = li_title
        li_artist = xbmc.getInfoLabel("MusicPlayer.Artist").decode('utf-8')
        li_album = xbmc.getInfoLabel("MusicPlayer.Album").decode('utf-8')
        li_disc = xbmc.getInfoLabel("MusicPlayer.DiscNumber").decode('utf-8')
        li_plot = xbmc.getInfoLabel("MusicPlayer.Comment").decode('utf-8')

        if not li_artist:
            # fix for internet streams
            for splitchar in [" - ","-", ":", ";"]:
                if splitchar in li_title:
                    li_artist = li_title.split(splitchar)[0].strip()
                    li_title = li_title.split(splitchar)[1].strip()
                    break

        if xbmc.getCondVisibility("Skin.HasSetting(SkinHelper.EnableMusicArt)") and li_artist:
            result = self.artutils.get_music_artwork(li_artist, li_album, li_title, li_disc)
            if result.get("extendedplot") and li_plot:
                li_plot = li_plot.replace('\n', ' ').replace('\r', '').rstrip()
                result["extendedplot"] = "%s -- %s" % (result["extendedplot"], li_plot)
            all_props = prepare_win_props(result, u"SkinHelper.Player.")
            if li_title_org == xbmc.getInfoLabel("MusicPlayer.Title").decode('utf-8'):
                process_method_on_list(self.set_win_prop, all_props)
 def getcastmedia(self):
     """helper to display get all media for a specific actor"""
     name = self.params.get("name")
     if name:
         all_items = self.kodi_db.castmedia(name)
         all_items = process_method_on_list(self.kodi_db.prepare_listitem, all_items)
         all_items = process_method_on_list(self.kodi_db.create_listitem, all_items)
         xbmcplugin.addDirectoryItems(int(sys.argv[1]), all_items, len(all_items))
     xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Ejemplo n.º 6
0
    def mainlisting(self):
        '''main listing'''
        all_items = []

        # movie node
        if xbmc.getCondVisibility("Library.HasContent(movies)"):
            all_items.append((xbmc.getLocalizedString(342), "movieslisting",
                              "DefaultMovies.png"))

        # tvshows and episodes nodes
        if xbmc.getCondVisibility("Library.HasContent(tvshows)"):
            all_items.append((xbmc.getLocalizedString(20343), "tvshowslisting",
                              "DefaultTvShows.png"))
            all_items.append((xbmc.getLocalizedString(20360),
                              "episodeslisting", "DefaultTvShows.png"))

        # pvr node
        if xbmc.getCondVisibility("Pvr.HasTVChannels"):
            all_items.append((self.addon.getLocalizedString(32054),
                              "pvrlisting", "DefaultAddonPVRClient.png"))

        # music nodes
        if xbmc.getCondVisibility("Library.HasContent(music)"):
            all_items.append((xbmc.getLocalizedString(132), "albumslisting",
                              "DefaultAlbumCover.png"))
            all_items.append((xbmc.getLocalizedString(134), "songslisting",
                              "DefaultMusicSongs.png"))
            all_items.append((xbmc.getLocalizedString(133), "artistslisting",
                              "DefaultArtist.png"))

        # musicvideo node
        if xbmc.getCondVisibility("Library.HasContent(musicvideos)"):
            all_items.append(
                (xbmc.getLocalizedString(20389), "musicvideoslisting",
                 "DefaultAddonAlbumInfo.png"))

        # media node
        if xbmc.getCondVisibility(
                "Library.HasContent(movies) | Library.HasContent(tvshows) | Library.HasContent(music)"
        ):
            all_items.append((self.addon.getLocalizedString(32057),
                              "medialisting", "DefaultAddonAlbumInfo.png"))

        # favourites node
        all_items.append((xbmc.getLocalizedString(10134), "favouriteslisting",
                          "DefaultAddonAlbumInfo.png"))

        # process the listitems and display listing
        all_items = process_method_on_list(create_main_entry, all_items)
        all_items = process_method_on_list(
            self.artutils.kodidb.prepare_listitem, all_items)
        all_items = process_method_on_list(
            self.artutils.kodidb.create_listitem, all_items)
        xbmcplugin.addDirectoryItems(ADDON_HANDLE, all_items, len(all_items))
        xbmcplugin.endOfDirectory(handle=ADDON_HANDLE)
    def set_video_properties(self, mediatype, li_dbid):
        '''sets the window props for a playing video item'''
        if not mediatype:
            mediatype = self.get_mediatype()
        details = self.get_player_infolabels()
        li_title = details["title"]
        li_year = details["year"]
        li_imdb = details["imdbnumber"]
        li_showtitle = details["tvshowtitle"]
        details = {"art": {}}

        # video content
        if mediatype in ["movie", "episode", "musicvideo"]:

            # get imdb_id
            li_imdb, li_tvdb = self.artutils.get_imdbtvdb_id(
                li_title, mediatype, li_year, li_imdb, li_showtitle)

            # generic video properties (studio, streamdetails, omdb, top250)
            details = extend_dict(details,
                                  self.artutils.get_omdb_info(li_imdb))
            if li_dbid:
                details = extend_dict(
                    details,
                    self.artutils.get_streamdetails(li_dbid, mediatype))
            details = extend_dict(details,
                                  self.artutils.get_top250_rating(li_imdb))

            # tvshows-only properties (tvdb)
            if mediatype == "episode":
                details = extend_dict(
                    details, self.artutils.get_tvdb_details(li_imdb, li_tvdb))

            # movies-only properties (tmdb, animated art)
            if mediatype == "movie":
                details = extend_dict(details,
                                      self.artutils.get_tmdb_details(li_imdb))
                if li_imdb and xbmc.getCondVisibility(
                        "Skin.HasSetting(SkinHelper.EnableAnimatedPosters)"):
                    details = extend_dict(
                        details, self.artutils.get_animated_artwork(li_imdb))

            # extended art
            if xbmc.getCondVisibility(
                    "Skin.HasSetting(SkinHelper.EnableExtendedArt)"):
                tmdbid = details.get("tmdb_id", "")
                details = extend_dict(
                    details,
                    self.artutils.get_extended_artwork(li_imdb, li_tvdb,
                                                       tmdbid, mediatype))

        if li_title == xbmc.getInfoLabel("Player.Title").decode('utf-8'):
            all_props = prepare_win_props(details, u"SkinHelper.Player.")
            process_method_on_list(self.set_win_prop, all_props)
Ejemplo n.º 8
0
 def getcastmedia(self):
     '''helper to display get all media for a specific actor'''
     name = self.params.get("name")
     if name:
         all_items = self.kodi_db.castmedia(name)
         all_items = process_method_on_list(self.kodi_db.prepare_listitem,
                                            all_items)
         all_items = process_method_on_list(self.kodi_db.create_listitem,
                                            all_items)
         xbmcplugin.addDirectoryItems(int(sys.argv[1]), all_items,
                                      len(all_items))
     xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Ejemplo n.º 9
0
    def do_search(self, search_term):
        '''scrape results for search query'''

        movies_list = self.dialog.getControl(3110)
        series_list = self.dialog.getControl(3111)
        cast_list = self.dialog.getControl(3112)

        # clear current values
        movies_list.reset()
        series_list.reset()
        cast_list.reset()

        if len(search_term) == 0:
            return

        filters = [{
            "operator": "contains",
            "field": "title",
            "value": search_term
        }]

        # Process movies
        items = self.kodidb.movies(filters=filters)
        items = process_method_on_list(self.kodidb.prepare_listitem, items)
        result = []
        for item in items:
            result.append(self.kodidb.create_listitem(item, False))
        movies_list.addItems(result)

        # Process tvshows
        items = self.kodidb.tvshows(filters=filters)
        items = process_method_on_list(self.kodidb.prepare_listitem, items)
        result = []
        for item in items:
            item["file"] = 'videodb://tvshows/titles/%s' % item['tvshowid']
            item["isFolder"] = True
            result.append(self.kodidb.create_listitem(item, False))
        series_list.addItems(result)

        # Process cast
        result = []
        for item in self.actors:
            if search_term.lower() in item["label"].lower():
                item = self.kodidb.prepare_listitem(item)
                item[
                    "file"] = "RunScript(script.skin.helper.service,action=getcastmedia,name=%s)" % item[
                        "label"]
                result.append(self.kodidb.create_listitem(item, False))
        cast_list.addItems(result)
Ejemplo n.º 10
0
 def similar(self):
     ''' get similar tvshows for given imdbid or just from random watched title if no imdbid'''
     imdb_id = self.options.get("imdbid", "")
     all_items = []
     all_titles = list()
     # lookup tvshow by imdbid or just pick a random watched tvshow
     ref_tvshow = None
     if imdb_id:
         # get tvshow by imdbid
         ref_tvshow = self.artutils.kodidb.tvshow_by_imdbid(imdb_id)
     if not ref_tvshow:
         # just get a random watched tvshow
         ref_tvshow = self.get_random_watched_tvshow()
     if ref_tvshow:
         # get all tvshows for the genres in the tvshow
         genres = ref_tvshow["genre"]
         similar_title = ref_tvshow["title"]
         for genre in genres:
             self.options["genre"] = genre
             genre_tvshows = self.forgenre()
             for item in genre_tvshows:
                 # prevent duplicates so skip reference tvshow and titles already in the list
                 if not item["title"] in all_titles and not item[
                         "title"] == similar_title:
                     item["extraproperties"] = {
                         "similartitle": similar_title,
                         "originalpath": item["file"]
                     }
                     all_items.append(item)
                     all_titles.append(item["title"])
     # return the list capped by limit and sorted by rating
     tvshows = sorted(all_items, key=itemgetter("rating"),
                      reverse=True)[:self.options["limit"]]
     return process_method_on_list(self.process_tvshow, tvshows)
Ejemplo n.º 11
0
    def recent(self):
        ''' get recently added episodes '''
        tvshow_episodes = {}
        total_count = 0
        unique_count = 0
        filters = []
        if self.options["hide_watched"]:
            filters.append(kodi_constants.FILTER_UNWATCHED)
        if self.options.get("tag"):
            filters.append({"operator": "contains", "field": "tag", "value": self.options["tag"]})
        while unique_count < self.options["limit"]:
            recent_episodes = self.artutils.kodidb.episodes(
                sort=kodi_constants.SORT_DATEADDED, filters=filters, limits=(
                    total_count, self.options["limit"] + total_count))
            if not self.options["group_episodes"]:
                # grouping is not enabled, just return the result
                return recent_episodes

            if len(recent_episodes) < self.options["limit"]:
                # break the loop if there are no more episodes
                unique_count = self.options["limit"]

            # if multiple episodes for the same show with same addition date, we combine them into one
            # to do that we build a dict with recent episodes for all episodes of the same season added on the same date
            for episode in recent_episodes:
                total_count += 1
                unique_key = "%s-%s-%s" % (episode["tvshowid"], episode["dateadded"].split(" ")[0], episode["season"])
                if unique_key not in tvshow_episodes:
                    tvshow_episodes[unique_key] = []
                    unique_count += 1
                tvshow_episodes[unique_key].append(episode)

        # create our entries and return the result sorted by dateadded
        all_items = process_method_on_list(self.create_grouped_entry, tvshow_episodes.itervalues())
        return sorted(all_items, key=itemgetter("dateadded"), reverse=True)[:self.options["limit"]]
Ejemplo n.º 12
0
 def recommended(self):
     ''' get recommended albums - library albums with sorted by rating '''
     all_items = self.artutils.kodidb.albums(
         sort=kodi_constants.SORT_RATING,
         filters=[],
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_album, all_items)
Ejemplo n.º 13
0
 def recent(self):
     ''' get recently added albums '''
     all_items = self.artutils.kodidb.albums(
         sort=kodi_constants.SORT_DATEADDED,
         filters=[],
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_album, all_items)
Ejemplo n.º 14
0
 def similar(self):
     ''' get similar songs for recent played song'''
     all_items = []
     all_titles = list()
     ref_song = self.get_random_played_song()
     if ref_song:
         # get all songs for the genres in the song
         genres = ref_song["genre"]
         similar_title = ref_song["title"]
         for genre in genres:
             genre = genre.split(";")[0]
             self.options["genre"] = genre
             genre_songs = self.get_genre_songs(genre)
             for item in genre_songs:
                 # prevent duplicates so skip reference song and titles already in the list
                 if not item["title"] in all_titles and not item[
                         "title"] == similar_title:
                     item["extraproperties"] = {
                         "similartitle": similar_title
                     }
                     all_items.append(item)
                     all_titles.append(item["title"])
     # return the list capped by limit and sorted by rating
     items = sorted(all_items, key=itemgetter("rating"),
                    reverse=True)[:self.options["limit"]]
     return process_method_on_list(self.process_song, items)
Ejemplo n.º 15
0
 def random(self):
     ''' get random albums '''
     all_items = self.artutils.kodidb.albums(
         sort=kodi_constants.SORT_RANDOM,
         filters=[],
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_album, all_items)
 def getcastmedia(self):
     '''helper to show a dialog with all media for a specific actor'''
     xbmc.executebuiltin("ActivateWindow(busydialog)")
     name = self.params.get("name", "")
     window_header = self.params.get("name", "")
     results = []
     items = self.kodidb.castmedia(name)
     items = process_method_on_list(self.kodidb.prepare_listitem, items)
     for item in items:
         if item["file"].startswith("videodb://"):
             item["file"] = "ActivateWindow(Videos,%s,return)" % item["file"]
         else:
             item["file"] = 'PlayMedia("%s")' % item["file"]
         results.append(self.kodidb.create_listitem(item, False))
     # finished lookup - display listing with results
     xbmc.executebuiltin("dialog.Close(busydialog)")
     dialog = DialogSelect("DialogSelect.xml", "", listing=results, windowtitle=window_header, richlayout=True)
     dialog.doModal()
     result = dialog.result
     del dialog
     if result:
         while xbmc.getCondVisibility("System.HasModalDialog"):
             xbmc.executebuiltin("Action(Back)")
             xbmc.sleep(300)
         xbmc.executebuiltin(result.getfilename())
         del result
Ejemplo n.º 17
0
 def recentplayed(self):
     ''' get in progress albums '''
     all_items = self.artutils.kodidb.albums(
         sort=kodi_constants.SORT_LASTPLAYED,
         filters=[],
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_album, all_items)
Ejemplo n.º 18
0
 def listing(self):
     '''main listing with all our movie nodes'''
     tag = self.options.get("tag", "")
     if tag:
         label_prefix = "%s - " % tag
     else:
         label_prefix = ""
     icon = "DefaultMovies.png"
     all_items = [
         (label_prefix + self.addon.getLocalizedString(32028),
          "inprogress&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32038),
          "recent&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32003),
          "recommended&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32029),
          "inprogressandrecommended&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32048),
          "random&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32066),
          "unwatched&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + self.addon.getLocalizedString(32046),
          "top250&mediatype=movies&tag=%s" % tag, icon),
         (label_prefix + xbmc.getLocalizedString(135),
          "browsegenres&mediatype=movies&tag=%s" % tag, "DefaultGenres.png")
     ]
     if not tag:
         all_items += [(self.addon.getLocalizedString(32006),
                        "similar&mediatype=movies&tag=%s" % tag, icon),
                       (xbmc.getLocalizedString(10134),
                        "favourites&mediatype=movies&tag=%s" % tag, icon),
                       (xbmc.getLocalizedString(20459),
                        "tags&mediatype=movies", icon)]
     return process_method_on_list(create_main_entry, all_items)
 def getcastmedia(self):
     '''helper to show a dialog with all media for a specific actor'''
     xbmc.executebuiltin("ActivateWindow(busydialog)")
     name = self.params.get("name", "")
     window_header = self.params.get("name", "")
     results = []
     items = self.kodidb.castmedia(name)
     items = process_method_on_list(self.kodidb.prepare_listitem, items)
     for item in items:
         if item["file"].startswith("videodb://"):
             item[
                 "file"] = "ActivateWindow(Videos,%s,return)" % item["file"]
         else:
             item["file"] = 'PlayMedia("%s")' % item["file"]
         results.append(self.kodidb.create_listitem(item, False))
     # finished lookup - display listing with results
     xbmc.executebuiltin("dialog.Close(busydialog)")
     dialog = DialogSelect("DialogSelect.xml",
                           "",
                           listing=results,
                           windowtitle=window_header,
                           richlayout=True)
     dialog.doModal()
     result = dialog.result
     del dialog
     if result:
         while xbmc.getCondVisibility("System.HasModalDialog"):
             xbmc.executebuiltin("Action(Back)")
             xbmc.sleep(300)
         xbmc.executebuiltin(result.getfilename())
         del result
Ejemplo n.º 20
0
 def recommended(self):
     ''' get recommended songs - library songs with score higher than 7 '''
     filters = [kodi_constants.FILTER_RATING_MUSIC]
     items = self.artutils.kodidb.songs(sort=kodi_constants.SORT_RATING,
                                        filters=filters,
                                        limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_song, items)
Ejemplo n.º 21
0
 def listing(self):
     '''main listing with only our favourites nodes'''
     all_items = [(xbmc.getLocalizedString(10134),
                   "favourites&mediatype=favourites", "DefaultFile.png"),
                  (self.addon.getLocalizedString(32001),
                   "favourites&mediatype=favourites&mediafilter=media",
                   "DefaultMovies.png")]
     return process_method_on_list(create_main_entry, all_items)
Ejemplo n.º 22
0
 def channels(self):
     ''' get all channels '''
     all_items = []
     if xbmc.getCondVisibility("Pvr.HasTVChannels"):
         all_items = self.artutils.kodidb.channels(
             limits=(0, self.options["limit"]))
         all_items = process_method_on_list(self.process_channel, all_items)
     return all_items
Ejemplo n.º 23
0
 def timers(self):
     '''get pvr timers'''
     all_items = []
     if xbmc.getCondVisibility("Pvr.HasTVChannels"):
         all_items = sorted(self.artutils.kodidb.timers(),
                            key=itemgetter('starttime'))
         all_items = process_method_on_list(self.process_timer, all_items)
     return all_items
Ejemplo n.º 24
0
 def browsegenres(self):
     '''
         special entry which can be used to create custom genre listings
         returns each genre with poster/fanart artwork properties from 5
         random movies in the genre.
         TODO: get auto generated collage pictures from skinhelper's artutils ?
     '''
     all_genres = self.artutils.kodidb.genres("movie")
     return process_method_on_list(self.get_genre_artwork, all_genres)
Ejemplo n.º 25
0
 def recent(self):
     ''' get recently added songs '''
     items = self.artutils.kodidb.get_json(
         "AudioLibrary.GetRecentlyAddedSongs",
         filters=[],
         fields=kodi_constants.FIELDS_SONGS,
         limits=(0, self.options["limit"]),
         returntype="songs")
     return process_method_on_list(self.process_song, items)
    def do_search(self, search_term):
        '''scrape results for search query'''

        movies_list = self.dialog.getControl(3110)
        series_list = self.dialog.getControl(3111)
        cast_list = self.dialog.getControl(3112)

        # clear current values
        movies_list.reset()
        series_list.reset()
        cast_list.reset()

        if len(search_term) == 0:
            return

        filters = [{"operator": "contains", "field": "title", "value": search_term}]

        # Process movies
        items = self.kodidb.movies(filters=filters)
        items = process_method_on_list(self.kodidb.prepare_listitem, items)
        result = []
        for item in items:
            result.append(self.kodidb.create_listitem(item, False))
        movies_list.addItems(result)

        # Process tvshows
        items = self.kodidb.tvshows(filters=filters)
        items = process_method_on_list(self.kodidb.prepare_listitem, items)
        result = []
        for item in items:
            item["file"] = 'videodb://tvshows/titles/%s' % item['tvshowid']
            item["isFolder"] = True
            result.append(self.kodidb.create_listitem(item, False))
        series_list.addItems(result)

        # Process cast
        result = []
        for item in self.actors:
            if search_term.lower() in item["label"].lower():
                item = self.kodidb.prepare_listitem(item)
                item["file"] = "RunScript(script.skin.helper.service,action=getcastmedia,name=%s)" % item["label"]
                result.append(self.kodidb.create_listitem(item, False))
        cast_list.addItems(result)
Ejemplo n.º 27
0
 def next(self):
     ''' get next episodes '''
     filters = [kodi_constants.FILTER_UNWATCHED]
     if self.options["next_inprogress_only"]:
         filters = [kodi_constants.FILTER_INPROGRESS]
     if self.options.get("tag"):
         filters.append({"operator": "contains", "field": "tag", "value": self.options["tag"]})
     # First we get a list of all the inprogress/unwatched TV shows ordered by lastplayed
     all_shows = self.artutils.kodidb.tvshows(sort=kodi_constants.SORT_LASTPLAYED, filters=filters,
                                              limits=(0, self.options["limit"]))
     return process_method_on_list(self.get_next_episode_for_show, [d['tvshowid'] for d in all_shows])
Ejemplo n.º 28
0
 def listing(self):
     '''main listing with all our artist nodes'''
     all_items = [
         (self.addon.getLocalizedString(32063), "recent&mediatype=artists",
          "DefaultMusicArtists.png"),
         (self.addon.getLocalizedString(32065),
          "recommended&mediatype=artists", "DefaultMusicArtists.png"),
         (self.addon.getLocalizedString(32064), "random&mediatype=artists",
          "DefaultMusicArtists.png"),
         (xbmc.getLocalizedString(10134), "favourites&mediatype=artists",
          "DefaultMusicArtists.png")
     ]
     return process_method_on_list(create_main_entry, all_items)
    def set_video_properties(self, mediatype, li_dbid):
        '''sets the window props for a playing video item'''
        if not mediatype:
            mediatype = self.get_mediatype()
        li_title = xbmc.getInfoLabel("Player.Title").decode('utf-8')
        li_year = xbmc.getInfoLabel("Player.Year").decode('utf-8')
        li_imdb = xbmc.getInfoLabel("VideoPlayer.IMDBNumber").decode('utf-8')
        li_showtitle = xbmc.getInfoLabel("VideoPlayer.TvShowTitle").decode('utf-8')
        details = {}

        # video content
        if mediatype in ["movies", "episodes", "musicvideos"]:

            # get imdb_id
            li_imdb, li_tvdb = self.artutils.get_imdbtvdb_id(li_title, media_type, li_year, li_imdb, li_showtitle)

            # generic video properties (studio, streamdetails, omdb, top250)
            details = extend_dict(details, self.artutils.get_omdb_info(li_imdb))
            if li_dbid:
                details = extend_dict(details, self.artutils.get_streamdetails(li_dbid, mediatype))
            details = extend_dict(details, self.artutils.get_top250_rating(li_imdb))

            if xbmc.getCondVisibility("Skin.HasSetting(SkinHelper.EnableExtendedArt)"):
                details = extend_dict(details, self.artutils.get_extended_artwork(
                    li_imdb, li_tvdb, mediatype))

            # tvshows-only properties (tvdb)
            if mediatype == "episodes":
                details = extend_dict(details, self.artutils.get_tvdb_details(li_imdb, li_tvdb))

            # movies-only properties (tmdb, animated art)
            if mediatype == "movies":
                details = extend_dict(details, self.artutils.get_tmdb_details(li_imdb))
                if li_imdb and xbmc.getCondVisibility("Skin.HasSetting(SkinHelper.EnableAnimatedPosters)"):
                    details = extend_dict(details, self.artutils.get_animated_artwork(li_imdb))

        if li_title == xbmc.getInfoLabel("Player.Title").decode('utf-8'):
            all_props = prepare_win_props(details, u"SkinHelper.Player.")
            process_method_on_list(self.set_win_prop, all_props)
Ejemplo n.º 30
0
 def random(self):
     ''' get random tvshows '''
     filters = []
     if self.options.get("tag"):
         filters.append({
             "operator": "contains",
             "field": "tag",
             "value": self.options["tag"]
         })
     tvshows = self.artutils.kodidb.tvshows(sort=kodi_constants.SORT_RANDOM,
                                            filters=filters,
                                            limits=(0,
                                                    self.options["limit"]))
     return process_method_on_list(self.process_tvshow, tvshows)
Ejemplo n.º 31
0
 def inprogress(self):
     ''' get in progress tvshows '''
     filters = [kodi_constants.FILTER_INPROGRESS]
     if self.options.get("tag"):
         filters.append({
             "operator": "contains",
             "field": "tag",
             "value": self.options["tag"]
         })
     tvshows = self.artutils.kodidb.tvshows(
         sort=kodi_constants.SORT_LASTPLAYED,
         filters=filters,
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_tvshow, tvshows)
Ejemplo n.º 32
0
 def listing(self):
     '''main listing with all our song nodes'''
     all_items = [(self.addon.getLocalizedString(32013),
                   "recentplayed&mediatype=songs", "DefaultMusicSongs.png"),
                  (self.addon.getLocalizedString(32012),
                   "recent&mediatype=songs", "DefaultMusicSongs.png"),
                  (self.addon.getLocalizedString(32016),
                   "recommended&mediatype=songs", "DefaultMusicSongs.png"),
                  (self.addon.getLocalizedString(32055),
                   "similar&mediatype=songs", "DefaultMusicSongs.png"),
                  (self.addon.getLocalizedString(32034),
                   "random&mediatype=songs", "DefaultMusicSongs.png"),
                  (xbmc.getLocalizedString(10134),
                   "favourites&mediatype=songs", "DefaultMusicAlbums.png")]
     return process_method_on_list(create_main_entry, all_items)
 def listing(self):
     '''main listing with all our musicvideo nodes'''
     tag = self.options.get("tag", "")
     all_items = [(self.addon.getLocalizedString(32061),
                   "inprogress&mediatype=musicvideos&tag=%s" % tag,
                   "DefaultTvShows.png"),
                  (self.addon.getLocalizedString(32040),
                   "recent&mediatype=musicvideos&tag=%s" % tag,
                   "DefaultRecentlyAddedmusicvideos.png"),
                  (self.addon.getLocalizedString(32062),
                   "random&mediatype=musicvideos&tag=%s" % tag,
                   "DefaultTvShows.png"),
                  (xbmc.getLocalizedString(10134),
                   "favourites&mediatype=musicvideos&tag=%s" % tag,
                   "DefaultMovies.png")]
     return process_method_on_list(create_main_entry, all_items)
Ejemplo n.º 34
0
 def listing(self):
     '''main listing with all our episode nodes'''
     all_items = [
         (self.addon.getLocalizedString(32027), "inprogress&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32002), "next&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32039), "recent&mediatype=episodes", "DefaultRecentlyAddedEpisodes.png"),
         (self.addon.getLocalizedString(32009), "recommended&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32010), "inprogressandrecommended&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32049), "inprogressandrandom&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32008), "random&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32042), "unaired&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32043), "nextaired&mediatype=episodes", "DefaultTvShows.png"),
         (self.addon.getLocalizedString(32068), "airingtoday&mediatype=episodes", "DefaultTvShows.png"),
         (xbmc.getLocalizedString(10134), "favourites&mediatype=episodes", "DefaultMovies.png")
     ]
     return process_method_on_list(create_main_entry, all_items)
Ejemplo n.º 35
0
 def recommended(self):
     ''' get recommended tvshows - library tvshows with score higher than 7 '''
     filters = [kodi_constants.FILTER_RATING]
     if self.options["hide_watched"]:
         filters.append(kodi_constants.FILTER_UNWATCHED)
     if self.options.get("tag"):
         filters.append({
             "operator": "contains",
             "field": "tag",
             "value": self.options["tag"]
         })
     tvshows = self.artutils.kodidb.tvshows(sort=kodi_constants.SORT_RATING,
                                            filters=filters,
                                            limits=(0,
                                                    self.options["limit"]))
     return process_method_on_list(self.process_tvshow, tvshows)
Ejemplo n.º 36
0
 def recent(self):
     ''' get recently added tvshows '''
     filters = []
     if self.options["hide_watched"]:
         filters.append(kodi_constants.FILTER_UNWATCHED)
     if self.options.get("tag"):
         filters.append({
             "operator": "contains",
             "field": "tag",
             "value": self.options["tag"]
         })
     tvshows = self.artutils.kodidb.tvshows(
         sort=kodi_constants.SORT_DATEADDED,
         filters=filters,
         limits=(0, self.options["limit"]))
     return process_method_on_list(self.process_tvshow, tvshows)
 def open_item(self):
     '''open selected item'''
     control_id = self.getFocusId()
     listitem = self.getControl(control_id).getSelectedItem()
     if "videodb:" in listitem.getfilename():
         #tvshow: open path
         xbmc.executebuiltin('ReplaceWindow(Videos,"%s")' % self.listitem.getfilename())
         self.close_dialog()
     elif "actor" in listitem.getProperty("DBTYPE"):
         #cast dialog
         xbmc.executebuiltin("ActivateWindow(busydialog)")
         from dialogselect import DialogSelect
         results = []
         kodidb = KodiDb()
         name = listitem.getLabel().decode("utf-8")
         items = kodidb.castmedia(name)
         items = process_method_on_list(kodidb.prepare_listitem, items)
         for item in items:
             if item["file"].startswith("videodb://"):
                 item["file"] = "ActivateWindow(Videos,%s,return)" % item["file"]
             else:
                 item["file"] = 'PlayMedia("%s")' % item["file"]
             results.append(kodidb.create_listitem(item, False))
         # finished lookup - display listing with results
         xbmc.executebuiltin("dialog.Close(busydialog)")
         dialog = DialogSelect("DialogSelect.xml", "", listing=results, windowtitle=name, richlayout=True)
         dialog.doModal()
         result = dialog.result
         del dialog
         if result:
             xbmc.executebuiltin(result.getfilename())
             self.close_dialog()
     else:
         # video file: start playback
         xbmc.executebuiltin('PlayMedia("%s")' % listitem.getfilename())
         self.close_dialog()
 def set_win_props(self, prop_tuples):
     '''set multiple window properties from list of tuples'''
     process_method_on_list(self.set_win_prop, prop_tuples)
 def reset_win_props(self):
     '''reset all window props set by the script...'''
     process_method_on_list(self.win.clearProperty, self.all_window_props)
     self.all_window_props = []