Closed xiNeRoar closed 6 months ago
I am very much hoping for this enhancement as well.
My coding skills are very limited, so I have currently made an automation with shell_commands.yaml running the command:
remove_old_files: 'find /media/movies -type f -mtime +30 -exec /bin/rm -f {} \;'
That is so bad in so many ways. 🫣
Crossing fingers for some wizardry from Denis @shemanaev
I've added this as separate setting. Use with caution as it's not well tested (I don't really need this for my use cases) and I recommend to experiment via troubleshoot log with disabled scheduled job first.
Thank you for your efforts.
When I manually try to run the Scheduled Task -> "Played media cleanup" under Maintenance, I get the following error. Is this just because there are no old files to remove?
[2024-02-25 15:03:44.671 +01:00] [INF] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: Executing "Played media cleanup"
[2024-02-25 15:03:44.775 +01:00] [INF] [8] MediaCleaner.MediaCleanupTask: ("Movie") ""Albert Brooks: Defending My Life"" will be deleted because no one played it since 10/28/2014 04:03:44
[2024-02-25 15:03:44.776 +01:00] [ERR] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at MediaCleaner.MediaCleanupTask.CreateNotification(ExpiredItem item)
at MediaCleaner.MediaCleanupTask.ExecuteAsync(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-02-25 15:03:44.777 +01:00] [INF] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Played media cleanup" Failed after 0 minute(s) and 0 seconds
[2024-02-25 15:03:44.778 +01:00] [INF] [8] Emby.Server.Implementations.ScheduledTasks.TaskManager: ExecuteQueuedTasks
Is this just because there are no old files to remove?
It's actually because there ARE old files and I missed one piece of delete process 😅. Pushed a fix.
Thanks for the quick fix. I appreciate it. 🙂
I tested your recent update today (2.13.0.0) by running its scheduled task manually again. Now it works! - but it seems to delete video files younger than the set time value (30 days).
Question:
In your code, does "x.Item.DateCreated" refer to a file's [original creation date] like in Windows (which could be anything), or does it refer to the moment [from when it's downloaded to my harddrive]?
Update: I guess, that I should switch to "Use date scanned into the library" for this to work properly 🙃
I guess, that I should switch to "Use date scanned into the library" for this to work properly 🙃
Good catch! I'll add it to read me.
Good catch! I'll add it to read me.
Thanks. Good work on the updated README.md - it's concise and informative 👍
Describe the feature you'd like added
I hope the plugin can add the ability to auto-delete media that is not being watched after a certain amount of days unless it is favourites but not only delete played media
Additional context
No response