Beispiel #1
0
    def addItem(self, item, path, isFolder=True):
        if not isFolder:
            item["context_menu"] = []
            log("(base3-context-menu) %s" %item, LOGLEVEL.INFO)

            if "info" in item and "trailer" in item["info"] and item["info"]["trailer"]:
                item["context_menu"] = item["context_menu"]+[('%s' %(__addon__.getLocalizedString(30038)), 'PlayMedia(%s)' %(item["info"]["trailer"]))]

            if "info" in item and "mediatype" in item["info"] and item["info"]["mediatype"] == 'movie':
                isfav = False
                favs = favourites._get_favs('movies')
                for fav in favs:
                    if fav['id'] == item["info"]["code"]:
                        isfav = True
                if isfav == True:
                    item["context_menu"] = item["context_menu"]+[('%s' %__addon__.getLocalizedString(30042), 'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=movies&id=%s)' % (item["info"]["code"]))]
                    item["context_menu"] = item["context_menu"]+[('%s' %__addon__.getLocalizedString(30044), 'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=movies&id=all)')]
                else:
                    item["context_menu"] = item["context_menu"]+[('%s' %__addon__.getLocalizedString(30041), 'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=add_fav&action=movies&id=%s)' % (item["info"]["code"]))]

            for _q in QUALITIES:
                if "&%s=" %_q in path or "?%s=" %_q in path:
                    log("(base3-context) %s" %_q, LOGLEVEL.INFO)
                    item["context_menu"] = item["context_menu"]+[('%s %s' %(__addon__.getLocalizedString(30009), _q), 'RunPlugin(%s&quality=%s)' %(path, _q))]
            item["context_menu"] = item["context_menu"]+[self.getOpenSettings()]
            item["replace_context_menu"] = True
        super(_Base3, self).addItem(item, path, isFolder)
Beispiel #2
0
def _favourites(dom, **kwargs):

    action = 'anime'
    favs = _favs._get_favs(action)

    shows = []
    for fa in favs:
        search = '%s/anime/%s' % (dom[0], fa['id'])
        req = urllib2.Request(
            search,
            headers={
                "User-Agent":
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36",
                "Accept-Encoding": "none"
            })
        response = urllib2.urlopen(req)
        show1 = json.loads(response.read())

        shows.append({
            "_id": fa['id'],
            "title": show1['title'],
            "year": show1['year'],
            "slug": show1['slug'],
            "images": show1['images'],
            "rating": show1['rating']
        })

    items = []
    for show in shows:
        context_menu = [(
            '%s' % __addon__.getLocalizedString(30040),
            'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=%s&id=%s)'
            % (action, show['_id']))]
        context_menu = context_menu + [(
            '%s' % __addon__.getLocalizedString(30043),
            'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=%s&id=all)'
            % action)]
        items.append({
            "label": show['title'],  # "label" is require
            "icon": show.get('images').get('poster'),
            "thumbnail": show.get('images').get('poster'),
            "info": Anime.get_meta_info(show, 0),
            "properties": {
                "fanart_image": show.get('images').get('fanart'),
            },
            "params": {
                "endpoint": "folders",  # "endpoint" is require
                'action':
                "anime-seasons",  # Require when calling browse or folders (Action is used to separate the content)
                '_id': show['_id'],
                'poster': show.get('images').get('poster'),
                'fanart': show.get('images').get('fanart'),
                'tvshow': show['title']
            },
            "context_menu": context_menu,
            "replace_context_menu": True
        })

    return items
Beispiel #3
0
def _favourites(dom, **kwargs):

    action = 'tvshows'
    favs = _favs._get_favs(action)

    shows = []
    for fa in favs:
        search = '%s/tv/show/%s' % (dom[0], fa['id'])
        req = urllib2.Request(search, headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36", "Accept-Encoding": "none"})
        response = urllib2.urlopen(req)
        show1 = json.loads(response.read())

        shows.append({
            "_id": fa['id'],
            "imdb_id": fa['id'],
            "tvdb_id": show1['tvdb_id'],
            "title": show1['title'],
            "year": show1['year'],
            "slug": show1['slug'],
            "num_seasons": show1['num_seasons'],
            "images": show1['images'],
            "rating": show1['rating']
        })

    items = []
    for show in shows:
        context_menu = [('%s' %__addon__.getLocalizedString(30040), 'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=%s&id=%s)' % (action, show['imdb_id']))]
        context_menu = context_menu+[('%s' %__addon__.getLocalizedString(30043), 'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=%s&id=all)' %action)]
        items.append({
            "label": show['title'],                                         # "label" is require
            "icon": show.get('images').get('poster'),
            "thumbnail": show.get('images').get('poster'),
            "info": TvShow.get_meta_info(show, 0),
            "properties": {
                "fanart_image": show.get('images').get('fanart'),
            },
            "params": {
                "seasons": show['num_seasons'],
                "endpoint": "folders",                                      # "endpoint" is require
                'action': "show-seasons",                                   # Require when calling browse or folders (Action is used to separate the content)
                'imdb_id': show['imdb_id'],
                'poster': show.get('images').get('poster'),
                'fanart': show.get('images').get('fanart'),
                'tvshow': show['title']
            },
            "context_menu": context_menu,
            "replace_context_menu": True
        })

    return items
    def addItem(self, item, path, isFolder=True):
        if not isFolder:
            item["context_menu"] = []
            log("(base3-context-menu) %s" % item, LOGLEVEL.INFO)

            if "info" in item and "trailer" in item["info"] and item["info"][
                    "trailer"]:
                item["context_menu"] = item["context_menu"] + [
                    ('%s' %
                     (__addon__.getLocalizedString(30038)), 'PlayMedia(%s)' %
                     (item["info"]["trailer"]))
                ]

            if "info" in item and "mediatype" in item["info"] and item["info"][
                    "mediatype"] == 'movie':
                isfav = False
                favs = favourites._get_favs('movies')
                for fav in favs:
                    if fav['id'] == item["info"]["code"]:
                        isfav = True
                if isfav == True:
                    item["context_menu"] = item["context_menu"] + [(
                        '%s' % __addon__.getLocalizedString(30042),
                        'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=movies&id=%s)'
                        % (item["info"]["code"]))]
                    item["context_menu"] = item["context_menu"] + [(
                        '%s' % __addon__.getLocalizedString(30044),
                        'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=remove_fav&action=movies&id=all)'
                    )]
                else:
                    item["context_menu"] = item["context_menu"] + [(
                        '%s' % __addon__.getLocalizedString(30041),
                        'RunPlugin(plugin://plugin.video.kodipopcorntime?cmd=add_fav&action=movies&id=%s)'
                        % (item["info"]["code"]))]

            for _q in QUALITIES:
                if "&%s=" % _q in path or "?%s=" % _q in path:
                    log("(base3-context) %s" % _q, LOGLEVEL.INFO)
                    item["context_menu"] = item["context_menu"] + [
                        ('%s %s' % (__addon__.getLocalizedString(30009), _q),
                         'RunPlugin(%s&quality=%s)' % (path, _q))
                    ]
            item["context_menu"] = item["context_menu"] + [
                self.getOpenSettings()
            ]
            item["replace_context_menu"] = True
        super(_Base3, self).addItem(item, path, isFolder)