def directory(path): if isinstance(path, str): path = path.decode('utf-8') user_info = get_user_info() user_cookie = user_info['cookie'] user_tokens = user_info['tokens'] dir_files = pcs.list_dir_all(user_info['cookie'], user_info['tokens'], path) item_list = MakeList(dir_files) previous_path = os.path.dirname(path).encode('utf-8') if previous_path == '/': item_list.insert(0,{ 'label': u'<< 返回首页', 'path': plugin.url_for('main_menu') }) else: item_list.insert(0,{ 'label': u'<< 返回上一目录', 'path': plugin.url_for('directory', path=previous_path), }) item_list.insert(0,{ 'label': u'## 当前目录: %s' % path, 'path': plugin.url_for('refresh') }) return plugin.finish(item_list, update_listing=True)
def directory(path): if isinstance(path, str): path = path.decode('utf-8') user_info = get_user_info() user_cookie = user_info['cookie'] user_tokens = user_info['tokens'] dir_files = pcs.list_dir_all(user_info['cookie'], user_info['tokens'], path) item_list = MakeList(dir_files) previous_path = os.path.dirname(path).encode('utf-8') if previous_path == '/': item_list.insert(0, { 'label': u'<< 返回首页', 'path': plugin.url_for('main_menu') }) else: item_list.insert( 0, { 'label': u'<< 返回上一目录', 'path': plugin.url_for('directory', path=previous_path), }) item_list.insert(0, { 'label': u'## 当前目录: %s' % path, 'path': plugin.url_for('refresh') }) return plugin.finish(item_list, update_listing=True)
def menu_cache(cookie, tokens): pcs_files = pcs.list_dir_all(cookie, tokens, path='/') if pcs_files: item_list = MakeList(pcs_files) else: return [{'label': u'请点击一下「刷新」', 'path': plugin.url_for('refresh')}] homemenu = plugin.get_storage('homemenu', TTL=60) homemenu['item_list'] = item_list return item_list
def menu_cache(cookie, tokens): pcs_files = pcs.list_dir_all(cookie, tokens, path='/') if pcs_files: item_list = MakeList(pcs_files) else: return [{'label': u'请点击一下「刷新」', 'path': plugin.url_for('refresh')}] homemenu = plugin.get_storage('homemenu', TTL=60) homemenu['item_list'] = item_list return item_list