MilhouseVH / texturecache.py

Utility script to manage the XBMC texture cache
http://forum.xbmc.org/showthread.php?tid=158373
GNU General Public License v2.0
181 stars 34 forks source link

Character encoding error #64

Open Zippy79 opened 3 years ago

Zippy79 commented 3 years ago

There seems to be a character encoding problem when using letters with diacritic marks in a filter:

kodi@kodi:~$ ./texturecache.py C artists "Sinéad O'Connor"

Caching artwork: 0 items remaining of 2 (qs: 0, qm: 0), 0 errors, 0 threads active (02.00 downloads per second, ETA: 00:00:00)

Traceback (most recent call last):
  File "./texturecache.py", line 8663, in <module>
    main(sys.argv[1:])
  File "./texturecache.py", line 8470, in main
    if _stats: TOTALS.libraryStats(multi=_multi_call, filter=_filter, lastRun=_lastRun, query=_query)
  File "./texturecache.py", line 3736, in libraryStats
    print(line0)
  File "/usr/lib/python2.7/codecs.py", line 369, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 63: ordinal not in range(128)

Omit the diacritic mark from the filter and it works correctly:

kodi@kodi:~$ ./texturecache.py C artists "O'Connor"

Caching artwork: 0 items remaining of 2 (qs: 0, qm: 0), 0 errors, 0 threads active (02.00 downloads per second, ETA: 00:00:00)

Cache pre-load activity summary for "artists", filtered by "O'Connor":

              |    fanart   |  thumbnail  |    TOTAL
--------------+-------------+-------------+-------------
Cached        |      1      |      1      |      2
Deleted       |      1      |      1      |      2
Duplicate     |      -      |      -      |      0
Error         |      -      |      -      |      0
Ignored       |      -      |      -      |      0
Skipped       |      -      |      -      |      0
Undefined     |      -      |      -      |      0
========================================================
TOTAL         |      2      |      2      |      4
Download Time | 00:00:00.28 | 00:00:00.31 | 00:00:00.31

  Threads Used: 2
   Min/Avg/Max: 02.00 / 06.29 / 02.00 downloads per second
   Min/Avg/Max: 00.29 / 00.30 / 00.32 seconds per download

       Loading: 00:00:00.03
       Parsing: 00:00:00.00
     Comparing: 00:00:00.17
   Downloading: 00:00:00.31
 TOTAL RUNTIME: 00:00:00.52
hugepants commented 3 years ago

Try using Python 3+ instead of 2.7