def load_custom_list(url): conn = sqlite3.connect(favoritesdb) conn.text_factory = str c = conn.cursor() if basics.addon.getSetting('custom_sites') == 'true': c.execute("select cli.rowid, cli.name, cli.url, cli.mode, cli.image from custom_listitems cli " + "LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' ||" + " cs.author = substr(cli.mode, 1, instr(cli.mode, '.') - 1)" + " WHERE ifnull(cs.enabled, 1) = 1 and cli.list_id = ?", (url,)) else: c.execute("select cli.rowid, cli.name, cli.url, cli.mode, cli.image from custom_listitems cli" + " LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' ||" + " cs.author = substr(cli.mode, 1, instr(cli.mode, '.') - 1)" + " WHERE cs.name IS NULL and cli.list_id = ?", (url,)) for (rowid, name, url, mode, img) in c.fetchall(): ins = AdultSite.get_site_by_name(mode.split('.')[0]) if ins: if ins.default_mode == mode: custom = ins.custom about = ins.about else: name = ins.title + ' - ' + name custom = False about = None basics.addDir(name, url, mode, img, about=about, custom=custom, list_avail=False, listitem_id=rowid) conn.close() if 'main' not in url: utils.eod(utils.addon_handle)
def add_dir(self, name, url, mode, iconimage=None, page=None, channel=None, section=None, keyword='', Folder=True, about=None, custom=False, list_avail=True, listitem_id=None, custom_list=False, contextm=None): mode = self.get_full_mode(mode) addDir(name=name, url=url, mode=mode, iconimage=iconimage, page=page, channel=channel, section=section, keyword=keyword, Folder=Folder, about=about, custom=custom, list_avail=list_avail, listitem_id=listitem_id, custom_list=custom_list, contextm=contextm)
def alphabeticalSearch(url, channel, keyword=None): if keyword: searchDir(url, channel, page=None, alphabet=keyword) else: key_list = keys() for c, count in sorted(key_list.items()): name = '[COLOR deeppink]{}[/COLOR] [COLOR lightpink]({})[/COLOR]'.format(c, count) addDir(name, url, "utils.alphabeticalSearch", cum_image('cum-search.png'), '', channel, keyword=c) eod()
def add_dir2(self, name, url, mode, iconimage=None, page=None, channel=None, section=None, onelist=None, desc='', username=None, sort=None, longer=None, loop=None, quality=None, category=None, filtered=None, hash=None, writefile=None, reverse=None, keyword='', Folder=True, about=None, custom=False, list_avail=True, listitem_id=None, custom_list=False, contextm=None): mode = self.get_full_mode(mode) addDir(name=name, url=url, mode=mode, iconimage=iconimage, page=page, channel=channel, section=section, onelist=onelist, desc=desc, username=username, sort=sort, longer=longer, loop=loop, quality=quality, category=category, filtered=filtered, hash=hash, writefile=writefile, reverse=reverse, keyword=keyword, Folder=Folder, about=about, custom=custom, list_avail=list_avail, listitem_id=listitem_id, custom_list=custom_list, contextm=contextm)
def alphabeticalSearch(url, channel, keyword=None): if keyword: searchDir(url, channel, page=None, alphabet=keyword) else: for c in string.ascii_uppercase: name = '[COLOR deeppink]' + c + '[/COLOR]' addDir(name, url, "utils.alphabeticalSearch", cum_image('cum-search.png'), '', channel, keyword=c) eod()
def List(): favorder = utils.addon.getSetting("favorder") or 'date added' basics.addDir( '[COLOR violet]Sort by: [/COLOR] [COLOR orange]{0}[/COLOR]'.format( favorder), '', 'favorites.Favorder', '', Folder=False) if utils.addon.getSetting("chaturbate") == "true": for f in AdultSite.clean_functions: f(False) conn = sqlite3.connect(favoritesdb) conn.text_factory = str c = conn.cursor() try: if 'folders' in favorder: if basics.addon.getSetting('custom_sites') == 'true': c.execute( "SELECT f.mode, COUNT(*) count FROM (SELECT * FROM favorites) f LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' || cs.author = substr(f.mode, 1, instr(f.mode, '.') - 1) WHERE IFNULL(cs.enabled, 1) = 1 GROUP BY 1 ORDER BY 1" ) else: c.execute( "SELECT f.mode, COUNT(*) count FROM (SELECT * FROM favorites) f LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' || cs.author = substr(f.mode, 1, instr(f.mode, '.') - 1) WHERE cs.name IS NULL GROUP BY 1 ORDER BY 1" ) for (mode, count) in c.fetchall(): site = mode.split('.')[0] img = '' for s in AdultSite.get_sites(): if s.name == site: name = s.title img = s.image break name = '{} [COLOR thistle][{} favorites][/COLOR]'.format( name, count) basics.addDir(name, mode, 'favorites.FavListSite', img) else: if basics.addon.getSetting('custom_sites') == 'true': c.execute( "SELECT f.* FROM (SELECT * FROM favorites ORDER BY {}) f LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' || cs.author = substr(f.mode, 1, instr(f.mode, '.') - 1) WHERE IFNULL(cs.enabled, 1) = 1" .format(orders[favorder])) else: c.execute( "SELECT f.* FROM (SELECT * FROM favorites ORDER BY {}) f LEFT JOIN custom_sites cs on 'custom_' || cs.name || '_by_' || cs.author = substr(f.mode, 1, instr(f.mode, '.') - 1) WHERE cs.name IS NULL" .format(orders[favorder])) for (name, url, mode, img, duration, quality) in c.fetchall(): duration = '' if duration is None else duration quality = '' if quality is None else quality if 'site' in favorder: site = mode.split('.')[0] for s in AdultSite.get_sites(): if s.name == site: site = s.title break name = '[COLOR hotpink][{}][/COLOR] {}'.format(site, name) basics.addDownLink(name, url, mode, img, desc='', stream='', fav='del', duration=duration, quality=quality) conn.close() utils.eod(utils.addon_handle) except: conn.close() utils.notify('No Favorites', 'No Favorites found') return