this should fix some more tests.

This commit is contained in:
Keivan Beigi 2013-02-22 15:55:43 -08:00
parent 85fd4248a6
commit d722a8357b
12 changed files with 22 additions and 19 deletions

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public TestSearch(ISeriesService seriesService, IEpisodeService episodeService, DownloadProvider downloadProvider, public TestSearch(ISeriesService seriesService, IEpisodeService episodeService, DownloadProvider downloadProvider,
IndexerService indexerService, SceneMappingProvider sceneMappingProvider, IIndexerService indexerService, SceneMappingProvider sceneMappingProvider,
AllowedDownloadSpecification allowedDownloadSpecification, SearchHistoryProvider searchHistoryProvider,ISeriesRepository seriesRepository) AllowedDownloadSpecification allowedDownloadSpecification, SearchHistoryProvider searchHistoryProvider,ISeriesRepository seriesRepository)
: base(seriesService, seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingProvider, : base(seriesService, seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingProvider,
allowedDownloadSpecification, searchHistoryProvider) allowedDownloadSpecification, searchHistoryProvider)

View File

@ -47,7 +47,7 @@ namespace NzbDrone.Core.Jobs
if (options != null) if (options != null)
{ {
Series series = _seriesRepository.Get(options.SeriesId); Series series = _seriesRepository.Get((int)options.SeriesId);
if (series != null && !String.IsNullOrEmpty(series.BannerUrl)) if (series != null && !String.IsNullOrEmpty(series.BannerUrl))
{ {

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Jobs
if (options == null || options.EpisodeId <= 0) if (options == null || options.EpisodeId <= 0)
throw new ArgumentNullException(options); throw new ArgumentNullException(options);
Episode episode = _episodeService.GetEpisode(options.EpisodeId); Episode episode = _episodeService.GetEpisode((int)options.EpisodeId);
notification.CurrentMessage = String.Format("Starting Conversion for {0}", episode); notification.CurrentMessage = String.Format("Starting Conversion for {0}", episode);
var outputFile = _handbrakeProvider.ConvertFile(episode, notification); var outputFile = _handbrakeProvider.ConvertFile(episode, notification);

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Jobs
if (options.SeriesId == 0) if (options.SeriesId == 0)
throw new ArgumentNullException("options.SeriesId"); throw new ArgumentNullException("options.SeriesId");
DeleteSeries(notification, options.SeriesId, options.DeleteFiles); DeleteSeries(notification, (int)options.SeriesId, (bool)options.DeleteFiles);
} }
private void DeleteSeries(ProgressNotification notification, int seriesId, bool deleteFiles) private void DeleteSeries(ProgressNotification notification, int seriesId, bool deleteFiles)

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Core.Jobs
} }
else else
{ {
seriesToScan = new List<Series>() { _seriesRepository.Get(options.SeriesId) }; seriesToScan = new List<Series>() { _seriesRepository.Get((int)options.SeriesId) };
} }
foreach (var series in seriesToScan) foreach (var series in seriesToScan)

View File

@ -49,7 +49,7 @@ namespace NzbDrone.Core.Jobs
if (options == null || options.EpisodeId <= 0) if (options == null || options.EpisodeId <= 0)
throw new ArgumentException("options"); throw new ArgumentException("options");
Episode episode = _episodeService.GetEpisode(options.EpisodeId); Episode episode = _episodeService.GetEpisode((int)options.EpisodeId);
if (episode == null) if (episode == null)
{ {

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Jobs
public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider, public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
ExternalNotificationProvider externalNotificationProvider, ISeriesService seriesService, ExternalNotificationProvider externalNotificationProvider, ISeriesService seriesService,
MetadataProvider metadataProvider,ISeriesRepository seriesRepository) MetadataProvider metadataProvider, ISeriesRepository seriesRepository)
{ {
_mediaFileProvider = mediaFileProvider; _mediaFileProvider = mediaFileProvider;
_diskScanProvider = diskScanProvider; _diskScanProvider = diskScanProvider;
@ -49,12 +49,12 @@ namespace NzbDrone.Core.Jobs
if (options.SeasonNumber < 0) if (options.SeasonNumber < 0)
throw new ArgumentException("options.SeasonNumber"); throw new ArgumentException("options.SeasonNumber");
var series = _seriesRepository.Get(options.SeriesId); var series = _seriesRepository.Get((int)options.SeriesId);
notification.CurrentMessage = String.Format("Renaming episodes for {0} Season {1}", series.Title, options.SeasonNumber); notification.CurrentMessage = String.Format("Renaming episodes for {0} Season {1}", series.Title, options.SeasonNumber);
logger.Debug("Getting episodes from database for series: {0} and season: {1}", options.SeriesId, options.SeasonNumber); logger.Debug("Getting episodes from database for series: {0} and season: {1}", options.SeriesId, options.SeasonNumber);
IList<EpisodeFile> episodeFiles = _mediaFileProvider.GetSeasonFiles(options.SeriesId, options.SeasonNumber); IList<EpisodeFile> episodeFiles = _mediaFileProvider.GetSeasonFiles((int)options.SeriesId, (int)options.SeasonNumber);
if (episodeFiles == null || !episodeFiles.Any()) if (episodeFiles == null || !episodeFiles.Any())
{ {
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Jobs
} }
} }
if(!oldEpisodeFiles.Any()) if (!oldEpisodeFiles.Any())
{ {
logger.Trace("No episodes were renamed for: {0} Season {1}, no changes were made", series.Title, logger.Trace("No episodes were renamed for: {0} Season {1}, no changes were made", series.Title,
options.SeasonNumber); options.SeasonNumber);

View File

@ -53,7 +53,7 @@ namespace NzbDrone.Core.Jobs
else else
{ {
seriesToRename = new List<Series>{ _seriesRepository.Get(options.SeriesId) }; seriesToRename = new List<Series>{ _seriesRepository.Get((int)options.SeriesId) };
} }
foreach(var series in seriesToRename) foreach(var series in seriesToRename)

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Core.Jobs
// return; // return;
Logger.Debug("Getting episodes from database for series: {0} and season: {1}", options.SeriesId, options.SeasonNumber); Logger.Debug("Getting episodes from database for series: {0} and season: {1}", options.SeriesId, options.SeasonNumber);
List<Episode> episodes = _episodeService.GetEpisodesBySeason(options.SeriesId, options.SeasonNumber); IList<Episode> episodes = _episodeService.GetEpisodesBySeason((int)options.SeriesId, (int)options.SeasonNumber);
if (episodes == null || episodes.Count == 0) if (episodes == null || episodes.Count == 0)
{ {

View File

@ -38,11 +38,11 @@ namespace NzbDrone.Core.Jobs
throw new ArgumentException("options.SeriesId"); throw new ArgumentException("options.SeriesId");
logger.Debug("Getting seasons from database for series: {0}", options.SeriesId); logger.Debug("Getting seasons from database for series: {0}", options.SeriesId);
IList<int> seasons = _seasonRepository.GetSeasonBySeries(options.SeriesId); IList<int> seasons = _seasonRepository.GetSeasonNumbers((int)options.SeriesId);
foreach (var season in seasons.Where(s => s > 0)) foreach (var season in seasons.Where(s => s > 0))
{ {
if (!_seasonRepository.IsIgnored(options.SeriesId, season)) if (!_seasonRepository.IsIgnored((int)options.SeriesId, season))
{ {
_seasonSearchJob.Start(notification, new { SeriesId = options.SeriesId, SeasonNumber = season }); _seasonSearchJob.Start(notification, new { SeriesId = options.SeriesId, SeasonNumber = season });
} }

View File

@ -58,7 +58,10 @@ namespace NzbDrone.Core.Jobs
} }
else else
{ {
seriesToUpdate = new List<Series> { _seriesRepository.Get(options.SeriesId) }; seriesToUpdate = new List<Series>
{
_seriesRepository.Get((int)options.SeriesId)
};
} }
//Update any Daily Series in the DB with the IsDaily flag //Update any Daily Series in the DB with the IsDaily flag
@ -74,11 +77,11 @@ namespace NzbDrone.Core.Jobs
notification.CurrentMessage = "Update completed for " + series.Title; notification.CurrentMessage = "Update completed for " + series.Title;
} }
catch(Exception ex) catch (Exception ex)
{ {
Logger.ErrorException("Failed to update episode info for series: " + series.Title, ex); Logger.ErrorException("Failed to update episode info for series: " + series.Title, ex);
} }
} }
} }
} }

View File

@ -46,9 +46,9 @@ namespace NzbDrone.Core.Jobs
else else
{ {
_logger.Trace("Starting XEM Update for series: {0}", options.SeriesId); _logger.Trace("Starting XEM Update for series: {0}", options.SeriesId);
_xemProvider.UpdateMappings(options.SeriesId); _xemProvider.UpdateMappings((int)options.SeriesId);
} }
_logger.Trace("XEM Update complete"); _logger.Trace("XEM Update complete");
} }
} }