def displayList(self):
     list = []
     if ":groups:" == self.menu:
         groups = self.favourites.getGroups()
         for item in groups:
             dItem = CDisplayListItem(name=item['title'],
                                      type=CDisplayListItem.TYPE_CATEGORY)
             dItem.privateData = item['group_id']
             list.append((dItem, ))
     else:
         if not self.loadGroupItems(self.menu):
             return
         sts, items = self.favourites.getGroupItems(self.menu)
         if not sts:
             self.session.open(MessageBox,
                               self.favourites.getLastError(),
                               type=MessageBox.TYPE_ERROR,
                               timeout=10)
             return
         for idx in range(len(items)):
             item = items[idx]
             dItem = CDisplayListItem(name=item.name, type=item.type)
             dItem.privateData = idx
             list.append((dItem, ))
     self["list"].setList(list)
 def displayList(self, activeIdx=0):
     list = []
     tmpList = self.stackList[-1]['list']
     type    = self.stackList[-1]['type']
     
     iconType = CDisplayListItem.TYPE_CATEGORY
     if type == 'movie':
         self["title"].setText(_("Select movie"))
     if type == 'episode':
         self["title"].setText(_("Select episode"))
     elif type == "lang":
         self["title"].setText(_("Select language"))
     elif type == "sub":
         iconType = CDisplayListItem.TYPE_ARTICLE
         self["title"].setText(_("Select subtitles to download"))
     
     self["title"].show()
     
     for item in tmpList:
         dItem = CDisplayListItem(name = clean_html(item['title']), type=iconType)
         dItem.privateData = item['private_data']
         list.append( (dItem,) )
     self["list"].setList(list)
     self["list"].show()
     try: self["list"].moveToIndex(activeIdx)
     except: pass
     
     self.setListMode(True)
    def displayList(self, activeIdx=0):
        list = []
        tmpList = self.stackList[-1]['list']
        type = self.stackList[-1]['type']

        iconType = CDisplayListItem.TYPE_CATEGORY
        if type == 'movie':
            self["title"].setText(_("Select movie"))
        if type == 'episode':
            self["title"].setText(_("Select episode"))
        elif type == "lang":
            self["title"].setText(_("Select language"))
        elif type == "sub":
            iconType = CDisplayListItem.TYPE_ARTICLE
            self["title"].setText(_("Select subtitles to download"))

        self["title"].show()

        for item in tmpList:
            dItem = CDisplayListItem(name=clean_html(item['title']),
                                     type=iconType)
            dItem.privateData = item['private_data']
            list.append((dItem, ))
        self["list"].setList(list)
        self["list"].show()
        try:
            self["list"].moveToIndex(activeIdx)
        except:
            pass

        self.setListMode(True)
 def displayList(self):
     list = []
     if ":groups:" == self.menu:
         groups = self.favourites.getGroups()
         for item in groups:
             dItem = CDisplayListItem(name=item['title'], type=CDisplayListItem.TYPE_CATEGORY)
             dItem.privateData = item['group_id']
             list.append( (dItem,) )
     else:
         if not self.loadGroupItems(self.menu): return 
         sts,items = self.favourites.getGroupItems(self.menu)
         if not sts:
             self.session.open(MessageBox, self.favourites.getLastError(), type=MessageBox.TYPE_ERROR, timeout=10)
             return
         for idx in range(len(items)):
             item = items[idx]
             dItem = CDisplayListItem(name=item.name, type=item.type)
             dItem.privateData = idx
             list.append( (dItem,) )
     self["list"].setList(list)
