Fixed: Queue not showing items with conflicting titles

(cherry picked from commit 789a8f53013a247cd195f864484089c27b5f3858)
(cherry picked from commit 96b31e3c94f178cacabeb2bedd57fd4316e52380)
This commit is contained in:
Mark McDowall 2022-12-12 22:44:08 -08:00 committed by bakerboy448
parent ec9625f2b3
commit cce7ffa6ac
4 changed files with 24 additions and 26 deletions

View file

@ -111,24 +111,26 @@ private List<TrackedDownload> ProcessClientDownloads(IDownloadClient downloadCli
private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem)
{
TrackedDownload trackedDownload = null;
try
{
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem);
trackedDownload =
_trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition,
downloadItem);
if (trackedDownload is { State: TrackedDownloadState.Downloading or TrackedDownloadState.ImportBlocked })
{
_failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload);
}
return trackedDownload;
}
catch (Exception e)
{
_logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title);
}
return null;
return trackedDownload;
}
private bool DownloadIsTrackable(TrackedDownload trackedDownload)

View file

@ -169,8 +169,8 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
{
trackedDownload.RemoteAlbum = _parsingService.Map(parsedAlbumInfo,
firstHistoryItem.ArtistId,
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed).Select(h => h.AlbumId)
.Distinct());
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed)
.Select(h => h.AlbumId).Distinct());
}
else
{
@ -183,8 +183,8 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
{
trackedDownload.RemoteAlbum = _parsingService.Map(parsedAlbumInfo,
firstHistoryItem.ArtistId,
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed).Select(h => h.AlbumId)
.Distinct());
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed)
.Select(h => h.AlbumId).Distinct());
}
}
}
@ -211,10 +211,17 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
_logger.Trace("No Album found for download '{0}'", trackedDownload.DownloadItem.Title);
}
}
catch (MultipleArtistsFoundException e)
{
_logger.Debug(e, "Found multiple artists for " + downloadItem.Title);
trackedDownload.Warn("Unable to import automatically, found multiple artists: {0}", string.Join(", ", e.Artists));
}
catch (Exception e)
{
_logger.Debug(e, "Failed to find album for " + downloadItem.Title);
return null;
trackedDownload.Warn("Unable to parse albums from title");
}
LogItemChange(trackedDownload, existingItem?.DownloadItem, trackedDownload.DownloadItem);

View file

@ -1,27 +1,16 @@
using System.Collections.Generic;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Music
{
public class MultipleArtistsFoundException : NzbDroneException
{
public MultipleArtistsFoundException(string message, params object[] args)
public List<Artist> Artists { get; }
public MultipleArtistsFoundException(List<Artist> artists, string message, params object[] args)
: base(message, args)
{
}
public MultipleArtistsFoundException(string message)
: base(message)
{
}
public MultipleArtistsFoundException(string message, System.Exception innerException)
: base(message, innerException)
{
}
protected MultipleArtistsFoundException(string message, System.Exception innerException, params object[] args)
: base(message, innerException, args)
{
Artists = artists;
}
}
}

View file

@ -106,7 +106,7 @@ private static Artist ReturnSingleArtistOrThrow(List<Artist> artists)
return artists[0];
}
throw new MultipleArtistsFoundException("Expected one artist, but found {0}. Matching artists: {1}", artists.Count, string.Join(",", artists.Select(s => s.Name)));
throw new MultipleArtistsFoundException(artists, "Expected one artist, but found {0}. Matching artists: {1}", artists.Count, string.Join(", ", artists));
}
}
}