コード例 #1
0
        /// <summary>
        /// Add a new language to the series
        /// </summary>
        /// <param name="_fields"></param>
        internal void AddLanguage(TvdbSeriesFields _fields)
        {
            if (m_seriesTranslations == null)
            {
                m_seriesTranslations = new Dictionary <TvdbLanguage, TvdbSeriesFields>();
            }

            if (m_seriesTranslations.Keys.Contains(_fields.Language))
            {//delete translation if it already exists and overwrite it with a new one
                m_seriesTranslations.Remove(_fields.Language);
            }

            m_seriesTranslations.Add(_fields.Language, _fields);
        }
コード例 #2
0
ファイル: TvdbSeries.cs プロジェクト: tanstaafl2014/tvdblib
        private void UpdateTvdbFields(TvdbSeriesFields _fields)
        {
            //Update series details
            this.Id            = _fields.Id;
            this.Actors        = _fields.Actors;
            this.AirsDayOfWeek = _fields.AirsDayOfWeek;
            this.AirsTime      = _fields.AirsTime;
            this.ContentRating = _fields.ContentRating;
            this.FirstAired    = _fields.FirstAired;
            this.Genre         = _fields.Genre;
            this.ImdbId        = _fields.ImdbId;
            this.Language      = _fields.Language;
            this.Network       = _fields.Network;
            this.Overview      = _fields.Overview;
            this.Rating        = _fields.Rating;
            this.Runtime       = _fields.Runtime;
            this.TvDotComId    = _fields.TvDotComId;
            this.SeriesName    = _fields.SeriesName;
            this.Status        = _fields.Status;
            this.BannerPath    = _fields.BannerPath;
            this.FanartPath    = _fields.FanartPath;
            this.LastUpdated   = _fields.LastUpdated;
            this.Zap2itId      = _fields.Zap2itId;

            if (_fields.Episodes != null)
            {
                this.EpisodesLoaded = _fields.EpisodesLoaded;
                if (this.Episodes != null && this.Episodes.Count > 0)
                {
                    //check for each episode if episode images have been loaded... if yes -> copy image
                    foreach (TvdbEpisode f in _fields.Episodes)
                    {
                        foreach (TvdbEpisode e in this.Episodes)
                        {
                            if (e.Id == f.Id && e.Banner != null && e.Banner.IsLoaded)
                            {
                                f.Banner = e.Banner;
                                break;
                            }
                        }
                    }
                }
                this.Episodes = _fields.Episodes;
            }
            else
            {
                this.EpisodesLoaded = false;
            }
        }
