commit
71d753878e
|
|
@ -40,26 +40,29 @@ def extract_identifiers_from_item(
|
||||||
guids = {}
|
guids = {}
|
||||||
if generate_guids:
|
if generate_guids:
|
||||||
guids = {k.lower(): v for k, v in item.get("ProviderIds", {}).items()}
|
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()
|
locations: tuple[str, ...] = tuple()
|
||||||
|
full_path: str = ""
|
||||||
if generate_locations:
|
if generate_locations:
|
||||||
if item.get("Path"):
|
if item.get("Path"):
|
||||||
locations = tuple([item["Path"].split("/")[-1]])
|
full_path = item["Path"]
|
||||||
|
locations = tuple([full_path.split("/")[-1]])
|
||||||
elif item.get("MediaSources"):
|
elif item.get("MediaSources"):
|
||||||
locations = tuple(
|
full_paths = [x["Path"] for x in item["MediaSources"] if x.get("Path")]
|
||||||
[
|
locations = tuple([x.split("/")[-1] for x in full_paths])
|
||||||
x["Path"].split("/")[-1]
|
full_path = " ".join(full_paths)
|
||||||
for x in item["MediaSources"]
|
|
||||||
if x.get("Path")
|
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:
|
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(
|
return MediaIdentifiers(
|
||||||
title=title,
|
title=title,
|
||||||
|
|
|
||||||
24
src/plex.py
24
src/plex.py
|
|
@ -65,13 +65,27 @@ def extract_identifiers_from_item(
|
||||||
generate_locations: bool,
|
generate_locations: bool,
|
||||||
) -> MediaIdentifiers:
|
) -> MediaIdentifiers:
|
||||||
guids = extract_guids_from_item(item, generate_guids)
|
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(
|
return MediaIdentifiers(
|
||||||
title=item.title,
|
title=item.title,
|
||||||
locations=(
|
locations=locations,
|
||||||
tuple([location.split("/")[-1] for location in item.locations])
|
|
||||||
if generate_locations
|
|
||||||
else tuple()
|
|
||||||
),
|
|
||||||
imdb_id=guids.get("imdb"),
|
imdb_id=guids.get("imdb"),
|
||||||
tvdb_id=guids.get("tvdb"),
|
tvdb_id=guids.get("tvdb"),
|
||||||
tmdb_id=guids.get("tmdb"),
|
tmdb_id=guids.get("tmdb"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue