Fixed: Queue not showing items with conflicting titles

pull/5297/head
Mark McDowall 2 years ago
parent 530829f8ed
commit 789a8f5301

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
@ -113,24 +113,26 @@ namespace NzbDrone.Core.Download.TrackedDownloads
private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem) private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem)
{ {
TrackedDownload trackedDownload = null;
try try
{ {
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem); trackedDownload =
_trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition,
downloadItem);
if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading) if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading)
{ {
_failedDownloadService.Check(trackedDownload); _failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload); _completedDownloadService.Check(trackedDownload);
} }
return trackedDownload;
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title); _logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title);
} }
return null; return trackedDownload;
} }
private bool DownloadIsTrackable(TrackedDownload trackedDownload) private bool DownloadIsTrackable(TrackedDownload trackedDownload)

@ -10,6 +10,7 @@ using NzbDrone.Core.Download.History;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events; using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Download.TrackedDownloads namespace NzbDrone.Core.Download.TrackedDownloads
@ -141,11 +142,15 @@ namespace NzbDrone.Core.Download.TrackedDownloads
{ {
// Try parsing the original source title and if that fails, try parsing it as a special // 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 // 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) 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 @@ namespace NzbDrone.Core.Download.TrackedDownloads
_logger.Trace("No Episode found for download '{0}'", trackedDownload.DownloadItem.Title); _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) catch (Exception e)
{ {
_logger.Debug(e, "Failed to find episode for " + downloadItem.Title); _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); LogItemChange(trackedDownload, existingItem?.DownloadItem, trackedDownload.DownloadItem);

@ -334,6 +334,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
Path = file, Path = file,
RelativePath = rootFolder.GetRelativePath(file), RelativePath = rootFolder.GetRelativePath(file),
Name = Path.GetFileNameWithoutExtension(file), Name = Path.GetFileNameWithoutExtension(file),
Size = _diskProvider.GetFileSize(file),
Rejections = new List<Rejection>() Rejections = new List<Rejection>()
}; };
} }

@ -1,12 +1,16 @@
using NzbDrone.Common.Exceptions; using System.Collections.Generic;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Tv namespace NzbDrone.Core.Tv
{ {
public class MultipleSeriesFoundException : NzbDroneException 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) : base(message, args)
{ {
Series = series;
} }
} }
} }

@ -103,7 +103,7 @@ namespace NzbDrone.Core.Tv
return series.First(); 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));
} }
} }
} }

Loading…
Cancel
Save