コード例 #3
0
ファイル: TvdbSeries.cs プロジェクト: tanstaafl2014/tvdblib
        /// <summary>
        /// Set the language of the series to one of the languages that have
        /// already been loaded
        /// </summary>
        /// <param name="_language">The new language for this series</param>
        /// <returns>true if success, false otherwise</returns>
        public bool SetLanguage(TvdbLanguage _language)
        {
            if (m_seriesTranslations.Keys.Contains(_language))
            {
                if (this.Language != null)
                {
                    if (m_seriesTranslations.Keys.Contains(this.Language))
                    {//the current language is not added to the dictionary -> add it
                        m_seriesTranslations.Remove(this.Language);
                    }


                    TvdbSeriesFields f = new TvdbSeriesFields();
                    f.Id             = this.Id;
                    f.Actors         = this.Actors;
                    f.AirsDayOfWeek  = this.AirsDayOfWeek;
                    f.AirsTime       = this.AirsTime;
                    f.ContentRating  = this.ContentRating;
                    f.FirstAired     = this.FirstAired;
                    f.Genre          = this.Genre;
                    f.ImdbId         = this.ImdbId;
                    f.Language       = this.Language;
                    f.Network        = this.Network;
                    f.Overview       = this.Overview;
                    f.Rating         = this.Rating;
                    f.Runtime        = this.Runtime;
                    f.TvDotComId     = this.TvDotComId;
                    f.SeriesName     = this.SeriesName;
                    f.Status         = this.Status;
                    f.BannerPath     = this.BannerPath;
                    f.FanartPath     = this.FanartPath;
                    f.LastUpdated    = this.LastUpdated;
                    f.Zap2itId       = this.Zap2itId;
                    f.Episodes       = this.Episodes;
                    f.EpisodesLoaded = this.EpisodesLoaded;

                    m_seriesTranslations.Add(this.Language, f);
                }
                this.UpdateTvdbFields(m_seriesTranslations[_language]);
                return(true);
            }
            else
            {//the translation hasn't been loaded yet
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// Set the language of the series to one of the languages that have
        /// already been loaded
        /// </summary>
        /// <param name="_language"></param>
        /// <returns></returns>
        public bool SetLanguage(TvdbLanguage _language)
        {
            if (m_seriesTranslations.Keys.Contains(_language))
            {
                if (!m_seriesTranslations.Keys.Contains(Language))
                {
                    TvdbSeriesFields f = new TvdbSeriesFields();
                    f.Id            = this.Id;
                    f.Actors        = this.Actors;
                    f.AirsDayOfWeek = this.AirsDayOfWeek;
                    f.AirsTime      = this.AirsTime;
                    f.ContentRating = this.ContentRating;
                    f.FirstAired    = this.FirstAired;
                    f.Genre         = this.Genre;
                    f.ImdbId        = this.ImdbId;
                    f.Language      = this.Language;
                    f.Network       = this.Network;
                    f.Overview      = this.Overview;
                    f.Rating        = this.Rating;
                    f.Runtime       = this.Runtime;
                    f.TvDotComId    = this.TvDotComId;
                    f.SeriesName    = this.SeriesName;
                    f.Status        = this.Status;
                    f.BannerPath    = this.BannerPath;
                    f.FanartPath    = this.FanartPath;
                    f.LastUpdated   = this.LastUpdated;
                    f.Zap2itId      = this.Zap2itId;
                }
                m_seriesTranslations[Language].Episodes = this.Episodes;

                this.UpdateTvdbFields(m_seriesTranslations[_language]);
                return(true);
            }
            else
            {//the translation hasn't been loaded yet
                return(false);
            }
        }
コード例 #5
0
 /// <summary>
 /// Create a series object with all the information contained in the TvdbSeriesFields object
 /// </summary>
 /// <param name="_fields"></param>
 internal TvdbSeries(TvdbSeriesFields _fields)
     : this()
 {
     AddLanguage(_fields);
     UpdateTvdbFields(_fields);
 }
コード例 #6
0
ファイル: TvdbSeries.cs プロジェクト: svn2github/tvdblib
 /// <summary>
 /// Create a series object with all the information contained in the TvdbSeriesFields object
 /// </summary>
 /// <param name="_fields"></param>
 internal TvdbSeries(TvdbSeriesFields _fields)
     : this()
 {
     AddLanguage(_fields);
       UpdateTvdbFields(_fields);
 }
コード例 #7
0
ファイル: TvdbSeries.cs プロジェクト: svn2github/tvdblib
        private void UpdateTvdbFields(TvdbSeriesFields _fields)
        {
            //Update series details
              this.Id = _fields.Id;
              this.Actors = _fields.Actors;
              this.AirsDayOfWeek = _fields.AirsDayOfWeek;
              this.AirsTime = _fields.AirsTime;
              this.ContentRating = _fields.ContentRating;
              this.FirstAired = _fields.FirstAired;
              this.Genre = _fields.Genre;
              this.ImdbId = _fields.ImdbId;
              this.Language = _fields.Language;
              this.Network = _fields.Network;
              this.Overview = _fields.Overview;
              this.Rating = _fields.Rating;
              this.Runtime = _fields.Runtime;
              this.TvDotComId = _fields.TvDotComId;
              this.SeriesName = _fields.SeriesName;
              this.Status = _fields.Status;
              this.BannerPath = _fields.BannerPath;
              this.FanartPath = _fields.FanartPath;
              this.LastUpdated = _fields.LastUpdated;
              this.Zap2itId = _fields.Zap2itId;

              if (_fields.Episodes != null)
              {
            this.EpisodesLoaded = true;
            //check for each episode if episode images have been loaded... if yes -> copy image
            foreach (TvdbEpisode f in _fields.Episodes)
            {
              foreach (TvdbEpisode e in m_episodes)
              {
            if (e.Id == f.Id && e.Banner != null && e.Banner.IsLoaded)
            {
              f.Banner = e.Banner;
              break;
            }
              }
            }
            m_episodes = _fields.Episodes;
              }
              else
              {
            this.EpisodesLoaded = false;
              }
        }
コード例 #8
0
ファイル: TvdbSeries.cs プロジェクト: svn2github/tvdblib
        /// <summary>
        /// Add a new language to the series
        /// </summary>
        /// <param name="_fields"></param>
        internal void AddLanguage(TvdbSeriesFields _fields)
        {
            if (m_seriesTranslations == null)
              {
            m_seriesTranslations = new Dictionary<TvdbLanguage, TvdbSeriesFields>();
              }

              if (m_seriesTranslations.Keys.Contains(_fields.Language))
              {//delete translation if it already exists and overwrite it with a new one
            m_seriesTranslations.Remove(_fields.Language);
              }

              m_seriesTranslations.Add(_fields.Language, _fields);
        }
コード例 #9
0
ファイル: TvdbSeries.cs プロジェクト: svn2github/tvdblib
        /// <summary>
        /// Set the language of the series to one of the languages that have
        /// already been loaded
        /// </summary>
        /// <param name="_language"></param>
        /// <returns></returns>
        public bool SetLanguage(TvdbLanguage _language)
        {
            if (m_seriesTranslations.Keys.Contains(_language))
              {
            if (!m_seriesTranslations.Keys.Contains(Language))
            {
              TvdbSeriesFields f = new TvdbSeriesFields();
              f.Id = this.Id;
              f.Actors = this.Actors;
              f.AirsDayOfWeek = this.AirsDayOfWeek;
              f.AirsTime = this.AirsTime;
              f.ContentRating = this.ContentRating;
              f.FirstAired = this.FirstAired;
              f.Genre = this.Genre;
              f.ImdbId = this.ImdbId;
              f.Language = this.Language;
              f.Network = this.Network;
              f.Overview = this.Overview;
              f.Rating = this.Rating;
              f.Runtime = this.Runtime;
              f.TvDotComId = this.TvDotComId;
              f.SeriesName = this.SeriesName;
              f.Status = this.Status;
              f.BannerPath = this.BannerPath;
              f.FanartPath = this.FanartPath;
              f.LastUpdated = this.LastUpdated;
              f.Zap2itId = this.Zap2itId;
            }
            m_seriesTranslations[Language].Episodes = this.Episodes;

            this.UpdateTvdbFields(m_seriesTranslations[_language]);
            return true;
              }
              else
              {//the translation hasn't been loaded yet
            return false;
              }
        }
コード例 #10
0
ファイル: TvdbSeries.cs プロジェクト: svn2github/tvdblib
        /// <summary>
        /// Set the language of the series to one of the languages that have
        /// already been loaded
        /// </summary>
        /// <param name="_language">The new language for this series</param>
        /// <returns>true if success, false otherwise</returns>
        public bool SetLanguage(TvdbLanguage _language)
        {
            if (m_seriesTranslations.Keys.Contains(_language))
              {
            if (this.Language != null)
            {
              if (m_seriesTranslations.Keys.Contains(this.Language))
              {//the current language is not added to the dictionary -> add it
            m_seriesTranslations.Remove(this.Language);
              }

              TvdbSeriesFields f = new TvdbSeriesFields();
              f.Id = this.Id;
              f.Actors = this.Actors;
              f.AirsDayOfWeek = this.AirsDayOfWeek;
              f.AirsTime = this.AirsTime;
              f.ContentRating = this.ContentRating;
              f.FirstAired = this.FirstAired;
              f.Genre = this.Genre;
              f.ImdbId = this.ImdbId;
              f.Language = this.Language;
              f.Network = this.Network;
              f.Overview = this.Overview;
              f.Rating = this.Rating;
              f.Runtime = this.Runtime;
              f.TvDotComId = this.TvDotComId;
              f.SeriesName = this.SeriesName;
              f.Status = this.Status;
              f.BannerPath = this.BannerPath;
              f.FanartPath = this.FanartPath;
              f.LastUpdated = this.LastUpdated;
              f.Zap2itId = this.Zap2itId;
              f.Episodes = this.Episodes;
              f.EpisodesLoaded = this.EpisodesLoaded;

              m_seriesTranslations.Add(this.Language, f);
            }
            this.UpdateTvdbFields(m_seriesTranslations[_language]);
            return true;
              }
              else
              {//the translation hasn't been loaded yet
            return false;
              }
        }