Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Aug 3, 2023
1 parent 6b9e8f7 commit f1e6a48
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions music_assistant/server/controllers/media/albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ async def add_item_to_library(
if not item.provider_mappings:
raise InvalidDataError("Album is missing provider mapping(s)")
# grab additional metadata
if not metadata_lookup:
if metadata_lookup:
await self.mass.metadata.get_album_metadata(item)
# actually add (or update) the item in the library db
# use the lock to prevent a race condition of the same item being added twice
async with self._db_add_lock:
library_item = await self._add_library_item(item)
# also fetch the same album on all providers
if not metadata_lookup:
if metadata_lookup:
await self._match(library_item)
library_item = await self.get_library_item(library_item.item_id)
# also add album tracks
Expand Down
4 changes: 2 additions & 2 deletions music_assistant/server/controllers/media/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ async def add_item_to_library(
if isinstance(item, ItemMapping):
metadata_lookup = True
# grab musicbrainz id and additional metadata
if not metadata_lookup:
if metadata_lookup:
await self.mass.metadata.get_artist_metadata(item)
# actually add (or update) the item in the library db
# use the lock to prevent a race condition of the same item being added twice
async with self._db_add_lock:
library_item = await self._add_library_item(item)
# also fetch same artist on all providers
if not metadata_lookup:
if metadata_lookup:
await self.match_artist(library_item)
library_item = await self.get_library_item(library_item.item_id)
self.mass.signal_event(
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/server/controllers/media/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def add_item_to_library(self, item: Playlist, metadata_lookup: bool = True
async for _ in self.tracks(item.item_id, item.provider):
pass
# metadata lookup we need to do after adding it to the db
if not metadata_lookup:
if metadata_lookup:
await self.mass.metadata.get_playlist_metadata(library_item)
library_item = await self.update_item_in_library(library_item.item_id, library_item)
self.mass.signal_event(
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/server/controllers/media/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def add_item_to_library(self, item: Radio, metadata_lookup: bool = True) -
raise InvalidDataError("Not a valid Radio object (ItemMapping can not be added to db)")
if not item.provider_mappings:
raise InvalidDataError("Radio is missing provider mapping(s)")
if not metadata_lookup:
if metadata_lookup:
await self.mass.metadata.get_radio_metadata(item)
# actually add (or update) the item in the library db
# use the lock to prevent a race condition of the same item being added twice
Expand Down
4 changes: 2 additions & 2 deletions music_assistant/server/controllers/media/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def add_item_to_library(self, item: Track, metadata_lookup: bool = True) -
if not item.provider_mappings:
raise InvalidDataError("Track is missing provider mapping(s)")
# grab additional metadata
if not metadata_lookup:
if metadata_lookup:
await self.mass.metadata.get_track_metadata(item)
# fallback track image from album (only if albumtype = single)
if (
Expand All @@ -145,7 +145,7 @@ async def add_item_to_library(self, item: Track, metadata_lookup: bool = True) -
async with self._db_add_lock:
library_item = await self._add_library_item(item)
# also fetch same track on all providers (will also get other quality versions)
if not metadata_lookup:
if metadata_lookup:
await self._match(library_item)
library_item = await self.get_library_item(library_item.item_id)
self.mass.signal_event(
Expand Down

0 comments on commit f1e6a48

Please sign in to comment.