Skip to content

Commit

Permalink
Fix 'audiotrackdata'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelspagl committed Oct 7, 2024
1 parent 0d2424b commit 11ed2d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.4.1] It seems some Soundbars don't like music

### Fixed

- As it seems that some soundbars don't have the 'audioTrackData' attribute
the update process now, only tries to look at the data if it is existing.

## [0.4.0] Started with an "ick", but is now packed with new features 💪

> ⚠️ Please read the following carefully:
Expand Down
25 changes: 13 additions & 12 deletions custom_components/samsung_soundbar/api_extension/SoundbarDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ async def update(self):
await self._update_equalizer()

async def _update_media(self):
self.__media_artist = self.device.status._attributes["audioTrackData"].value[
"artist"
]
self.__media_title = self.device.status._attributes["audioTrackData"].value[
"title"
]
if self.__media_title != self.__old_media_title:
self.__old_media_title = self.__media_title
self.__media_cover_url_update_time = datetime.datetime.now()
self.__media_cover_url = await self.get_song_title_artwork(
self.__media_artist, self.__media_title
)
if "audioTrackData" in self.device.status._attributes:
self.__media_artist = self.device.status._attributes["audioTrackData"].value[
"artist"
]
self.__media_title = self.device.status._attributes["audioTrackData"].value[
"title"
]
if self.__media_title != self.__old_media_title:
self.__old_media_title = self.__media_title
self.__media_cover_url_update_time = datetime.datetime.now()
self.__media_cover_url = await self.get_song_title_artwork(
self.__media_artist, self.__media_title
)

async def _update_soundmode(self):
await self.update_execution_data(["/sec/networkaudio/soundmode"])
Expand Down

0 comments on commit 11ed2d1

Please sign in to comment.