This Docker image provides an automated system to identify and clean up inactive TV series from your Emby library, optionally unmonitoring them in Sonarr. It also provides a small Flask web UI to view logs and trigger various test scripts.
| Variable | Description | Default / Example |
|---|---|---|
| EMBY_URL | Emby server URL (including port). | http://localhost:9096 |
| EMBY_API_KEY | API key for Emby. | "" (empty) |
| USER_ID | The admin user ID for Emby operations. | "" (empty) |
| SONARR_URL | Sonarr server URL (including port). | http://localhost:8989 |
| SONARR_API_KEY | API key for Sonarr. | "" (empty) |
| LIBRARY_ID | Emby Library ID of the “to be deleted” folder/library. | "447866" |
| SERIES_FOLDER_ID | Emby folder ID for the main library containing Series. | 6 |
| LIBRARY_PATH | Physical path (inside container) where symlinks are created for the “to be deleted” library. | /app/data/to_be_deleted/ |
| EMBY_SYMLINK_BASE | The path Emby sees for those symlinks (e.g. /media/to_be_deleted). | /media/to_be_deleted |
| CALCULATE_TOTAL_PLAY_COUNT | Whether to sum the total play count of episodes across all users for scoring. | true |
| CHECK_EPISODES_INTEREST | Whether to check if episodes appear in playlists/favorites (episode-level interest). | true |
| CHECK_SERIES_INTEREST | Whether to check if the series itself appears in playlists/favorites. | true |
| INACTIVE_DAYS | Number of days with no plays to consider a series inactive. | 365 |
| RATING_THRESHOLD | Community rating above which the script skips deletion. | 7.0 |
| FINAL_DELETE_DAYS | How many days after linking a series to “to be deleted” it will be removed. | 14 |
| THREE_DAY_NOTICE | Days before final deletion to send a warning email. | FINAL_DELETE_DAYS - 3 |
| MAX_ITEMS | Max number of items allowed in the “to be deleted” list. | 30 |
| SIZE_WEIGHT | Weight multiplier for series size in the scoring system. | 2 |
| NOTIFICATION_ENABLED | Toggle email notifications on/off. | True |
| NOTIFICATION_METHOD | Currently only “email” is implemented. | email |
| ADMIN_EMAIL | Admin email to receive error and important notifications. | [email protected] |
| USER_EMAILS | Comma-separated list of additional user emails to get certain notifications. | [email protected],[email protected] |
| SMTP_HOST | SMTP server host (for email). | smtp.gmail.com |
| SMTP_PORT | SMTP server port. | 587 |
| SMTP_USERNAME | SMTP user/email. | [email protected] |
| SMTP_PASSWORD | SMTP password or App Password. | "" (empty) |
| DISPLAY_NAME | The display name for sent emails. | EmbyCleaner |
main.py daily at midnight, appending output to /var/log/emby_cleanup/cron.log.logs/emby_cleanup.log/var/log/emby_cleanup/cron.loglogs/email_delivery.log/var/log/emby_cleanup/test_scripts.logdocker run -d
--name emby_cleanup
-e EMBY_URL="http://192.168.1.10:8096"
-e EMBY_API_KEY="abc123"
-e USER_ID="999999"
-e SONARR_URL="http://192.168.1.10:8989"
-e SONARR_API_KEY="sonarr_api_key"
-e ADMIN_EMAIL="[email protected]"
-e USER_EMAILS="[email protected],[email protected]"
-p 9999:9999
jelhe32/emby_cleaner:latest
main.py script)By default, a line is added to crontab:
0 0 * * * root CRON_JOB=1 /usr/local/bin/python /app/main.py >> /var/log/emby_cleanup/cron.log 2>&1
This calls main.py nightly at 00:00 to perform the automated cleanup.
Clone the repository.
Edit or customize environment variables in .env.
Build your local image:
docker build -t emby_cleaner:local .
Run as described in Docker usage examples.
This project is provided under the MIT License (or the license you prefer). Feel free to open issues or submit PRs for improvements.
Content type
Image
Digest
sha256:029087ef2…
Size
401 MB
Last updated
5 months ago
docker pull jelhe32/embycleanup