def main(): cache_manager = cache.CacheManager() discord_manager = discord.DiscordManager() twit = twitter.TwitterStreamListener(cache_manager, discord_manager) print('Bot ready') while twit.is_running(): time.sleep(1)
def init_cache(): manager = cache.CacheManager() if 'cache' in config: manager.setup(n.meta_session, config['cache'].get('index_prefix', 'cached_files_')) [ manager.add_namespace(ns) for ns in config['cache'].get('namespaces', []) ] # registering cache handlers register_handle(manager.get_cached_keys) register_handle(manager.get_cached_keys_by_group) register_handle(manager.upload_list) return manager
def init_cache_worker(W, n, niu, j, meta_db): if not config.get("cache"): logger.error('Cache is not set up in config ("cache" key), ' 'will not be initialized') return None if not config.get('metadata', {}).get('cache', {}).get('db'): logger.error('Cache metadata db is not set up ("metadata.cache.db" key), ' 'will not be initialized') return None c = cache.CacheManager(n, niu, j, meta_db) h.register_handle(W, c.get_top_keys) h.register_handle(W, c.cache_statistics) h.register_handle(W, c.cache_clean) h.register_handle(W, c.cache_groups) h.register_handle(W, c.get_cached_keys) return c
import sys, getopt import cache, server, nmapi cm = cache.CacheManager() server.html_path = '../html/' help_info = ''' Lyric->Romaji Usage: -h, --help: \t\t\thelp message -v, --version: \t\t\tversion info -s <name>, --search=<name>: \tsearch song by name -i <id>, --id=<id>: \t\tget song by id -c, --cache: show cache status -e, --clear: clear cached songs ''' version_info = ''' Lyric->Romaji Version 0.0.1 A simple python program that can convert Japanese song lyrics to romaji notation 2010-2018 MaxXSoft, MaxXing. MIT License ''' try: short_options = 'hvs:i:ce' long_options = ['help', 'version', 'search=', 'id=', 'cache', 'clear'] opts, args = getopt.getopt(sys.argv[1:], short_options, long_options) except getopt.GetoptError: print('invalid argument') print("use '-h' or '--help' for help") exit(1) if len(opts) == 0: