Esempio n. 1
0
def SetPin():
    selected = dialog.select(i18n('choose_option'), [i18n('set_pin'), i18n('remove_pin')])
    if selected == -1:
        return
    elif selected == 0:
        pincode = AskPin()
        if pincode:
            addon.setSetting('pincode', pincode)
            addon.setSetting('logintime', '')
    elif selected == 1:
        addon.setSetting('pincode', '')
        addon.setSetting('logintime', '')
    return
Esempio n. 2
0
def INDEX():
    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(
        utils.i18n('sites')),
                           '',
                           'site_list',
                           basics.cum_image('cum-sites.png'),
                           '',
                           list_avail=False)
    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(
        utils.i18n('fav_videos')),
                           '',
                           'favorites.List',
                           basics.cum_image('cum-fav.png'),
                           '',
                           list_avail=False)
    download_path = addon.getSetting('download_path')
    if download_path != '' and xbmcvfs.exists(download_path):
        url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(
            utils.i18n('dnld_folder')),
                               download_path,
                               'OpenDownloadFolder',
                               basics.cum_image('cum-downloads.png'),
                               '',
                               list_avail=False)

    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(
        utils.i18n('custom_list')),
                           '',
                           'favorites.create_custom_list',
                           Folder=False,
                           list_avail=False)
    for rowid, name in favorites.get_custom_lists():
        url_dispatcher.add_dir(name,
                               str(rowid),
                               'favorites.load_custom_list',
                               list_avail=False,
                               custom_list=True)
    favorites.load_custom_list('main')
    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(
        utils.i18n('clear_cache')),
                           '',
                           'utils.clear_cache',
                           basics.cuminationicon,
                           '',
                           Folder=False,
                           list_avail=False)

    utils.eod(basics.addon_handle, False)
Esempio n. 3
0
def CheckPin():
    now = time.time()
    hashedpin = addon.getSetting('pincode')
    logintime = addon.getSetting('logintime')
    if not logintime:
        logintime = 0
    timecheck = now - (60 * 60)
    if not float(logintime) < timecheck:
        return True
    if hashedpin:
        pinhash = AskPin()
        if pinhash == hashedpin:
            addon.setSetting('logintime', str(now))
            return True
        else:
            retry = dialog.yesno(i18n('pin_incorrect'), '{0}[CR]{1}?'.format(i18n('incorrect_msg'), i18n('retry')), yeslabel=i18n('retry'))
            if retry:
                return CheckPin()
            else:
                return False
    return True
Esempio n. 4
0
def site_list():
    custom_listitems = favorites.get_custom_listitems()
    custom_listitems_dict = {}
    for x in custom_listitems:
        custom_listitems_dict[x[0]] = x[1]
    for x in sorted(AdultSite.get_sites(), key=lambda y: y.get_clean_title().lower(), reverse=False):
        if x.custom:
            utils.kodilog('{0}: {1}'.format(utils.i18n('list_custom'), x.title), xbmc.LOGDEBUG)
        title = x.title
        if title in custom_listitems_dict.keys():
            title = '{} [COLOR red]{}[/COLOR]'.format(title, ''.ljust(custom_listitems_dict[title], '*'))
        url_dispatcher.add_dir(title, x.url, x.default_mode, x.image, about=x.about, custom=x.custom)
    utils.eod(basics.addon_handle, False)
Esempio n. 5
0
def about_site(name, about, custom):
    heading = '{0} {1}'.format(utils.i18n('about'), name)
    dir = basics.customSitesDir if custom else basics.aboutDir
    with open(TRANSLATEPATH(os.path.join(dir, '{}.txt'.format(about)))) as f:
        announce = f.read()
    utils.textBox(heading, announce)
Esempio n. 6
0
xbmcplugin.setContent(basics.addon_handle, 'movies')
addon = xbmcaddon.Addon()
TRANSLATEPATH = xbmcvfs.translatePath if six.PY3 else xbmc.translatePath
progress = utils.progress
dialog = utils.dialog

url_dispatcher = URL_Dispatcher('main')

if addon.getSetting('custom_sites') == 'true':
    sys.path.append(basics.customSitesDir)
    for module_name in favorites.enabled_custom_sites():
        try:
            importlib.import_module(module_name)
        except Exception as e:
            utils.kodilog('{0} {1}: {2}'.format(utils.i18n('err_custom'), module_name, e))
            favorites.disable_custom_site_by_module(module_name)
            title = favorites.get_custom_site_title_by_module(module_name)
            utils.textBox(utils.i18n('disable_custom'), '{0}:[CR]{1}'.format(utils.i18n('custom_msg'), title))


@url_dispatcher.register()
def INDEX():
    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(utils.i18n('sites')), '', 'site_list',
                           basics.cum_image('cum-sites.png'), '', list_avail=False)
    url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(utils.i18n('fav_videos')), '', 'favorites.List',
                           basics.cum_image('cum-fav.png'), '', list_avail=False)
    download_path = addon.getSetting('download_path')
    if download_path != '' and xbmcvfs.exists(download_path):
        url_dispatcher.add_dir('[COLOR white]{}[/COLOR]'.format(utils.i18n('dnld_folder')), download_path, 'OpenDownloadFolder',
                               basics.cum_image('cum-downloads.png'), '', list_avail=False)
Esempio n. 7
0
def AskPin():
    pincode = dialog.input(i18n('enter_pin'), option=xbmcgui.ALPHANUM_HIDE_INPUT)
    if pincode:
        return HashPin(pincode)
    return False