Esempio n. 1
0
        private void RefreshSeriesInfo(Series series)
        {
            _logger.ProgressInfo("Updating Info for {0}", series.Title);
            var tuple = _seriesInfo.GetSeriesInfo(series.TvdbId);

            var seriesInfo = tuple.Item1;

            series.Title         = seriesInfo.Title;
            series.TitleSlug     = seriesInfo.TitleSlug;
            series.TvRageId      = seriesInfo.TvRageId;
            series.ImdbId        = seriesInfo.ImdbId;
            series.AirTime       = seriesInfo.AirTime;
            series.Overview      = seriesInfo.Overview;
            series.Status        = seriesInfo.Status;
            series.CleanTitle    = seriesInfo.CleanTitle;
            series.SortTitle     = seriesInfo.SortTitle;
            series.LastInfoSync  = DateTime.UtcNow;
            series.Runtime       = seriesInfo.Runtime;
            series.Images        = seriesInfo.Images;
            series.Network       = seriesInfo.Network;
            series.FirstAired    = seriesInfo.FirstAired;
            series.Ratings       = seriesInfo.Ratings;
            series.Actors        = seriesInfo.Actors;
            series.Genres        = seriesInfo.Genres;
            series.Certification = seriesInfo.Certification;

            if (_dailySeriesService.IsDailySeries(series.TvdbId))
            {
                series.SeriesType = SeriesTypes.Daily;
            }

            try
            {
                series.Path = new DirectoryInfo(series.Path).FullName;
                series.Path = series.Path.GetActualCasing();
            }
            catch (Exception e)
            {
                _logger.WarnException("Couldn't update series path for " + series.Path, e);
            }

            series.Seasons = UpdateSeasons(series, seriesInfo);

            _seriesService.UpdateSeries(series);
            _refreshEpisodeService.RefreshEpisodeInfo(series, tuple.Item2);

            _logger.Debug("Finished series refresh for {0}", series.Title);
            _eventAggregator.PublishEvent(new SeriesUpdatedEvent(series));
        }
Esempio n. 2
0
        private void RefreshSeriesInfo(Series series)
        {
            _logger.ProgressInfo("Updating {0}", series.Title);

            Series         seriesInfo;
            List <Episode> episodes;

            try
            {
                var tuple = _seriesInfo.GetSeriesInfo(series.TvdbId);
                seriesInfo = tuple.Item1;
                episodes   = tuple.Item2;
            }
            catch (SeriesNotFoundException)
            {
                if (series.Status != SeriesStatusType.Deleted)
                {
                    series.Status = SeriesStatusType.Deleted;
                    _seriesService.UpdateSeries(series);
                    _logger.Debug("Series marked as deleted on tvdb for {0}", series.Title);
                    _eventAggregator.PublishEvent(new SeriesUpdatedEvent(series));
                }
                throw;
            }

            if (series.TvdbId != seriesInfo.TvdbId)
            {
                _logger.Warn("Series '{0}' (tvdbid {1}) was replaced with '{2}' (tvdbid {3}), because the original was a duplicate.", series.Title, series.TvdbId, seriesInfo.Title, seriesInfo.TvdbId);
                series.TvdbId = seriesInfo.TvdbId;
            }

            series.Title         = seriesInfo.Title;
            series.TitleSlug     = seriesInfo.TitleSlug;
            series.TvRageId      = seriesInfo.TvRageId;
            series.TvMazeId      = seriesInfo.TvMazeId;
            series.ImdbId        = seriesInfo.ImdbId;
            series.AirTime       = seriesInfo.AirTime;
            series.Overview      = seriesInfo.Overview;
            series.Status        = seriesInfo.Status;
            series.CleanTitle    = seriesInfo.CleanTitle;
            series.SortTitle     = seriesInfo.SortTitle;
            series.LastInfoSync  = DateTime.UtcNow;
            series.Runtime       = seriesInfo.Runtime;
            series.Images        = seriesInfo.Images;
            series.Network       = seriesInfo.Network;
            series.FirstAired    = seriesInfo.FirstAired;
            series.Ratings       = seriesInfo.Ratings;
            series.Actors        = seriesInfo.Actors;
            series.Genres        = seriesInfo.Genres;
            series.Certification = seriesInfo.Certification;

            if (_dailySeriesService.IsDailySeries(series.TvdbId))
            {
                series.SeriesType = SeriesTypes.Daily;
            }

            try
            {
                series.Path = new DirectoryInfo(series.Path).FullName;
                series.Path = series.Path.GetActualCasing();
            }
            catch (Exception e)
            {
                _logger.Warn(e, "Couldn't update series path for " + series.Path);
            }

            series.Seasons = UpdateSeasons(series, seriesInfo);

            _seriesService.UpdateSeries(series);
            _refreshEpisodeService.RefreshEpisodeInfo(series, episodes);

            _logger.Debug("Finished series refresh for {0}", series.Title);
            _eventAggregator.PublishEvent(new SeriesUpdatedEvent(series));
        }
