与Saucenao本地合作的小模块
SauceNAO的Python项目详细描述
绍塞瑙
非官方的python模块,使在项目中使用SauceNAO更容易
安装
此脚本与Python 3一起运行。
当前有一个正在工作的Python 2 branch,但我不再更新它。
下载此存储库并运行setup.py以安装所有必需的依赖项
依赖性
必需:
- BeautifulSoup-html解析器
- requests-http库
可选:
- Pillow-python映像库,用于为unittests生成映像
- python-dotenv-.env用于单元测试的文件加载程序
- requests-mock-请求用于单元测试的模拟响应
使用量
您可以将Saucenao作为模块运行:
import logging
from saucenao import SauceNao
saucenao = SauceNao(directory='directory', databases=999, minimum_similarity=65, combine_api_types=False, api_key='',
exclude_categories='', move_to_categories=False, use_author_as_category=False,
output_type=SauceNao.API_HTML_TYPE, start_file='', log_level=logging.ERROR,
title_minimum_similarity=90)
或作为应用程序:
python usage.py --dir [--databases] [--minimum-similarity] [--combine-api-types] [--api-key] [--exclude-categories] [--move-to-categories] [--use-author-as-category] [--output-type] [--start-file] [--log-level] [--filter-creation-date] [--filter-modified-date] [--title-minimum-similarity]
您还可以使用它来获取为您自己的脚本收集的信息:
filtered_results = saucenao.check_file(file_name='test.jpg')
或者使用worker类为大量文件获取生成器对象,所有参数也在此处工作:
from saucenao import Worker
results = Worker(directory='directory', files=('test.jpg', 'test2.jpg')).run()
运行测试
在“测试”文件夹中,您可以单独运行每个unittest。
测试用例应该是自解释的。
开发
想做贡献吗?伟大的!
我总是很高兴听到关于Bug或Pull请求的消息。
许可证
这个项目是在麻省理工学院的许可下授权的-请参见LICENSE.md文件了解详细信息