コード例 #1
0
ファイル: Fetcher.cs プロジェクト: HristoKolev/TrackTV
        private static void SetSeasons(Show show, TVDBSharp.Models.Show fetchedShow)
        {
            ICollection<Season> seasons = show.Seasons;

            foreach (TVDBSharp.Models.Episode episodeModel in fetchedShow.Episodes)
            {
                int seasonNumber = episodeModel.SeasonNumber;

                Season season = seasons.FirstOrDefault(s => s.Number == seasonNumber);

                if (season == null)
                {
                    season = new Season
                    {
                        Number = seasonNumber
                    };

                    seasons.Add(season);
                }

                TVDBSharp.Models.Episode model = episodeModel;

                Episode episode = season.Episodes.FirstOrDefault(e => e.Number == model.EpisodeNumber);

                if (episode == null)
                {
                    episode = new Episode();
                }

                MapEpisode(episode, episodeModel);

                episode.Season = season;
                season.Episodes.Add(episode);

                show.Seasons.Add(season);
                season.Show = show;
            }
        }
コード例 #2
0
ファイル: Fetcher.cs プロジェクト: HristoKolev/TrackTV
 private static void MapEpisode(Episode episode, TVDBSharp.Models.Episode episodeModel)
 {
     episode.ImdbId = episodeModel.ImdbId;
     episode.TvDbId = episodeModel.Id;
     episode.FirstAired = episodeModel.FirstAired;
     episode.Description = episodeModel.Description;
     episode.LastUpdated = episodeModel.LastUpdated;
     episode.Number = episodeModel.EpisodeNumber;
     episode.Title = episodeModel.Title;
 }