Release - XBMC File Cleaner

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Anthirian Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 1
Post: #1
Official Release: 4.0.0 - Available through the XBMC official addon repository.

*** Please post a link to your xbmc.log with debugging on, or make use of the XBMC Log Uploader addon. This is the best way to troubleshoot any issues you might have. ***

What does this addon do?
XBMC File Cleaner helps you keep a clean XBMC video library by deleting any video that you have watched in the past. The videos can be either deleted permanently or moved to a holding folder (the default setting). You may also enable some of the various filters to apply before videos are deleted, for example "do not delete videos that have a rating lower than 8" or "wait to delete videos until my free disk space is less than 20%". XBMC File Cleaner can run as a service or started manually. When you enable service mode you may set a scan interval, as well as specify a startup delay. You can also choose to hold off on cleaning while you're watching a video. In that case cleaning will wait until the next interval has passed before trying again.

Note: Please confirm you have set everything up correctly before switching to the permanent deletion option. If you're not sure what videos will be deleted, please set up a holding folder and check what has been moved there. Once you feel everything is working fine, you can choose to turn on permanent deletion.

Installation
In XBMC, go to Settings » Add-ons » Services
Select XBMC File Cleaner and choose install
After installation you are encouraged to take a good look at all the options that are available to you.

Thanks
Special thanks to Andrew Higginson for his work on the Dharma version a few years back. He has not had the time to maintain this addon, so I have taken over.
Also, thanks to rectifyer for his nice thread layout that I have used for this post.

Links
GitHub source code - https://github.com/Anthirian/script.filecleaner

Disclaimer
This addon has the potential to wipe your entire video collection! Please make sure you understand exactly what this addon is designed to do before enabling the file deletion capabilities in the settings. I will not be held responsible for loss of data.

Release Notes
Code:
Version 4.0.0
==============
- [NEW] Gotham compatibility
- [NEW] Start addon manually
- [NEW] Allow disabling the service
- [NEW] Log file viewer (accessible from settings)
- [NEW] Support for stacked movies (does not include DVD folder structures, e.g. VIDEO_TS)
- [NEW] Polish translation (thanks struart)

- [FIX] Subtitles with language codes were not cleaned
- [FIX] Changed localizations to use the new PO structure
- [FIX] Increased the maximum allowed scan interval
- [FIX] Videos are now moved by default instead of deleted, to prevent loss of data
- [FIX] Improved support for unicode filenames

Version 3.2.1
==============
- [FIX] Related files were not being cleaned

Version 3.2.0
==============
- [NEW] Clean related files with similar names (e.g. subtitles) (thanks WoLpH)

Version 3.1.0
===============
- [NEW] Exclude up to three file paths from being cleaned

Version 3.0.2
===============
- [FIX] Filenames with non-ASCII characters were not being cleaned

Version 3.0.1
===============
- [FIX] Setting a different locale broke the addon

Version 3.0.0
===============
- [NEW] Frodo compatibility
- [NEW] Music videos support (please use TheAudioDB.com scraper)
- [NEW] Only clean while not playing video
- [NEW] Do not clean videos that are in progress
- [NEW] Do not clean during video playback
- [NEW] Hide notifications during video playback
- [NEW] Delete the parent folder of the file being cleaned, if that folder becomes empty (configurable)
- [NEW] No more individual notifications, but a summary instead (see logs for more details)
- [NEW] JSON-RPC is used to find watched videos (backward compatibility with Eden is effectively lost)

- [FIX] Redesigned addon settings

Version 2.0.0
===============
- [NEW] Eden compatibility
- [NEW] Addon now runs as a service
- [NEW] Dutch language support
- [NEW] Set delayed start
- [NEW] Set scan interval

- [FIX] Totally revamped the settings page
- [FIX] Removed obsolete setting to delete files after x days in the holding folder
- [FIX] Users could not disable expiration checks
- [FIX] Disk space checks did not work on Windows
- [FIX] Enhanced queries used to select files to be deleted
- [FIX] Updated text strings
- [FIX] More more descriptive notifications and logging

Version 1.3.5
===============
- [FIX] Various bug fixes

Version 1.2.0
===============
- [NEW] Delete based on rating
- [NEW] Move videos to holding folder instead of deleting

- [FIX] Code cleanup

Version 1.1.2
===============
- [FIX] Adhere to file naming conventions
- [FIX] Updated contact details
- [FIX] Fixed autoStart method call

Version 1.1.0
===============
- [FIX] Almost entire rewrite of script
- [FIX] Created service loop instead of relying on AlarmClock
- [FIX] Setting changes will now be detected by the running service
- [FIX] Removed 'delete only if watched' option and instead will ONLY delete watched files

Version 1.0.0
===============
- [NEW] Intial version
(This post was last modified: 2014-05-14 14:02 by Anthirian.)
find quote
patria o muerte Offline
Member
Posts: 80
Joined: Feb 2013
Reputation: 0
Post: #2
Hi,
Does this addon work on android devices?
Thanks.
find quote
Anthirian Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 1
Post: #3
It probably will, because it uses XBMC's interface for the file system, but I have no Android devices that I can test it on. Could you give it a try and give me some feedback on it please?
find quote
patria o muerte Offline
Member
Posts: 80
Joined: Feb 2013
Reputation: 0
Post: #4
(2013-04-22 21:37)Anthirian Wrote:  It probably will, because it uses XBMC's interface for the file system, but I have no Android devices that I can test it on. Could you give it a try and give me some feedback on it please?

