Small module to work with SauceNAO locally
Project description
SauceNAO
unofficial python module to make working with SauceNAO in projects easier
Installation
This package requires Python 3.6 or later.
You can simply install the latest version with
pip install SauceNAO
Alternatively you can download this repository and run the setup.py to install all necessary dependencies.
In case you want to install the dependencies to run the unit tests you can additionally run pip install -e .[dev]
in this project.
Dependencies
Required:
- BeautifulSoup - html parser
- requests - http library
Optional:
- Pillow - Python Imaging Library, used to generate images for unittests
- python-dotenv - .env file loader used for unittests
- requests-mock - requests mock responses used for unittests
Usage
You can run SauceNAO either as module:
import logging
from saucenao import SauceNao, SauceNaoDatabase
saucenao = SauceNao(directory='directory', databases=SauceNaoDatabase.All, minimum_similarity=65,
combine_api_types=False, api_key='', is_premium=False, 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)
or as application:
python usage.py --dir [--databases] [--minimum-similarity] [--combine-api-types] [--api-key] [--premium]
[--exclude-categories] [--move-to-categories] [--use-author-as-category] [--output-type] [--start-file]
[--log-level] [--filter-creation-date] [--filter-modified-date] [--title-minimum-similarity]
you can also use it to get the gathered information for your own script:
filtered_results = saucenao.check_file(file_name='test.jpg')
# or with streams/byte objects
filtered_results = saucenao.check_file(io.BytesIO(b'\x00'))
or get a generator object for a bulk of files using the worker class, all parameters work here too:
from saucenao import Worker
results = Worker(directory='directory', files=('test.jpg', 'test2.jpg', io.BytesIO(b'\x00'))).run()
the worker automatically differentiates between file names and BinaryIO objects, so you can simply pass both types at the same time.
Running the tests
In the tests folder you can run each unittest individually.
The test cases should be self-explanatory.
Development
Want to contribute? Great!
I'm always glad hearing about bugs or pull requests.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Thanks
A big thanks to SauceNAO who are indexing all the images and compares them.
This script would be completely useless without them.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file SauceNAO-1.1.0.tar.gz
.
File metadata
- Download URL: SauceNAO-1.1.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd58bd251f80b42703c8c8dba14cfcfd513dadf25cdfe3a03d86e77edda686c9 |
|
MD5 | 70ec777da6253797c7f6ebe82e09440e |
|
BLAKE2b-256 | d25e5fdb966f057a5686344dff160c09d450da27df6d8c523eafcfdb7276057e |
File details
Details for the file SauceNAO-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: SauceNAO-1.1.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04e116b217357cbd3c16af1eae0853a3f2fdba3bf1f5a118040fec4baa4b3825 |
|
MD5 | 54c43c3b526aac5678cc9cb6f37f39a5 |
|
BLAKE2b-256 | 798d3a1a6b5c299d1a4b81c7f28e18673f2be099641f4d4f42f2d4ab554d3c5e |