Esempio n. 3
0
        private void RefreshSeriesInfo(Series series)
        {
            _logger.ProgressInfo("Updating Info for {0}", series.Title);

            Tuple <Series, List <Episode> > tuple;

            try
            {
                tuple = _seriesInfo.GetSeriesInfo(series.TvdbId);
            }
            catch (SeriesNotFoundException)
            {
                _logger.Error("Series '{0}' (tvdbid {1}) was not found, it may have been removed from TheTVDB.", series.Title, series.TvdbId);
                return;
            }

            var seriesInfo = tuple.Item1;

            if (series.TvdbId != seriesInfo.TvdbId)
            {
                _logger.Warn("Series '{0}' (tvdbid {1}) was replaced with '{2}' (tvdbid {3}), because the original was a duplicate.", series.Title, series.TvdbId, seriesInfo.Title, seriesInfo.TvdbId);
                series.TvdbId = seriesInfo.TvdbId;
            }

            series.Title         = seriesInfo.Title;
            series.TitleSlug     = seriesInfo.TitleSlug;
            series.TvRageId      = seriesInfo.TvRageId;
            series.TvMazeId      = seriesInfo.TvMazeId;
            series.ImdbId        = seriesInfo.ImdbId;
            series.AirTime       = seriesInfo.AirTime;
            series.Overview      = seriesInfo.Overview;
            series.Status        = seriesInfo.Status;
            series.CleanTitle    = seriesInfo.CleanTitle;
            series.SortTitle     = seriesInfo.SortTitle;
            series.LastInfoSync  = DateTime.UtcNow;
            series.Runtime       = seriesInfo.Runtime;
            series.Images        = seriesInfo.Images;
            series.Network       = seriesInfo.Network;
            series.FirstAired    = seriesInfo.FirstAired;
            series.Ratings       = seriesInfo.Ratings;
            series.Actors        = seriesInfo.Actors;
            series.Genres        = seriesInfo.Genres;
            series.Certification = seriesInfo.Certification;

            if (_dailySeriesService.IsDailySeries(series.TvdbId))
            {
                series.SeriesType = SeriesTypes.Daily;
            }

            try
            {
                series.Path = new DirectoryInfo(series.Path).FullName;
                series.Path = series.Path.GetActualCasing();
            }
            catch (Exception e)
            {
                _logger.WarnException("Couldn't update series path for " + series.Path, e);
            }

            series.Seasons = UpdateSeasons(series, seriesInfo);

            _seriesService.UpdateSeries(series);
            _refreshEpisodeService.RefreshEpisodeInfo(series, tuple.Item2);

            _logger.Debug("Finished series refresh for {0}", series.Title);
            _eventAggregator.PublishEvent(new SeriesUpdatedEvent(series));
        }