Beispiel #1
0
def AddFavoriteItems(fav_addon_id,
                     section='',
                     sub_section='',
                     item_mode='main'):

    fav_items = ''
    fav_items_1 = ''
    str_fav_items_1 = ''
    if not section:
        fav_items = fav.get_main_sections(fav_addon_id, item_mode)
    elif section and sub_section:
        fav_items = fav.get_favorites(section, sub_section, fav_addon_id,
                                      item_mode)
    else:
        fav_items = fav.get_sub_sections(section, fav_addon_id, item_mode)
        if len(fav_items) <= 0:
            sub_section = 'all'
            fav_items = fav.get_favorites(section, sub_section, fav_addon_id,
                                          item_mode)
        else:
            fav_items_1 = fav.get_favorites(section, '', fav_addon_id,
                                            item_mode)
            str_fav_items_1 = str(fav_items_1)
            fav_items = fav_items + fav_items_1

    for item in fav_items:

        tmp_section = section
        tmp_sub_section = sub_section

        str_item = str(item)
        item = dict(item)
        title = item['title']
        if not local:
            title = re.sub('\[.+?\]', '', title)

        if (section and sub_section) or (str_item in str_fav_items_1):
            infolabels = item['infolabels']

            img = item['image_url']
            fanart = item['fanart_url']

            if infolabels and infolabels.get('supports_meta',
                                             'false') == 'true':
                infolabels = get_metadata(
                    infolabels.get('video_type', ''),
                    infolabels.get('name', ''),
                    infolabels.get('name', ''),
                    infolabels.get('year', ''),
                    imdb=infolabels.get('imdb_id', ''),
                    season_num=infolabels.get('season', ''),
                    episode_num=infolabels.get('episode', ''),
                    img=item['image_url'])

                if infolabels.get('cover_url', '') != '':
                    img = infolabels.get('cover_url', '')
                if infolabels.get('backdrop_url', '') != '':
                    fanart = infolabels.get('backdrop_url', '')

            listitem = xbmcgui.ListItem(title,
                                        iconImage=img,
                                        thumbnailImage=img)
            listitem.setInfo(type="video", infoLabels=infolabels)
            listitem.setProperty('fanart_image', fanart)
            listitem.setProperty('IsPlayable', item['isplayable'])

            tmp_fav_addon_id = item['addon_id']
            tmp_fav = favorites.Favorites(tmp_fav_addon_id, sys.argv)
            context_menu_items = []
            context_menu_items.append(
                ('Show Information', 'XBMC.Action(Info)'))
            context_menu_items.append(
                ('Delete from Favorites',
                 tmp_fav.delete_item(
                     title,
                     section_title=item['section_title'],
                     section_addon_title=item['section_addon_title'],
                     sub_section_title=item['sub_section_title'],
                     sub_section_addon_title=item['sub_section_addon_title'],
                     item_mode=item_mode)))
            listitem.addContextMenuItems(context_menu_items, replaceItems=True)

            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                        url=item['url'] + '&favortite=true',
                                        isFolder=str2bool(item['isfolder']),
                                        listitem=listitem)

        else:
            if tmp_section:
                tmp_sub_section = title
            else:
                tmp_section = title
            addon.add_directory(
                {
                    'mode': 'browse',
                    'addon_id': fav_addon_id,
                    'local': local,
                    'section': tmp_section,
                    'sub_section': tmp_sub_section,
                    'item_mode': item_mode
                }, {'title': title.title()})

    xbmcplugin.endOfDirectory(int(sys.argv[1]))
Beispiel #2
0
net = Net()
addon_id = 'plugin.video.favorites'
addon = Addon(addon_id, sys.argv)


def AddSysPath(path):
    if path not in sys.path:
        sys.path.append(path)


#PATHS
AddonPath = addon.get_path()

from universal import favorites
fav = favorites.Favorites(addon_id, sys.argv)

#VARIABLES
VideoType_Movies = 'movie'
VideoType_TV = 'tvshow'
VideoType_Season = 'season'
VideoType_Episode = 'episode'
VideoType_Link = 'link'

mode = addon.queries['mode']
fav_addon_id = addon.queries.get('addon_id', '')
section = addon.queries.get('section', '')
sub_section = addon.queries.get('sub_section', '')
local = addon.queries.get('local', '')
item_mode = addon.queries.get('item_mode', 'main')
Beispiel #3
0
from metahandler import metahandlers
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
from universal import favorites
from universal import _common as univ_common

###############################################################################################################

addon_id = 'plugin.video.collective'
local = xbmcaddon.Addon(id=addon_id)
collectivepath = local.getAddonInfo('path')
addon = Addon(addon_id, sys.argv)
datapath = addon.get_profile()
art = collectivepath+'/art'
net = Net()
fav = favorites.Favorites('plugin.video.collective', sys.argv)
artRadio='http://www.thedarewall.com/mp3/images/bgcont.png'


