/// <summary>
        /// Handles the DoWork event of the bgwScan control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.
        /// </param>
        private void BgwScan_DoWork(object sender, DoWorkEventArgs e)
        {
            var tvdb = new TheTvdb();
            int count = 0;

            foreach (UpdateTvRecords series in this.updateDatabase)
            {
                this.bgwScan.ReportProgress(0, series.SeriesName);

                Series seriesObj = TvDBFactory.GetSeriesFromName(series.SeriesName);

                Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated);

                if (newSeries != null)
                {
                    series.NewTime = newSeries.Lastupdated;
                    count++;
                }
            }

            e.Result = count;
        }
Exemple #2
0
        /// <summary>
        /// Handles the DoWork event of the bgwScan control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.
        /// </param>
        private void BgwScan_DoWork(object sender, DoWorkEventArgs e)
        {
            var tvdb = new TheTvdb();
            int count = 0;

            foreach (UpdateTvRecords record in this.updateDatabase)
            {
                InternalApps.Logs.Log.WriteToLog(
                            LogSeverity.Debug,
                            0,
                            "UI > Dialogs > TV > FrmUpdateShows > BgwScan_DoWork",
                            string.Format(
                                "Checking {0} {1}x{2:00} for update",
                                record.SeriesName, record.SeasonNumber.GetValueOrDefault(0), record.EpisodeNumber.GetValueOrDefault(0)
                            )
                );

                this.bgwScan.ReportProgress(0, record);

                Series seriesObj = TvDBFactory.GetSeriesFromName(record.SeriesName);

                Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated);

                if (newSeries != null)
                {
                    InternalApps.Logs.Log.WriteToLog(
                                LogSeverity.Debug,
                                0,
                                "UI > Dialogs > TV > FrmUpdateShows > BgwScan_DoWork",
                                string.Format(
                                    "Update found for {0} {1}x{2:00}",
                                    record.SeriesName, record.SeasonNumber.GetValueOrDefault(0), record.EpisodeNumber.GetValueOrDefault(0)
                                )
                    );

                    record.NewTime = newSeries.Lastupdated;
                    count++;
                }
            }

            e.Result = count;
        }
Exemple #3
0
        /// <summary>
        /// Update series from TvDB database.
        /// </summary>
        /// <param name="seriesId">
        /// The series id.
        /// </param>
        public static void UpdateSeries(uint? seriesId)
        {
            Series seriesObj = GetSeriesFromSeriesId(seriesId);

            var tvdb = new TheTvdb();

            Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated);

            if (!seriesObj.IsLocked)
            {
                seriesObj.Added = newSeries.Added;
                seriesObj.AddedBy = newSeries.AddedBy;
                seriesObj.AirsDayOfWeek = newSeries.AirsDayOfWeek;
                seriesObj.AirsTime = newSeries.AirsTime;
                seriesObj.ContentRating = newSeries.ContentRating;
                seriesObj.Country = newSeries.Country;
                seriesObj.Genre = newSeries.Genre;
                seriesObj.ImdbId = newSeries.ImdbId;
                seriesObj.Language = newSeries.ImdbId;
                seriesObj.Lastupdated = newSeries.Lastupdated;
                seriesObj.Network = newSeries.Lastupdated;
                seriesObj.NetworkID = newSeries.NetworkID;
                seriesObj.Overview = newSeries.Overview;
                seriesObj.Rating = newSeries.Rating;
                seriesObj.Runtime = newSeries.Runtime;
                seriesObj.SeriesName = newSeries.SeriesName;
                seriesObj.Status = newSeries.Status;
                seriesObj.Zap2It_Id = newSeries.Zap2It_Id;

                if (string.IsNullOrEmpty(seriesObj.SeriesBannerPath) && string.IsNullOrEmpty(seriesObj.SeriesBannerUrl))
                {
                    seriesObj.SeriesBannerUrl = newSeries.SeriesBannerUrl;
                }

                if (string.IsNullOrEmpty(seriesObj.PosterUrl) && string.IsNullOrEmpty(seriesObj.PosterPath))
                {
                    seriesObj.PosterUrl = newSeries.PosterUrl;
                }

                if (string.IsNullOrEmpty(seriesObj.FanartUrl) && string.IsNullOrEmpty(seriesObj.FanartPath))
                {
                    seriesObj.FanartUrl = newSeries.FanartUrl;
                }
            }

            foreach (var season in newSeries.Seasons)
            {
                UpdateSeason(seriesObj, season.Value);
            }
        }
Exemple #4
0
        /// <summary>
        /// Update series from TvDB database.
        /// </summary>
        /// <param name="seriesId">
        /// The series id.
        /// </param>
        public static void UpdateSeries(uint? seriesId, int? seasonNumber = null, int? episodeNumber = null)
        {
            Series seriesObj = GetSeriesFromSeriesId(seriesId);

            InternalApps.Logs.Log.WriteToLog(
                        LogSeverity.Debug,
                        0,
                        "Factories > TvDBFactory > UpdateSeries",
                        string.Format(
                            "Called with seriesId {0}({1}), seasonNumber {2}, episodeNumber {3}",
                            seriesId.GetValueOrDefault(0), seriesObj.SeriesName, seasonNumber.GetValueOrDefault(0), episodeNumber.GetValueOrDefault(0)
                        )
            );

            var tvdb = new TheTvdb();

            Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated, true);

            if (!seriesObj.IsLocked && seasonNumber == null && episodeNumber == null)
            {
                seriesObj.Added = newSeries.Added;
                seriesObj.AddedBy = newSeries.AddedBy;
                seriesObj.AirsDayOfWeek = newSeries.AirsDayOfWeek;
                seriesObj.AirsTime = newSeries.AirsTime;
                seriesObj.ContentRating = newSeries.ContentRating;
                seriesObj.Country = newSeries.Country;
                seriesObj.Genre = newSeries.Genre;
                seriesObj.ImdbId = newSeries.ImdbId;
                seriesObj.Language = newSeries.ImdbId;
                seriesObj.Lastupdated = newSeries.Lastupdated;
                seriesObj.Network = newSeries.Lastupdated;
                seriesObj.NetworkID = newSeries.NetworkID;
                seriesObj.Overview = newSeries.Overview;
                seriesObj.Rating = newSeries.Rating;
                seriesObj.Runtime = newSeries.Runtime;
                seriesObj.SeriesName = newSeries.SeriesName;
                seriesObj.Status = newSeries.Status;
                seriesObj.Zap2It_Id = newSeries.Zap2It_Id;

                if (string.IsNullOrEmpty(seriesObj.SeriesBannerPath) && string.IsNullOrEmpty(seriesObj.SeriesBannerUrl))
                {
                    seriesObj.SeriesBannerUrl = newSeries.SeriesBannerUrl;
                }

                if (string.IsNullOrEmpty(seriesObj.PosterUrl) && string.IsNullOrEmpty(seriesObj.PosterPath))
                {
                    seriesObj.PosterUrl = newSeries.PosterUrl;
                }

                if (string.IsNullOrEmpty(seriesObj.FanartUrl) && string.IsNullOrEmpty(seriesObj.FanartPath))
                {
                    seriesObj.FanartUrl = newSeries.FanartUrl;
                }
            }

            foreach (var season in newSeries.Seasons)
            {
                if (seasonNumber == null)
                {
                    UpdateSeason(seriesObj, season.Value, episodeNumber);
                }
                else if (season.Value.SeasonNumber == seasonNumber)
                {
                    UpdateSeason(seriesObj, season.Value, episodeNumber, true);
                }
            }
        }