def reflection(key): if util.is_url(key): for test in tests: if test(key): for plugin in plugins: if plugin.name()==test(key): return plugin else: continue else: continue return False else: for plugin in plugins: if plugin.name()==key: return plugin else: continue return False
for test in tests: t = test(url) if t: class_ = reflection(t) else: continue if class_: add(url,class_) else: util.easy_log('No plugin can deal with url \''+url+'\'.','D') #record inv url exit(1) elif op == '-s': credential = value if credential: if util.is_url(credential): for test in tests: if test(credential): plugin = reflection(credential) object_ = plugin(credential) info = { 'plugin':object_.name(), 'credential':object_.credential, 'url':credential, 'name':object_.get_comic_name() } result = search(info['plugin'],info['credential']) if result==[]: util.easy_log('Can\'t find item.Please use \'unname -a\' to add it.') else: sync(result[0])