jradwan / TiVoToGo.bundle

TiVo To Go Plex Server Channel
6 stars 2 forks source link

Mind RPC call to retrieve metadata doesn't work on Windows? #5

Open jradwan opened 6 years ago

jradwan commented 6 years ago

When using the new Mind RPC functionality (to retrieve the episode name/number for proper Plex filename formatting) on Windows, the call fails:

2018-06-03 18:17:22,023 (1170) :  INFO (logkit:16) - URL: http://192.168.1.73:80/download/Colony.TiVo?Container=%2FNowPlaying&id=49643
2018-06-03 18:17:22,023 (1170) :  INFO (logkit:16) - Title: Colony - End of the Road
2018-06-03 18:17:22,025 (1170) :  INFO (logkit:16) - Search title  : Colony
2018-06-03 18:17:22,025 (1170) :  INFO (logkit:16) - Search episode: End of the Road
2018-06-03 18:17:22,025 (1170) :  INFO (logkit:16) - Executing episodeSearch
2018-06-03 18:17:22,038 (1170) :  CRITICAL (core:574) - Exception (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-31d3c0c65\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py", line 843, in handle_request
    result = f(**d)
  File "C:\Users\username\AppData\Local\Plex Media Server\Plug-ins\TiVoToGo.bundle\Contents\Code\__init__.py", line 497, in downloadLocal
    remote = Remote(rpc_username, rpc_password)
  File "C:\Users\username\AppData\Local\Plex Media Server\Plug-ins\TiVoToGo.bundle\Contents\Code\__init__.py", line 715, in __init__
    self.ssl_socket = ssl.wrap_socket(self.socket, certfile=certfile_path)
  File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\ssl.py", line 933, in wrap_socket
    ciphers=ciphers)
  File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\ssl.py", line 580, in __init__
    self.getpeername()
  File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied

I'm wondering if this is related to issue #4 in that it's somehow path-related and how Python is handing long paths with spaces in it. In this case, the certfile_path which is where the cdata.pem file is located, necessary for the SSL connection to the TiVo Mind server (ex. C:\Users\username\AppData\Local\Plex Media Server\Plug-ins\TiVoToGo.bundle\Contents\Libraries\Shared\cdata.pem). This feature works fine on Linux.

jradwan commented 6 years ago

Actually now I'm not convinced it's the path to the certificate file. The "error: [Errno 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied" seems to be a connection issue. Related to the self.getpeername() call?

jradwan commented 6 years ago

I'm wondering if it has something to do with ssl.py differences between Linux and Windows? Really not sure ...

jradwan commented 6 years ago

Related? (problem mentions works on OSX, not on Windows)

https://stackoverflow.com/questions/6605406/socketserver-tcpsocket-works-on-stock-python-but-not-python-compiled-against-ms

jradwan commented 6 years ago

It's not an ssl.py difference between Windows and Linux ... both are using the python 2.7 version of the file.

jradwan commented 6 years ago

Maybe use this?

https://github.com/michaeluhl/libtivomind