Exemple #1
0
        private void FillSeriesDetails(TvdbSeries series)
        {
            if (m_tvdbHandler.UserInfo != null)
            {
                cmdAddRemoveFavorites.Enabled = true;
                cmdAddRemoveFavorites.Text    = series.IsFavorite ? "Remove from favorites" : "Add to favorites";
                cmdSendSeriesRating.Enabled   = true;
                raterSeriesYourRating.Enabled = true;
            }
            else
            {
                cmdAddRemoveFavorites.Enabled = false;
                cmdSendSeriesRating.Enabled   = false;
                raterSeriesYourRating.Enabled = false;
            }

            List <TvdbBanner> bannerlist = new List <TvdbBanner>();

            foreach (TvdbBanner b in series.Banners)
            {
                if (b.GetType() == typeof(TvdbSeriesBanner))
                {
                    //if (b.Language.Id == m_defaultLang.Id)
                    {
                        bannerlist.Add(b);
                    }
                }
            }

            if (bannerlist.Count > 0)
            {
                bcSeriesBanner.BannerImages = bannerlist;
            }
            else
            {
                bcSeriesBanner.ClearControl();
            }

            txtSeriesId.Text   = series.Id.ToString();
            txtSeriesName.Text = series.SeriesName;
            txtStatus.Text     = series.Status;
            txtGenre.Text      = series.GenreString;
            txtFirstAired.Text = series.FirstAired != null?series.FirstAired.ToShortDateString() : "";

            txtAirsWeekday.Text = series.AirsDayOfWeek != null?series.AirsDayOfWeek.ToString() : "";

            txtAirstime.Text = series.AirsTime.ToShortTimeString();
            txtNetwork.Text  = series.Network;
            txtRuntime.Text  = series.Runtime != -99 ? series.Runtime.ToString() : "";
            txtRating.Text   = series.Rating != -99 ? series.Rating.ToString() : "";
            txtActors.Text   = series.ActorsString;
            txtOverview.Text = series.Overview;
            txtTvComId.Text  = series.TvDotComId != -99 ? series.TvDotComId.ToString() : ""; //series.
            if (series.TvDotComId != -99)
            {
                String link = "http://www.tv.com/show/" + series.TvDotComId + "/summary.html";
                llblTvComId.Text = "Open";
                llblTvComId.Links.Clear();
                llblTvComId.Links.Add(0, link.Length, link);
            }
            else
            {
                llblTvComId.Links.Clear();
                llblTvComId.Text = "";
            }
            txtImdbId.Text = series.ImdbId;
            if (series.ImdbId != null && !series.ImdbId.Equals(""))
            {
                String link = "http://www.imdb.com/title/" + series.ImdbId;
                llblImdb.Text = "Open";
                llblImdb.Links.Clear();
                llblImdb.Links.Add(0, link.Length, link);
            }
            else
            {
                llblImdb.Links.Clear();
                llblImdb.Text = "";
            }

            txtZap2itId.Text = series.Zap2itId;
            raterSeriesSiteRating.CurrentRating = series.Rating != -99 ? (int)(series.Rating / 10) : 0;
        }
        /// <summary>
        /// Create the series content
        /// </summary>
        /// <param name="_series">Series to store</param>
        /// <returns>xml content</returns>
        internal String CreateSeriesContent(TvdbSeries _series)
        {
            XElement xml = new XElement("Data");

            xml.Add(new XElement("Series",
                                 new XElement("id", _series.Id),
                                 new XElement("Actors", _series.ActorsString),
                                 new XElement("Airs_DayOfWeek", _series.AirsDayOfWeek),
                                 new XElement("Airs_Time", _series.AirsTime),
                                 new XElement("ContentRating", _series.ContentRating),
                                 new XElement("FirstAired", _series.FirstAired),
                                 new XElement("Genre", _series.GenreString),
                                 new XElement("IMDB_ID", _series.ImdbId),
                                 new XElement("Language", _series.Language.Abbriviation),
                                 new XElement("Network", _series.Network),
                                 new XElement("Overview", _series.Overview),
                                 new XElement("Rating", _series.Rating),
                                 new XElement("Runtime", _series.Runtime),
                                 new XElement("SeriesID", _series.TvDotComId),
                                 new XElement("SeriesName", _series.SeriesName),
                                 new XElement("Status", _series.Status),
                                 new XElement("banner", _series.BannerPath != null ? _series.BannerPath : ""),
                                 new XElement("fanart", _series.FanartPath != null ? _series.FanartPath : ""),
                                 new XElement("lastupdated", Util.DotNetToUnix(_series.LastUpdated)),
                                 new XElement("zap2it_id", _series.Zap2itId))
                    );


            if (_series.Episodes != null && _series.EpisodesLoaded)
            {
                foreach (TvdbEpisode e in _series.Episodes)
                {
                    xml.Add(new XElement("Episode",
                                         new XElement("id", e.Id),
                                         new XElement("Combined_episodenumber", e.CombinedEpisodeNumber),
                                         new XElement("Combined_season", e.CombinedSeason),
                                         new XElement("DVD_chapter", e.DvdChapter != -99 ? e.DvdChapter.ToString() : ""),
                                         new XElement("DVD_discid", e.DvdDiscId != -99 ? e.DvdDiscId.ToString() : ""),
                                         new XElement("DVD_episodenumber", e.DvdEpisodeNumber != -99 ? e.DvdEpisodeNumber.ToString() : ""),
                                         new XElement("DVD_season", e.DvdSeason != -99 ? e.DvdSeason.ToString() : ""),
                                         new XElement("Director", e.DirectorsString),
                                         new XElement("EpisodeName", e.EpisodeName),
                                         new XElement("EpisodeNumber", e.EpisodeNumber),
                                         new XElement("FirstAired", e.FirstAired),
                                         new XElement("GuestStars", e.GuestStarsString),
                                         new XElement("IMDB_ID", e.ImdbId),
                                         new XElement("Language", e.Language.Name),
                                         new XElement("Overview", e.Overview),
                                         new XElement("ProductionCode", e.ProductionCode),
                                         new XElement("Rating", e.Rating.ToString()),
                                         new XElement("SeasonNumber", e.SeasonNumber),
                                         new XElement("Writer", e.WriterString),
                                         new XElement("absolute_number", e.AbsoluteNumber),
                                         new XElement("airsafter_season", e.AirsAfterSeason != -99 ? e.AirsAfterSeason.ToString() : ""),
                                         new XElement("airsbefore_episode", e.AirsBeforeEpisode != -99 ? e.AirsBeforeEpisode.ToString() : ""),
                                         new XElement("airsbefore_season", e.AirsBeforeSeason != -99 ? e.AirsBeforeSeason.ToString() : ""),
                                         new XElement("filename", e.BannerPath),
                                         new XElement("lastupdated", Util.DotNetToUnix(e.LastUpdated)),
                                         new XElement("seasonid", e.SeasonId),
                                         new XElement("seriesid", e.SeriesId))
                            );
                }
            }
            return(xml.ToString());
        }
        /// <summary>
        /// Load the give series from cache
        /// </summary>
        /// <param name="seriesId">Id of the series to load</param>
        /// <returns>Series that has been loaded or null if series doesn't exist</returns>
        public TvdbSeries LoadSeriesFromCache(int seriesId)
        {
            String seriesRoot = _rootFolder + Path.DirectorySeparatorChar + seriesId;

            if (!Directory.Exists(seriesRoot))
            {
                return(null);
            }
            TvdbSeries series = new TvdbSeries();

            _seriesLock.EnterReadLock();

            try
            {
                #region load series in all available languages
                String[] seriesLanguages = Directory.GetFiles(seriesRoot, "*.xml");
                foreach (String l in seriesLanguages)
                {
                    if (!l.EndsWith("actors.xml") && !l.EndsWith("banners.xml"))
                    {
                        String content = File.ReadAllText(l);
                        List <TvdbSeriesFields> seriesList = _xmlReader.ExtractSeriesFields(content);
                        if (seriesList != null && seriesList.Count == 1)
                        {
                            TvdbSeriesFields s = seriesList[0];
                            //Load episodes
                            if (l.EndsWith("full.xml"))
                            {
                                List <TvdbEpisode> epList = _xmlReader.ExtractEpisodes(content);
                                s.EpisodesLoaded = true;
                                s.Episodes.Clear();
                                s.Episodes.AddRange(epList);
                            }
                            series.AddLanguage(s);
                        }
                    }
                }

                if (series.SeriesTranslations.Count > 0)
                {
                    //change language of the series to the default language
                    series.SetLanguage(series.SeriesTranslations.Keys.First());
                }
                else
                {
                    //no series info could be loaded
                    return(null);
                }

                if (!series.BannerPath.Equals(""))
                {
                    series.Banners.Add(new TvdbSeriesBanner(series.Id, series.BannerPath, series.Language, TvdbSeriesBanner.Type.Graphical));
                }

                if (!series.PosterPath.Equals(""))
                {
                    series.Banners.Add(new TvdbPosterBanner(series.Id, series.PosterPath, series.Language));
                }

                if (!series.FanartPath.Equals(""))
                {
                    series.Banners.Add(new TvdbFanartBanner(series.Id, series.FanartPath, series.Language));
                }

                Regex rex = new Regex("S(\\d+)E(\\d+)");
                if (Directory.Exists(seriesRoot + Path.DirectorySeparatorChar + "EpisodeImages"))
                {
                    String[] episodeFiles = Directory.GetFiles(seriesRoot + Path.DirectorySeparatorChar + "EpisodeImages", "ep_*.jpg");
                    foreach (String epImageFile in episodeFiles)
                    {
                        try
                        {
                            Match match   = rex.Match(epImageFile);
                            int   season  = Int32.Parse(match.Groups[1].Value);
                            int   episode = Int32.Parse(match.Groups[2].Value);
                            foreach (TvdbEpisode e in series.Episodes.Where(e => e.SeasonNumber == season && e.EpisodeNumber == episode))
                            {
                                if (epImageFile.Contains("thumb"))
                                {
                                    e.Banner.LoadThumb(Image.FromFile(epImageFile));
                                }
                                else
                                {
                                    e.Banner.LoadBanner(Image.FromFile(epImageFile));
                                }
                                break;
                            }
                        }
                        catch (Exception)
                        {
                            Log.Warn("Couldn't load episode image file " + epImageFile);
                        }
                    }
                }

                #endregion

                #region Banner loading
                String bannerFile = seriesRoot + Path.DirectorySeparatorChar + "banners.xml";
                //load cached banners
                if (File.Exists(bannerFile))
                {
                    //banners have been already loaded
                    List <TvdbBanner> bannerList = _xmlReader.ExtractBanners(File.ReadAllText(bannerFile));

                    String[] banners = Directory.GetFiles(seriesRoot, "banner*.jpg");
                    foreach (String b in banners)
                    {
                        try
                        {
                            int bannerId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                            foreach (TvdbBanner banner in bannerList.Where(banner => banner.Id == bannerId))
                            {
                                if (b.Contains("thumb") && banner.GetType().BaseType == typeof(TvdbBannerWithThumb))
                                {
                                    ((TvdbBannerWithThumb)banner).LoadThumb(Image.FromFile(b));
                                }
                                else if (b.Contains("vignette") && banner.GetType() == typeof(TvdbFanartBanner))
                                {
                                    ((TvdbFanartBanner)banner).LoadVignette(Image.FromFile(b));
                                }
                                else
                                {
                                    banner.LoadBanner(Image.FromFile(b));
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Log.Warn("Couldn't load image file " + b);
                        }
                    }
                    series.Banners = bannerList;
                }
                #endregion

                #region actor loading
                //load actor info
                String actorFile = seriesRoot + Path.DirectorySeparatorChar + "actors.xml";
                if (File.Exists(actorFile))
                {
                    List <TvdbActor> actorList = _xmlReader.ExtractActors(File.ReadAllText(actorFile));

                    String[] banners = Directory.GetFiles(seriesRoot, "actor_*.jpg");
                    foreach (String b in banners)
                    {
                        try
                        {
                            int actorId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                            foreach (TvdbActor actor in actorList.Where(actor => actor.Id == actorId))
                            {
                                actor.ActorImage.LoadBanner(Image.FromFile(b));
                            }
                        }
                        catch (Exception)
                        {
                            Log.Warn("Couldn't load image file " + b);
                        }
                    }
                    series.TvdbActors = actorList;
                }
                #endregion
            }
            finally
            {
                _seriesLock.ExitReadLock();
            }

            return(series);
        }
        /// <summary>
        /// Saves the series to cache
        /// </summary>
        /// <param name="_series"></param>
        public void SaveToCache(TvdbSeries _series)
        {
            if (_series != null)
            {
                String seriesRoot = m_rootFolder + Path.DirectorySeparatorChar + _series.Id;
                if (!Directory.Exists(seriesRoot))
                {
                    Directory.CreateDirectory(seriesRoot);
                }

                #region delete all loaded images (since they should be already cached)

                //delete banners
                foreach (TvdbBanner b in _series.Banners)
                {
                    if (b.IsLoaded)
                    {//banner is loaded
                        b.UnloadBanner();
                    }

                    //remove the ref to the cacheprovider
                    b.CacheProvider = null;

                    if (b.GetType() == typeof(TvdbBannerWithThumb))
                    {//thumb is loaded
                        if (((TvdbBannerWithThumb)b).IsThumbLoaded)
                        {
                            ((TvdbBannerWithThumb)b).UnloadThumb();
                        }
                    }

                    if (b.GetType() == typeof(TvdbFanartBanner))
                    {//vignette is loaded
                        if (((TvdbFanartBanner)b).IsVignetteLoaded)
                        {
                            ((TvdbFanartBanner)b).UnloadVignette();
                        }
                    }
                }

                //delete Actor Images
                if (_series.TvdbActorsLoaded)
                {
                    foreach (TvdbActor a in _series.TvdbActors)
                    {
                        if (a.ActorImage.IsLoaded)
                        {
                            a.ActorImage.UnloadBanner();
                        }
                        //remove the ref to the cacheprovider
                        a.ActorImage.CacheProvider = null;
                    }
                }

                //delete episode images
                if (_series.EpisodesLoaded)
                {
                    foreach (TvdbEpisode e in _series.Episodes)
                    {
                        if (e.Banner.IsLoaded)
                        {
                            e.Banner.UnloadBanner();
                        }
                        //remove the ref to the cacheprovider
                        e.Banner.CacheProvider = null;
                    }
                }
                #endregion
                //serialize series to hdd
                m_filestream = new FileStream(seriesRoot + Path.DirectorySeparatorChar + "series_" + _series.Id + ".ser", FileMode.Create);
                m_formatter.Serialize(m_filestream, _series);
                m_filestream.Close();

                //serialize series config to hdd
                SeriesConfiguration cfg = new SeriesConfiguration(_series.Id, _series.EpisodesLoaded,
                                                                  _series.BannersLoaded, _series.TvdbActorsLoaded);
                m_filestream = new FileStream(seriesRoot + Path.DirectorySeparatorChar + "series_" + _series.Id + ".cfg", FileMode.Create);
                m_formatter.Serialize(m_filestream, cfg);
                m_filestream.Close();
            }
        }
Exemple #5
0
 /// <summary>
 /// Removes the series from the users list of favorites and returns the new list of
 /// favorites
 /// </summary>
 /// <param name="_series">series to remove from the favorites</param>
 /// <returns>new list with all favorites</returns>
 public List <int> RemoveSeriesFromFavorites(TvdbSeries _series)
 {
     return(RemoveSeriesFromFavorites(_series.Id));
 }
Exemple #6
0
        private bool MakeUpdate(Util.UpdateInterval _interval, bool _zipped)
        {
            Log.Info("Started update (" + _interval.ToString() + ")");
            Stopwatch watch = new Stopwatch();

            watch.Start();
            //update all flagged series
            List <TvdbSeries>  updateSeries;
            List <TvdbEpisode> updateEpisodes;
            List <TvdbBanner>  updateBanners;
            DateTime           updateTime   = m_downloader.DownloadUpdate(out updateSeries, out updateEpisodes, out updateBanners, _interval, _zipped);
            List <int>         cachedSeries = m_cacheProvider.GetCachedSeries();

            List <TvdbSeries> seriesToSave = new List <TvdbSeries>();

            foreach (TvdbSeries us in updateSeries)
            {
                foreach (TvdbSeries s in m_loadedData.SeriesList)
                {
                    if (us.Id == s.Id)
                    {
                        if (s.LastUpdated < us.LastUpdated)
                        {//changes occured in series
                            UpdateSeries(s, us.LastUpdated);
                        }
                        break;
                    }
                }

                //Update series that have been already cached but are not in memory
                foreach (int s in cachedSeries)
                {
                    if (us.Id == s)
                    {//changes occured in series
                        TvdbSeries series = m_cacheProvider.LoadSeriesFromCache(us.Id);
                        if (series.LastUpdated < us.LastUpdated)
                        {
                            UpdateSeries(series, us.LastUpdated);
                            AddSeriesToCache(series);
                            seriesToSave.Add(series);
                        }
                        break;
                    }
                }
            }

            //update all flagged episodes
            foreach (TvdbEpisode ue in updateEpisodes)
            {
                foreach (TvdbSeries s in m_loadedData.SeriesList)
                {
                    if (ue.SeriesId == s.Id)
                    {
                        UpdateEpisode(s, ue);
                        break;
                    }
                }

                foreach (int s in cachedSeries)
                {
                    if (ue.SeriesId == s)
                    {//changes occured in series
                        TvdbSeries series = m_cacheProvider.LoadSeriesFromCache(ue.SeriesId);
                        UpdateEpisode(series, ue);
                        break;
                    }
                }
            }

            //todo: update banner information here -> wait for forum response regarding missing
            foreach (TvdbBanner b in updateBanners)
            {
                foreach (TvdbSeries s in m_loadedData.SeriesList)
                {
                    if (s.Id == b.SeriesId)
                    {
                        UpdateBanner(s, b);
                        break;
                    }
                }

                foreach (int s in cachedSeries)
                {
                    if (b.SeriesId == s)
                    {//changes occured in series
                        TvdbSeries series = m_cacheProvider.LoadSeriesFromCache(s);
                        UpdateBanner(series, b);
                        break;
                    }
                }
            }
            //set the last updated time to time of this update
            m_loadedData.LastUpdated = updateTime;
            watch.Stop();
            Log.Info("Finished update (" + _interval.ToString() + ") in " + watch.ElapsedMilliseconds + " milliseconds");
            return(true);
        }
Exemple #7
0
        public override async Task <List <EpisodeInfo> > SearchSeriesEpisodeAsync(EpisodeInfo episodeSearch, TvdbLanguage language)
        {
            language = language ?? PreferredLanguage;

            SeriesInfo seriesSearch = episodeSearch.CloneBasicInstance <SeriesInfo>();

            if (episodeSearch.SeriesTvdbId <= 0 && string.IsNullOrEmpty(episodeSearch.SeriesImdbId))
            {
                if (!await SearchSeriesUniqueAndUpdateAsync(seriesSearch, language).ConfigureAwait(false))
                {
                    return(null);
                }
                episodeSearch.CopyIdsFrom(seriesSearch);
            }

            List <EpisodeInfo> episodes = null;

            if ((episodeSearch.SeriesTvdbId > 0 || !string.IsNullOrEmpty(episodeSearch.SeriesImdbId)) && episodeSearch.SeasonNumber.HasValue)
            {
                int seriesId = 0;
                if (episodeSearch.SeriesTvdbId > 0)
                {
                    seriesId = episodeSearch.SeriesTvdbId;
                }
                else if (!string.IsNullOrEmpty(episodeSearch.SeriesImdbId))
                {
                    TvdbSearchResult searchResult = await _tvdbHandler.GetSeriesByRemoteIdAsync(ExternalId.ImdbId, episodeSearch.SeriesImdbId);

                    if (searchResult?.Id > 0)
                    {
                        seriesId = searchResult.Id;
                    }
                }
                TvdbSeries seriesDetail = await _tvdbHandler.GetSeriesAsync(seriesId, language, true, false, false).ConfigureAwait(false);

                if (seriesDetail == null)
                {
                    return(null);
                }

                foreach (TvdbEpisode episode in seriesDetail.Episodes.OrderByDescending(e => e.Id))
                {
                    if ((episodeSearch.EpisodeNumbers.Contains(episode.EpisodeNumber) || episodeSearch.EpisodeNumbers.Count == 0) &&
                        (episodeSearch.SeasonNumber == episode.SeasonNumber || episodeSearch.SeasonNumber.HasValue == false))
                    {
                        if (episodes == null)
                        {
                            episodes = new List <EpisodeInfo>();
                        }

                        EpisodeInfo info = new EpisodeInfo
                        {
                            TvdbId        = episode.Id,
                            SeriesName    = new SimpleTitle(seriesDetail.SeriesName, false),
                            SeasonNumber  = episode.SeasonNumber,
                            EpisodeName   = new SimpleTitle(episode.EpisodeName, false),
                            DataProviders = new List <string>()
                            {
                                _name
                            }
                        };
                        info.EpisodeNumbers.Add(episode.EpisodeNumber);
                        info.CopyIdsFrom(seriesSearch);
                        info.Languages.Add(episode.Language.Abbriviation);
                        if (!episodes.Contains(info))
                        {
                            episodes.Add(info);
                        }
                    }
                }
                if (episodes != null)
                {
                    episodes.Sort();
                }
            }

            if (episodes == null)
            {
                episodes = new List <EpisodeInfo>();
                EpisodeInfo info = new EpisodeInfo
                {
                    SeriesName    = seriesSearch.SeriesName,
                    SeasonNumber  = episodeSearch.SeasonNumber,
                    EpisodeName   = episodeSearch.EpisodeName,
                    DataProviders = new List <string>()
                    {
                        _name
                    }
                };
                info.CopyIdsFrom(seriesSearch);
                info.EpisodeNumbers = info.EpisodeNumbers.Union(episodeSearch.EpisodeNumbers).ToList();
                info.Languages      = seriesSearch.Languages;
                episodes.Add(info);
            }

            return(episodes);
        }
        private void UpdateSeries(TvdbSeries _series)
        {
            m_currentSeries = _series;
            FillSeriesDetails(_series);

            cmdForceUpdate.Enabled = true;
            if (_series.BannersLoaded)
            {
                cmdLoadBanners.Enabled   = false;
                pnlFanartEnabled.Visible = false;

                if (_series.PosterBanners.Count > 0)
                {
                    posterControlSeries.PosterImages = _series.PosterBanners;
                }
                else
                {
                    posterControlSeries.ClearPoster();
                }
            }
            else
            {
                cmdLoadBanners.Enabled   = true;
                pnlFanartEnabled.Visible = true;
            }

            if (_series.EpisodesLoaded)
            {
                cmdLoadFullSeriesInfo.Enabled = false;
                pnlEpisodeEnabled.Visible     = false;
                FillFullSeriesDetails(_series);
            }
            else
            {
                cmdLoadFullSeriesInfo.Enabled = true;
                pnlEpisodeEnabled.Visible     = true;
            }

            if (_series.TvdbActorsLoaded && _series.Actors.Count > 0)
            {
                cmdLoadActorInfo.Enabled = false;
                pnlActorsEnabled.Visible = false;
                lbAllActors.Items.Clear();
                bcActors.ClearControl();
                if (_series.TvdbActors.Count > 0)
                {
                    List <TvdbBanner> bannerList = new List <TvdbBanner>();
                    foreach (TvdbActor a in _series.TvdbActors)
                    {
                        lbAllActors.Items.Add(a.Name);
                        bannerList.Add(a.ActorImage);
                    }

                    bcActors.BannerImages = bannerList;
                    SetActorInfo(_series.TvdbActors[0]);
                }
            }
            else
            {
                bcActors.ClearControl();

                cmdLoadActorInfo.Enabled = true;
                pnlActorsEnabled.Visible = true;
            }
        }
 /// <summary>
 /// Gets Series information from TvDB. Results will be added automatically to cache.
 /// </summary>
 /// <param name="seriesId">TvDB ID of series</param>
 /// <param name="loadEpisodes"><c>true</c> to load episodes</param>
 /// <param name="series">Returns the Series information</param>
 /// <returns><c>true</c> if successful</returns>
 public bool GetSeries(int seriesId, bool loadEpisodes, out TvdbSeries series)
 {
     series = _tvdbHandler.GetSeries(seriesId, PreferredLanguage, loadEpisodes, false, false);
     return(series != null);
 }
 /// <summary>
 /// Gets Series information from TvDB. Results will be added automatically to cache.
 /// </summary>
 /// <param name="seriesId">TvDB ID of series</param>
 /// <param name="series">Returns the Series information</param>
 /// <returns><c>true</c> if successful</returns>
 public bool GetSeriesFanArt(int seriesId, out TvdbSeries series)
 {
     series = _tvdbHandler.GetSeries(seriesId, PreferredLanguage, false, false, true);
     return(series != null);
 }
Exemple #11
0
        public override void CreateForSeries(Series series, TvdbSeries tvDbSeries)
        {
            //Create tvshow.nfo, fanart.jpg, folder.jpg and season##.tbn
            var episodeGuideUrl = GetEpisodeGuideUrl(series.SeriesId);

            _logger.Debug("Generating tvshow.nfo for: {0}", series.Title);
            var sb  = new StringBuilder();
            var xws = new XmlWriterSettings();

            xws.OmitXmlDeclaration = true;
            xws.Indent             = false;

            using (var xw = XmlWriter.Create(sb, xws))
            {
                var tvShow = new XElement("tvshow");

                tvShow.Add(new XElement("title", tvDbSeries.SeriesName));
                tvShow.Add(new XElement("rating", tvDbSeries.Rating));
                tvShow.Add(new XElement("plot", tvDbSeries.Overview));
                tvShow.Add(new XElement("episodeguide", new XElement("url", episodeGuideUrl)));
                tvShow.Add(new XElement("episodeguideurl", episodeGuideUrl));
                tvShow.Add(new XElement("mpaa", tvDbSeries.ContentRating));
                tvShow.Add(new XElement("id", tvDbSeries.Id));
                tvShow.Add(new XElement("genre", tvDbSeries.GenreString.Trim('|').Split('|')[0]));
                tvShow.Add(new XElement("premiered", tvDbSeries.FirstAired.ToString("yyyy-MM-dd")));
                tvShow.Add(new XElement("studio", tvDbSeries.Network));

                foreach (var actor in tvDbSeries.TvdbActors)
                {
                    tvShow.Add(new XElement("actor",
                                            new XElement("name", actor.Name),
                                            new XElement("role", actor.Role),
                                            new XElement("thumb", "http://www.thetvdb.com/banners/" + actor.ActorImage.BannerPath)
                                            ));
                }

                var doc = new XDocument(tvShow);
                doc.Save(xw);

                _logger.Debug("Saving tvshow.nfo for {0}", series.Title);
                _diskProvider.WriteAllText(Path.Combine(series.Path, "tvshow.nfo"), doc.ToString());
            }

            if (String.IsNullOrWhiteSpace(tvDbSeries.FanartPath))
            {
                _logger.Debug("Fanart does not exist for series: {0}, skipping.", series.Title);
            }
            else
            {
                if (!_diskProvider.FileExists(Path.Combine(series.Path, "fanart.jpg")))
                {
                    _logger.Debug("Downloading fanart for: {0}", series.Title);
                    _bannerProvider.Download(tvDbSeries.FanartPath, Path.Combine(series.Path, "fanart.jpg"));
                }
            }

            if (!_diskProvider.FileExists(Path.Combine(series.Path, "folder.jpg")))
            {
                if (_configProvider.MetadataUseBanners)
                {
                    if (!String.IsNullOrWhiteSpace(tvDbSeries.BannerPath))
                    {
                        _logger.Debug("Downloading series banner for: {0}", series.Title);
                        _bannerProvider.Download(tvDbSeries.BannerPath, Path.Combine(series.Path, "folder.jpg"));
                    }

                    _logger.Debug("Downloading Season banners for {0}", series.Title);
                    DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.seasonwide);
                }

                else
                {
                    if (!String.IsNullOrWhiteSpace(tvDbSeries.PosterPath))
                    {
                        _logger.Debug("Downloading series thumbnail for: {0}", series.Title);
                        _bannerProvider.Download(tvDbSeries.PosterPath, Path.Combine(series.Path, "folder.jpg"));
                    }

                    _logger.Debug("Downloading Season posters for {0}", series.Title);
                    DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.season);
                }
            }
        }
Exemple #12
0
        public override void CreateForEpisodeFile(EpisodeFile episodeFile, TvdbSeries tvDbSeries)
        {
            //Create filename.tbn and filename.nfo
            var episodes = _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId);

            if (!episodes.Any())
            {
                _logger.Debug("No episodes where found for this episode file: {0}", episodeFile.EpisodeFileId);
                return;
            }

            var episodeFileThumbnail = tvDbSeries.Episodes.FirstOrDefault(
                e =>
                e.SeasonNumber == episodeFile.SeasonNumber &&
                e.EpisodeNumber == episodes.First().EpisodeNumber);

            if (episodeFileThumbnail == null || String.IsNullOrWhiteSpace(episodeFileThumbnail.BannerPath))
            {
                _logger.Debug("No thumbnail is available for this episode");
            }

            else
            {
                if (!_diskProvider.FileExists(episodeFile.Path.Replace(Path.GetExtension(episodeFile.Path), ".tbn")))
                {
                    _logger.Debug("Downloading episode thumbnail for: {0}", episodeFile.EpisodeFileId);
                    _bannerProvider.Download(episodeFileThumbnail.BannerPath,
                                             episodeFile.Path.Replace(Path.GetExtension(episodeFile.Path), ".tbn"));
                }
            }



            _logger.Debug("Generating filename.nfo for: {0}", episodeFile.EpisodeFileId);

            var xmlResult = String.Empty;

            foreach (var episode in episodes)
            {
                var sb  = new StringBuilder();
                var xws = new XmlWriterSettings();
                xws.OmitXmlDeclaration = true;
                xws.Indent             = false;

                using (var xw = XmlWriter.Create(sb, xws))
                {
                    var doc         = new XDocument();
                    var tvdbEpisode = tvDbSeries.Episodes.FirstOrDefault(
                        e =>
                        e.Id == episode.TvDbEpisodeId);

                    if (tvdbEpisode == null)
                    {
                        _logger.Debug("Looking up by TvDbEpisodeId failed, trying to match via season/episode number combination");
                        tvdbEpisode = tvDbSeries.Episodes.FirstOrDefault(
                            e =>
                            e.SeasonNumber == episode.SeasonNumber &&
                            e.EpisodeNumber == episode.EpisodeNumber);
                    }

                    if (tvdbEpisode == null)
                    {
                        _logger.Debug("Unable to find episode from TvDb - skipping");
                        return;
                    }

                    var details = new XElement("episodedetails");
                    details.Add(new XElement("title", tvdbEpisode.EpisodeName));
                    details.Add(new XElement("season", tvdbEpisode.SeasonNumber));
                    details.Add(new XElement("episode", tvdbEpisode.EpisodeNumber));
                    details.Add(new XElement("aired", tvdbEpisode.FirstAired.ToString("yyyy-MM-dd")));
                    details.Add(new XElement("plot", tvdbEpisode.Overview));
                    details.Add(new XElement("displayseason"));
                    details.Add(new XElement("displayepisode"));
                    details.Add(new XElement("thumb", "http://www.thetvdb.com/banners/" + tvdbEpisode.BannerPath));
                    details.Add(new XElement("watched", "false"));
                    details.Add(new XElement("credits", tvdbEpisode.Writer.FirstOrDefault()));
                    details.Add(new XElement("director", tvdbEpisode.Directors.FirstOrDefault()));
                    details.Add(new XElement("rating", tvdbEpisode.Rating));

                    foreach (var actor in tvdbEpisode.GuestStars)
                    {
                        if (!String.IsNullOrWhiteSpace(actor))
                        {
                            continue;
                        }

                        details.Add(new XElement("actor",
                                                 new XElement("name", actor)
                                                 ));
                    }

                    foreach (var actor in tvDbSeries.TvdbActors)
                    {
                        details.Add(new XElement("actor",
                                                 new XElement("name", actor.Name),
                                                 new XElement("role", actor.Role),
                                                 new XElement("thumb", "http://www.thetvdb.com/banners/" + actor.ActorImage.BannerPath)
                                                 ));
                    }

                    doc.Add(details);
                    doc.Save(xw);

                    xmlResult += doc.ToString();
                    xmlResult += Environment.NewLine;
                }
            }
            var filename = episodeFile.Path.Replace(Path.GetExtension(episodeFile.Path), ".nfo");

            _logger.Debug("Saving episodedetails to: {0}", filename);
            _diskProvider.WriteAllText(filename, xmlResult.Trim(EnvironmentProvider.NewLineChars));
        }
        /// <summary>
        /// Load the give series from cache
        /// </summary>
        /// <param name="_seriesId">Id of the series to load</param>
        /// <returns>Series that has been loaded</returns>
        public TvdbSeries LoadSeriesFromCache(int _seriesId)
        {
            String seriesRoot = m_rootFolder + "\\" + _seriesId;
            //todo: handle languages
            TvdbSeries series = new TvdbSeries();

            #region load series in all available languages
            String[]     seriesLanguages = Directory.GetFiles(seriesRoot, "*.xml");
            TvdbLanguage defaultLanguage = null;;

            foreach (String l in seriesLanguages)
            {
                if (!l.EndsWith("actors.xml") && !l.EndsWith("banners.xml"))
                {
                    String content = File.ReadAllText(l);
                    List <TvdbSeriesFields> seriesList = m_xmlReader.ExtractSeriesFields(content);
                    if (seriesList != null && seriesList.Count == 1)
                    {
                        TvdbSeriesFields s = seriesList[0];
                        if (l.EndsWith("all.xml"))
                        {
                            defaultLanguage = s.Language;
                        }

                        //Load episodes
                        List <TvdbEpisode> epList = m_xmlReader.ExtractEpisodes(content);
                        if (epList != null && epList.Count > 0)
                        {
                            s.EpisodesLoaded = true;
                            s.Episodes       = epList;
                        }
                        series.AddLanguage(s);
                    }
                }
            }

            if (defaultLanguage != null)
            {//change language of the series to the default language
                series.SetLanguage(defaultLanguage);
            }
            else
            {//no series info could be loaded
                return(null);
            }

            Regex rex = new Regex("S(\\d+)E(\\d+)");
            if (Directory.Exists(seriesRoot + "\\EpisodeImages"))
            {
                String[] episodeFiles = Directory.GetFiles(seriesRoot + "\\EpisodeImages", "*.jpg");
                foreach (String epImageFile in episodeFiles)
                {
                    try
                    {
                        Match match   = rex.Match(epImageFile);
                        int   season  = Int32.Parse(match.Groups[1].Value);
                        int   episode = Int32.Parse(match.Groups[2].Value);
                        foreach (TvdbEpisode e in series.Episodes)
                        {
                            if (e.SeasonNumber == season && e.EpisodeNumber == episode)
                            {
                                e.Banner.LoadBanner(Image.FromFile(epImageFile));
                                break;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Log.Warn("Couldn't load episode image file " + epImageFile);
                    }
                }
            }

            #endregion

            #region Banner loading
            String bannerFile = seriesRoot + "\\banners.xml";
            //load cached banners
            if (File.Exists(bannerFile))
            {//banners have been already loaded
                List <TvdbBanner> bannerList = m_xmlReader.ExtractBanners(File.ReadAllText(bannerFile));

                String[] banners = Directory.GetFiles(seriesRoot, "banner*.jpg");
                foreach (String b in banners)
                {
                    try
                    {
                        int bannerId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                        foreach (TvdbBanner banner in bannerList)
                        {
                            if (banner.Id == bannerId)
                            {
                                if (b.Contains("thumb") && banner.GetType() == typeof(TvdbFanartBanner))
                                {
                                    ((TvdbFanartBanner)banner).LoadThumb(Image.FromFile(b));
                                }
                                else if (b.Contains("vignette") && banner.GetType() == typeof(TvdbFanartBanner))
                                {
                                    ((TvdbFanartBanner)banner).LoadVignette(Image.FromFile(b));
                                }
                                else
                                {
                                    banner.LoadBanner(Image.FromFile(b));
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Log.Warn("Couldn't load image file " + b);
                    }
                }
                series.Banners = bannerList;
            }
            #endregion

            #region actor loading
            //load actor info
            String actorFile = seriesRoot + "\\actors.xml";
            if (File.Exists(actorFile))
            {
                List <TvdbActor> actorList = m_xmlReader.ExtractActors(File.ReadAllText(actorFile));

                String[] banners = Directory.GetFiles(seriesRoot, "actor_*.jpg");
                foreach (String b in banners)
                {
                    try
                    {
                        int actorId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                        foreach (TvdbActor actor in actorList)
                        {
                            if (actor.Id == actorId)
                            {
                                actor.ActorImage.LoadBanner(Image.FromFile(b));
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Log.Warn("Couldn't load image file " + b);
                    }
                }
                series.TvdbActors = actorList;
            }
            #endregion

            return(series);
        }
Exemple #14
0
        /// <summary>
        /// Load the give series from cache
        /// </summary>
        /// <param name="_seriesId"></param>
        /// <returns></returns>
        public TvdbSeries LoadSeriesFromCache(int _seriesId)
        {
            String seriesRoot = m_rootFolder + "\\" + _seriesId;
            String xmlFile    = seriesRoot + "\\all.xml";

            if (!File.Exists(xmlFile))
            {
                return(null);
            }
            String            content    = File.ReadAllText(xmlFile);
            List <TvdbSeries> seriesList = m_xmlReader.ExtractSeries(content);

            if (seriesList != null && seriesList.Count == 1)
            {
                TvdbSeries         series = seriesList[0];
                List <TvdbEpisode> epList = m_xmlReader.ExtractEpisodes(content);
                series.Episodes = epList;
                String bannerFile = seriesRoot + "\\banners.xml";
                String actorFile  = seriesRoot + "\\actors.xml";
                Regex  rex        = new Regex("S(\\d+)E(\\d+)");


                if (Directory.Exists(seriesRoot + "\\EpisodeImages"))
                {
                    String[] episodeFiles = Directory.GetFiles(seriesRoot + "\\EpisodeImages", "*.jpg");
                    foreach (String epImageFile in episodeFiles)
                    {
                        try
                        {
                            Match match   = rex.Match(epImageFile);
                            int   season  = Int32.Parse(match.Groups[1].Value);
                            int   episode = Int32.Parse(match.Groups[2].Value);
                            foreach (TvdbEpisode e in series.Episodes)
                            {
                                if (e.SeasonNumber == season && e.EpisodeNumber == episode)
                                {
                                    e.Banner.LoadBanner(Image.FromFile(epImageFile));
                                    break;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Warn("Couldn't load episode image file " + epImageFile);
                        }
                    }
                }
                //load cached banners
                if (File.Exists(bannerFile))
                {//banners have been already loaded
                    List <TvdbBanner> bannerList = m_xmlReader.ExtractBanners(File.ReadAllText(bannerFile));

                    String[] banners = Directory.GetFiles(seriesRoot, "banner*.jpg");
                    foreach (String b in banners)
                    {
                        try
                        {
                            int bannerId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                            foreach (TvdbBanner banner in bannerList)
                            {
                                if (banner.Id == bannerId)
                                {
                                    if (b.Contains("thumb") && banner.GetType() == typeof(TvdbFanartBanner))
                                    {
                                        ((TvdbFanartBanner)banner).LoadThumb(Image.FromFile(b));
                                    }
                                    else if (b.Contains("vignette") && banner.GetType() == typeof(TvdbFanartBanner))
                                    {
                                        ((TvdbFanartBanner)banner).LoadVignette(Image.FromFile(b));
                                    }
                                    else
                                    {
                                        banner.LoadBanner(Image.FromFile(b));
                                    }
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Log.Warn("Couldn't load image file " + b);
                        }
                    }
                    series.Banners = bannerList;
                }

                //load actor info
                if (File.Exists(actorFile))
                {
                    List <TvdbActor> actorList = m_xmlReader.ExtractActors(File.ReadAllText(actorFile));

                    String[] banners = Directory.GetFiles(seriesRoot, "actor_*.jpg");
                    foreach (String b in banners)
                    {
                        try
                        {
                            int actorId = Int32.Parse(b.Remove(b.IndexOf(".")).Remove(0, b.LastIndexOf("_") + 1));
                            foreach (TvdbActor actor in actorList)
                            {
                                if (actor.Id == actorId)
                                {
                                    actor.ActorImage.LoadBanner(Image.FromFile(b));
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Log.Warn("Couldn't load image file " + b);
                        }
                    }
                    series.TvdbActors = actorList;
                }

                return(series);
            }
            else
            {
                return(null);
            }
        }
Exemple #15
0
        public override async Task <bool> UpdateFromOnlineSeriesAsync(SeriesInfo series, TvdbLanguage language, bool cacheOnly)
        {
            try
            {
                language = language ?? PreferredLanguage;

                TvdbSeries seriesDetail = null;
                if (series.TvdbId > 0)
                {
                    seriesDetail = await _tvdbHandler.GetSeriesAsync(series.TvdbId, language, true, true, false).ConfigureAwait(false);
                }
                if (seriesDetail == null && !cacheOnly && !string.IsNullOrEmpty(series.ImdbId))
                {
                    TvdbSearchResult foundSeries = await _tvdbHandler.GetSeriesByRemoteIdAsync(ExternalId.ImdbId, series.ImdbId).ConfigureAwait(false);

                    if (foundSeries != null)
                    {
                        seriesDetail = await _tvdbHandler.GetSeriesAsync(foundSeries.Id, language, true, true, false).ConfigureAwait(false);
                    }
                }
                if (seriesDetail == null)
                {
                    return(false);
                }

                series.TvdbId = seriesDetail.Id;
                series.ImdbId = seriesDetail.ImdbId;

                series.SeriesName  = new SimpleTitle(seriesDetail.SeriesName, false);
                series.FirstAired  = seriesDetail.FirstAired;
                series.Description = new SimpleTitle(seriesDetail.Overview, false);
                series.Rating      = new SimpleRating(seriesDetail.Rating, seriesDetail.RatingCount);
                series.Genres      = seriesDetail.Genre.Where(s => !string.IsNullOrEmpty(s?.Trim())).Select(s => new GenreInfo {
                    Name = s.Trim()
                }).ToList();
                series.Networks = ConvertToCompanies(seriesDetail.NetworkID, seriesDetail.Network, CompanyAspect.COMPANY_TV_NETWORK);
                if (seriesDetail.Status.IndexOf("Ended", StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    series.IsEnded = true;
                }

                CertificationMapping certification = null;
                if (CertificationMapper.TryFindMovieCertification(seriesDetail.ContentRating, out certification))
                {
                    series.Certification = certification.CertificationId;
                }

                series.Actors     = ConvertToPersons(seriesDetail.TvdbActors, PersonAspect.OCCUPATION_ACTOR, null, seriesDetail.SeriesName);
                series.Characters = ConvertToCharacters(seriesDetail.TvdbActors, null, seriesDetail.SeriesName);

                foreach (TvdbActor actor in seriesDetail.TvdbActors)
                {
                    _seriesToActorMap.StoreMappedId(actor.Id.ToString(), seriesDetail.Id.ToString());
                }

                foreach (TvdbEpisode episodeDetail in seriesDetail.Episodes.OrderByDescending(e => e.Id))
                {
                    SeasonInfo seasonInfo = new SeasonInfo()
                    {
                        TvdbId = episodeDetail.SeasonId,

                        SeriesTvdbId  = seriesDetail.Id,
                        SeriesImdbId  = seriesDetail.ImdbId,
                        SeriesName    = new SimpleTitle(seriesDetail.SeriesName, false),
                        SeasonNumber  = episodeDetail.SeasonNumber,
                        DataProviders = new List <string>()
                        {
                            _name
                        }
                    };
                    if (!series.Seasons.Contains(seasonInfo))
                    {
                        series.Seasons.Add(seasonInfo);
                    }

                    EpisodeInfo episodeInfo = new EpisodeInfo()
                    {
                        TvdbId = episodeDetail.Id,

                        SeriesTvdbId     = seriesDetail.Id,
                        SeriesImdbId     = seriesDetail.ImdbId,
                        SeriesName       = new SimpleTitle(seriesDetail.SeriesName, false),
                        SeriesFirstAired = seriesDetail.FirstAired,

                        ImdbId         = episodeDetail.ImdbId,
                        SeasonNumber   = episodeDetail.SeasonNumber,
                        EpisodeNumbers = new List <int>(new int[] { episodeDetail.EpisodeNumber }),
                        FirstAired     = episodeDetail.FirstAired,
                        EpisodeName    = new SimpleTitle(episodeDetail.EpisodeName, false),
                        Summary        = new SimpleTitle(episodeDetail.Overview, false),
                        Genres         = seriesDetail.Genre.Where(s => !string.IsNullOrEmpty(s?.Trim())).Select(s => new GenreInfo {
                            Name = s.Trim()
                        }).ToList(),
                        Rating        = new SimpleRating(episodeDetail.Rating, episodeDetail.RatingCount),
                        DataProviders = new List <string>()
                        {
                            _name
                        }
                    };

                    if (episodeDetail.DvdEpisodeNumber > 0)
                    {
                        episodeInfo.DvdEpisodeNumbers = new List <double>(new double[] { episodeDetail.DvdEpisodeNumber });
                    }

                    episodeInfo.Actors = ConvertToPersons(seriesDetail.TvdbActors, PersonAspect.OCCUPATION_ACTOR, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                    //info.Actors.AddRange(ConvertToPersons(episodeDetail.GuestStars, PersonAspect.OCCUPATION_ACTOR, info.Actors.Count));
                    episodeInfo.Characters = ConvertToCharacters(seriesDetail.TvdbActors, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                    episodeInfo.Directors  = ConvertToPersons(episodeDetail.Directors, PersonAspect.OCCUPATION_DIRECTOR, 0, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                    episodeInfo.Writers    = ConvertToPersons(episodeDetail.Writer, PersonAspect.OCCUPATION_WRITER, 0, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                    episodeInfo.Languages.Add(episodeDetail.Language.Abbriviation);

                    if (!series.Episodes.Contains(episodeInfo))
                    {
                        series.Episodes.Add(episodeInfo);
                    }
                }
                series.Episodes.Sort();
                series.TotalEpisodes = series.Episodes.Count;

                for (int index = 0; index < series.Seasons.Count; index++)
                {
                    series.Seasons[index].FirstAired    = series.Episodes.Find(e => e.SeasonNumber == series.Seasons[index].SeasonNumber).FirstAired;
                    series.Seasons[index].TotalEpisodes = series.Episodes.FindAll(e => e.SeasonNumber == series.Seasons[index].SeasonNumber).Count;
                }
                series.Seasons.Sort();
                series.TotalSeasons = series.Seasons.Count;

                TvdbEpisode nextEpisode = seriesDetail.Episodes.Where(e => e.FirstAired > DateTime.Now).OrderBy(e => e.FirstAired)
                                          .ThenByDescending(p => p.Id).FirstOrDefault();
                if (nextEpisode != null)
                {
                    series.NextEpisodeName         = new SimpleTitle(nextEpisode.EpisodeName, false);
                    series.NextEpisodeAirDate      = nextEpisode.FirstAired;
                    series.NextEpisodeSeasonNumber = nextEpisode.SeasonNumber;
                    series.NextEpisodeNumber       = nextEpisode.EpisodeNumber;
                }

                if (!series.DataProviders.Contains(_name))
                {
                    series.DataProviders.Add(_name);
                }

                return(true);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("TvDbWrapper: Exception while processing series {0}", ex, series.ToString());
                return(false);
            }
        }
Exemple #16
0
        /// <summary>
        /// Saves the series to cache
        /// </summary>
        /// <param name="_series"></param>
        public void SaveToCache(TvdbSeries _series)
        {
            String root = m_rootFolder + "\\" + _series.Id;

            m_xmlWriter.WriteSeriesContent(_series, root + "\\all.xml");
            if (_series.BannersLoaded)
            {
                m_xmlWriter.WriteSeriesBannerContent(_series.Banners, root + "\\banners.xml");
            }

            if (_series.TvdbActorsLoaded)
            {
                m_xmlWriter.WriteActorFile(_series.TvdbActors, root + "\\actors.xml");
            }

            //Save all loaded banners to file
            foreach (TvdbBanner b in _series.Banners)
            {
                FileInfo file = new FileInfo(root + "\\banner_" + b.Id + ".jpg");
                if (b.IsLoaded && !file.Exists)
                {//banner is cached
                    if (!file.Directory.Exists)
                    {
                        file.Directory.Create();
                    }
                    b.Banner.Save(file.FullName);
                }
                if (b.GetType() == typeof(TvdbFanartBanner))
                {//banner is fanart -> has vignette and thumb
                    file = new FileInfo(root + "\\bannerthumb_" + b.Id + ".jpg");
                    if (((TvdbFanartBanner)b).IsThumbLoaded && !file.Exists)
                    {
                        if (!file.Directory.Exists)
                        {
                            file.Directory.Create();
                        }
                        ((TvdbFanartBanner)b).BannerThumb.Save(file.FullName);
                    }

                    file = new FileInfo(root + "\\bannervignette_" + b.Id + ".jpg");
                    if (((TvdbFanartBanner)b).IsVignetteLoaded && !file.Exists)
                    {
                        if (!file.Directory.Exists)
                        {
                            file.Directory.Create();
                        }
                        ((TvdbFanartBanner)b).VignetteImage.Save(file.FullName);
                    }
                }
            }

            if (_series.EpisodesLoaded)
            {
                foreach (TvdbEpisode e in _series.Episodes)
                {
                    FileInfo file = new FileInfo(root + "\\EpisodeImages\\S" + e.SeasonNumber + "E" + e.EpisodeNumber + ".jpg");
                    if (e.Banner.IsLoaded && !file.Exists)
                    {
                        if (!file.Directory.Exists)
                        {
                            file.Directory.Create();
                        }
                        e.Banner.Banner.Save(file.FullName);
                    }
                }
            }

            if (_series.TvdbActorsLoaded)
            {
                foreach (TvdbActor a in _series.TvdbActors)
                {
                    FileInfo file = new FileInfo(root + "\\actor_" + a.ActorImage.Id + ".jpg");
                    if (a.ActorImage.IsLoaded && !file.Exists)
                    {
                        if (!file.Directory.Exists)
                        {
                            file.Directory.Create();
                        }
                        a.ActorImage.Banner.Save(file.FullName);
                    }
                }
            }
        }
Exemple #17
0
        public override async Task <bool> UpdateFromOnlineSeriesEpisodeAsync(EpisodeInfo episode, TvdbLanguage language, bool cacheOnly)
        {
            try
            {
                language = language ?? PreferredLanguage;

                List <EpisodeInfo> episodeDetails = new List <EpisodeInfo>();
                TvdbSeries         seriesDetail   = null;
                TvdbEpisode        episodeDetail  = null;

                if ((episode.SeriesTvdbId > 0 || !string.IsNullOrEmpty(episode.SeriesImdbId)) && episode.SeasonNumber.HasValue && episode.EpisodeNumbers.Count > 0)
                {
                    if (episode.SeriesTvdbId > 0)
                    {
                        seriesDetail = await _tvdbHandler.GetSeriesAsync(episode.SeriesTvdbId, language, true, true, true).ConfigureAwait(false);
                    }
                    if (seriesDetail == null && !cacheOnly && !string.IsNullOrEmpty(episode.SeriesImdbId))
                    {
                        TvdbSearchResult foundSeries = await _tvdbHandler.GetSeriesByRemoteIdAsync(ExternalId.ImdbId, episode.SeriesImdbId).ConfigureAwait(false);

                        if (foundSeries != null)
                        {
                            seriesDetail = await _tvdbHandler.GetSeriesAsync(foundSeries.Id, language, true, true, true).ConfigureAwait(false);
                        }
                    }
                    if (seriesDetail == null)
                    {
                        return(false);
                    }

                    bool isFirstEpisode = true;
                    foreach (int episodeNumber in episode.EpisodeNumbers)
                    {
                        episodeDetail = seriesDetail.Episodes.Where(e => e.EpisodeNumber == episodeNumber &&
                                                                    e.SeasonNumber == episode.SeasonNumber.Value).OrderByDescending(e => e.Id).FirstOrDefault();
                        if (episodeDetail == null)
                        {
                            continue;
                        }

                        EpisodeInfo info = new EpisodeInfo()
                        {
                            TvdbId = episodeDetail.Id,

                            SeriesTvdbId     = seriesDetail.Id,
                            SeriesImdbId     = seriesDetail.ImdbId,
                            SeriesName       = new SimpleTitle(seriesDetail.SeriesName, false),
                            SeriesFirstAired = seriesDetail.FirstAired,

                            ImdbId         = episodeDetail.ImdbId,
                            SeasonNumber   = episodeDetail.SeasonNumber,
                            EpisodeNumbers = new List <int>(new int[] { episodeDetail.EpisodeNumber }),
                            FirstAired     = episodeDetail.FirstAired,
                            EpisodeName    = new SimpleTitle(episodeDetail.EpisodeName, false),
                            Summary        = new SimpleTitle(episodeDetail.Overview, false),
                            Genres         = seriesDetail.Genre.Where(s => !string.IsNullOrEmpty(s?.Trim())).Select(s => new GenreInfo {
                                Name = s.Trim()
                            }).ToList(),
                            Rating        = new SimpleRating(episodeDetail.Rating, episodeDetail.RatingCount),
                            DataProviders = new List <string>()
                            {
                                _name
                            }
                        };

                        if (episodeDetail.DvdEpisodeNumber > 0)
                        {
                            info.DvdEpisodeNumbers = new List <double>(new double[] { episodeDetail.DvdEpisodeNumber });
                        }

                        info.Actors = ConvertToPersons(seriesDetail.TvdbActors, PersonAspect.OCCUPATION_ACTOR, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                        //info.Actors.AddRange(ConvertToPersons(episodeDetail.GuestStars, PersonAspect.OCCUPATION_ACTOR, info.Actors.Count));
                        info.Characters = ConvertToCharacters(seriesDetail.TvdbActors, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                        info.Directors  = ConvertToPersons(episodeDetail.Directors, PersonAspect.OCCUPATION_DIRECTOR, 0, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                        info.Writers    = ConvertToPersons(episodeDetail.Writer, PersonAspect.OCCUPATION_WRITER, 0, episodeDetail.EpisodeName, seriesDetail.SeriesName);
                        info.Languages.Add(episodeDetail.Language.Abbriviation);

                        //Should be handled by the fanart collector instead
                        //if (isFirstEpisode && !episode.HasThumbnail && episodeDetail.Banner != null)
                        //  info.Thumbnail = await episodeDetail.Banner.LoadImageDataAsync().ConfigureAwait(false);

                        episodeDetails.Add(info);
                        isFirstEpisode = false;
                    }
                }

                if (episodeDetails.Count > 1)
                {
                    SetMultiEpisodeDetails(episode, episodeDetails);
                    if (!episode.DataProviders.Contains(_name))
                    {
                        episode.DataProviders.Add(_name);
                    }
                    return(true);
                }
                else if (episodeDetails.Count > 0)
                {
                    SetEpisodeDetails(episode, episodeDetails[0]);
                    if (!episode.DataProviders.Contains(_name))
                    {
                        episode.DataProviders.Add(_name);
                    }
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("TvDbWrapper: Exception while processing episode {0}", ex, episode.ToString());
                return(false);
            }
        }
        protected bool TryMatch(string seriesNameOrImdbId, bool isImdbId, bool cacheOnly, out TvdbSeries seriesDetail, int tvdbid = 0)
        {
            seriesDetail = null;
            try
            {
                // Prefer memory cache
                CheckCacheAndRefresh();
                if (_memoryCache.TryGetValue(seriesNameOrImdbId, out seriesDetail))
                {
                    if (tvdbid == 0 || seriesDetail.Id == tvdbid)
                    {
                        return(true);
                    }
                }

                // Load cache or create new list
                List <SeriesMatch> matches;
                lock (_syncObj)
                    matches = Settings.Load <List <SeriesMatch> >(MatchesSettingsFile) ?? new List <SeriesMatch>();

                // Init empty
                seriesDetail = null;

                // Use cached values before doing online query
                SeriesMatch match = matches.Find(m =>
                                                 (
                                                     string.Equals(m.ItemName, seriesNameOrImdbId, StringComparison.OrdinalIgnoreCase) ||
                                                     string.Equals(m.TvDBName, seriesNameOrImdbId, StringComparison.OrdinalIgnoreCase)
                                                 ) && (tvdbid == 0 || m.Id == tvdbid));

                ServiceRegistration.Get <ILogger>().Debug("SeriesTvDbMatcher: Try to lookup series \"{0}\" from cache: {1}", seriesNameOrImdbId, match != null && match.Id != 0);

                // Try online lookup
                if (!Init())
                {
                    return(false);
                }

                // If this is a known series, only return the series details (including episodes).
                if (match != null)
                {
                    return(match.Id != 0 && _tv.GetSeries(match.Id, true, out seriesDetail));
                }

                if (cacheOnly)
                {
                    return(false);
                }

                TvdbSearchResult matchedSeries = null;
                bool             foundResult   = false;
                if (tvdbid != 0)
                {
                    foundResult = _tv.GetSeries(tvdbid, true, out seriesDetail);
                }
                else
                if (isImdbId)
                {
                    // If we got an IMDBID, use it to lookup by key directly
                    _tv.GetSeries(seriesNameOrImdbId, out matchedSeries);
                }
                else
                {
                    // Otherwise we try to find unique series by name
                    List <TvdbSearchResult> series;
                    if (_tv.SearchSeriesUnique(seriesNameOrImdbId, out series))
                    {
                        matchedSeries = series[0];
                    }
                }

                if (matchedSeries != null)
                {
                    ServiceRegistration.Get <ILogger>().Debug("SeriesTvDbMatcher: Found unique online match for \"{0}\": \"{1}\" [Lang: {2}]", seriesNameOrImdbId, matchedSeries.SeriesName, matchedSeries.Language);
                    foundResult = _tv.GetSeries(matchedSeries.Id, true, out seriesDetail);
                }
                if (foundResult)
                {
                    ServiceRegistration.Get <ILogger>().Debug("SeriesTvDbMatcher: Loaded details for \"{0}\"", seriesDetail.SeriesName);
                    // Add this match to cache
                    SeriesMatch onlineMatch = new SeriesMatch
                    {
                        ItemName = seriesNameOrImdbId,
                        Id       = seriesDetail.Id,
                        TvDBName = seriesDetail.SeriesName
                    };

                    // Save cache
                    _storage.TryAddMatch(onlineMatch);
                    return(true);
                }

                ServiceRegistration.Get <ILogger>().Debug("SeriesTvDbMatcher: No unique match found for \"{0}\"", seriesNameOrImdbId);
                // Also save "non matches" to avoid retrying
                _storage.TryAddMatch(new SeriesMatch {
                    ItemName = seriesNameOrImdbId
                });
                return(false);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("SeriesTvDbMatcher: Exception while processing series {0}", ex, seriesNameOrImdbId);
                return(false);
            }
            finally
            {
                if (seriesDetail != null)
                {
                    _memoryCache.TryAdd(seriesNameOrImdbId, seriesDetail);
                }
            }
        }
        /// <summary>
        /// Extract all the series fields that are available on thetvdb
        /// <![CDATA[
        /// <?xml version="1.0" encoding="UTF-8" ?>
        /// <Data>
        ///    <Series>
        ///       <id>73739</id>
        ///       <Actors>|Malcolm David Kelley|Jorge Garcia|Maggie Grace|...|</Actors>
        ///       <Airs_DayOfWeek>Thursday</Airs_DayOfWeek>
        ///       <Airs_Time>9:00 PM</Airs_Time>
        ///       <ContentRating>TV-14</ContentRating>
        ///       <FirstAired>2004-09-22</FirstAired>
        ///       <Genre>|Action and Adventure|Drama|Science-Fiction|</Genre>
        ///       <IMDB_ID>tt0411008</IMDB_ID>
        ///       <Language>en</Language>
        ///       <Network>ABC</Network>
        ///       <Overview>After Oceanic Air flight 815...</Overview>
        ///       <Rating>8.9</Rating>
        ///       <Runtime>60</Runtime>
        ///       <SeriesID>24313</SeriesID>
        ///       <SeriesName>Lost</SeriesName>
        ///       <Status>Continuing</Status>
        ///       <banner>graphical/24313-g2.jpg</banner>
        ///       <fanart>fanart/original/73739-1.jpg</fanart>
        ///       <lastupdated>1205694666</lastupdated>
        ///       <zap2it_id>SH672362</zap2it_id>
        ///    </Series>
        ///
        /// </Data>
        /// ]]>
        /// </summary>
        /// <param name="_data"></param>
        /// <returns></returns>
        internal List <TvdbSeriesFields> ExtractSeriesFields(String _data)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            XDocument xml = XDocument.Parse(_data);

            var allSeries = from series in xml.Descendants("Series")
                            select new
            {
                Id             = series.Element("id").Value,
                Actors         = series.Element("Actors").Value,
                Airs_DayOfWeek = series.Element("Airs_DayOfWeek").Value,
                Airs_Time      = series.Element("Airs_Time").Value,
                ContentRating  = series.Element("ContentRating").Value,
                FirstAired     = series.Element("FirstAired").Value,
                Genre          = series.Element("Genre").Value,
                IMDB_ID        = series.Element("IMDB_ID").Value,
                Language       = series.Element("Language").Value,
                Network        = series.Element("Network").Value,
                Overview       = series.Element("Overview").Value,
                Rating         = series.Element("Rating").Value,
                Runtime        = series.Element("Runtime").Value,
                SeriesID       = series.Element("SeriesID").Value,
                SeriesName     = series.Element("SeriesName").Value,
                Status         = series.Element("Status").Value,
                banner         = series.Element("banner").Value,
                fanart         = series.Element("fanart").Value,
                lastupdated    = series.Element("lastupdated").Value,
                zap2it_id      = series.Element("zap2it_id").Value
            };

            List <TvdbSeriesFields> retList = new List <TvdbSeriesFields>();

            foreach (var s in allSeries)
            {
                TvdbSeries series = new TvdbSeries();
                series.Id            = Util.Int32Parse(s.Id);
                series.Actors        = Util.SplitTvdbString(s.Actors);
                series.AirsDayOfWeek = Util.GetDayOfWeek(s.Airs_DayOfWeek);
                series.AirsTime      = s.Airs_Time.Equals("") ? new DateTime(1, 1, 1) : DateTime.Parse(s.Airs_Time.Replace(".", ":"));
                series.ContentRating = s.ContentRating;
                series.FirstAired    = s.FirstAired.Equals("") ? new DateTime() : DateTime.Parse(s.FirstAired);
                series.Genre         = Util.SplitTvdbString(s.Genre);
                series.ImdbId        = s.IMDB_ID;
                series.Language      = Util.ParseLanguage(s.Language);
                series.Network       = s.Network;
                series.Overview      = s.Overview;
                series.Rating        = Util.DoubleParse(s.Rating);
                series.Runtime       = Util.DoubleParse(s.Runtime);
                series.TvDotComId    = Util.Int32Parse(s.SeriesID);
                series.SeriesName    = s.SeriesName;
                series.Status        = s.Status;
                series.BannerPath    = s.banner;
                series.FanartPath    = s.fanart;
                series.LastUpdated   = Util.UnixToDotNet(s.lastupdated);
                series.Zap2itId      = s.zap2it_id;
                if (series.Id != -99)
                {
                    retList.Add(series);
                }
            }

            watch.Stop();
            Log.Debug("Extracted " + retList.Count + " series in " + watch.ElapsedMilliseconds + " milliseconds");
            return(retList);
        }
Exemple #20
0
        /// <summary>
        /// Gets the series with the given id either from cache (if it has already been loaded) or from
        /// the selected tvdb mirror. If you use zip the request automatically downloads the episodes, the actors and the banners, so you should also select those features.
        ///
        /// To check if this series has already been cached, use the Method IsCached(TvdbSeries _series)
        /// </summary>
        /// <exception cref="TvdbNotAvailableException">Tvdb is not available</exception>
        /// <exception cref="TvdbInvalidApiKeyException">The given api key is not valid</exception>
        /// <param name="_seriesId">id of series</param>
        /// <param name="_language">language that should be retrieved</param>
        /// <param name="_loadEpisodes">if true, the full series record will be loaded (series + all episodes), otherwise only the base record will be loaded which contains only series information</param>
        /// <param name="_loadBanners">if true also loads the paths to the banners</param>
        /// <param name="_loadActors">if true also loads the extended actor information</param>
        /// <param name="_useZip">If this series is not already cached and the series has to be downloaded, the zipped version will be downloaded</param>
        /// <returns>Instance of TvdbSeries containing all gained information</returns>
        public TvdbSeries GetSeries(int _seriesId, TvdbLanguage _language, bool _loadEpisodes,
                                    bool _loadActors, bool _loadBanners, bool _useZip)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();

            TvdbSeries series = GetSeriesFromCache(_seriesId);

            if (series == null ||                                                                           //series not yet cached
                (_useZip && (!series.EpisodesLoaded && !series.TvdbActorsLoaded && !series.BannersLoaded))) //only the basic series info has been loaded -> zip is still faster than fetching the missing informations without using zip
            {                                                                                               //load complete series from tvdb
                if (_useZip)
                {
                    series = m_downloader.DownloadSeriesZipped(_seriesId, _language);
                }
                else
                {
                    series = m_downloader.DownloadSeries(_seriesId, _language, _loadEpisodes, _loadActors, _loadBanners);
                }

                if (series == null)
                {
                    return(null);
                }
                watch.Stop();
                Log.Info("Loaded series in " + watch.ElapsedMilliseconds + " milliseconds");
                series.IsFavorite = m_userInfo == null ? false : CheckIfSeriesFavorite(_seriesId, m_userInfo.UserFavorites);
                AddSeriesToCache(series);
                return(series);
            }
            else
            {     //some (if not all) information has already been loaded from tvdb at some point -> fill the missing details and return the series
                if (!_language.Abbriviation.Equals(series.Language.Abbriviation))
                { //user wants a different language than the one that has been loaded
                    if (series.GetAvailableLanguages().Contains(_language))
                    {
                        series.SetLanguage(_language);
                    }
                    else
                    {
                        TvdbSeriesFields newFields = m_downloader.DownloadSeriesFields(_seriesId, _language);
                        if (_loadEpisodes)
                        {
                            List <TvdbEpisode> epList = m_downloader.DownloadEpisodes(_seriesId, _language);
                            if (epList != null)
                            {
                                newFields.Episodes = epList;
                            }
                        }
                        if (newFields != null)
                        {
                            series.AddLanguage(newFields);
                            series.SetLanguage(_language);
                        }
                        else
                        {
                            Log.Warn("Couldn't load new language " + _language.Abbriviation + " for series " + _seriesId);
                            return(null);
                        }
                    }
                }

                if (_loadActors && !series.TvdbActorsLoaded)
                {//user wants actors loaded
                    List <TvdbActor> actorList = m_downloader.DownloadActors(_seriesId);
                    if (actorList != null)
                    {
                        series.TvdbActorsLoaded = true;
                        series.TvdbActors       = actorList;
                    }
                }

                if (_loadEpisodes && !series.EpisodesLoaded)
                {//user wants the full version but only the basic has been loaded (without episodes
                    List <TvdbEpisode> epList = m_downloader.DownloadEpisodes(_seriesId, _language);
                    if (epList != null)
                    {
                        series.EpisodesLoaded = true;
                        series.Episodes       = epList;
                    }
                }

                if (_loadBanners && !series.BannersLoaded)
                {//user wants banners loaded but current series hasn't -> Do it baby
                    List <TvdbBanner> bannerList = m_downloader.DownloadBanners(_seriesId);
                    if (bannerList != null)
                    {
                        series.BannersLoaded = true;
                        series.Banners       = bannerList;
                    }
                }

                watch.Stop();
                Log.Info("Loaded series in " + watch.ElapsedMilliseconds + " milliseconds");

                return(series);
            }
        }
        public void Setup()
        {
            WithTempAsAppPath();

            series = Builder <Series>
                     .CreateNew()
                     .With(s => s.SeriesId == 79488)
                     .With(s => s.Title == "30 Rock")
                     .Build();

            episodeFile = Builder <EpisodeFile> .CreateNew()
                          .With(f => f.SeriesId     = 79488)
                          .With(f => f.SeasonNumber = 1)
                          .With(f => f.Path         = @"C:\Test\30 Rock\Season 01\30 Rock - S01E01 - Pilot.avi")
                          .Build();

            var tvdbEpisodes = Builder <TvdbEpisode> .CreateListOfSize(2)
                               .All()
                               .With(e => e.SeriesId     = 79488)
                               .With(e => e.SeasonNumber = 1)
                               .With(e => e.Directors    = new List <string> {
                "Fake Director"
            })
                               .With(e => e.Writer = new List <string> {
                "Fake Writer"
            })
                               .With(e => e.GuestStars = new List <string> {
                "Guest Star 1", "Guest Star 2", "Guest Star 3", ""
            })
                               .Build();

            var seasonBanners = Builder <TvdbSeasonBanner>
                                .CreateListOfSize(4)
                                .TheFirst(2)
                                .With(b => b.Season = 1)
                                .TheLast(2)
                                .With(b => b.Season = 2)
                                .TheFirst(1)
                                .With(b => b.BannerType = TvdbSeasonBanner.Type.season)
                                .With(b => b.BannerPath = "seasons/79488-1-1.jpg")
                                .TheNext(2)
                                .With(b => b.BannerType = TvdbSeasonBanner.Type.seasonwide)
                                .With(b => b.BannerPath = "banners/seasons/79488-test.jpg")
                                .TheLast(1)
                                .With(b => b.BannerType = TvdbSeasonBanner.Type.season)
                                .With(b => b.BannerPath = "seasons/79488-2-1.jpg")
                                .Build();

            var seriesActors = Builder <TvdbActor>
                               .CreateListOfSize(5)
                               .All()
                               .With(a => a.ActorImage = Builder <TvdbActorBanner> .CreateNew().Build())
                               .Build();

            tvdbSeries = Builder <TvdbSeries>
                         .CreateNew()
                         .With(s => s.Id         = 79488)
                         .With(s => s.SeriesName = "30 Rock")
                         .With(s => s.TvdbActors = seriesActors.ToList())
                         .With(s => s.Episodes   = tvdbEpisodes.ToList())
                         .Build();

            tvdbSeries.Banners.AddRange(seasonBanners);
        }
        private SeriesTag CopySeriesInfos(SeriesTag seriesTag, TvdbSeries series, int seasonIndex, int episodeIndex)
        {
            seriesTag.SeriesName = series.SeriesName;
              seriesTag.IMDB_ID = series.ImdbId;
              seriesTag.TVDB_ID = series.Id.ToString();
              // Do not overwrite the index
              //seriesTag.SeasonIndex
              //seriesTag.EpisodeIndexList

              seriesTag.Network = series.Network;
              seriesTag.Certification = series.ContentRating;
              seriesTag.SeriesFirstAired = series.FirstAired.ToString("yyyy-MM-dd");
              seriesTag.SeriesOverview = series.Overview;
              seriesTag.SeriesGenreList = series.Genre.AsReadOnly();
              seriesTag.SeriesActors = series.Actors.AsReadOnly();

              TvdbEpisode ep =
            series.Episodes.FirstOrDefault(e => e.SeasonNumber == seasonIndex && e.EpisodeNumber == episodeIndex);
              if (ep == null)
            return seriesTag;

              seriesTag.EpisodeFirstAired = ep.FirstAired.ToString("yyyy-MM-dd");
              seriesTag.EpisodeTitle = ep.EpisodeName;
              seriesTag.EpisodeIMDB_ID = ep.ImdbId;
              seriesTag.EpisodeOverview = ep.Overview;
              seriesTag.GuestStars = ep.GuestStars.AsReadOnly();
              seriesTag.Directors = ep.Directors.AsReadOnly();
              seriesTag.Writers = ep.Writer.AsReadOnly();

              return seriesTag;
        }
Exemple #23
0
 /// <summary>
 /// Forces a complete update of the series. All information that has already been loaded (including loaded images!) will be deleted and reloaded from tvdb -> if you only want to update the series, use the "MakeUpdate" method
 /// </summary>
 /// <param name="_series">Series to reload</param>
 public TvdbSeries ForceUpdate(TvdbSeries _series)
 {
     return(ForceUpdate(_series, _series.EpisodesLoaded, _series.TvdbActorsLoaded, _series.BannersLoaded));
 }