Skip to content

clara-j/media_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 

Repository files navigation

media_cleaner

This script will go through all watched videos and delete any for a specific user that is older then a defined cutt off.

Config file

The first time you run the script it will attempt to create the config file for you by asking a few questions

filename: media_cleaner_config.py

  • server_brand=0-emby or 1-jellyfin
  • server_url='http://localhost:8096/emby' - Server name or ip address
  • admin_username='UserName' - Username for Admin user with access to delete files
  • admin_password='Password' - Password for Admin user with access to delete files (hashed password stored)
  • access_token='ZZZZZZZZZZZZZ' - Token used to verify admin user actions
  • user_key='YYYYYYYYYYYYY' - UserID of the user that script checks watched status for
  • DEBUG=0 - 0 Do not display debug info; 1 Display debug info
  • not_played_age_movie=100 - How many days to keep a watched movie before deleting; -1 do not delete media type
  • not_played_age_episode=100 - How many days to keep a watched episode before deleting; -1 do not delete media type
  • not_played_age_video=100 - How many days to keep a watched video before deleting; -1 do not delete media type
  • not_played_age_trailer=100 - How many days to keep a watched trailer before deleting; -1 do not delete media type
  • remove_files=0 - 0 for trial runs (media is not deleted); 1 to allow script to delete media
  • keep_favorites_movie=1 - 1 Keep movies that have been marked as favorite; 0 Delete movies marked as favorite
  • keep_favorites_episode=1 - 1 Keep episodes, seasons, and series that have been marked as favorite; 0 Delete episodes marked as favorite
  • keep_favorites_video=1 - 1 Keep videos that have been marked as favorite; 0 Delete videos marked as favorite
  • keep_favorites_trailer=1 - 1 Keep trailers that have been marked as favorite; 0 Delete trailers marked as favorite

Usage

Make media_cleaner.py executable and run ./media_cleaner.py. If no conifg file is found it will prompt you to create one. Once done you can run the script again to view files that will be deleted

Requirements

  • python3
  • python-dateutil

First Run

  • You may get the below python error if the python-dateutil module is not installed
    • ModuleNotFoundError: No module named 'dateutil' python-dateutil
  • For Ubuntu/Linux Mint type systems you can install the python-dateutil module with the following commands:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade -y
    • $ sudo apt-get install python3-pip -y
    • $ sudo pip3 install -U pip
    • $ sudo pip3 install python-dateutil
  • For other operating systems
    • tbd or Google

Donation

If you find this useful and you would like to support please the use option below.

paypal

About

Python script to delete watched content on Emby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages