Analyze and visualize your Sonarr library storage with secure historical insights.
9.1K
A web application built with Streamlit for analyzing and monitoring your Sonarr library. Track episode file sizes, detect outliers, compare historical analyses, forecast storage growth, and manage multiple Sonarr instances โ all from a single, multi-user interface with role-based access control and encrypted credential storage.
Before you start, make sure you have:
# Pull the latest image
docker pull martitoci/sonarr-analyzer:latest
# Run with persistent data
docker run -d \
--name sonarr-analyzer \
-p 8501:8501 \
-v sonarr-data:/app/data \
--restart unless-stopped \
martitoci/sonarr-analyzer:latest
Access the application: http://localhost:8501โ
Save this as docker-compose.yml and run docker compose up -d:
services:
sonarr-analyzer:
image: martitoci/sonarr-analyzer:latest
container_name: sonarr-analyzer
ports:
- "8501:8501"
volumes:
- sonarr-data:/app/data
restart: unless-stopped
volumes:
sonarr-data:
Main dashboard showing series analysis with file sizes, outliers, and detailed metrics
Historical data view with storage evolution, trends over time, and date comparisons
home, remote)Start App โ Create Admin Screen โ Create Admin โ Login Screen โ Dashboard
Start App โ Login Screen โ Enter Credentials โ Dashboard
| Feature | Admin | Read-Only |
|---|---|---|
| Login | โ | โ |
| Dashboard | โ | โ |
| Configure Sonarr Instances | โ | โ |
| Run Analysis | โ | โ |
| View Current Results | โ | โ |
| Episode Breakdown | โ | โ |
| View Historical Data | โ | โ |
| Storage Forecast | โ | โ |
| Codec Distribution | โ | โ |
| Configure Scheduler | โ | โ |
| Change Own Password | โ | โ |
| Create / Manage Users | โ | โ |
| Delete Analysis Data | โ | โ |
admin or readonly)Each user can add and manage multiple Sonarr instances independently.
home, 4k, remote)/app/data/.master.keyโ
Use strong passwords ยท Back up your data volume ยท Use HTTPS behind a reverse proxy
โ Don't share the master key ยท Don't expose port 8501 directly to the internet
Navigate to "๐ Historical Data" in the sidebar. Five tabs are available:
Overview table of every saved analysis with storage evolution and average-size trend charts.
Select two past dates to compare. See new/removed series, storage delta, and a top-changers chart. Download as CSV.
Select a series and view its total size, episode count, and average size over time.
Stacked area chart showing storage breakdown by quality profile (codec) over time.
Linear regression projection of total library size. Estimates when you'll hit storage milestones.
Sonarr Analyzer supports passive scheduling: analyses run automatically when the app is loaded (no background process needed).
# Install dependencies
pip install -r requirements.txt
# Run all tests
pytest -v
# Run with coverage
pytest --cov=. --cov-report=html tests/
Coverage includes: Authentication, token encryption, storage operations, integration workflows, role enforcement, and schema migrations.
/app/data| File | Purpose | Encrypted |
|---|---|---|
users.db | User accounts and hashed passwords | Passwords bcrypt-hashed |
tokens.db | Per-user, per-instance Sonarr credentials | โ Fernet encrypted |
.master.key | Master encryption key | Keep this safe! |
sonarr_history.db | Historical analyses and schedules | No |
# Backup named volume
docker run --rm \
-v sonarr-data:/data \
-v $(pwd):/backup \
alpine tar czf /backup/sonarr-backup.tar.gz -C /data .
# Restore
docker run --rm \
-v sonarr-data:/data \
-v $(pwd):/backup \
alpine tar xzf /backup/sonarr-backup.tar.gz -C /data
mkdir -p ./sonarr-data
# Linux/macOS: fix ownership for UID 1000 (container user)
sudo chown -R 1000:1000 ./sonarr-data
docker run -d \
--name sonarr-analyzer \
-p 8501:8501 \
-v $(pwd)/sonarr-data:/app/data \
martitoci/sonarr-analyzer:latest
| Metric | Description |
|---|---|
| Episodes | Number of downloaded episode files |
| Total Size (GB) | Combined size of all episodes |
| Avg Size (MB) | Average file size per episode |
| Z-Score | Statistical deviation from the mean across all series |
| Outlier | Yes if Z-Score exceeds the configured threshold (default 2.0) |
Z-Score = (Value โ Mean) / Std Deviation
| Z-Score | Status | Suggested Action |
|---|---|---|
| 0 โ 1 | Normal โ | No action needed |
| 1 โ 2 | Slightly high โ ๏ธ | Monitor |
| > 2 | Outlier ๐จ | Review and consider re-encoding |
| > 3 | Extreme ๐ฅ | High priority |
| Variable | Default | Description |
|---|---|---|
STREAMLIT_SERVER_PORT | 8501 | Web interface port |
STREAMLIT_SERVER_ADDRESS | 0.0.0.0 | Bind address |
STREAMLIT_SERVER_HEADLESS | true | Headless mode |
STREAMLIT_BROWSER_GATHER_USAGE_STATS | false | Disable telemetry |
docker run -d --name sonarr-analyzer -p 9000:8501 \
-v sonarr-data:/app/data \
martitoci/sonarr-analyzer:latest
# Access at http://localhost:9000
gosu (GPG-verified, official Docker pattern)| Tag | Description |
|---|---|
latest | Latest stable release |
v0.4.0 | This release |
v0.3.0 | Previous release |
docker pull martitoci/sonarr-analyzer:latest
docker pull martitoci/sonarr-analyzer:v0.4.0
docker logs sonarr-analyzerdocker exec sonarr-analyzer rm /app/data/users.db
docker restart sonarr-analyzer
# Fix ownership on the host
sudo chown -R 1000:1000 /path/to/your/data
The entrypoint script attempts to fix this automatically when the container runs as root. For persistent issues, switch to a named volume.
http://192.168.1.10:8989localhostdocker restart sonarr-analyzer
All encrypted tokens become unrecoverable โ users must re-enter their Sonarr credentials. Always back up /app/data.
Monthly Storage Audit: Run on the 1st of each month, compare with the previous run to identify growth outliers.
Pre/Post Re-encoding: Run before and after re-encoding high-Z-score series to measure savings.
Multi-Server Monitoring: Each team member or household user manages their own Sonarr instance credentials and sees only their own history.
Proactive Planning: Use the Storage Forecast tab to know when to add drives before you run out of space.
git clone https://github.com/chmedinap/sonarr-analyzer.git
cd sonarr-analyzer
docker build -t sonarr-analyzer:local .
docker run -d \
--name sonarr-analyzer \
-p 8501:8501 \
-v sonarr-data:/app/data \
sonarr-analyzer:local
@st.cache_data incompatibility with progress UIrequests.Session resource leakrowcount capturing wrong table in delete operationspytest -v and verify all passMIT License โ see LICENSE file for details.
# Pull latest image
docker pull martitoci/sonarr-analyzer:latest
# Run with persistent data
docker run -d --name sonarr-analyzer -p 8501:8501 \
-v sonarr-data:/app/data --restart unless-stopped \
martitoci/sonarr-analyzer:latest
# View logs
docker logs -f sonarr-analyzer
# Stop / remove
docker stop sonarr-analyzer
docker rm sonarr-analyzer
# Backup data volume
docker run --rm -v sonarr-data:/data -v $(pwd):/backup \
alpine tar czf /backup/sonarr-backup.tar.gz -C /data .
# Update to latest
docker pull martitoci/sonarr-analyzer:latest
docker stop sonarr-analyzer && docker rm sonarr-analyzer
docker run -d --name sonarr-analyzer -p 8501:8501 \
-v sonarr-data:/app/data --restart unless-stopped \
martitoci/sonarr-analyzer:latest
Made with โค๏ธ for the Sonarr community
Content type
Image
Digest
sha256:1537b4cb0โฆ
Size
220.6 MB
Last updated
4 months ago
docker pull martitoci/sonarr-analyzer