Ejemplo n.º 1
0
        public static Core.Tv.Series ToModel(this SeriesResource resource, Core.Tv.Series series)
        {
            var updatedSeries = resource.ToModel();

            series.ApplyChanges(updatedSeries);

            return(series);
        }
Ejemplo n.º 2
0
        public static Core.Tv.Series ToModel(this SeriesResource resource)
        {
            if (resource == null)
            {
                return(null);
            }

            return(new Core.Tv.Series
            {
                Id = resource.Id,

                Title = resource.Title,
                //AlternateTitles
                SortTitle = resource.SortTitle,

                //TotalEpisodeCount
                //EpisodeCount
                //EpisodeFileCount
                //SizeOnDisk
                Status = resource.Status,
                Overview = resource.Overview,
                //NextAiring
                //PreviousAiring
                Network = resource.Network,
                AirTime = resource.AirTime,
                Images = resource.Images,

                Seasons = resource.Seasons.ToModel(),
                Year = resource.Year,

                Path = resource.Path,
                QualityProfileId = resource.ProfileId,
                LanguageProfileId = resource.LanguageProfileId,

                SeasonFolder = resource.SeasonFolder,
                Monitored = resource.Monitored,

                UseSceneNumbering = resource.UseSceneNumbering,
                Runtime = resource.Runtime,
                TvdbId = resource.TvdbId,
                TvRageId = resource.TvRageId,
                TvMazeId = resource.TvMazeId,
                FirstAired = resource.FirstAired,
                LastInfoSync = resource.LastInfoSync,
                SeriesType = resource.SeriesType,
                CleanTitle = resource.CleanTitle,
                ImdbId = resource.ImdbId,
                TitleSlug = resource.TitleSlug,
                RootFolderPath = resource.RootFolderPath,
                Certification = resource.Certification,
                Genres = resource.Genres,
                Tags = resource.Tags,
                Added = resource.Added,
                AddOptions = resource.AddOptions,
                Ratings = resource.Ratings
            });
        }
Ejemplo n.º 3
0
        public void should_be_able_to_add_to_blacklist()
        {
            _series = EnsureSeries(266189, "The Blacklist");

            Blacklist.Post(new Api.Blacklist.BlacklistResource
            {
                SeriesId = _series.Id,
                SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
            });
        }
Ejemplo n.º 4
0
        public void should_not_be_able_to_get_unmonitored_episodes()
        {
            _series = EnsureSeries(266189, "The Blacklist", false);

            var request = Calendar.BuildRequest();
            request.AddParameter("start", new DateTime(2015, 10, 1).ToString("s") + "Z");
            request.AddParameter("end", new DateTime(2015, 10, 3).ToString("s") + "Z");
            request.AddParameter("unmonitored", "false");
            var items = Calendar.Get<List<EpisodeResource>>(request);

            items = items.Where(v => v.SeriesId == _series.Id).ToList();

            items.Should().BeEmpty();
        }
Ejemplo n.º 5
0
        public void should_be_able_to_get_episodes()
        {
            _series = EnsureSeries(266189, "The Blacklist", true);

            var request = Calendar.BuildRequest();
            request.AddParameter("start", new DateTime(2015, 10, 1).ToString("s") + "Z");
            request.AddParameter("end", new DateTime(2015, 10, 3).ToString("s") + "Z");
            var items = Calendar.Get<List<EpisodeResource>>(request);

            items = items.Where(v => v.SeriesId == _series.Id).ToList();

            items.Should().HaveCount(1);
            items.First().Title.Should().Be("The Troll Farmer");
        }
Ejemplo n.º 6
0
        public static Core.Tv.Series ToModel(this SeriesResource resource, Core.Tv.Series series)
        {
            series.TvdbId = resource.TvdbId;

            series.Seasons   = resource.Seasons.ToModel();
            series.Path      = resource.Path;
            series.ProfileId = resource.ProfileId;

            series.SeasonFolder = resource.SeasonFolder;
            series.Monitored    = resource.Monitored;

            series.SeriesType     = resource.SeriesType;
            series.RootFolderPath = resource.RootFolderPath;
            series.Tags           = resource.Tags;
            series.AddOptions     = resource.AddOptions;

            return(series);
        }
Ejemplo n.º 7
0
 public void Setup()
 {
     series = GivenSeriesWithEpisodes();
 }
Ejemplo n.º 8
0
        public EpisodeFileResource EnsureEpisodeFile(SeriesResource series, int season, int episode, Quality quality)
        {
            var result = Episodes.GetEpisodesInSeries(series.Id).Single(v => v.SeasonNumber == season && v.EpisodeNumber == episode);

            if (result.EpisodeFile == null)
            {
                var path = Path.Combine(SeriesRootFolder, series.Title, string.Format("Series.S{0}E{1}.{2}.mkv", season, episode, quality.Name));

                Directory.CreateDirectory(Path.GetDirectoryName(path));
                File.WriteAllText(path, "Fake Episode");

                Commands.PostAndWait(new CommandResource { Name = "refreshseries", Body = new RefreshSeriesCommand(series.Id) });
                Commands.WaitAll();

                result = Episodes.GetEpisodesInSeries(series.Id).Single(v => v.SeasonNumber == season && v.EpisodeNumber == episode);

                result.EpisodeFile.Should().NotBeNull();
            }

            return result.EpisodeFile;
        }