Casvt / Plex-scripts

Plex, the arr's and tautulli scripts coming from user requests
GNU General Public License v3.0
338 stars 30 forks source link

Delete Watched Movies #127

Closed dasauto1 closed 2 years ago

dasauto1 commented 2 years ago

Hello,

I use the auto delete change setting using weekly cronjob to change the watched status in order for Plex to delete it (works very well thank you for the script). Since Movie library in plex does not have this 'delete after x days' feature, may I request for a simple script to delete watched plex movies after X days?

Ideally it can detect "Movies" library and I can then run it as a cronjob weekly etc.

Thank you.

Casvt commented 2 years ago

This can already be done. See the following script: https://github.com/Casvt/Plex-scripts/blob/main/media_management/recent_episode_maintainer.py.

Use --DaysOld with a number to delete media that has been watched for the last time N days ago.

utkarshsethi commented 1 year ago

Hi sorry about confusion, this works for all media (including movies and TV)?

and what would be interaction of multiple users.

is the logic, delete X days after any user last marked watched.

so if 3 users. and 2 marked it played on day 1 of month, and a 3rd user marked on day 15 of month. and it is set to delete after 30 days. will it delete on 15th of month 2?

Just trying to get clarifications.

Casvt commented 1 year ago

Hi sorry about confusion, this works for all media (including movies and TV)?

Yes. Run the script with -h to see how you select your target.

and what would be interaction of multiple users.

You supply the admin token at the top. The watch activity of that user decides if a file is deleted or not. Other users are not taken into consideration.

And just to make clear: the script doesn't schedule deletions. It only deletes on the spot. So you'll have to run the script something like weekly to keep up.