예제 #1
0
def setScrapers():
    import cvutil
    import cinemavision

    selected = [
        s.strip().lower()
        for s in kodiutil.getSetting('trailer.scrapers', '').split(',')
    ]
    contentScrapers = cinemavision.util.contentScrapers()
    temp = [list(x) for x in cinemavision.sequence.Trailer._scrapers]
    options = []
    for s in temp:
        for ctype, c in contentScrapers:
            if ctype == 'trailers' and c == s[0]:
                s[2] = s[2] in selected
                options.append(s)
    options.sort(key=lambda i: i[0].lower() in selected and selected.index(i[
        0].lower()) + 1 or 99)

    result = cvutil.multiSelect(options, default=True)

    if result is False or result is None:
        return

    kodiutil.setSetting('trailer.scrapers', result)
예제 #2
0
def setScrapers():
    import cvutil
    import cinemavision

    selected = [s.strip().lower() for s in kodiutil.getSetting('trailer.scrapers', '').split(',')]
    contentScrapers = cinemavision.util.contentScrapers()
    temp = [list(x) for x in cinemavision.sequence.Trailer._scrapers]
    options = []
    for s in temp:
        for ctype, c in contentScrapers:
            if ctype == 'trailers' and c == s[0]:
                s[2] = s[2] in selected
                options.append(s)
    options.sort(key=lambda i: i[0].lower() in selected and selected.index(i[0].lower())+1 or 99)

    result = cvutil.multiSelect(options, default=True)

    if result is False or result is None:
        return

    kodiutil.setSetting('trailer.scrapers', result)
예제 #3
0
파일: main.py 프로젝트: camster1/RTOTV
    def _editItemSetting(self):
        item = self.settingsList.getSelectedItem()
        if not item or item.getProperty('type') == 'integer':
            return

        sItem = self.item.dataSource

        attr = item.dataSource

        options = sItem.getSettingOptions(attr)

        if options in (cinemavision.sequence.LIMIT_FILE,
                       cinemavision.sequence.LIMIT_FILE_DEFAULT):
            select = True
            if sItem.getSetting(attr):
                yes = xbmcgui.Dialog().yesno(
                    T(32517, 'Change Path'), '',
                    T(32518,
                      'Would choose a new path, or clear the current path?'),
                    '', T(32519, 'Choose'), T(32520, 'Clear'))
                if yes:
                    if options == cinemavision.sequence.LIMIT_FILE:
                        value = ''
                    else:
                        value = None
                    select = False

            if select:
                value = xbmcgui.Dialog().browse(1, T(32521, 'Select File'),
                                                'files', None, False, False,
                                                sItem.getSetting(attr))
                if not value:
                    return
                value = value.decode('utf-8')
        elif options == cinemavision.sequence.LIMIT_DB_CHOICE:
            options = sItem.DBChoices(attr)
            if not options:
                xbmcgui.Dialog().ok(T(32508, 'No Content'), '',
                                    T(32522, 'No matching content found.'))
                return False
            options.insert(0, (None, T(32322, 'Default')))
            idx = xbmcgui.Dialog().select(T(32523, 'Options'),
                                          [x[1] for x in options])
            if idx < 0:
                return False
            value = options[idx][0]
        elif options == cinemavision.sequence.LIMIT_DIR:
            select = True
            if sItem.getSetting(attr):
                yes = xbmcgui.Dialog().yesno(
                    T(32517, 'Change Path'), '',
                    T(32518, 'Choose a new path or clear the current path?'),
                    '', T(32520, 'Clear'), T(32519, 'Choose'))
                if yes:
                    value = None
                    select = False

            if select:
                value = xbmcgui.Dialog().browse(0, T(32524,
                                                     'Select Directory'),
                                                'files')
                if not value:
                    return
                value = value.decode('utf-8')
        elif options == cinemavision.sequence.LIMIT_MULTI_SELECT:
            options = sItem.Select(attr)
            if not options:
                xbmcgui.Dialog().ok(T(32525, 'No Options'), '',
                                    T(32526, 'No options found.'))
                return False
            result = cvutil.multiSelect(options)
            if result is False:
                return False
            value = result
        elif options == cinemavision.sequence.LIMIT_BOOL_DEFAULT:
            curr = sItem.getSetting(attr)
            if curr is None:
                value = True
            elif curr is True:
                value = False
            else:
                value = None
        elif options == cinemavision.sequence.LIMIT_BOOL:
            value = not sItem.getSetting(attr)
        elif options == cinemavision.sequence.LIMIT_ACTION:
            if self.item.dataSource._type == 'action':
                cvutil.evalActionFile(self.item.dataSource.file)
            return False
        elif isinstance(options, list):
            idx = xbmcgui.Dialog().select(T(32523, 'Options'),
                                          [x[1] for x in options])
            if idx < 0:
                return False
            value = options[idx][0]
        else:
            return False

        sItem.setSetting(attr, value)

        if sItem._type == 'video' and attr == 'vtype':
            if not sItem.getSetting(attr):
                name = '[COLOR FFFF0000]{0}[/COLOR]'.format(
                    item.getProperty('name'))
            else:
                name = item.getProperty('name')
            item.setLabel(name)

        item.setLabel2(unicode(sItem.getSettingDisplay(attr)))

        self.modified = True

        self.main.updateItemSettings(self.item)

        if sItem._type == 'command' and attr == 'command':
            self.main.updateSpecials()
예제 #4
0
    def _editItemSetting(self):
        item = self.settingsList.getSelectedItem()
        if not item or item.getProperty('type') == 'integer':
            return

        sItem = self.item.dataSource

        attr = item.dataSource

        options = sItem.getSettingOptions(attr)

        if options in (cinemavision.sequence.LIMIT_FILE, cinemavision.sequence.LIMIT_FILE_DEFAULT):
            select = True
            if sItem.getSetting(attr):
                yes = xbmcgui.Dialog().yesno(
                    T(32517, 'Change Path'),
                    '',
                    T(32518, 'Would choose a new path, or clear the current path?'),
                    '',
                    T(32519, 'Choose'),
                    T(32520, 'Clear')
                )
                if yes:
                    if options == cinemavision.sequence.LIMIT_FILE:
                        value = ''
                    else:
                        value = None
                    select = False

            if select:
                value = xbmcgui.Dialog().browse(1, T(32521, 'Select File'), 'files', None, False, False, sItem.getSetting(attr))
                if not value:
                    return
                value = value.decode('utf-8')
        elif options == cinemavision.sequence.LIMIT_DB_CHOICE:
            options = sItem.DBChoices(attr)
            if not options:
                xbmcgui.Dialog().ok(T(32508, 'No Content'), '', T(32522, 'No matching content found.'))
                return False
            options.insert(0, (None, T(32322, 'Default')))
            idx = xbmcgui.Dialog().select(T(32523, 'Options'), [x[1] for x in options])
            if idx < 0:
                return False
            value = options[idx][0]
        elif options == cinemavision.sequence.LIMIT_DIR:
            select = True
            if sItem.getSetting(attr):
                yes = xbmcgui.Dialog().yesno(
                    T(32517, 'Change Path'),
                    '',
                    T(32518, 'Choose a new path or clear the current path?'),
                    '',
                    T(32520, 'Clear'),
                    T(32519, 'Choose')
                )
                if yes:
                    value = None
                    select = False

            if select:
                value = xbmcgui.Dialog().browse(0, T(32524, 'Select Directory'), 'files')
                if not value:
                    return
                value = value.decode('utf-8')
        elif options == cinemavision.sequence.LIMIT_MULTI_SELECT:
            options = sItem.Select(attr)
            if not options:
                xbmcgui.Dialog().ok(T(32525, 'No Options'), '', T(32526, 'No options found.'))
                return False
            result = cvutil.multiSelect(options)
            if result is False:
                return False
            value = result
        elif options == cinemavision.sequence.LIMIT_BOOL_DEFAULT:
            curr = sItem.getSetting(attr)
            if curr is None:
                value = True
            elif curr is True:
                value = False
            else:
                value = None
        elif options == cinemavision.sequence.LIMIT_BOOL:
            value = not sItem.getSetting(attr)
        elif options == cinemavision.sequence.LIMIT_ACTION:
            if self.item.dataSource._type == 'action':
                cvutil.evalActionFile(self.item.dataSource.file)
            return False
        elif isinstance(options, list):
            idx = xbmcgui.Dialog().select(T(32523, 'Options'), [x[1] for x in options])
            if idx < 0:
                return False
            value = options[idx][0]
        else:
            return False

        sItem.setSetting(attr, value)
        item.setLabel2(unicode(sItem.getSettingDisplay(attr)))

        self.modified = True

        self.main.updateItemSettings(self.item)

        if sItem._type == 'command' and attr == 'command':
            self.main.updateSpecials()