-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'NoneType' object is not subscriptable #7
Comments
I asked for help at reddit, will hopefully get some response. |
This would be because the Jellyfin serializer started returning null values instead of not including the key in the response. It caused some problems for me too in jellyfin-mpv-shim. This code would have to be updated to deal with a null value for It was changed all over, so more changes for where keys historically weren't present now need to also deal with null values. I've gotten really defensive about null values coming back from Jellyfin accordingly. |
iwalton's correct. What's happening is that some of the responses from the server are coming back as
Relatively easy fix, but then there's several other places in the codebase that are doing similar things where it assumes if the key exists, it will be a dict. For example: Line 409 in 6bb621e
Lines 124 to 125 in 6bb621e
I'm working through and trying to find each of them right now, should have a PR up in a bit. |
Further update: In it's current state basically every function in @property
def media_id(self):
""" Return title currently playing."""
try:
return self.session['NowPlayingItem']['Id']
except KeyError:
return None would need to become something along the lines of @property
def media_id(self):
""" Return title currently playing."""
if self.session['NowPlayingItem']:
return self.session['NowPlayingItem']['Id']
else:
return None Obviously this would be a lot of changes in that file that may not be entirely wanted. An alternative method would be something that we implemented in our Kodi addon that solves the problem by simply removing all keys with values of @mezz64 let me know which direction you'd rather go with it. |
@mcarlton00 I'd prefer the remove None valued keys approach. Seems much more elegant than checking everywhere. |
Within home-assistant, the current status of a jellyfin instance is not updated. The logs show the following:
This looks to me like an issue in pyemby, perhaps just some mapping, or is this an issue by jellyfin not implementing the API correclty?
This has been reported in home-assistant/core#38501
The text was updated successfully, but these errors were encountered: