Fix for Unicode Exception in Scanners.bundle

Hi,

 

I have an issue with PMS where the scanners simply stop indexing my files. After tracking it down in the logs, I found plex was running into an infinite loop (re-scanning the same file over and over) and also found python traceback related to unicode exceptions.

 

I seem to have fixed both problems for myself by editing the following file:

 

Plug-ins/Scanners.bundle/Contents/Resources/Common/VideoFiles.py

I think this is the original code

 # Make sure we pre-compose.
  name = unicodedata.normalize('NFKC', name.decode('utf-8'))
  name = name.lower()

The exception was on name.decode, so I simply wrapped the line in a try/except and (more importantly) added decoding for ISO-8859 which is what my filenames were.

 

  # Make sure we pre-compose.
  try:
    name = unicodedata.normalize('NFKC', name.decode('utf-8'))
  except Exception, e:
    try:
      name = unicodedata.normalize('NFKC', name.decode('iso8859-15'))
    except Exception, e:
      raise e
  name = name.lower()

 

I know this is a monkey patch but without it my plex server was useless since my files wouldn't be indexed anymore.

 

I am hoping the devs will integrate this fix for the next version of plex. Maybe the patch should be more generic and done elsewhere ? I do not know. And obviously other unicode codecs should be added if needed.

 

Thanks for the great software!

helped me a lot, thanks !

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.