Skip to content

Commit 3d76056

Browse files
committed
Revert instance check
1 parent dd3f797 commit 3d76056

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

music_assistant/controllers/media/albums.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import TYPE_CHECKING, Any, cast
88

99
from music_assistant_models.enums import AlbumType, MediaType, ProviderFeature
10-
from music_assistant_models.errors import MediaNotFoundError, MusicAssistantError
10+
from music_assistant_models.errors import InvalidDataError, MediaNotFoundError, MusicAssistantError
1111
from music_assistant_models.media_items import (
1212
Album,
1313
Artist,
@@ -348,6 +348,9 @@ async def add_item_mapping_as_album_to_library(self, item: ItemMapping) -> Album
348348

349349
async def _add_library_item(self, item: Album, overwrite_existing: bool = False) -> int:
350350
"""Add a new record to the database."""
351+
if not isinstance(item, Album): # TODO: Remove this once the codebase is fully typed
352+
msg = "Not a valid Album object (ItemMapping can not be added to db)" # type: ignore[unreachable]
353+
raise InvalidDataError(msg)
351354
assert self.mass.music.database is not None
352355
db_id = await self.mass.music.database.insert(
353356
self.db_table,

0 commit comments

Comments
 (0)