Example #1
0
    def showContextMenu(self):
        show = self.tvshows[self.getControl(TVSHOW_LIST).getSelectedPosition()]
        li = self.getControl(TVSHOW_LIST).getSelectedItem()
        options = []
        actions = []
        if self.type != 'watchlist':
            if 'watchlist' in show:
                if show['watchlist']:
                    options.append(__language__(137).encode( "utf-8", "ignore" ))
                    actions.append('unwatchlist')
                else:
                    options.append(__language__(136).encode( "utf-8", "ignore" ))
                    actions.append('watchlist')
            else:
                options.append(__language__(136).encode( "utf-8", "ignore" ))
                actions.append('watchlist')
        else:
            options.append(__language__(137).encode( "utf-8", "ignore" ))
            actions.append('unwatchlist')
        options.append(__language__(138).encode( "utf-8", "ignore" ))
        actions.append('rate')

        select = xbmcgui.Dialog().select(show['title'], options)
        if select != -1:
            Debug("Select: " + actions[select])
        if select == -1:
            Debug ("menu quit by user")
            return
        elif actions[select] == 'play':
            xbmcgui.Dialog().ok(__language__(200).encode( "utf-8", "ignore" ), __language__(152).encode( "utf-8", "ignore" ))
        elif actions[select] == 'unwatchlist':
            if utilities.removeTVShowsFromWatchlist([show]) == None:
                utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(132).encode( "utf-8", "ignore" )) # Failed to remove from watch-list
            else:
                utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(133).encode( "utf-8", "ignore" )) # Successfully removed from watch-list
                li.setProperty('Watchlist','false')
                show['watchlist'] = False
        elif actions[select] == 'watchlist':
            if utilities.addTVShowsToWatchlist([show]) == None:
                utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(130).encode( "utf-8", "ignore" )) # Failed to added to watch-list
            else:
                utilities.notification(__language__(200).encode( "utf-8", "ignore" ), __language__(131).encode( "utf-8", "ignore" )) # Successfully added to watch-list
                li.setProperty('Watchlist','true')
                show['watchlist'] = True
        elif actions[select] == 'rate':
            rateShow = RateShowDialog("rate.xml", __settings__.getAddonInfo('path'), "Default")
            rateShow.initDialog(show['tvdb_id'], show['title'], show['year'], utilities.getShowRatingFromTrakt(show['tvdb_id'], show['title'], show['year']))
            rateShow.doModal()
            del rateShow
Example #2
0
    def onClick(self, controlId):
        if controlId == RATE_RATE_SHOW_BTN:
            self.getControl(RATE_RATE_SHOW_BG).setVisible(False)
            self.getControl(RATE_RATE_SHOW_BTN).setVisible(False)
            self.setFocus(self.getControl(RATE_SKIP_RATING))

            if self._rating_type == "advanced":
                rateShow = RateShowDialog("rate_advanced.xml", __settings__.getAddonInfo('path'))
            else:
                rateShow = RateShowDialog("rate.xml", __settings__.getAddonInfo('path'))

            rateShow.initDialog(self.tvdbid, self.title, self.year, utilities.getShowRatingFromTrakt(self.tvdbid, self.title, self.year))
            rateShow.doModal()
            del rateShow
        else:
            method = functools.partial(utilities.rateEpisodeOnTrakt, self.tvdbid, self.title, self.year, self.season, self.episode)
            super(RateEpisodeDialog, self).onClick(controlId, method)