api radarr debugs
This commit is contained in:
@@ -274,15 +274,21 @@ class RadarrClient:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# For moviefileimported events, handle specially
|
# For import/download events, handle specially
|
||||||
|
imported_path = None
|
||||||
|
# Try different sources for the path
|
||||||
if event_type == "moviefileimported":
|
if event_type == "moviefileimported":
|
||||||
imported_path = (event.get("data", {}).get("importedPath", "") or
|
imported_path = (event.get("data", {}).get("importedPath", "") or
|
||||||
event.get("data", {}).get("path", "") or
|
event.get("data", {}).get("path", "") or
|
||||||
event.get("importedPath", "") or
|
event.get("importedPath", "") or
|
||||||
event.get("sourcePath", "")).lower()
|
event.get("sourcePath", "")).lower()
|
||||||
|
elif event_type == "downloadFolderImported":
|
||||||
|
imported_path = (event.get("data", {}).get("path", "") or
|
||||||
|
event.get("sourcePath", "") or
|
||||||
|
event.get("downloadPath", "")).lower()
|
||||||
|
|
||||||
if imported_path:
|
if imported_path:
|
||||||
_log("DEBUG", f"Found moviefileimported event with path: {imported_path}")
|
_log("DEBUG", f"Found potential import event ({event_type}) with path: {imported_path}")
|
||||||
movie_imdb = (movie_info.get("imdbId", "") or "").lower()
|
movie_imdb = (movie_info.get("imdbId", "") or "").lower()
|
||||||
movie_title = (movie_info.get("title", "") or "").lower()
|
movie_title = (movie_info.get("title", "") or "").lower()
|
||||||
movie_year = str(movie_info.get("year", ""))
|
movie_year = str(movie_info.get("year", ""))
|
||||||
@@ -298,11 +304,16 @@ class RadarrClient:
|
|||||||
earliest_real_import = date_iso
|
earliest_real_import = date_iso
|
||||||
break
|
break
|
||||||
|
|
||||||
# Then try title/year match
|
# Then try title/year match with fuzzy path cleaning
|
||||||
if movie_title and movie_year:
|
if movie_title and movie_year:
|
||||||
# Clean strings for comparison
|
# Clean strings for comparison by replacing common separators
|
||||||
clean_title = movie_title.replace(" ", ".").replace(":", ".").lower()
|
clean_title = movie_title.replace(" ", ".").replace(":", ".").replace("-", ".").replace("_", ".").lower()
|
||||||
clean_path = imported_path.replace(" ", ".").replace("-", ".").replace("_", ".").lower()
|
clean_path = imported_path.replace(" ", ".").replace("-", ".").replace("_", ".").replace("[", "").replace("]", "").lower()
|
||||||
|
|
||||||
|
# Remove common words for better matching
|
||||||
|
for word in ["the", "a", "an"]:
|
||||||
|
clean_title = clean_title.replace(f".{word}.", ".").replace(f"{word}.", "").replace(f".{word}", "")
|
||||||
|
clean_path = clean_path.replace(f".{word}.", ".").replace(f"{word}.", "").replace(f".{word}", "")
|
||||||
|
|
||||||
# Look for both title and year
|
# Look for both title and year
|
||||||
if clean_title in clean_path and movie_year in clean_path:
|
if clean_title in clean_path and movie_year in clean_path:
|
||||||
|
|||||||
Reference in New Issue
Block a user