Compare commits

..

2 Commits

Author SHA1 Message Date
19822f376e Fixup pyproject.toml 2025-08-03 22:59:21 -05:00
cb6a39b22d Add README.md 2025-08-03 22:16:13 -05:00
2 changed files with 76 additions and 11 deletions

63
README.md Normal file
View File

@@ -0,0 +1,63 @@
# indexer-analyze
This tool analyzes Sonarr's data to provide statistics on which indexers are used to download episode files. It works by iterating through all the series in Sonarr, examining the history of each episode to find out where it was downloaded from, and then tallies the counts for each indexer.
## Features
- Fetches all series from your Sonarr instance.
- Analyzes the history of each episode to determine the source indexer.
- Provides a summary of file counts per indexer.
- Displays results in a clean, formatted table.
## Concurrency
To ensure the analysis is performed as quickly as possible, this tool is built using modern asynchronous Python libraries (`anyio` and `httpx`).
- **Concurrent API Requests:** It makes concurrent requests to the Sonarr API, allowing it to fetch data for multiple series and episodes at the same time.
- **Efficient Processing:** By processing each series in parallel, the tool significantly reduces the total time required to analyze a large Sonarr library compared to a traditional synchronous approach. A configurable semaphore limits the maximum number of simultaneous requests to avoid overwhelming the Sonarr API.
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/Xevion/indexer-analyze.git
cd indexer-analyze
```
2. **Install dependencies using Poetry:**
```bash
poetry install
```
## Configuration
Create a `.env` file in the root of the project and add the following environment variables:
```
SONARR_URL=http://your-sonarr-instance:8989
SONARR_API_KEY=your-sonarr-api-key
AUTHELIA_URL=http://your-authelia-instance
AUTHELIA_USERNAME=your-authelia-username
AUTHELIA_PASSWORD=your-authelia-password
```
## Usage
To run the analysis, execute the following command:
```bash
poetry run python main.py
```
The script will then connect to the Sonarr API, process all the series, and output the indexer statistics to the console.
### Example Output
```
Indexer Statistics:
Indexer | Count
-------------+------
IndexerOne | 1234
IndexerTwo | 567
IndexerThree | 89
```

View File

@@ -1,18 +1,20 @@
[tool.poetry]
[project]
name = "indexer-analyze"
version = "0.1.0"
description = ""
authors = ["Xevion <xevion@xevion.dev>"]
description = "A tool to analyze Sonarr indexer data."
authors = [{ name = "Xevion", email = "xevion@xevion.dev" }]
readme = "README.md"
requires-python = ">=3.10,<4.0"
dependencies = [
"python-dotenv>=1.1.0,<2.0.0",
"structlog>=25.3.0,<26.0.0",
"httpx[http2]>=0.28.1,<0.29.0",
"anyio>=4.9.0,<5.0.0",
]
[tool.poetry.dependencies]
python = "^3.10"
python-dotenv = "^1.1.0"
structlog = "^25.3.0"
httpx = {extras = ["http2"], version = "^0.28.1"}
anyio = "^4.9.0"
[tool.poetry]
package-mode = false
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"