1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Queue not showing items with conflicting titles

This commit is contained in:
Mark McDowall 2022-12-12 22:44:08 -08:00
parent 530829f8ed
commit 789a8f5301
5 changed files with 30 additions and 11 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
@ -113,24 +113,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 != null && trackedDownload.State == TrackedDownloadState.Downloading)
{
_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

@ -10,6 +10,7 @@
using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Download.TrackedDownloads
@ -141,11 +142,15 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
{
// Try parsing the original source title and if that fails, try parsing it as a special
// TODO: Pass the TVDB ID and TVRage IDs in as well so we have a better chance for finding the item
parsedEpisodeInfo = Parser.Parser.ParseTitle(firstHistoryItem.SourceTitle) ?? _parsingService.ParseSpecialEpisodeTitle(parsedEpisodeInfo, firstHistoryItem.SourceTitle, 0, 0);
parsedEpisodeInfo = Parser.Parser.ParseTitle(firstHistoryItem.SourceTitle) ??
_parsingService.ParseSpecialEpisodeTitle(parsedEpisodeInfo, firstHistoryItem.SourceTitle, 0, 0);
if (parsedEpisodeInfo != null)
{
trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, firstHistoryItem.SeriesId, historyItems.Where(v => v.EventType == EpisodeHistoryEventType.Grabbed).Select(h => h.EpisodeId).Distinct());
trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo,
firstHistoryItem.SeriesId,
historyItems.Where(v => v.EventType == EpisodeHistoryEventType.Grabbed)
.Select(h => h.EpisodeId).Distinct());
}
}
}
@ -162,10 +167,17 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
_logger.Trace("No Episode found for download '{0}'", trackedDownload.DownloadItem.Title);
}
}
catch (MultipleSeriesFoundException e)
{
_logger.Debug(e, "Found multiple series for " + downloadItem.Title);
trackedDownload.Warn("Unable to import automatically, found multiple series: {0}", string.Join(", ", e.Series));
}
catch (Exception e)
{
_logger.Debug(e, "Failed to find episode for " + downloadItem.Title);
return null;
trackedDownload.Warn("Unable to parse episodes from title");
}
LogItemChange(trackedDownload, existingItem?.DownloadItem, trackedDownload.DownloadItem);

View File

@ -334,6 +334,7 @@ private ManualImportItem ProcessFile(string rootFolder, string baseFolder, strin
Path = file,
RelativePath = rootFolder.GetRelativePath(file),
Name = Path.GetFileNameWithoutExtension(file),
Size = _diskProvider.GetFileSize(file),
Rejections = new List<Rejection>()
};
}

View File

@ -1,12 +1,16 @@
using NzbDrone.Common.Exceptions;
using System.Collections.Generic;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Tv
{
public class MultipleSeriesFoundException : NzbDroneException
{
public MultipleSeriesFoundException(string message, params object[] args)
public List<Series> Series { get; set; }
public MultipleSeriesFoundException(List<Series> series, string message, params object[] args)
: base(message, args)
{
Series = series;
}
}
}

View File

@ -103,7 +103,7 @@ private Series ReturnSingleSeriesOrThrow(List<Series> series)
return series.First();
}
throw new MultipleSeriesFoundException("Expected one series, but found {0}. Matching series: {1}", series.Count, string.Join(",", series));
throw new MultipleSeriesFoundException(series, "Expected one series, but found {0}. Matching series: {1}", series.Count, string.Join(", ", series));
}
}
}