Hi,
I have installed this addon a few days ago,it gives me a script error every time i start Xbmc.
find quote
Anthirian Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 1
Post: #5
You might still have the issue with setting a locale. I fixed that bug yesterday evening and pushed it to the official repo. You should get updated to version 3.0.1 soon, which fixes that problem.
find quote
patria o muerte Offline
Member
Posts: 80
Joined: Feb 2013
Reputation: 0
Post: #6
(2013-04-23 10:43)Anthirian Wrote:  You might still have the issue with setting a locale. I fixed that bug yesterday evening and pushed it to the official repo. You should get updated to version 3.0.1 soon, which fixes that problem.

Ok,Thanks a lot!
find quote
fernandovg Offline
Fan
Posts: 406
Joined: Jul 2012
Reputation: 4
Location: Brazil
Post: #7
does it delete the external subtitles either?

[Image: all-thin-banner.jpg]
find quote
patria o muerte Offline
Member
Posts: 80
Joined: Feb 2013
Reputation: 0
Post: #8
Hi,
i confirm that this addon works on my android device,good job!
but
I realize that it doesn't delete extrathumbs and extrafanart subfolders,it only cleans movies and related subtitles.
find quote
straasha Offline
Junior Member
Posts: 4
Joined: Mar 2013
Reputation: 0
Post: #9
this version is causing a very high CPU utilization...around 65-75%...and never goes back to normal. I have a core 2 duo 2.53 GHz. I have tried on both 12.1 and the latest 12.2 pre build with the same results.

here is a log report
http://pastebin.ca/2365113
find quote
lysin Offline
Member
Posts: 91
Joined: Mar 2012
Reputation: 1
Post: #10
Is there a way to have a log of what has been erased?

It scares me having the plugin erasing stuff without some kind of supervision.

And I can't disable permanent deletion because I'm on Openelec.

Thanks and keep up the good work.

[Image: all-thin-banner.jpg]
find quote
ijourneaux Offline
Fan
Posts: 536
Joined: Mar 2009
Reputation: 3
Location: Wisconsin, USA
Post: #11
Do you have the ability to control the TV shows that are deleted by title?
find quote
Anthirian Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 1
Post: #12
(2013-04-23 16:02)fernandovg Wrote:  does it delete the external subtitles either?
Yes it will delete any file that is in the video's folder, but only if that folder becomes empty by deleting the last video in it. You can specify the file types that should be ignored while checking if the folder is empty through the settings. That means, if one of these file types is found, e.g. a .srt subtitle file, it still counts as if the folder is empty and the folder will be deleted.

(2013-04-23 23:36)patria o muerte Wrote:  Hi,
i confirm that this addon works on my android device,good job!
but I realize that it doesn't delete extrathumbs and extrafanart subfolders,it only cleans movies and related subtitles.
Thank you for getting back to me. You're right that those subfolders are not getting deleted. That is because it after deleting a file it will check if the folder the video was in has become empty by deleting the video. Because tools like Sick Beard require the TV Show folder to be present in order to download new episodes, I chose not to check if the parent folder is empty but only check the subfolders. I could probably make an exception for non-episodes to ignore the extrafanart and extrathumbs subfolders, but just adding the extensions of the images in those folders to the ignored file types list in the settings would result in the desired behavior already, since it checks subfolders too.

(2013-04-24 05:15)straasha Wrote:  this version is causing a very high CPU utilization...around 65-75%...and never goes back to normal. I have a core 2 duo 2.53 GHz. I have tried on both 12.1 and the latest 12.2 pre build with the same results.

here is a log report
http://pastebin.ca/2365113
Unfortunately the log you uploaded does not show any output by the cleaner, so I cannot find the issue from it. The log reads "22:48:07 T:6844 NOTICE: Disabled debug logging due to GUI setting. Level 0." This is because you have disabled logging somewhere.

Could you please add
PHP Code:
<loglevel>1</loglevel
to your advancedsettings.xml and upload another log so I may find the cause of the issue?

(2013-04-26 20:38)lysin Wrote:  Is there a way to have a log of what has been erased?

It scares me having the plugin erasing stuff without some kind of supervision.

And I can't disable permanent deletion because I'm on Openelec.

Thanks and keep up the good work.
I'm curious why you cannot change the permanent deletion setting on OpenELEC. Could you elaborate on that? You can find the files that have been deleted in xbmc.log in your userdata folder. I agree that it is risky to delete stuff without knowing what was deleted, so I may add a cleaning report section somewhere in the future that will show the last cleaning log.

(2013-04-27 01:09)ijourneaux Wrote:  Do you have the ability to control the TV shows that are deleted by title?
At the moment, no. Back in the days of Dharma, there was a fork on Github by someone who added this behavior, but it was very messy and it did not make it into the final version for Dharma then either. I might give it a try to add it into the cleaner, but it would require a lot of work and will not be done anytime soon. If you have only a few TV shows you wish to delete, you might be better off doing it manually in the meantime.
(This post was last modified: 2013-05-02 13:03 by Anthirian.)
find quote
patria o muerte Offline
Member
Posts: 80
Joined: Feb 2013
Reputation: 0
Post: #13
(2013-05-02 12:55)Anthirian Wrote:  but just adding the extensions of the images in those folders to the ignored file types list in the settings would result in the desired behavior already, since it checks subfolders too.

Hi,
i did as you told me and finally it works perfectly!
Many thanks!
find quote
lysin Offline
Member
Posts: 91
Joined: Mar 2012
Reputation: 1
Post: #14
I'm getting a python error script

Here is the debug log:

http://pastebin.com/EATHQQKC

I'm guessing the error happens around line 1934.

[Image: all-thin-banner.jpg]
find quote
Anthirian Offline
Senior Member
Posts: 103
Joined: Jan 2012
Reputation: 1
Post: #15
That's one strange error. I did some searching online and found that it has something to do with the python interpreter itself. There is a similar issue here. Do you get this everytime? Apparently it is a rare error that usually fixes itself by restarting the python process, i.e. XBMC in this case.
find quote
Post Reply