Merge pull request #298 from luigi311/identifies_logging

Identifies logging
pull/307/head
Luigi311 2025-07-15 01:09:07 -06:00 committed by GitHub
commit 71d753878e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 17 deletions

View File

@ -40,26 +40,29 @@ def extract_identifiers_from_item(
guids = {}
if generate_guids:
guids = {k.lower(): v for k, v in item.get("ProviderIds", {}).items()}
if not guids:
logger.debug(
f"{server_type}: {title if title else id} has no guids",
)
locations: tuple[str, ...] = tuple()
full_path: str = ""
if generate_locations:
if item.get("Path"):
locations = tuple([item["Path"].split("/")[-1]])
full_path = item["Path"]
locations = tuple([full_path.split("/")[-1]])
elif item.get("MediaSources"):
locations = tuple(
[
x["Path"].split("/")[-1]
for x in item["MediaSources"]
if x.get("Path")
]
full_paths = [x["Path"] for x in item["MediaSources"] if x.get("Path")]
locations = tuple([x.split("/")[-1] for x in full_paths])
full_path = " ".join(full_paths)
if generate_guids:
if not guids:
logger.debug(
f"{server_type}: {title if title else id} has no guids{f', locations: {full_path}' if full_path else ''}",
)
if generate_locations:
if not locations:
logger.debug(f"{server_type}: {title if title else id} has no locations")
logger.debug(
f"{server_type}: {title if title else id} has no locations{f', guids: {guids}' if guids else ''}",
)
return MediaIdentifiers(
title=title,

View File

@ -65,13 +65,27 @@ def extract_identifiers_from_item(
generate_locations: bool,
) -> MediaIdentifiers:
guids = extract_guids_from_item(item, generate_guids)
locations = (
tuple([location.split("/")[-1] for location in item.locations])
if generate_locations
else tuple()
)
if generate_guids:
if not guids:
logger.debug(
f"Plex: {item.title} has no guids{f', locations: {" ".join(item.locations)}' if generate_locations else ''}",
)
if generate_locations:
if not locations:
logger.debug(
f"Plex: {item.title} has no locations{f', guids: {guids}' if generate_guids else ''}",
)
return MediaIdentifiers(
title=item.title,
locations=(
tuple([location.split("/")[-1] for location in item.locations])
if generate_locations
else tuple()
),
locations=locations,
imdb_id=guids.get("imdb"),
tvdb_id=guids.get("tvdb"),
tmdb_id=guids.get("tmdb"),