# in case of filestem, removal from library means the whole item is
# moved/deleted so we remove the prov mapping from db.
if provider_id == "filesystem":
- if db_item := controller.get_db_item(item_id):
+ if db_item := await controller.get_db_item(item_id):
db_item.provider_ids = {
x
for x in db_item.provider_ids
"""Update Album record in the database."""
async with self.mass.database.get_db() as _db:
cur_item = await self.get_db_item(item_id)
- if album.artist.musicbrainz_id and album.artist.provider != "database":
+ if (
+ not isinstance(album.artist, ItemMapping)
+ and album.artist.musicbrainz_id
+ and album.artist.provider != "database"
+ ):
album_artist = await self.mass.music.artists.add_db_item(album.artist)
else:
album_artist = (
# TODO: Fall back to parsing base details from filename if no tags found/supported
tag = await self.mass.loop.run_in_executor(None, parse_tag)
+
+ # we need at least a title and artist
+ if tag.title is None or tag.artist is None:
+ self.logger.warning("Skipping track due to invalid ID3 tags: %s", filename)
+ return None
+
prov_item_id = await self._get_item_id(filename, MediaType.TRACK)
name, version = parse_title_and_version(tag.title)
track = Track(