commit
71d753878e
|
|
@ -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,
|
||||
|
|
|
|||
24
src/plex.py
24
src/plex.py
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue