Exemplo n.º 1
0
        public override IList <ImportListItemInfo> Fetch()
        {
            var result = new List <ImportListItemInfo>();

            try
            {
                var series = _seriesInfo.GetSeriesInfo(Settings.SeriesId);

                foreach (var work in series.Works)
                {
                    result.Add(new ImportListItemInfo
                    {
                        BookGoodreadsId    = work.Id.ToString(),
                        Book               = work.OriginalTitle,
                        EditionGoodreadsId = work.BestBook.Id.ToString(),
                        Author             = work.BestBook.AuthorName,
                        AuthorGoodreadsId  = work.BestBook.AuthorId.ToString()
                    });
                }

                _importListStatusService.RecordSuccess(Definition.Id);
            }
            catch
            {
                _importListStatusService.RecordFailure(Definition.Id);
            }

            return(CleanupListItems(result));
        }
Exemplo n.º 2
0
        private Series AddSkyhookData(Series newSeries)
        {
            Tuple <Series, List <Episode> > tuple;

            try
            {
                tuple = _seriesInfo.GetSeriesInfo(newSeries.TvdbId);
            }
            catch (SeriesNotFoundException)
            {
                _logger.Error("TVDB ID {0} was not found, it may have been removed from TheTVDB.  Path: {1}", newSeries.TvdbId, newSeries.Path);

                throw new ValidationException(new List <ValidationFailure>
                {
                    new ValidationFailure("TvdbId", $"A series with this ID was not found. Path: {newSeries.Path}", newSeries.TvdbId)
                });
            }

            var series = tuple.Item1;

            // If seasons were passed in on the new series use them, otherwise use the seasons from Skyhook
            newSeries.Seasons = newSeries.Seasons != null && newSeries.Seasons.Any() ? newSeries.Seasons : series.Seasons;

            series.ApplyChanges(newSeries);

            return(series);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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));
        }