d8ahazard / Cast.bundle

A Plex Channel To Interact With Local Cast Devices, Via Plex Media Server
59 stars 11 forks source link

All API endpoints give NULL pointer access error #11

Closed milesoberstadt closed 5 years ago

milesoberstadt commented 6 years ago

I installed your plugin with WebTools, and I see it register as Cast in the Plugins list. However, clicking on any of the buttons results in the error "This plugin is not responding.". After testing the API endpoints, I can hit the root endpoing (http://localhost:32400/chromecast?X-Plex-Token=XXXXXXXXXX), but all other routes ( http://localhost:32400/chromecast/devices?X-Plex-Token=XXXXXXXXXX ) give the following error:

<Response code="2000" status="ValueError: NULL pointer access">
<Traceback>
Traceback (most recent call last): File "/usr/lib/plexmediaserver/Resources/Plug-ins-31d3c0c65/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/Cast.bundle/Contents/Code/__init__.py", line 166, in Devices casts = fetch_devices() File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Code/__init__.py", line 612, in fetch_devices casts = scan_devices() File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Code/__init__.py", line 700, in scan_devices casts = pychromecast.get_chromecasts(1, None, None, True) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/__init__.py", line 74, in get_chromecasts hosts = discover_chromecasts() File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/discovery.py", line 121, in discover_chromecasts listener, browser = start_discovery(callback) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/discovery.py", line 91, in start_discovery service_browser = zeroconf.ServiceBrowser(zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All), File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1680, in __init__ interfaces = normalize_interface_choice(interfaces) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1618, in normalize_interface_choice choices = choices + get_all_addresses() File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1606, in get_all_addresses for iface in ifaddr.get_adapters(): File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/ifaddr/_posix.py", line 58, in get_adapters ip = shared.sockaddr_to_ip(addr[0].ifa_addr) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/ifaddr/_shared.py", line 163, in sockaddr_to_ip if sockaddr_ptr[0].sa_familiy == socket.AF_INET: ValueError: NULL pointer access
</Traceback>
</Response>

I've never written a Plex plugin, so I don't really know how else to help. Please let me know if any other info is needed to diagnose this.

michaelarnauts commented 6 years ago
2018-06-10 16:04:19,640 (7f0b052f9700) :  DEBUG (runtime:717) - Handling request GET /chromecast/rescan
2018-06-10 16:04:19,642 (7f0b052f9700) :  DEBUG (runtime:814) - Found route matching /chromecast/rescan
2018-06-10 16:04:19,643 (7f0b052f9700) :  DEBUG (__init__:240) - Recieved a call to rescan devices
2018-06-10 16:04:19,643 (7f0b052f9700) :  DEBUG (__init__:84) - UpdateCache called
2018-06-10 16:04:19,643 (7f0b052f9700) :  DEBUG (__init__:699) - Re-fetching devices
2018-06-10 16:04:19,645 (7f0b052f9700) :  CRITICAL (runtime:889) - Exception (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-fd05be322/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Code/__init__.py", line 242, in Rescan
    UpdateCache()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Code/__init__.py", line 85, in UpdateCache
    scan_devices()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Code/__init__.py", line 700, in scan_devices
    casts = pychromecast.get_chromecasts(1, None, None, True)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/__init__.py", line 74, in get_chromecasts
    hosts = discover_chromecasts()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/discovery.py", line 121, in discover_chromecasts
    listener, browser = start_discovery(callback)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/pychromecast/discovery.py", line 91, in start_discovery
    service_browser = zeroconf.ServiceBrowser(zeroconf.Zeroconf(interfaces=zeroconf.InterfaceChoice.All),
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1680, in __init__
    interfaces = normalize_interface_choice(interfaces)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1618, in normalize_interface_choice
    choices = choices + get_all_addresses()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/zeroconf.py", line 1606, in get_all_addresses
    for iface in ifaddr.get_adapters():
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/ifaddr/_posix.py", line 58, in get_adapters
    ip = shared.sockaddr_to_ip(addr[0].ifa_addr)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Cast.bundle/Contents/Libraries/Shared/ifaddr/_shared.py", line 163, in sockaddr_to_ip
    if sockaddr_ptr[0].sa_familiy == socket.AF_INET:
ValueError: NULL pointer access
aniljbhatia commented 6 years ago

Did you ever figure this out? I have the same issue :(

michaelarnauts commented 6 years ago

Nope. I've given up on Phlex for now.

aniljbhatia commented 6 years ago

I managed to get it working by making a change to one of the library files - it wasn't error checking properly. I posted details on a different issue: https://github.com/d8ahazard/Cast.bundle/issues/16

d8ahazard commented 5 years ago

Please check out https://github.com/FlexTV.bundle for the latest iteration of the plugin.

Also, there's an experimental stand-alone app for homes without a PMS server, but you want to control cast devices at https://github.com/d8ahazard/FlexConnect - and docker - https://github.com/d8ahazard/docker-FlexConnect

If you have issues, feel free to report them there!