File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
music_assistant/controllers/media Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 77from typing import TYPE_CHECKING , Any , cast
88
99from 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
1111from 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 ,
You can’t perform that action at this time.
0 commit comments