Anthirian / script.service.janitor

Janitor is an addon for Kodi that cleans up any watched videos from your hard drive(s) based on various criteria
GNU General Public License v3.0
26 stars 14 forks source link

exceptions.UnicodeDecodeError #77

Closed BoKKeR closed 4 years ago

BoKKeR commented 5 years ago

Janitor: Janitor version 4.4.0 loaded. Here are the movies it broke on: u'Kame\u0148\xe1k 2'}, {u'title': u'Kame\u0148\xe1k 3',

2019-09-08 21:26:50.022 T:140648166455040   DEBUG: Janitor: Found 94 videos that may need cleaning.
2019-09-08 21:26:50.022 T:140648166455040   DEBUG: Janitor: Unstacking smb://SNAS/video/movies/Kamenak (2003)/KAMENAK (2003).avi is not needed.
2019-09-08 21:26:50.985 T:140648166455040  NOTICE: Janitor: Not cleaning smb://SNAS/video/movies/Kamenak (2003)/KAMENAK (2003).avi.
2019-09-08 21:26:50.986 T:140648166455040   DEBUG: Janitor: Progress percent is 1.06382978723, amount is 94 and increment is 0.0106382978723
2019-09-08 21:26:50.987 T:140648166455040   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: 'ascii' codec can't decode byte 0xc5 in position 4: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 641, in <module>
                                                results, return_status = cleaner.clean_all()
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 227, in clean_all
                                                cleaned_files, count, status = self.clean(video_type)
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 193, in clean
                                                self.progress.update(int(progress_percent), translate(32616).format(amount=amount, type=type_translation[video_type]), translate(32617), u"[I]{0}[/I]".format(title))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 4: ordinal not in range(128)
                                            -->End of Python script error report<--
2019-09-08 21:26:50.987 T:140648166455040   DEBUG: onExecutionDone(3, /storage/.kodi/addons/script.service.janitor/default.py)
2019-09-08 21:26:51.014 T:140648459283776   DEBUG: ------ Window Init (DialogNotification.xml) ------
2019-09-08 21:26:51.063 T:140648166455040 WARNING: CPythonInvoker(3, /storage/.kodi/addons/script.service.janitor/default.py): the python script "/storage/.kodi/addons/script.service.janitor/default.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon4xbmc7MonitorE,N9XBMCAddon7xbmcgui14DialogProgressE
2019-09-08 21:26:51.063 T:140648166455040    INFO: Python interpreter stopped
2019-09-08 21:26:51.063 T:140648166455040   DEBUG: Thread LanguageInvoker 140648166455040 terminating
2019-09-08 21:26:53.004 T:140647144834816   DEBUG: CWebServer[80]: request received for /jsonrpc
2019-09-08 21:26:56.802 T:140648459283776   DEBUG: Previous line repeats 1 times.
2019-09-08 21:26:56.803 T:140648459283776   DEBUG: ------ Window Deinit (DialogNotification.xml) ------
Anthirian commented 5 years ago

Thanks for submitting the issue. I will try to fix it as soon as I can. In the meantime could you please try removing line 192 from default.py (see below) and report back whether or not that fixes your issue?

title = title.encode("utf-8")
BoKKeR commented 5 years ago

Sorry I ended up removing the movies manually.

baimont commented 5 years ago

Hello,

First let me tell you: thank you for the amazing work.

I seem to have the exact same problem with an other movie of course:

2019-10-06 22:07:58.154 T:1782550752   DEBUG: Janitor: [VideoLibrary.GetMovies] Filters enabled: [{u'operator': u'greaterthan', u'field': u'playcount', u'value': u'0'}, {u'operator': u'false', u'field': u'inprogress', u'value': u''}]
2019-10-06 22:07:58.244 T:1782550752   DEBUG: Janitor: [VideoLibrary.GetMovies] Response: {"id":1,"jsonrpc":"2.0","result":{"limits":{"end":2,"start":0,"total":2},"movies":[{"file":"/media/DD/Framboise/Films/Pokémon Detective Pikachu (2019) [BluRay] [1080p] [YTS.LT]/Pokémon.Detective.Pikachu.2019.1080p.BluRay.x264-[YTS.LT].mp4","label":"Pokémon Detective Pikachu","movieid":23,"title":"Pokémon Detective Pikachu"},{"file":"/media/DD/Framboise/Films/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX.mkv","label":"Toy Story 4","movieid":60,"title":"Toy Story 4"}]}}
2019-10-06 22:07:58.245 T:1782550752   DEBUG: Janitor: Building list of expired videos
2019-10-06 22:07:58.245 T:1782550752   DEBUG: Janitor: Found 2 watched movies matching your conditions
2019-10-06 22:07:58.245 T:1782550752   DEBUG: Janitor: JSON Response: {u'movies': [{u'title': u'Pok\xe9mon Detective Pikachu', u'movieid': 23, u'file': u'/media/DD/Framboise/Films/Pok\xe9mon Detective Pikachu (2019) [BluRay] [1080p] [YTS.LT]/Pok\xe9mon.Detective.Pikachu.2019.1080p.BluRay.x264-[YTS.LT].mp4', u'label': u'Pok\xe9mon Detective Pikachu'}, {u'title': u'Toy Story 4', u'movieid': 60, u'file': u'/media/DD/Framboise/Films/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX.mkv', u'label': u'Toy Story 4'}], u'limits': {u'start': 0, u'total': 2, u'end': 2}}
2019-10-06 22:07:58.245 T:1782550752   DEBUG: Janitor: Expired videos: [[u'/media/DD/Framboise/Films/Pok\xe9mon Detective Pikachu (2019) [BluRay] [1080p] [YTS.LT]/Pok\xe9mon.Detective.Pikachu.2019.1080p.BluRay.x264-[YTS.LT].mp4', u'Pok\xe9mon Detective Pikachu'], [u'/media/DD/Framboise/Films/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX/Toy.Story.4.2019.1080p.WEBRip.x264.AAC2.0-SHITBOX.mkv', u'Toy Story 4']]
2019-10-06 22:07:58.246 T:1782550752   DEBUG: Janitor: Found 2 videos that may need cleaning.
2019-10-06 22:07:58.246 T:1782550752   DEBUG: Janitor: Unstacking /media/DD/Framboise/Films/Pokémon Detective Pikachu (2019) [BluRay] [1080p] [YTS.LT]/Pokémon.Detective.Pikachu.2019.1080p.BluRay.x264-[YTS.LT].mp4 is not needed.
2019-10-06 22:07:58.247 T:1782550752  NOTICE: Janitor: Not cleaning /media/DD/Framboise/Films/Pokémon Detective Pikachu (2019) [BluRay] [1080p] [YTS.LT]/Pokémon.Detective.Pikachu.2019.1080p.BluRay.x264-[YTS.LT].mp4.
2019-10-06 22:07:58.247 T:1782550752   DEBUG: Janitor: Progress percent is 50.0, amount is 2 and increment is 0.5
2019-10-06 22:07:58.249 T:1782550752   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: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/home/pi/.kodi/addons/script.service.janitor/default.py", line 641, in <module>
                                                results, return_status = cleaner.clean_all()
                                              File "/home/pi/.kodi/addons/script.service.janitor/default.py", line 227, in clean_all
                                                cleaned_files, count, status = self.clean(video_type)
                                              File "/home/pi/.kodi/addons/script.service.janitor/default.py", line 193, in clean
                                                self.progress.update(int(progress_percent), translate(32616).format(amount=amount, type=type_translation[video_type]), translate(32617), u"[I]{0}[/I]".format(title))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
                                            -->End of Python script error report<--
Anthirian commented 5 years ago

Okay, does the fix mentioned above work for you?

baimont commented 5 years ago

Okay, does the fix mentioned above work for you?

I didn't try the fix since I didn't know where to find the default.py file. Maybe you could tell me how to do that (special way to install janitor, where to find the file, reload kodi with a janitor with modified files?) and if the problem happens again, I'll try the solution?

Anthirian commented 5 years ago

Sure. You should be able to find it in special://profile in a (sub)folder called script.service.janitor.

If you don’t know how to access this location please check the link below:

https://kodi.wiki/view/Special_protocol

On Fri, 25 Oct 2019 at 08:17 baimont notifications@github.com wrote:

Okay, does the fix mentioned above work for you?

I didn't try the fix since I didn't know where to find the default.py file. Maybe you could tell me how to do that (special way to install janitor, where to find the file, reload kodi with a janitor with modified files?) and if the problem happens again, I'll try the solution?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Anthirian/script.service.janitor/issues/77?email_source=notifications&email_token=AAFL7BCC4CB7IVP5XXGDVVDQQKFOFA5CNFSM4IUUS7KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECHJ5UY#issuecomment-546217683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFL7BG2GH5X55BR7WGFA2DQQKFOFANCNFSM4IUUS7KA .

BmdOnline commented 4 years ago

Hi, Same issue here

2019-12-17 19:14:10.813 T:1807721328   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: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 641, in <module>
                                                results, return_status = cleaner.clean_all()
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 227, in clean_all
                                                cleaned_files, count, status = self.clean(video_type)
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 193, in clean
                                                self.progress.update(int(progress_percent), translate(32616).format(amount=amount, type=type_translation[video_type]), translate(32617), u"[I]{0}[/I]".format(title))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)
                                            -->End of Python script error report<--
