Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 17 additions & 31 deletions frontend/static/js/hunt_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ const huntManagerModule = {
const title = link.textContent; // Use the text content as the title

console.log('Hunt item clicked:', { appType, instanceName, itemId, title });
// Only process clicks for Sonarr (other apps have URL issues)
if (appType === 'sonarr' && instanceName) {

// Process clicks for Sonarr, Radarr, and Lidarr
if ((appType === 'sonarr' || appType === 'radarr' || appType === 'lidarr') && instanceName) {
huntManagerModule.openAppInstance(appType, instanceName, itemId, title);
} else if (appType === 'sonarr' && window.huntarrUI) {
// Fallback to Apps section for Sonarr if no instance name
} else if ((appType === 'sonarr' || appType === 'radarr' || appType === 'lidarr') && window.huntarrUI) {
// Fallback to Apps section if no instance name
window.huntarrUI.switchSection('apps');
window.location.hash = '#apps';
console.log(`Navigated to apps section for ${appType}`);
} else {
// For non-Sonarr apps, show a helpful message
console.log(`Clicking disabled for ${appType} - only Sonarr links work properly`);
// For other apps, show a helpful message
console.log(`Clicking disabled for ${appType} - only Sonarr, Radarr, and Lidarr links work currently`);
}
}
});
Expand Down Expand Up @@ -248,10 +248,10 @@ const huntManagerModule = {
return row;
},

// Format processed info
// Format processed info
formatProcessedInfo: function(entry) {
// Only Sonarr entries are clickable with external linking (other apps have URL issues)
const isClickable = entry.app_type === 'sonarr' && entry.instance_name;
// Sonarr, Radarr, and Lidarr entries are clickable with external linking
const isClickable = (entry.app_type === 'sonarr' || entry.app_type === 'radarr' || entry.app_type === 'lidarr') && entry.instance_name;
const dataAttributes = isClickable ?
`data-app="${entry.app_type}" data-instance="${entry.instance_name}" data-item-id="${entry.media_id || ''}"` :
`data-app="${entry.app_type}"`;
Expand Down Expand Up @@ -399,26 +399,12 @@ const huntManagerModule = {
}
break;
case 'radarr':
// Radarr also uses title-based slugs
if (title) {
// Extract movie title (remove year and other info)
let movieTitle = title.replace(/\s*\(\d{4}\).*$/, ''); // Remove (2023) and anything after

const slug = movieTitle
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '')
.replace(/\s+/g, '-')
.replace(/-+/g, '-')
.replace(/^-|-$/g, '');

path = `/movie/${slug}`;
} else {
path = `/movie/${itemId}`;
}
// Radarr uses numeric IDs
path = `/movie/${itemId}`;
break;
case 'lidarr':
path = `/artist/${itemId}`;
// Lidarr uses foreignAlbumId (MusicBrainz UUID)
path = `/album/${itemId}`;
break;
case 'readarr':
path = `/author/${itemId}`;
Expand Down Expand Up @@ -490,9 +476,9 @@ const huntManagerModule = {

if (instanceSettings && instanceSettings.api_url) {
let targetUrl;
// If we have item details, try to create a direct link for all supported apps
if (itemId && title && ['sonarr', 'radarr', 'lidarr', 'readarr', 'whisparr', 'eros'].includes(appType.toLowerCase())) {

// If we have item details, try to create a direct link for supported apps
if (itemId && ['sonarr', 'radarr', 'lidarr', 'readarr', 'whisparr', 'eros'].includes(appType.toLowerCase())) {
targetUrl = this.generateDirectLink(appType, instanceSettings.api_url, itemId, title);
console.log('Generated direct link:', targetUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/primary/apps/lidarr/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ def process_missing_albums(
title = album_info.get('title', f'Album ID {album_id}')
artist_name = album_info.get('artist', {}).get('artistName', 'Unknown Artist')
media_name = f"{artist_name} - {title}"
log_processed_media("lidarr", media_name, album_id, instance_name, "missing")
# Use foreignAlbumId for Lidarr URLs (falls back to internal ID if not available)
foreign_album_id = album_info.get('foreignAlbumId', album_id)
log_processed_media("lidarr", media_name, foreign_album_id, instance_name, "missing")
lidarr_logger.debug(f"Logged history entry for album: {media_name}")

time.sleep(command_wait_delay) # Basic delay after the single command
Expand Down
4 changes: 3 additions & 1 deletion src/primary/apps/lidarr/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def process_cutoff_upgrades(
album_title = album.get('title', f'Album ID {album_id}')
artist_name = album.get('artist', {}).get('artistName', 'Unknown Artist')
media_name = f"{artist_name} - {album_title}"
log_processed_media("lidarr", media_name, album_id, instance_name, "upgrade")
# Use foreignAlbumId for Lidarr URLs (falls back to internal ID if not available)
foreign_album_id = album.get('foreignAlbumId', album_id)
log_processed_media("lidarr", media_name, foreign_album_id, instance_name, "upgrade")
lidarr_logger.debug(f"Logged quality upgrade to history for album ID {album_id}")
break

Expand Down
4 changes: 3 additions & 1 deletion src/primary/apps/radarr/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ def process_missing_movies(
# Log to history system
year = movie.get("year", "Unknown Year")
media_name = f"{movie_title} ({year})"
log_processed_media("radarr", media_name, movie_id, instance_name, "missing")
# Use TMDb ID for Radarr URLs (falls back to internal ID if TMDb ID not available)
tmdb_id = movie.get("tmdbId", movie_id)
log_processed_media("radarr", media_name, tmdb_id, instance_name, "missing")
radarr_logger.debug(f"Logged history entry for movie: {media_name}")

increment_stat_only("radarr", "hunted")
Expand Down
4 changes: 3 additions & 1 deletion src/primary/apps/radarr/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def process_cutoff_upgrades(

# Log to history so the upgrade appears in the history UI
media_name = f"{movie_title} ({movie_year})"
log_processed_media("radarr", media_name, movie_id, instance_name, "upgrade")
# Use TMDb ID for Radarr URLs (falls back to internal ID if TMDb ID not available)
tmdb_id = movie.get("tmdbId", movie_id)
log_processed_media("radarr", media_name, tmdb_id, instance_name, "upgrade")
radarr_logger.debug(f"Logged quality upgrade to history for movie ID {movie_id}")

processed_count += 1
Expand Down