Пример #1
0
    def getAllSources(self):
     
        sFolder = bFolder.replace('\\', '/')

        aFileNames = self.__getFileNamesFromFolder(sFolder)

        aPlugins = []
        for sFileName in aFileNames:

            aPlugin = self.__importAllSources(sFileName)

            if (aPlugin[0] != False):
                sSiteName = aPlugin[0]
                sPluginSettingsName = aPlugin[1]
                sSiteIcon = 'sites/%s.png' % (sFileName)
                sFanart = 'host_fanart.jpg'
                
                bPlugin = VSgetsetting(sPluginSettingsName)
                if (bPlugin != ''):
                    if (bPlugin == 'true'):
                        aPlugins.append((sFileName,'load',sSiteName,sSiteIcon,sFanart,'siteUrl=http://venom'))
                else:
                    aPlugins.append((sFileName,'load',sSiteName,sSiteIcon,sFanart,'siteUrl=http://venom'))

        return aPlugins
Пример #2
0
    def getAvailablePlugins(self, sLabel,sFanart):
      
        sFolder = bFolder.replace('\\', '/')

        aFileNames = self.__getFileNamesFromFolder(sFolder)
        
        aPlugins = []
        for sFileName in aFileNames:

            aPlugin = self.__importPlugin(sFileName, sLabel)

            if (aPlugin[0] != False):
                sSiteUrl = aPlugin[0]
                sPluginSettingsName = aPlugin[1]
                sSiteFunc = aPlugin[2]
                sSiteName = aPlugin[3]
                sSiteIcon = 'sites/%s.png' % (sFileName)

                bPlugin = VSgetsetting(sPluginSettingsName)
                if (bPlugin != ''):
                    if (bPlugin == 'true'):
                        aPlugins.append((sFileName,sSiteFunc,sSiteName,sSiteIcon,sFanart,'siteUrl='+str(sSiteUrl)+''))
                else:
                    aPlugins.append((sFileName,sSiteFunc,sSiteName,sSiteIcon,sFanart,'siteUrl='+str(sSiteUrl)+''))


        return aPlugins
Пример #3
0
    def __importPlugin(self, sName, sLabel):
        pluginData = {}
        sPluginSettingsName = sLabel + '_' + sName
        bPlugin = VSgetsetting(sPluginSettingsName)
        #multicherche
        if sLabel == 'search5':
            bPlugin = 'true'

        OnPlugins = VSgetsetting('plugin_' + sName)

        if (bPlugin == 'true') and (OnPlugins == 'true'):
            try:

                plugin = __import__('resources.sites.%s' % sName,
                                    fromlist=[sName])

                pluginData['identifier'] = plugin.SITE_IDENTIFIER
                pluginData['name'] = plugin.SITE_NAME
                pluginData['search'] = plugin.URL_SEARCH

            except Exception, e:
                VSlog("cant import plugin: " + str(sName))
Пример #4
0
    def setDisp(self, sDisp):
        if not sDisp:
            disp = [
                'search1', 'search2', 'search3', 'search4', 'search5',
                'search10'
            ]
            dialog2 = xbmcgui.Dialog()
            dialog_sel = [
                VSgetsetting('search1_label'),
                VSgetsetting('search2_label'),
                VSgetsetting('search3_label'),
                VSgetsetting('search4_label'),
                VSlang(30092),
                VSlang(30417)
            ]

            ret = dialog2.sel(VSlang(30093), dialog_sel)

            if ret > -1:
                sDisp = disp[ret]

        self.__sDisp = sDisp

        return self.__sDisp
Пример #5
0
    def getAvailablePlugins(self):
        oConfig = cConfig()
        sText = self.getText()
        if not sText:
            return False
        sLabel = self.getDisp()
        if not sLabel:
            return False

        #historique
        try:
            if (VSgetsetting("history-view") == 'true'
                    and self.__sRead != "False"):
                meta = {}
                meta['title'] = sText
                meta['disp'] = sLabel
                cDb().insert_history(meta)
        except:
            pass

        # xbox hack
        sFolder = bFolder.replace('\\', '/')
        VSlog("Sites Folder: " + sFolder)

        aFileNames = self.__getFileNamesFromFolder(sFolder)

        aPlugins = []
        for sFileName in aFileNames:
            aPlugin = self.__importPlugin(sFileName, sLabel)
            if aPlugin:
                aPlugins.append(aPlugin)

        #multiselect
        if sLabel == 'search5':
            multi = []
            for plugin in aPlugins:
                multi.append(plugin['identifier'])
            dialog = xbmcgui.Dialog()
            ret = dialog.multiselect(VSlang(30094), multi)
            NewFileNames = []
            if ret > -1:
                for i in ret:
                    NewFileNames.append(aPlugins[i])

            aPlugins = NewFileNames
        #fin multiselect
        return aPlugins
Пример #6
0
    def showSearch(self):

        Films_params = "http://venom&disp=search1&type=" + VSgetsetting(
            'search1_type') + "&readdb=True"

        Films = (VSlang(30077) + ": " + VSgetsetting('search1_label'),
                 "search.png", Films_params)

        Series_params = "http://venom&disp=search2&type=" + VSgetsetting(
            'search2_type') + "&readdb=True"

        Series = (VSlang(30089) + ": " + VSgetsetting('search2_label'),
                  "search.png", Series_params)

        Animes_params = "http://venom&disp=search3&type=" + VSgetsetting(
            'search3_type') + "&readdb=True"

        Animes = (VSlang(30090) + ": " + VSgetsetting('search3_label'),
                  "search.png", Animes_params)

        Docs_params = "http://venom&disp=search4&type=" + VSgetsetting(
            'search4_type') + "&readdb=True"

        Docs = (VSlang(30091) + ": " + VSgetsetting('search4_label'),
                "search.png", Docs_params)

        Choix_params = "http://venom&disp=search5&readdb=True"

        Choix = (('%s 5: %s') % (VSlang(30076), VSlang(30092)), "search.png",
                 Choix_params)

        Alluc_params = "http://venom&disp=search10&readdb=True"

        Alluc = (VSlang(30417), "search.png", Alluc_params)

        History = ("DoNothing", "DoNothing", VSlang(30416), "none.png",
                   "search_fanart.jpg", "siteUrl=http://venom")

        self.SubMenu.extend([Films, Series, Animes, Docs, Choix, Alluc])

        #dossier recherche
        oGui.FolderType2("globalSearch", "searchMovie", "search_fanart.jpg",
                         self.SubMenu)

        if (VSgetsetting("history-view") == 'true'):
            row = cDb().get_history()
            olist = []
            if row:
                #text historique
                oGui.FolderType1([History])
                for match in row:
                    oOutputParameterHandler = cOutputParameterHandler()

                    #code to get type with disp
                    type = VSgetsetting('search' + match[2][-1:] + '_type')
                    if type:
                        oOutputParameterHandler.addParameter('type', type)
                        xbmcgui.Window(10101).setProperty('search_type', type)

                    oOutputParameterHandler.addParameter(
                        'searchtext', match[1])
                    oOutputParameterHandler.addParameter('disp', match[2])
                    oOutputParameterHandler.addParameter('readdb', 'False')

                    sParams = oOutputParameterHandler.getParameterAsUri()

                    aEntry = ("globalSearch", "searchMovie", match[1],
                              "search.png", "search_fanart.jpg", sParams)

                    olist.append(aEntry)

                #historique
                oGui.FolderType1(olist, History=True)

                #supprimer l'historique
                oGui.FolderType1([
                    (SITE_IDENTIFIER, 'delSearch', VSlang(30413), "search.png",
                     "search_fanart.jpg", "siteUrl=http://venom")
                ])

        oGui.endOfDirectory()
Пример #7
0
    def load(self):

        Menu = []

        if (VSgetsetting('home_cherches') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showSearch", VSlang(30076), "search.png",
                 "search_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_cherchev') == 'true'):
            Menu.append(
                ("themoviedb_org", "load", VSlang(30088), "searchtmdb.png",
                 "vsearch_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_tvs') == 'true'):
            Menu.append(("freebox", "load", VSlang(30115), "tv.png",
                         "tv_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_replaytvs') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showReplay", VSlang(30117), "replay.png",
                 "replay_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_films') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showMovies", VSlang(30120), "films.png",
                 "films_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_series') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showSeries", VSlang(30121), "series.png",
                 "series_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_anims') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showAnimes", VSlang(30122), "animes.png",
                 "animes_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_docs') == 'true'):
            Menu.append((SITE_IDENTIFIER, "showDocs", VSlang(30112), "doc.png",
                         "doc_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_sports') == 'true'):
            Menu.append(
                ("sitehandler", "callplugin", VSlang(30113), "sport.png",
                 "sport_fanart.jpg", "siteUrl=SPORT_SPORTS"))

        if (VSgetsetting('home_videos') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showNets", VSlang(30114), "buzz.png",
                 "buzz_fanart.jpg", "siteUrl=http://venom"))

        #dossiers fixe
        Trakt = ("cTrakt", "getLoad", "Trakt", "trakt.png", "fanart.jpg",
                 "siteUrl=http://venom")

        Download = ("cDownload", 'getDownload', VSlang(30202), "download.png",
                    "download_fanart.jpg", "siteUrl=http://venom")

        Librairie = ("cLibrary", "getLibrary", VSlang(30300), "library.png",
                     "library_fanart.jpg", "siteUrl=http://venom")

        Sources = ("globalSources", "showSources", VSlang(30116), "host.png",
                   "host_fanart.jpg", "siteUrl=http://venom")

        Marque = ('cFav', 'getFavourites', VSlang(30210), 'mark.png',
                  "mark_fanart.jpg", "siteUrl=http://venom")

        Menu.extend([Trakt, Download, Librairie, Sources, Marque])

        #maj en dernier
        if (VSgetsetting('home_update') == 'true'):
            Menu.append(("MAJ", "showUpdate", VSlang(30418), "update.png",
                         "update_fanart.jpg", "siteUrl=http://venom"))

        oGui.FolderType1(Menu)

        oGui.endOfDirectory()
Пример #8
0
#-*- coding: utf-8 -*-
#https://github.com/Kodi-vStream/venom-xbmc-addons
from resources.test.util import VSlog, VSgetsetting, VSlang
from resources.test.gui import cGui
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
from resources.lib.db import cDb
import xbmcgui

SITE_IDENTIFIER = 'cHome'

Deco = '%s [COLOR ' + VSgetsetting('deco_color') + '](%s)[/COLOR]'

oGui = cGui()


class cHome:
    def __init__(self):
        self.SubMenu = []

    def load(self):

        Menu = []

        if (VSgetsetting('home_cherches') == 'true'):
            Menu.append(
                (SITE_IDENTIFIER, "showSearch", VSlang(30076), "search.png",
                 "search_fanart.jpg", "siteUrl=http://venom"))

        if (VSgetsetting('home_cherchev') == 'true'):
            Menu.append(
                ("themoviedb_org", "load", VSlang(30088), "searchtmdb.png",
Пример #9
0
    def searchGlobal(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()
        sSearchText = oInputParameterHandler.getValue('searchtext')
        sReadDB = oInputParameterHandler.getValue('readdb')
        sDisp = oInputParameterHandler.getValue('disp')

        sSearchText = self.setText(sSearchText)
        self.setDisp(sDisp)
        self.setRead(sReadDB)
        aPlugins = self.getAvailablePlugins()
        if not aPlugins:
            return True
        total = len(aPlugins)

        #xbmc.log(str(aPlugins), xbmc.LOGNOTICE)

        dialog = VScreateDialog("vStream")
        xbmcgui.Window(10101).setProperty('search', 'true')

        oGui.addText(
            'globalSearch',
            '[COLOR khaki]%s: %s[/COLOR]' % (VSlang(30076), sSearchText),
            'none.png')

        for count, plugin in enumerate(aPlugins):

            text = '%s/%s - %s' % ((count + 1), total, plugin['name'])
            VSupdateDialogSearch(dialog, total, text)
            if dialog.iscanceled():
                break

            #nom du site
            oGui.addText(
                plugin['identifier'],
                '%s. [COLOR olive]%s[/COLOR]' % ((count + 1), plugin['name']),
                'sites/%s.png' % (plugin['identifier']))
            #recherche import
            self.pluginSearch(plugin, sSearchText)

        xbmcgui.Window(10101).setProperty('search', 'false')

        #affichage
        total = len(oGui.searchResults)
        #filtre
        int_1 = cUtil().CheckOrd(sSearchText)

        for count, result in enumerate(oGui.searchResults):
            text = '%s/%s - %s' % (
                (count + 1 / total), total, result['guiElement'].getTitle())
            VSupdateDialogSearch(dialog, total, text)

            #filtre
            if VSgetsetting('search_filter') == 'true' and result[
                    'guiElement'].getFunction() != 'DoNothing':
                int_2 = cUtil().CheckOrd(result['guiElement'].getFileName())
                middle = int(abs(int_1 - int_2))
                #xbmc.log('%s (%s) - %s (%s)' % (middle, result['guiElement'].getFileName(), cConfig().getSetting('search_ord'), sSearchText),  xbmc.LOGNOTICE)
                if middle > int(VSgetsetting('search_ord')):
                    continue

            oGui.addFolder(result['guiElement'], result['params'])
            #xbmc.log('%s - %s' % (middle,old_label),  xbmc.LOGNOTICE)

        VSfinishDialog(dialog)

        oGui.setEndOfDirectory()

        return True