-
Notifications
You must be signed in to change notification settings - Fork 243
Open
Description
In the parse response function in music_services/data_structures.py the following code exists as part of the process of parsing music service search results:
# if there is only 1 result, it is not put in an array [this comment is in the code]
if isinstance(raw_items, OrderedDict)
raw_items = [raw_items]
As opposed to that code correctly dealing with the case where there is only one search result returned, the following exception is thrown when there is only one search result:
File ".../python3.13/site-packages/soco/music_services/data_structures.py", line 146, in parse_response
class_key = result_type_proper + raw_item["itemType"].title()
~~~~~~~~^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
Specifically in the case of Amazon Music, what is returned in raw_items is a dict and not an OrderedDict so the code above does not place the dict in a list and a little farther along an exception is triggered.
isinstance(raw_items, dict) will catch both dict and OrderedDict in the case where a a single search result is returned so that change should be made in the code.
Metadata
Metadata
Assignees
Labels
No labels