Release - Janitor (formerly Kodi File Cleaner)

  Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Senior Member
Posts: 133
Joined: Jan 2012
Reputation: 4
Post: #271
First of all, apologies for not responding sooner. I have taken up a new full time job recently and don't have that much time for Janitor anymore.

(2016-07-05 18:50)mels0n Wrote:  Every time I run Janitor it locks up and I get the following in the log:
11:27:26 629.741699 T:1766851568  NOTICE: Janitor: Starting cleaning routine.
11:27:27 629.793152 T:1766851568  NOTICE: Janitor: Cleaning of 'movies' is disabled. Skipping.
11:27:27 629.810242 T:1766851568  NOTICE: Janitor: Cleaning of 'musicvideos' is disabled. Skipping.
11:27:27 629.899780 T:1766851568  NOTICE: Janitor: [VideoLibrary.GetEpisodes] Filters enabled: [{'operator': 'greaterthan', 'field': 'playcount', 'value': '0'}, {'operator': 'notinthelast', 'field': 'lastplayed', 'value': '30.000000'}, {'operator': 'false', 'field': 'inprogress', 'value': ''}]
11:27:28 631.583740 T:1766851568  NOTICE: Janitor: [VideoLibrary.GetEpisodes] Response: '{"id":1,"jsonrpc":"2.0","result":{"episodes":[{"episodeid":2,"file":"nfs:// Shows/White Collar/Season 06/White Collar - S06E01 - Borrowed Time.mkv","label":"6x01. Borrowed Time","showtitle":"White Collar"},{"episodeid":3,"file":"nfs:// Shows/White Collar/Season 06/White Collar - S06E02 - Return to Sender.mkv","label
11:27:28 631.614441 T:1766851568   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeDecodeError'>
                                            Error Contents: 'utf8' codec can't decode byte 0xe2 in position 85: invalid continuation byte
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/script.filecleaner/", line 46, in <module>
                                              File "/home/osmc/.kodi/addons/script.filecleaner/", line 32, in autostart
                                                results, _ = cleaner.clean_all()
                                              File "/home/osmc/.kodi/addons/script.filecleaner/", line 234, in clean_all
                                                cleaned_files, count, status = self.clean(video_type)
                                              File "/home/osmc/.kodi/addons/script.filecleaner/", line 140, in clean
                                                expired_videos = self.get_expired_videos(video_type)
                                              File "/home/osmc/.kodi/addons/script.filecleaner/", line 342, in get_expired_videos
                                                result = json.loads(response)
                                              File "/usr/lib/python2.7/json/", line 338, in loads
                                                return _default_decoder.decode(s)
                                              File "/usr/lib/python2.7/json/", line 366, in decode
                                                obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                                              File "/usr/lib/python2.7/json/", line 382, in raw_decode
                                                obj, end = self.scan_once(s, idx)
                                            UnicodeDecodeError: 'utf8' codec can't decode byte 0xe2 in position 85: invalid continuation byte
                                            -->End of Python script error report<--
11:27:29 631.824890 T:1766851568 WARNING: CPythonInvoker(2, /home/osmc/.kodi/addons/script.filecleaner/ the python script "/home/osmc/.kodi/addons/script.filecleaner/" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon4xbmc7MonitorE,N9XBMCAddon7xbmcgui14DialogProgressE
From this error message I understand there is a problem with the second file in the results set. It looks like the title scraped into the library for the episode White Collar 6x02 contains some unicode characters that result in an error when processed by Janitor. I'm not sure why this happens. I have performed various tests scraping a movie into my library using the Russian and Korean titles, but these are in fact cleaned up successfully:

22:41:33 T:10208  NOTICE: Janitor: [VideoLibrary.GetMovies] Filters enabled: [{'operator': 'greaterthan', 'field': 'playcount', 'value': '0'}, {'operator': 'false', 'field': 'inprogress', 'value': ''}, {'operator': 'doesnotcontain', 'field': 'path', 'value': 'nfs://'}, {'operator': 'doesnotcontain', 'field': 'path', 'value': 'E:\\Downloads\\Unsorted\\Misc\\'}]
22:41:33 T:10208   DEBUG: CVideoDatabase::RunQuery took 4 ms for 1 items query: select * from movie_view  WHERE ((CAST(movie_view.playCount as DECIMAL(5,1)) > 0)) AND (movie_view.idFile  NOT IN (SELECT DISTINCT idFile FROM bookmark WHERE type = 1)) AND ((movie_view.strPath NOT LIKE '%nfs://' OR movie_view.strPath IS NULL)) AND ((movie_view.strPath NOT LIKE '%E:\Downloads\Unsorted\Misc\%' OR movie_view.strPath IS NULL))
22:41:33 T:10208  NOTICE: Janitor: [VideoLibrary.GetMovies] Response: '{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":1,"start":0,"total":1},"movies":[{"file":"E:\\\\Downloads\\\\Unsorted\\\\Movies\\\\Schindlers.List.1080p.BluRay.x264-SPARKS\\\\Schindlers.List.1080p.BluRay.x264-SPARKs.mkv","label":"\xec\x89\xb0\xeb\x93\xa4\xeb\x9f\xac \xeb\xa6\xac\xec\x8a\xa4\xed\x8a\xb8","movieid":375,"title":"\xec\x89\xb0\xeb\x93\xa4\xeb\x9f\xac \xeb\xa6\xac\xec\x8a\xa4\xed\x8a\xb8"}]}}'
22:41:33 T:10208  NOTICE: Janitor: Building list of expired videos
22:41:33 T:10208  NOTICE: Janitor: Found 1 watched movies matching your conditions
22:41:33 T:10208  NOTICE: Janitor: JSON Response: {u'movies': [{u'title': u'\uc270\ub4e4\ub7ec \ub9ac\uc2a4\ud2b8', u'movieid': 375, u'file': u'E:\\Downloads\\Unsorted\\Movies\\Schindlers.List.1080p.BluRay.x264-SPARKS\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv', u'label': u'\uc270\ub4e4\ub7ec \ub9ac\uc2a4\ud2b8'}], u'limits': {u'start': 0, u'total': 1, u'end': 1}}
22:41:33 T:10208  NOTICE: Janitor: Expired videos: [[u'E:\\Downloads\\Unsorted\\Movies\\Schindlers.List.1080p.BluRay.x264-SPARKS\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv', u'\uc270\ub4e4\ub7ec \ub9ac\uc2a4\ud2b8']]
22:41:33 T:10208  NOTICE: Janitor: Found 1 videos that may need cleaning.
22:41:33 T:10208  NOTICE: Janitor: Unstacking 'E:\\Downloads\\Unsorted\\Movies\\Schindlers.List.1080p.BluRay.x264-SPARKS\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv' is not needed.
22:41:33 T:10208  NOTICE: Previous line repeats 1 times.
22:41:33 T:10208  NOTICE: Janitor: Attempting to move 'E:\\Downloads\\Unsorted\\Movies\\Schindlers.List.1080p.BluRay.x264-SPARKS\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv' to 'E:\\Downloads\\Unsorted\\Expired\\\xec\x89\xb0\xeb\x93\xa4\xeb\x9f\xac \xeb\xa6\xac\xec\x8a\xa4\xed\x8a\xb8'.
22:41:33 T:10208  NOTICE: Janitor: Created destination 'E:\\Downloads\\Unsorted\\Expired\\\xec\x89\xb0\xeb\x93\xa4\xeb\x9f\xac \xeb\xa6\xac\xec\x8a\xa4\xed\x8a\xb8'.
22:41:33 T:10208  NOTICE: Janitor: Moving 'E:\\Downloads\\Unsorted\\Movies\\Schindlers.List.1080p.BluRay.x264-SPARKS\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv' to 'E:\\Downloads\\Unsorted\\Expired\\\xec\x89\xb0\xeb\x93\xa4\xeb\x9f\xac \xeb\xa6\xac\xec\x8a\xa4\xed\x8a\xb8\\Schindlers.List.1080p.BluRay.x264-SPARKS.mkv'.
22:41:33 T:10208  NOTICE: Janitor: File(s) moved successfully.

Could you try deleting this episode manually and trying again?

(2016-07-27 11:13)matt666 Wrote:  I'm having a similar problem to the user above where exclusions are no longer working - not a massive problem for me as I only have Janitor enabled on TV Series, and the only thing I want to keep is a folder of a kids TV show for my kids.

It's running on a Synology NAS and I had the idea that I'd just set the permissions on that folder to Read Only, however the files still get deleted. Does the Janitor process use the root account to carry out it's delete operation?

Is there anything I can do to preserve this folder?

(2016-07-27 20:35)matt666 Wrote:  This is weirder than I thought, the episodes don't delete when I kick off Janitor manually but they do disappear if they have a watched status and the system kicks off an automatic sweep. Nothing in the logs to say they've been deleted either.
I'm not quite sure why this happens for you. Janitor runs within Kodi, not with elevated privileges, so if it is deleting something that is read only, I suspect it might be a bug within Kodi's python API. Could you show me a log that shows this behavior?

(2016-09-01 19:28)i3laze Wrote:  Thanks for your efforts!

Would you please publish the old version, that still supports Gotham?
Got "Dependencies not met" installing on Gotham box (PrismCube).

UPD: Found it:
Is 4.0.1 the latest to work on Gotham?
UPD: Yes.

I got the bug with log not being created - should I downgrade to 4.0.0? Or.. Whats's the filename and path for the log file? (I will create it manually)
UPD: The log is up and running at "./mnt/hdd0/program/.xbmc/userdata/addon_data/script.filecleaner/cleaner.log",
yet when i press "View cleaning history" from the app the log window does not popup : (

P.S. Sorry for self-talk.. just wonder why I had log window working previously (before i reinstalled XMBC).
As explained above my time has become limited, so I unfortunately don't have the time to keep compabitility with older versions of Kodi. Maybe if you were to post a log I could point you in the right direction.

(2016-09-19 02:26)kbaudi Wrote:  Do you plan to update Janitor for Kodi 17 betas, or do we need to wait for the official Kodi release?
I'm not planning to update it for the betas, so your best bet is to wait until Kodi 17 is released and I update the addon. It may take a while before it is updated however, since as I mentioned above, I now have a full time job that takes up most of my time.

[Image: all-thin-banner@2x.jpg]
find quote
Post Reply