@ -47,8 +47,12 @@ namespace NzbDrone.Core.Tv
_logger = logger ;
_logger = logger ;
}
}
private void RefreshSeriesInfo ( Series series )
private Series RefreshSeriesInfo ( int seriesId )
{
{
// Get the series before updating, that way any changes made to the series after the refresh started,
// but before this series was refreshed won't be lost.
var series = _seriesService . GetSeries ( seriesId ) ;
_logger . ProgressInfo ( "Updating {0}" , series . Title ) ;
_logger . ProgressInfo ( "Updating {0}" , series . Title ) ;
Series seriesInfo ;
Series seriesInfo ;
@ -115,6 +119,8 @@ namespace NzbDrone.Core.Tv
_logger . Debug ( "Finished series refresh for {0}" , series . Title ) ;
_logger . Debug ( "Finished series refresh for {0}" , series . Title ) ;
_eventAggregator . PublishEvent ( new SeriesUpdatedEvent ( series ) ) ;
_eventAggregator . PublishEvent ( new SeriesUpdatedEvent ( series ) ) ;
return series ;
}
}
private List < Season > UpdateSeasons ( Series series , Series seriesInfo )
private List < Season > UpdateSeasons ( Series series , Series seriesInfo )
@ -196,7 +202,7 @@ namespace NzbDrone.Core.Tv
try
try
{
{
RefreshSeriesInfo( series) ;
series = RefreshSeriesInfo( mes sage. S eriesId. Value ) ;
RescanSeries ( series , isNew , trigger ) ;
RescanSeries ( series , isNew , trigger ) ;
}
}
catch ( SeriesNotFoundException )
catch ( SeriesNotFoundException )
@ -216,29 +222,30 @@ namespace NzbDrone.Core.Tv
foreach ( var series in allSeries )
foreach ( var series in allSeries )
{
{
if ( trigger = = CommandTrigger . Manual | | _checkIfSeriesShouldBeRefreshed . ShouldRefresh ( series ) )
var seriesLocal = series ;
if ( trigger = = CommandTrigger . Manual | | _checkIfSeriesShouldBeRefreshed . ShouldRefresh ( seriesLocal ) )
{
{
try
try
{
{
RefreshSeriesInfo( series ) ;
seriesLocal = RefreshSeriesInfo( series Local. Id ) ;
}
}
catch ( SeriesNotFoundException )
catch ( SeriesNotFoundException )
{
{
_logger . Error ( "Series '{0}' (tvdbid {1}) was not found, it may have been removed from TheTVDB." , series . Title , series . TvdbId ) ;
_logger . Error ( "Series '{0}' (tvdbid {1}) was not found, it may have been removed from TheTVDB." , series Local . Title , series Local . TvdbId ) ;
continue ;
continue ;
}
}
catch ( Exception e )
catch ( Exception e )
{
{
_logger . Error ( e , "Couldn't refresh info for {0}" , series ) ;
_logger . Error ( e , "Couldn't refresh info for {0}" , series Local ) ;
}
}
RescanSeries ( series , false , trigger ) ;
RescanSeries ( series Local , false , trigger ) ;
}
}
else
else
{
{
_logger . Info ( "Skipping refresh of series: {0}" , series . Title ) ;
_logger . Info ( "Skipping refresh of series: {0}" , series Local . Title ) ;
RescanSeries ( series , false , trigger ) ;
RescanSeries ( series Local , false , trigger ) ;
}
}
}
}
}
}