Exemple #5
0
    def listSubtitlesProviders(self):
        printDBG("IPTVSubDownloaderWidget.listSubtitlesProviders")
        subProvidersList = []
        napisy24pl = {'title': _("Napisy24.pl"), 'sub_provider': 'napisy24pl'}
        openSubtitles = {
            'title': _("OpenSubtitles.org"),
            'sub_provider': 'opensubtitlesorg'
        }
        napiprojektpl = {
            'title': _("Napiprojekt.pl"),
            'sub_provider': 'napiprojektpl'
        }
        titlovi = {'title': _("Titlovi.com"), 'sub_provider': 'titlovicom'}
        subscene = {'title': _("Subscene.com"), 'sub_provider': 'subscenecom'}
        youtube = {'title': _("Youtube.com"), 'sub_provider': 'youtubecom'}

        if 'youtube_id' in self.params['url_params'] and '' != self.params[
                'url_params']['youtube_id']:
            subProvidersList.append(youtube)
        if 'pl' == GetDefaultLang():
            subProvidersList.append(napisy24pl)
            if IsSubtitlesParserExtensionCanBeUsed():
                subProvidersList.append(napiprojektpl)
        subProvidersList.append(openSubtitles)
        subProvidersList.append(titlovi)
        subProvidersList.append(subscene)
        if 'pl' != GetDefaultLang():
            subProvidersList.append(napisy24pl)
            if IsSubtitlesParserExtensionCanBeUsed():
                subProvidersList.append(napiprojektpl)

        self.currList = []
        for item in subProvidersList:
            params = CDisplayListItem(item['title'], item.get('desc', ''),
                                      CDisplayListItem.TYPE_SUB_PROVIDER)
            params.privateData = {'sub_provider': item['sub_provider']}
            self.currList.append(params)

        idx = 0
        selIndex = 0
        for idx in range(len(self.currList)):
            if self.hostName == self.currList[idx].privateData['sub_provider']:
                selIndex = idx
                break

        self["list"].setList([(x, ) for x in self.currList])
        #restor previus selection
        if len(self.currList) > selIndex:
            self["list"].moveToIndex(selIndex)
        self.changeBottomPanel()
        self["headertext"].setText(self.getCategoryPath())
        self["statustext"].setText("")
        self["list"].show()
    def displayList(self):
        list = []
        self["title"].setText(_("Select subtitles to download"))
        self["title"].show()

        tmpList = self.params.get('sub_list', [])
        for item in tmpList:
            dItem = CDisplayListItem(name=item['title'],
                                     type=CDisplayListItem.TYPE_ARTICLE)
            dItem.privateData = item
            list.append((dItem, ))
        self["list"].setList(list)
        self["list"].show()
        self.setListMode(True)
 def displayList(self):
     list = []
     self["title"].setText(_("Select subtitles to download"))
     self["title"].show()
     
     tmpList = self.params.get('sub_list', [])
     try:
         for item in tmpList:
             printDBG(item)
             dItem = CDisplayListItem(name = item['title'], type=CDisplayListItem.TYPE_ARTICLE)
             dItem.privateData = item
             list.append( (dItem,) )
     except: 
         printExc()
     self["list"].setList(list)
     self["list"].show()
     self.setListMode(True)
    def listSubtitlesProviders(self):
        printDBG("IPTVSubDownloaderWidget.listSubtitlesProviders")
        subProvidersList = []
        napisy24pl = {'title': "Napisy24.pl", 'sub_provider': 'napisy24pl'}
        openSubtitles = {'title': "OpenSubtitles.org API", 'sub_provider': 'opensubtitlesorg'}
        openSubtitles2 = {'title': "OpenSubtitles.org WWW", 'sub_provider': 'opensubtitlesorg2'}
        openSubtitles3 = {'title': "OpenSubtitles.org REST", 'sub_provider': 'opensubtitlesorg3'}
        napiprojektpl = {'title': "Napiprojekt.pl", 'sub_provider': 'napiprojektpl'}
        podnapisinet = {'title': "Podnapisi.net", 'sub_provider': 'podnapisinet'}
        titlovi = {'title': "Titlovi.com", 'sub_provider': 'titlovicom'}
        subscene = {'title': "Subscene.com", 'sub_provider': 'subscenecom'}
        youtube = {'title': "Youtube.com", 'sub_provider': 'youtubecom'}
        popcornsubtitles = {'title': "PopcornSubtitles.com", 'sub_provider': 'popcornsubtitles'}
        subtitlesgr = {'title': "Subtitles.gr", 'sub_provider': 'subtitlesgr'}
        prijevodi = {'title': "Prijevodi-Online.org", 'sub_provider': 'prijevodi'}
        subsro = {'title': "Subs.ro", 'sub_provider': 'subsro'}

        defaultLang = GetDefaultLang()

        if 'youtube_id' in self.params['url_params'] and '' != self.params['url_params']['youtube_id']:
            subProvidersList.append(youtube)

        if 'popcornsubtitles_url' in self.params['url_params'] and '' != self.params['url_params']['popcornsubtitles_url']:
            subProvidersList.append(popcornsubtitles)

        if 'hr' == defaultLang:
            subProvidersList.append(prijevodi)

        if 'el' == defaultLang:
            subProvidersList.append(subtitlesgr)

        if 'ro' == defaultLang:
            subProvidersList.append(subsro)

        if 'pl' == defaultLang:
            subProvidersList.append(napisy24pl)
            if IsSubtitlesParserExtensionCanBeUsed():
                subProvidersList.append(napiprojektpl)

        subProvidersList.append(openSubtitles2)
        subProvidersList.append(openSubtitles3)
        subProvidersList.append(openSubtitles)
        subProvidersList.append(podnapisinet)
        subProvidersList.append(titlovi)
        subProvidersList.append(subscene)

        if 'pl' != defaultLang:
            subProvidersList.append(napisy24pl)
            if IsSubtitlesParserExtensionCanBeUsed():
                subProvidersList.append(napiprojektpl)

        if 'el' != defaultLang:
            subProvidersList.append(subtitlesgr)

        if 'hr' != defaultLang:
            subProvidersList.append(prijevodi)

        if 'ro' != defaultLang:
            subProvidersList.append(subsro)

        self.currList = []
        for item in subProvidersList:
            params = CDisplayListItem(item['title'], item.get('desc', ''), CDisplayListItem.TYPE_SUB_PROVIDER)
            params.privateData = {'sub_provider': item['sub_provider']}
            self.currList.append(params)

        idx = 0
        selIndex = 0
        for idx in range(len(self.currList)):
            if self.hostName == self.currList[idx].privateData['sub_provider']:
                selIndex = idx
                break

        self["list"].setList([(x,) for x in self.currList])
        #restor previus selection
        if len(self.currList) > selIndex:
            self["list"].moveToIndex(selIndex)
        self.changeBottomPanel()
        self["headertext"].setText(self.getCategoryPath())
        self["statustext"].setText("")
        self["list"].show()