##### Common Functions #####
def eod(): addon.end_of_directory()
def addst(r,s=''): return addon.get_setting(r)   ## Get Addon Settings
def addpr(r,s=''): return addon.queries.get(r,s) ## Get Addon Params
def tfalse(r,d=False): ## Get True / False
	if   (r.lower()=='true' ): return True
	elif (r.lower()=='false'): return False
	else: return d
def set_view(content='none',view_mode=50):
	h=int(sys.argv[1])
	if (content is not 'none'): xbmcplugin.setContent(h, content) ### set content type so library shows more views and info
	if (tfalse(addst('auto-view'))==True):
Beispiel #4
0
from t0mm0.common.net import Net
from universal import favorites
from universal import _common as univ_common
from thedareradio import *

#www.thedarewall.com (The Dare TV) - by The_Silencer 2013 v0.6.0

grab = metahandlers.MetaData(preparezip=False)
addon_id = 'plugin.video.thedaretv'
local = xbmcaddon.Addon(id=addon_id)
daretvpath = local.getAddonInfo('path')
addon = Addon(addon_id, sys.argv)
datapath = addon.get_profile()
art = daretvpath + '/art'
net = Net()
fav = favorites.Favorites('plugin.video.thedaretv', sys.argv)


#Metahandler
def GRABMETA(name, types):
    type = types
    EnableMeta = local.getSetting('Enable-Meta')
    if EnableMeta == 'true':
        if 'Movie' in type:
            meta = grab.get_meta('movie', name, '', None, None, overlay=6)
            infoLabels = {
                'rating': meta['rating'],
                'duration': meta['duration'],
                'genre': meta['genre'],
                'mpaa': "rated %s" % meta['mpaa'],
                'plot': meta['plot'],
Beispiel #5
0
    def GetSection(self,
                   indexer,
                   section,
                   url,
                   type,
                   list,
                   page='',
                   total_pages='',
                   sort_by='',
                   sort_order=''):

        from universal import favorites
        fav = favorites.Favorites(common.addon_id)

        if section == 'main':
            main_sections = fav.get_my_main_sections()

            for main_section in main_sections:
                self.AddSection(list,
                                indexer,
                                main_section['title'],
                                main_section['title'],
                                type=main_section['title'].lower())

        else:
            section_items = section.split('|')
            section_items_count = len(section_items)

            if section_items_count == 1:

                items = fav.get_my_sub_sections(section_items[0])

                if len(items) > 0:
                    for item in items:
                        self.AddSection(list,
                                        indexer,
                                        section + '|' + item['title'],
                                        item['title'],
                                        type=(section + ' ' +
                                              item['title']).lower())
                else:
                    items = fav.get_my_favorites(section_items[0])

                    for item in items:

                        id = common.CreateIdFromString(item['title'])
                        list.append({
                            'indexer':
                            item['infolabels'].get('indexer', ''),
                            'mode':
                            item['infolabels'].get('mode', ''),
                            'title':
                            item['title'],
                            'url':
                            item['infolabels'].get('url', ''),
                            'id':
                            id,
                            'website':
                            item['infolabels'].get('indexer_id', ''),
                            'indexer_id':
                            item['infolabels'].get('indexer_id', ''),
                            'name':
                            item['infolabels'].get('name', ''),
                            'year':
                            item['infolabels'].get('year', ''),
                            'season':
                            item['infolabels'].get('season', ''),
                            'episode':
                            item['infolabels'].get('episode', ''),
                            'type':
                            item['infolabels'].get('type', ''),
                            'img':
                            item['infolabels'].get('img', ''),
                            'favorite':
                            'true',
                            'imdb_id':
                            item['infolabels'].get('imdb_id', ''),
                            'video_type':
                            item['infolabels'].get('video_type', ''),
                            'urls':
                            item['infolabels'].get('urls', '')
                        })

            elif section_items_count == 2:

                items = fav.get_my_favorites(section_items[0],
                                             section_items[1])

                for item in items:

                    id = common.CreateIdFromString(item['title'])
                    list.append({
                        'indexer':
                        item['infolabels'].get('indexer', ''),
                        'mode':
                        item['infolabels'].get('mode', ''),
                        'title':
                        item['title'],
                        'item_title':
                        item['infolabels'].get('item_title', ''),
                        'url':
                        item['infolabels'].get('url', ''),
                        'id':
                        id,
                        'website':
                        item['infolabels'].get('indexer_id', ''),
                        'indexer_id':
                        item['infolabels'].get('indexer_id', ''),
                        'name':
                        item['infolabels'].get('name', ''),
                        'year':
                        item['infolabels'].get('year', ''),
                        'season':
                        item['infolabels'].get('season', ''),
                        'episode':
                        item['infolabels'].get('episode', ''),
                        'type':
                        item['infolabels'].get('type', ''),
                        'img':
                        item['infolabels'].get('img', ''),
                        'favorite':
                        'true',
                        'imdb_id':
                        item['infolabels'].get('imdb_id', ''),
                        'video_type':
                        item['infolabels'].get('video_type', ''),
                        'urls':
                        item['infolabels'].get('urls', '')
                    })