Skip to content

Commit

Permalink
Merge pull request #91 from andrewsayre/fix_media_name
Browse files Browse the repository at this point in the history
Unquote media item name
  • Loading branch information
andrewsayre authored Jan 24, 2025
2 parents bff198c + cad148d commit 8ccb03f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion pyheos/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections.abc import Sequence
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Optional, cast
from urllib.parse import unquote

from pyheos import command as c
from pyheos.abc import RemoveHeosFieldABC
Expand Down Expand Up @@ -140,7 +141,7 @@ def from_data(
source_id=new_source_id,
container_id=data.get(c.ATTR_CONTAINER_ID, container_id),
browsable=new_browseable,
name=data[c.ATTR_NAME],
name=unquote(data[c.ATTR_NAME]),
type=MediaType(data[c.ATTR_TYPE]),
image_url=data[c.ATTR_IMAGE_URL],
playable=data.get(c.ATTR_PLAYABLE) == c.VALUE_YES,
Expand Down
26 changes: 13 additions & 13 deletions tests/snapshots/test_heos_browse.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-R4004275',
'name': 'Ferrari Simmons %26 RaySean',
'name': 'Ferrari Simmons & RaySean',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -166,7 +166,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-R5180582',
'name': 'Dr. Hook %26 Ray Sawyer',
'name': 'Dr. Hook & Ray Sawyer',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -192,7 +192,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S133862497',
'name': 'Tangerine Rays by Zedd, Bea Miller %26 ellis',
'name': 'Tangerine Rays by Zedd, Bea Miller & ellis',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -205,7 +205,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S142439068',
'name': 'Tangerine Rays by Zedd, Bea Miller %26 ellis',
'name': 'Tangerine Rays by Zedd, Bea Miller & ellis',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -218,7 +218,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S142439069',
'name': 'Tangerine Rays (Instrumental) by Zedd, Bea Miller %26 ellis',
'name': 'Tangerine Rays (Instrumental) by Zedd, Bea Miller & ellis',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -231,7 +231,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S142439070',
'name': 'Tangerine Rays (Acapella) by Zedd, Bea Miller %26 ellis',
'name': 'Tangerine Rays (Acapella) by Zedd, Bea Miller & ellis',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -244,7 +244,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S136888654',
'name': 'Tangerine Rays (8-Bit Bea Miller, Ellis %26 Zedd Emulation) by 8-Bit Arcade',
'name': 'Tangerine Rays (8-Bit Bea Miller, Ellis & Zedd Emulation) by 8-Bit Arcade',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand Down Expand Up @@ -296,7 +296,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S5615318',
'name': 'Tangerine by Herb Alpert %26 The Tijuana Brass',
'name': 'Tangerine by Herb Alpert & The Tijuana Brass',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand Down Expand Up @@ -751,7 +751,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S36767691',
'name': 'Tangerine Sour by Emancipator %26 9 Theory',
'name': 'Tangerine Sour by Emancipator & 9 Theory',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand Down Expand Up @@ -803,7 +803,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S17131911',
'name': 'Morgenstern, Pt. 4 by Schiller %26 Tangerine Dream',
'name': 'Morgenstern, Pt. 4 by Schiller & Tangerine Dream',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand All @@ -829,7 +829,7 @@
'container_id': None,
'image_url': '',
'media_id': 'CREATE_STATION-S9747275',
'name': 'Tangerine by Bob Brookmeyer %26 Stan Getz Quintet',
'name': 'Tangerine by Bob Brookmeyer & Stan Getz Quintet',
'playable': True,
'source_id': 1,
'type': <MediaType.STATION: 'station'>,
Expand Down Expand Up @@ -959,7 +959,7 @@
'container_id': None,
'image_url': 'http://resources.wimpmusic.com/images/4efa15cf/1a95/423a/8b05/f656281da36e/640x640.jpg',
'media_id': '389676834',
'name': 'Tangerine Rays (Karaoke Version Originally Performed by Bea Miller, Ellis %26 Zedd)',
'name': 'Tangerine Rays (Karaoke Version Originally Performed by Bea Miller, Ellis & Zedd)',
'playable': True,
'source_id': 10,
'type': <MediaType.SONG: 'song'>,
Expand Down Expand Up @@ -1224,7 +1224,7 @@
'container_id': None,
'image_url': 'http://resources.wimpmusic.com/images/4efa15cf/1a95/423a/8b05/f656281da36e/640x640.jpg',
'media_id': '389676834',
'name': 'Tangerine Rays (Karaoke Version Originally Performed by Bea Miller, Ellis %26 Zedd)',
'name': 'Tangerine Rays (Karaoke Version Originally Performed by Bea Miller, Ellis & Zedd)',
'playable': True,
'source_id': 10,
'type': <MediaType.SONG: 'song'>,
Expand Down

0 comments on commit 8ccb03f

Please sign in to comment.