2019-12-17 19:14:11.011 T:1807721328 WARNING: CPythonInvoker(10, /storage/.kodi/addons/script.service.janitor/default.py): the python script "/storage/.kodi/addons/script.service.janitor/default.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon7xbmcgui14DialogProgressE,N9XBMCAddon4xbmc7MonitorE

I have applied the fix as above, removing :

title = title.encode("utf-8")

And it works.

Anthirian commented 4 years ago

Thanks for letting me know. I will push a bugfix to the repositories soon.

BoKKeR commented 4 years ago

This came back for me running 4.4.0

2020-06-23 15:07:03.034 T:140128316610304   DEBUG: Janitor: Unstacking smb://unraid/video/series/xxxxé-xxxxx.mkv is not needed.
2020-06-23 15:07:03.045 T:140128316610304   ERROR: Delete - Error( Permission denied )
2020-06-23 15:07:03.050 T:140128316610304   ERROR: Delete - Error deleting file smb://unraid/video/series/xxxxé-xxxxx.mkv
2020-06-23 15:07:03.050 T:140128316610304   DEBUG: Janitor: Progress percent is 4.34782608696, amount is 69 and increment is 0.0144927536232
2020-06-23 15:07:03.052 T:140128316610304   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: 'ascii' codec can't decode byte 0xc3 in position 12: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 641, in <module>
                                                results, return_status = cleaner.clean_all()
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 227, in clean_all
                                                cleaned_files, count, status = self.clean(video_type)
                                              File "/storage/.kodi/addons/script.service.janitor/default.py", line 193, in clean
                                                self.progress.update(int(progress_percent), translate(32616).format(amount=amount, type=type_translation[video_type]), translate(32617), u"[I]{0}[/I]".format(title))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 12: ordinal not in range(128)
                                            -->End of Python script error report<--

The character is é

2020-06-23 15:05:16.865 T:140128490421888 NOTICE: ADDON: script.service.janitor v4.4.0 installed

Anthirian commented 4 years ago

It appears that I haven't created a new release yet. I must have forgotten. Could you confirm that you have the latest version from master, i.e. do you have the changes from these commits in your code as well? If so, I'll need to do another (proper) fix for this. Please let me know.

BoKKeR commented 4 years ago

yeah, none of those changes are in 4.4.0 that is installed on my device.