add_to_library: bool = False,
) -> ItemCls:
"""Return (full) details for a single media item."""
+ metadata_lookup = force_refresh or add_to_library
# always prefer the full library item if we have it
library_item = await self.get_library_item_by_prov_id(
item_id,
)
if library_item and (time() - (library_item.metadata.last_refresh or 0)) > REFRESH_INTERVAL:
# it's been too long since the full metadata was last retrieved (or never at all)
- force_refresh = True
- add_to_library = True
+ metadata_lookup = True
if library_item and force_refresh:
# get (first) provider item id belonging to this library item
add_to_library = True
# we couldn't get a match from any of the providers, raise error
msg = f"Item not found: {provider_instance_id_or_domain}/{item_id}"
raise MediaNotFoundError(msg)
- if not add_to_library:
+ if not (add_to_library or metadata_lookup):
# return the provider item as-is
return details
# create task to add the item to the library,
add_task = self.mass.create_task(
self.add_item_to_library,
item=details,
- metadata_lookup=True,
+ metadata_lookup=metadata_lookup,
overwrite_existing=overwrite_existing,
task_id=task_id,
)
if prov_artist_id.startswith(FAKE_ARTIST_PREFIX):\r
# This artist does not exist in jellyfin, so we can just load it from DB.\r
\r
- if db_artist := await self.mass.music.artists.get_db_item_by_prov_id(\r
+ if db_artist := await self.mass.music.artists.get_library_item_by_prov_id(\r
prov_artist_id, self.instance_id\r
):\r
return db_artist\r