paolobernardi / italiansubsagent-for-plex

Plex Plugin that retrieves automatically Italian subtitle of Tv Shows from ItalianSubs Community.
23 stars 3 forks source link

Unable to save settings #1

Open robbixc opened 10 years ago

robbixc commented 10 years ago

Hi @paolobernardi , i installed your plugin on my plex media server machine (ubuntu 14.04) and then when i tried to activate the agent and login with my username and password i got the error "Unable to save settings"

here's the log:

2014-05-03 16:38:28,216 (7f40a3fff700) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.italiansubs/prefs
2014-05-03 16:38:28,217 (7f40a3fff700) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.italiansubs/prefs
2014-05-03 16:38:28,218 (7f40a3fff700) :  DEBUG (runtime:918) - Response: [200] MediaContainer, 397 bytes
2014-05-03 16:38:38,720 (7f40a3fff700) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.italiansubs/prefs/set?username1=******&password1=*******
2014-05-03 16:38:38,722 (7f40a3fff700) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.italiansubs/prefs/set
2014-05-03 16:38:38,725 (7f40a3fff700) :  CRITICAL (runtime:883) - Exception (most recent call last):
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/handlers/runtime.py", line 184, in set_prefs
    self._core.sandbox.preferences.get().update_user_values(**kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/preferences.py", line 216, in update_user_values
    self._save_user_file()
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/preferences.py", line 193, in _save_user_file
    el.append(self._core.data.xml.element(name, self._user_values_dict.get(name, pref.encode_value(pref.default_value))))
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/data.py", line 129, in element
    return self._construct_el(etree.Element(name), text, kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/data.py", line 123, in _construct_el
    el.text = text
  File "lxml.etree.pyx", line 916, in lxml.etree._Element.text.__set__ (src/lxml/lxml.etree.c:36134)
  File "apihelpers.pxi", line 721, in lxml.etree._setNodeText (src/lxml/lxml.etree.c:17141)
  File "apihelpers.pxi", line 1366, in lxml.etree._utf8 (src/lxml/lxml.etree.c:22211)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

2014-05-03 16:38:38,728 (7f40a3fff700) :  DEBUG (runtime:918) - Response: [500] 2154 bytes

Thanks!

paolobernardi commented 10 years ago

Have you special characters or accented in your username/password? I just replicated your error by putting accented chars in my username. I'm afraid the problem/bug is in the core of plex, it seems it can't handle properly this type of chars.

paolobernardi commented 10 years ago

Anyway, it's definitely a Plex limitations, I just pushed an update to try to overcome this.

If you have accented/special chars in username/password, you need to convert them in html entities ( you can use http://htmlentities.net ), eg. My username is paolò, I have to type paolò (ò is html entities of ò). My workaround will parse this in a proper way and everything should be fine.