From dff2aa02a95262591602023bb4018fe72b84649f Mon Sep 17 00:00:00 2001 From: Admin9705 <9705@duck.com> Date: Sun, 8 Jun 2025 16:25:01 -0400 Subject: [PATCH] Update version to 7.6.9 and modify tagging functionality across Eros, Lidarr, Radarr, Readarr, Sonarr, and Whisparr to use new tag labels ("huntarr-missing" and "huntarr-upgraded") for improved clarity and consistency in processing. --- src/primary/apps/eros/api.py | 27 ++++++++++++++------------ src/primary/apps/eros/missing.py | 6 +++--- src/primary/apps/eros/upgrade.py | 6 +++--- src/primary/apps/lidarr/api.py | 27 ++++++++++++++------------ src/primary/apps/lidarr/missing.py | 12 ++++++------ src/primary/apps/lidarr/upgrade.py | 6 +++--- src/primary/apps/radarr/api.py | 27 ++++++++++++++------------ src/primary/apps/radarr/missing.py | 6 +++--- src/primary/apps/radarr/upgrade.py | 6 +++--- src/primary/apps/readarr/api.py | 29 +++++++++++++++------------- src/primary/apps/readarr/missing.py | 6 +++--- src/primary/apps/readarr/upgrade.py | 6 +++--- src/primary/apps/sonarr/api.py | 27 ++++++++++++++------------ src/primary/apps/sonarr/missing.py | 12 ++++++------ src/primary/apps/sonarr/upgrade.py | 12 ++++++------ src/primary/apps/whisparr/api.py | 27 ++++++++++++++------------ src/primary/apps/whisparr/missing.py | 6 +++--- src/primary/apps/whisparr/upgrade.py | 6 +++--- version.txt | 2 +- 19 files changed, 137 insertions(+), 119 deletions(-) diff --git a/src/primary/apps/eros/api.py b/src/primary/apps/eros/api.py index e3c4fb52..3b60fb41 100644 --- a/src/primary/apps/eros/api.py +++ b/src/primary/apps/eros/api.py @@ -585,33 +585,36 @@ def add_tag_to_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int eros_logger.error(f"Error adding tag {tag_id} to movie {movie_id}: {e}") return False -def tag_processed_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag a movie as processed by Huntarr. + Tag a movie in Eros with the specified tag. Args: api_url: The base URL of the Eros API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request movie_id: The ID of the movie to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - eros_logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + eros_logger.error(f"Failed to get or create tag '{tag_label}' in Eros") return False - + # Add the tag to the movie success = add_tag_to_movie(api_url, api_key, api_timeout, movie_id, tag_id) if success: - eros_logger.info(f"Successfully tagged movie {movie_id} with '{tag_label}'") - return success - + eros_logger.debug(f"Successfully tagged Eros movie {movie_id} with '{tag_label}'") + return True + else: + eros_logger.error(f"Failed to add tag '{tag_label}' to Eros movie {movie_id}") + return False + except Exception as e: - eros_logger.error(f"Error tagging movie {movie_id} with '{tag_label}': {e}") + eros_logger.error(f"Error tagging Eros movie {movie_id} with '{tag_label}': {e}") return False diff --git a/src/primary/apps/eros/missing.py b/src/primary/apps/eros/missing.py index faf16731..04ce1276 100644 --- a/src/primary/apps/eros/missing.py +++ b/src/primary/apps/eros/missing.py @@ -198,10 +198,10 @@ def process_missing_items( # Tag the movie if enabled if tag_processed_items: try: - eros_api.tag_processed_movie(api_url, api_key, api_timeout, item_id) - eros_logger.debug(f"Tagged movie {item_id} as processed") + eros_api.tag_processed_movie(api_url, api_key, api_timeout, item_id, "huntarr-missing") + eros_logger.debug(f"Tagged movie {item_id} with 'huntarr-missing'") except Exception as e: - eros_logger.warning(f"Failed to tag movie {item_id}: {e}") + eros_logger.warning(f"Failed to tag movie {item_id} with 'huntarr-missing': {e}") # Log to history system log_processed_media("eros", item_info, item_id, instance_name, "missing") diff --git a/src/primary/apps/eros/upgrade.py b/src/primary/apps/eros/upgrade.py index aafed9b0..952a040a 100644 --- a/src/primary/apps/eros/upgrade.py +++ b/src/primary/apps/eros/upgrade.py @@ -178,10 +178,10 @@ def process_cutoff_upgrades( # Tag the movie if enabled if tag_processed_items: try: - eros_api.tag_processed_movie(api_url, api_key, api_timeout, item_id) - eros_logger.debug(f"Tagged movie {item_id} as processed for upgrades") + eros_api.tag_processed_movie(api_url, api_key, api_timeout, item_id, "huntarr-upgraded") + eros_logger.debug(f"Tagged movie {item_id} with 'huntarr-upgraded'") except Exception as e: - eros_logger.warning(f"Failed to tag movie {item_id}: {e}") + eros_logger.warning(f"Failed to tag movie {item_id} with 'huntarr-upgraded': {e}") # Log to history so the upgrade appears in the history UI log_processed_media("eros", item_info, item_id, instance_name, "upgrade") diff --git a/src/primary/apps/lidarr/api.py b/src/primary/apps/lidarr/api.py index 2026d679..ffbd271d 100644 --- a/src/primary/apps/lidarr/api.py +++ b/src/primary/apps/lidarr/api.py @@ -551,33 +551,36 @@ def add_tag_to_artist(api_url: str, api_key: str, api_timeout: int, artist_id: i lidarr_logger.error(f"Error adding tag {tag_id} to artist {artist_id}: {e}") return False -def tag_processed_artist(api_url: str, api_key: str, api_timeout: int, artist_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_artist(api_url: str, api_key: str, api_timeout: int, artist_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag an artist as processed by Huntarr. + Tag an artist in Lidarr with the specified tag. Args: api_url: The base URL of the Lidarr API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request artist_id: The ID of the artist to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - lidarr_logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + lidarr_logger.error(f"Failed to get or create tag '{tag_label}' in Lidarr") return False - + # Add the tag to the artist success = add_tag_to_artist(api_url, api_key, api_timeout, artist_id, tag_id) if success: - lidarr_logger.info(f"Successfully tagged artist {artist_id} with '{tag_label}'") - return success - + lidarr_logger.debug(f"Successfully tagged Lidarr artist {artist_id} with '{tag_label}'") + return True + else: + lidarr_logger.error(f"Failed to add tag '{tag_label}' to Lidarr artist {artist_id}") + return False + except Exception as e: - lidarr_logger.error(f"Error tagging artist {artist_id} with '{tag_label}': {e}") + lidarr_logger.error(f"Error tagging Lidarr artist {artist_id} with '{tag_label}': {e}") return False \ No newline at end of file diff --git a/src/primary/apps/lidarr/missing.py b/src/primary/apps/lidarr/missing.py index 038f6234..654f0043 100644 --- a/src/primary/apps/lidarr/missing.py +++ b/src/primary/apps/lidarr/missing.py @@ -263,10 +263,10 @@ def process_missing_albums( # Tag the artist if enabled if tag_processed_items: try: - lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id) - lidarr_logger.debug(f"Tagged artist {artist_id} as processed") + lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id, "huntarr-missing") + lidarr_logger.debug(f"Tagged artist {artist_id} with 'huntarr-missing'") except Exception as e: - lidarr_logger.warning(f"Failed to tag artist {artist_id}: {e}") + lidarr_logger.warning(f"Failed to tag artist {artist_id} with 'huntarr-missing': {e}") # Also mark all albums from this artist as processed if artist_id in items_by_artist: @@ -353,11 +353,11 @@ def process_missing_albums( artist_id = album_info.get('artistId') if artist_id and artist_id not in tagged_artists: try: - lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id) - lidarr_logger.debug(f"Tagged artist {artist_id} as processed (from album {album_id})") + lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id, "huntarr-missing") + lidarr_logger.debug(f"Tagged artist {artist_id} with 'huntarr-missing'") tagged_artists.add(artist_id) except Exception as e: - lidarr_logger.warning(f"Failed to tag artist {artist_id}: {e}") + lidarr_logger.warning(f"Failed to tag artist {artist_id} with 'huntarr-missing': {e}") # Log to history system for album_id in album_ids_to_search: diff --git a/src/primary/apps/lidarr/upgrade.py b/src/primary/apps/lidarr/upgrade.py index c84419d0..9c28f158 100644 --- a/src/primary/apps/lidarr/upgrade.py +++ b/src/primary/apps/lidarr/upgrade.py @@ -167,11 +167,11 @@ def process_cutoff_upgrades( artist_id = album.get('artistId') if artist_id and artist_id not in tagged_artists: try: - lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id) - lidarr_logger.debug(f"Tagged artist {artist_id} as processed for upgrades") + lidarr_api.tag_processed_artist(api_url, api_key, api_timeout, artist_id, "huntarr-upgraded") + lidarr_logger.debug(f"Tagged artist {artist_id} with 'huntarr-upgraded'") tagged_artists.add(artist_id) except Exception as e: - lidarr_logger.warning(f"Failed to tag artist {artist_id}: {e}") + lidarr_logger.warning(f"Failed to tag artist {artist_id} with 'huntarr-upgraded': {e}") # Log to history for album_id in album_ids_to_search: diff --git a/src/primary/apps/radarr/api.py b/src/primary/apps/radarr/api.py index faba38ad..25a22fae 100644 --- a/src/primary/apps/radarr/api.py +++ b/src/primary/apps/radarr/api.py @@ -487,33 +487,36 @@ def add_tag_to_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int radarr_logger.error(f"Error adding tag {tag_id} to movie {movie_id}: {e}") return False -def tag_processed_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_movie(api_url: str, api_key: str, api_timeout: int, movie_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag a movie as processed by Huntarr. + Tag a movie in Radarr with the specified tag. Args: api_url: The base URL of the Radarr API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request movie_id: The ID of the movie to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - radarr_logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + radarr_logger.error(f"Failed to get or create tag '{tag_label}' in Radarr") return False - + # Add the tag to the movie success = add_tag_to_movie(api_url, api_key, api_timeout, movie_id, tag_id) if success: - radarr_logger.info(f"Successfully tagged movie {movie_id} with '{tag_label}'") - return success - + radarr_logger.debug(f"Successfully tagged Radarr movie {movie_id} with '{tag_label}'") + return True + else: + radarr_logger.error(f"Failed to add tag '{tag_label}' to Radarr movie {movie_id}") + return False + except Exception as e: - radarr_logger.error(f"Error tagging movie {movie_id} with '{tag_label}': {e}") + radarr_logger.error(f"Error tagging Radarr movie {movie_id} with '{tag_label}': {e}") return False \ No newline at end of file diff --git a/src/primary/apps/radarr/missing.py b/src/primary/apps/radarr/missing.py index b2907389..c87b6da9 100644 --- a/src/primary/apps/radarr/missing.py +++ b/src/primary/apps/radarr/missing.py @@ -281,10 +281,10 @@ def process_missing_movies( # Tag the movie if enabled if tag_processed_items: try: - radarr_api.tag_processed_movie(api_url, api_key, api_timeout, movie_id) - radarr_logger.debug(f"Tagged movie {movie_id} as processed") + radarr_api.tag_processed_movie(api_url, api_key, api_timeout, movie_id, "huntarr-missing") + radarr_logger.debug(f"Tagged movie {movie_id} with 'huntarr-missing'") except Exception as e: - radarr_logger.warning(f"Failed to tag movie {movie_id}: {e}") + radarr_logger.warning(f"Failed to tag movie {movie_id} with 'huntarr-missing': {e}") # Immediately add to processed IDs to prevent duplicate processing success = add_processed_id("radarr", instance_name, str(movie_id)) diff --git a/src/primary/apps/radarr/upgrade.py b/src/primary/apps/radarr/upgrade.py index 8926a4f4..6496273e 100644 --- a/src/primary/apps/radarr/upgrade.py +++ b/src/primary/apps/radarr/upgrade.py @@ -112,10 +112,10 @@ def process_cutoff_upgrades( # Tag the movie if enabled if tag_processed_items: try: - radarr_api.tag_processed_movie(api_url, api_key, api_timeout, movie_id) - radarr_logger.debug(f"Tagged movie {movie_id} as processed for upgrades") + radarr_api.tag_processed_movie(api_url, api_key, api_timeout, movie_id, "huntarr-upgraded") + radarr_logger.debug(f"Tagged movie {movie_id} with 'huntarr-upgraded'") except Exception as e: - radarr_logger.warning(f"Failed to tag movie {movie_id}: {e}") + radarr_logger.warning(f"Failed to tag movie {movie_id} with 'huntarr-upgraded': {e}") # Log to history so the upgrade appears in the history UI media_name = f"{movie_title} ({movie_year})" diff --git a/src/primary/apps/readarr/api.py b/src/primary/apps/readarr/api.py index 87dab242..b2eedfd0 100644 --- a/src/primary/apps/readarr/api.py +++ b/src/primary/apps/readarr/api.py @@ -504,33 +504,36 @@ def add_tag_to_author(api_url: str, api_key: str, api_timeout: int, author_id: i logger.error(f"Error adding tag {tag_id} to author {author_id}: {e}") return False -def tag_processed_author(api_url: str, api_key: str, api_timeout: int, author_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_author(api_url: str, api_key: str, api_timeout: int, author_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag an author as processed by Huntarr. + Tag an author in Readarr with the specified tag. Args: api_url: The base URL of the Readarr API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request author_id: The ID of the author to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: - # Get or create the tag + # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + readarr_logger.error(f"Failed to get or create tag '{tag_label}' in Readarr") return False - + # Add the tag to the author success = add_tag_to_author(api_url, api_key, api_timeout, author_id, tag_id) if success: - logger.info(f"Successfully tagged author {author_id} with '{tag_label}'") - return success - + readarr_logger.debug(f"Successfully tagged Readarr author {author_id} with '{tag_label}'") + return True + else: + readarr_logger.error(f"Failed to add tag '{tag_label}' to Readarr author {author_id}") + return False + except Exception as e: - logger.error(f"Error tagging author {author_id} with '{tag_label}': {e}") + readarr_logger.error(f"Error tagging Readarr author {author_id} with '{tag_label}': {e}") return False \ No newline at end of file diff --git a/src/primary/apps/readarr/missing.py b/src/primary/apps/readarr/missing.py index 911fec29..22265fb8 100644 --- a/src/primary/apps/readarr/missing.py +++ b/src/primary/apps/readarr/missing.py @@ -168,10 +168,10 @@ def process_missing_books( # Tag the book's author if enabled (keep author tagging as it's still useful) if tag_processed_items and author_id: try: - readarr_api.tag_processed_author(api_url, api_key, api_timeout, author_id) - readarr_logger.debug(f"Tagged author {author_id} as processed") + readarr_api.tag_processed_author(api_url, api_key, api_timeout, author_id, "huntarr-missing") + readarr_logger.debug(f"Tagged author {author_id} with 'huntarr-missing'") except Exception as e: - readarr_logger.warning(f"Failed to tag author {author_id}: {e}") + readarr_logger.warning(f"Failed to tag author {author_id} with 'huntarr-missing': {e}") # Log history entry for this specific book media_name = f"{author_name} - {book_title}" diff --git a/src/primary/apps/readarr/upgrade.py b/src/primary/apps/readarr/upgrade.py index 620f6410..071ab393 100644 --- a/src/primary/apps/readarr/upgrade.py +++ b/src/primary/apps/readarr/upgrade.py @@ -164,11 +164,11 @@ def process_cutoff_upgrades( author_id = book.get('authorId') if author_id and author_id not in tagged_authors: try: - readarr_api.tag_processed_author(api_url, api_key, api_timeout, author_id) - readarr_logger.debug(f"Tagged author {author_id} as processed for upgrades") + readarr_api.tag_processed_author(api_url, api_key, api_timeout, author_id, "huntarr-upgraded") + readarr_logger.debug(f"Tagged author {author_id} with 'huntarr-upgraded'") tagged_authors.add(author_id) except Exception as e: - readarr_logger.warning(f"Failed to tag author {author_id}: {e}") + readarr_logger.warning(f"Failed to tag author {author_id} with 'huntarr-upgraded': {e}") # Log to history system for each book for book in books_to_process: diff --git a/src/primary/apps/sonarr/api.py b/src/primary/apps/sonarr/api.py index e534fc73..7609fda3 100644 --- a/src/primary/apps/sonarr/api.py +++ b/src/primary/apps/sonarr/api.py @@ -1226,33 +1226,36 @@ def add_tag_to_series(api_url: str, api_key: str, api_timeout: int, series_id: i sonarr_logger.error(f"Error adding tag {tag_id} to series {series_id}: {e}") return False -def tag_processed_series(api_url: str, api_key: str, api_timeout: int, series_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_series(api_url: str, api_key: str, api_timeout: int, series_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag a series as processed by Huntarr. + Tag a series in Sonarr with the specified tag. Args: api_url: The base URL of the Sonarr API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request series_id: The ID of the series to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded, huntarr-shows-missing) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - sonarr_logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + sonarr_logger.error(f"Failed to get or create tag '{tag_label}' in Sonarr") return False - + # Add the tag to the series success = add_tag_to_series(api_url, api_key, api_timeout, series_id, tag_id) if success: - sonarr_logger.info(f"Successfully tagged series {series_id} with '{tag_label}'") - return success - + sonarr_logger.debug(f"Successfully tagged Sonarr series {series_id} with '{tag_label}'") + return True + else: + sonarr_logger.error(f"Failed to add tag '{tag_label}' to Sonarr series {series_id}") + return False + except Exception as e: - sonarr_logger.error(f"Error tagging series {series_id} with '{tag_label}': {e}") + sonarr_logger.error(f"Error tagging Sonarr series {series_id} with '{tag_label}': {e}") return False \ No newline at end of file diff --git a/src/primary/apps/sonarr/missing.py b/src/primary/apps/sonarr/missing.py index 3a08f0fb..0da61b72 100644 --- a/src/primary/apps/sonarr/missing.py +++ b/src/primary/apps/sonarr/missing.py @@ -222,10 +222,10 @@ def process_missing_seasons_packs_mode( # Tag the series if enabled if tag_processed_items: try: - sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id) - sonarr_logger.debug(f"Tagged series {series_id} as processed") + sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id, "huntarr-missing") + sonarr_logger.debug(f"Tagged series {series_id} with 'huntarr-missing'") except Exception as e: - sonarr_logger.warning(f"Failed to tag series {series_id}: {e}") + sonarr_logger.warning(f"Failed to tag series {series_id} with 'huntarr-missing': {e}") # Log to history system media_name = f"{series_title} - Season {season_number} (contains {episode_count} missing episodes)" @@ -373,10 +373,10 @@ def process_missing_shows_mode( # Tag the series if enabled if tag_processed_items: try: - sonarr_api.tag_processed_series(api_url, api_key, api_timeout, show_id) - sonarr_logger.debug(f"Tagged series {show_id} as processed") + sonarr_api.tag_processed_series(api_url, api_key, api_timeout, show_id, "huntarr-shows-missing") + sonarr_logger.debug(f"Tagged series {show_id} with 'huntarr-shows-missing'") except Exception as e: - sonarr_logger.warning(f"Failed to tag series {show_id}: {e}") + sonarr_logger.warning(f"Failed to tag series {show_id} with 'huntarr-shows-missing': {e}") # Add episode IDs to stateful manager IMMEDIATELY after processing each batch for episode_id in episode_ids: diff --git a/src/primary/apps/sonarr/upgrade.py b/src/primary/apps/sonarr/upgrade.py index aea3f29b..beedc591 100644 --- a/src/primary/apps/sonarr/upgrade.py +++ b/src/primary/apps/sonarr/upgrade.py @@ -204,10 +204,10 @@ def process_upgrade_seasons_mode( # Tag the series if enabled if tag_processed_items: try: - sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id) - sonarr_logger.debug(f"Tagged series {series_id} as processed for upgrades") + sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id, "huntarr-upgraded") + sonarr_logger.debug(f"Tagged series {series_id} with 'huntarr-upgraded'") except Exception as e: - sonarr_logger.warning(f"Failed to tag series {series_id}: {e}") + sonarr_logger.warning(f"Failed to tag series {series_id} with 'huntarr-upgraded': {e}") # Log this as a season pack upgrade in the history log_season_pack_upgrade(api_url, api_key, api_timeout, series_id, season_number, instance_name) @@ -390,10 +390,10 @@ def process_upgrade_shows_mode( # Tag the series if enabled if tag_processed_items: try: - sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id) - sonarr_logger.debug(f"Tagged series {series_id} as processed for upgrades") + sonarr_api.tag_processed_series(api_url, api_key, api_timeout, series_id, "huntarr-upgraded") + sonarr_logger.debug(f"Tagged series {series_id} with 'huntarr-upgraded'") except Exception as e: - sonarr_logger.warning(f"Failed to tag series {series_id}: {e}") + sonarr_logger.warning(f"Failed to tag series {series_id} with 'huntarr-upgraded': {e}") # We'll increment stats individually for each episode instead of in batch # increment_stat("sonarr", "upgraded", len(episode_ids)) diff --git a/src/primary/apps/whisparr/api.py b/src/primary/apps/whisparr/api.py index 48763e95..5ccca6b8 100644 --- a/src/primary/apps/whisparr/api.py +++ b/src/primary/apps/whisparr/api.py @@ -501,33 +501,36 @@ def add_tag_to_series(api_url: str, api_key: str, api_timeout: int, series_id: i whisparr_logger.error(f"Error adding tag {tag_id} to series {series_id}: {e}") return False -def tag_processed_series(api_url: str, api_key: str, api_timeout: int, series_id: int, tag_label: str = "huntarr-processed") -> bool: +def tag_processed_series(api_url: str, api_key: str, api_timeout: int, series_id: int, tag_label: str = "huntarr-missing") -> bool: """ - Tag a series as processed by Huntarr. + Tag a series in Whisparr with the specified tag. Args: api_url: The base URL of the Whisparr API - api_key: The API key for authentication + api_key: The API key for authentication api_timeout: Timeout for the API request series_id: The ID of the series to tag - tag_label: The label of the tag to add (default: "huntarr-processed") + tag_label: The tag to apply (huntarr-missing, huntarr-upgraded) Returns: - True if successful, False otherwise + True if the tagging was successful, False otherwise """ try: # Get or create the tag tag_id = get_or_create_tag(api_url, api_key, api_timeout, tag_label) - if not tag_id: - whisparr_logger.error(f"Failed to get or create tag '{tag_label}'") + if tag_id is None: + whisparr_logger.error(f"Failed to get or create tag '{tag_label}' in Whisparr") return False - + # Add the tag to the series success = add_tag_to_series(api_url, api_key, api_timeout, series_id, tag_id) if success: - whisparr_logger.info(f"Successfully tagged series {series_id} with '{tag_label}'") - return success - + whisparr_logger.debug(f"Successfully tagged Whisparr series {series_id} with '{tag_label}'") + return True + else: + whisparr_logger.error(f"Failed to add tag '{tag_label}' to Whisparr series {series_id}") + return False + except Exception as e: - whisparr_logger.error(f"Error tagging series {series_id} with '{tag_label}': {e}") + whisparr_logger.error(f"Error tagging Whisparr series {series_id} with '{tag_label}': {e}") return False \ No newline at end of file diff --git a/src/primary/apps/whisparr/missing.py b/src/primary/apps/whisparr/missing.py index 9c0c9dcc..67609785 100644 --- a/src/primary/apps/whisparr/missing.py +++ b/src/primary/apps/whisparr/missing.py @@ -182,10 +182,10 @@ def process_missing_items( series_id = item.get('seriesId') if series_id: try: - whisparr_api.tag_processed_series(api_url, api_key, api_timeout, series_id) - whisparr_logger.debug(f"Tagged series {series_id} as processed") + whisparr_api.tag_processed_series(api_url, api_key, api_timeout, series_id, "huntarr-missing") + whisparr_logger.debug(f"Tagged series {series_id} with 'huntarr-missing'") except Exception as e: - whisparr_logger.warning(f"Failed to tag series {series_id}: {e}") + whisparr_logger.warning(f"Failed to tag series {series_id} with 'huntarr-missing': {e}") # Log to history system media_name = f"{title} - {season_episode}" diff --git a/src/primary/apps/whisparr/upgrade.py b/src/primary/apps/whisparr/upgrade.py index ac7dd7af..47d53573 100644 --- a/src/primary/apps/whisparr/upgrade.py +++ b/src/primary/apps/whisparr/upgrade.py @@ -159,10 +159,10 @@ def process_cutoff_upgrades( series_id = item.get('seriesId') if series_id: try: - whisparr_api.tag_processed_series(api_url, api_key, api_timeout, series_id) - whisparr_logger.debug(f"Tagged series {series_id} as processed for upgrades") + whisparr_api.tag_processed_series(api_url, api_key, api_timeout, series_id, "huntarr-upgraded") + whisparr_logger.debug(f"Tagged series {series_id} with 'huntarr-upgraded'") except Exception as e: - whisparr_logger.warning(f"Failed to tag series {series_id}: {e}") + whisparr_logger.warning(f"Failed to tag series {series_id} with 'huntarr-upgraded': {e}") # Log to history so the upgrade appears in the history UI series_title = item.get("series", {}).get("title", "Unknown Series") diff --git a/version.txt b/version.txt index ceddb885..3c0381a3 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -7.6.8 +7.6.9