private async Task UpdateInformationMetadata(string path, FullSerie serie)
        {
            TvShowMetadata metadata = MapFullSerieToMetadata(serie);

            await UpdateActorsMetadata(path, metadata);
            await Save(path, metadata);
        }
        public async Task <TvShowMetadata> Get(string path)
        {
            TvShowMetadata metadata = await _metadataRepository.Get(path);

            foreach (ActorMetadata actor in metadata.Actors)
            {
                actor.ThumbPath = ActorMetadata.GetActorThumbPath(path, actor.Name);
            }
            return(metadata);
        }
        private async Task <string> GetSeriesId(string path)
        {
            TvShowMetadata metadata = await Get(path);

            if (string.IsNullOrEmpty(metadata.Id))
            {
                return(await FindIdFromPath(path));
            }
            return(metadata.Id);
        }
        public void Save_Always_PersistMetadata()
        {
            // Arrange
            TvShowMetadata metadata = new TvShowMetadata();

            // Act
            _service.Save(_path, metadata);

            // Assert
            _metadataRepository.Received()
                .Save(_path, metadata);
        }
Example #5
0
        public void Save_Always_PersistMetadata()
        {
            // Arrange
            TvShowMetadata metadata = new TvShowMetadata();

            // Act
            _service.Save(_path, metadata);

            // Assert
            _metadataRepository.Received()
            .Save(_path, metadata);
        }
        public async Task Get_Always_ReturnsMetadata()
        {
            // Arrange
            TvShowMetadata expectedMetadata = new TvShowMetadata();
            _metadataRepository.Get(_path)
                .Returns(expectedMetadata.ToTask());

            // Act
            TvShowMetadata metadata = await _service.Get(_path);

            // Assert
            Assert.Equal(expectedMetadata, metadata);
        }
Example #7
0
        public async Task Get_Always_ReturnsMetadata()
        {
            // Arrange
            TvShowMetadata expectedMetadata = new TvShowMetadata();

            _metadataRepository.Get(_path)
            .Returns(expectedMetadata.ToTask());

            // Act
            TvShowMetadata metadata = await _service.Get(_path);

            // Assert
            Assert.Equal(expectedMetadata, metadata);
        }
        private async Task UpdateActorsMetadata(string path, TvShowMetadata metadata)
        {
            IEnumerable <Actor> actors = await _metadataUpdater.FindActors(metadata.Id);

            foreach (Actor thetvdbActor in actors)
            {
                ActorMetadata actor = new ActorMetadata
                {
                    Name      = thetvdbActor.Name,
                    Role      = thetvdbActor.Role,
                    Thumb     = TvShowHelper.ExpandImagesUrl(thetvdbActor.Image),
                    ThumbPath = ActorMetadata.GetActorThumbPath(path, thetvdbActor.Name)
                };
                metadata.Actors.Add(actor);
            }
        }
        private TvShowMetadata MapFullSerieToMetadata(FullSerie serie)
        {
            TvShowMetadata metadata = new TvShowMetadata();

            metadata.Genres           = MapGenres(serie);
            metadata.Id               = serie.Id;
            metadata.ImdbId           = serie.ImdbId;
            metadata.Language         = serie.Language;
            metadata.MpaaRating       = serie.ContentRating;
            metadata.Plot             = serie.Overview;
            metadata.Premiered        = serie.FirstAired;
            metadata.Rating           = serie.Rating;
            metadata.RuntimeInMinutes = serie.Runtime;
            //metadata.State = serie.Status;
            metadata.Studio = serie.Network;
            metadata.Title  = serie.SeriesName;

            return(metadata);
        }
 private bool AssertMetadataEqualsViewModel(TvShowMetadata metadata)
 {
     Assert.Equal(metadata.Genres, _viewModel.Genres.Collection);
     Assert.Equal(metadata.Id, _viewModel.Id);
     Assert.Equal(metadata.ImdbId, _viewModel.ImdbId);
     Assert.Equal(metadata.Language, _viewModel.Language);
     Assert.Equal(metadata.MpaaRating, _viewModel.MpaaRating);
     Assert.Equal(metadata.Plot, _viewModel.Plot);
     Assert.Equal(metadata.Premiered, _viewModel.PremieredDate);
     Assert.Equal(metadata.Rating, _viewModel.Rating);
     Assert.Equal(metadata.RuntimeInMinutes, _viewModel.RuntimeInMinutes);
     Assert.Equal(metadata.State, _viewModel.State);
     Assert.Equal(metadata.Studio, _viewModel.Studio);
     Assert.Equal(metadata.Title, _viewModel.Title.Value);
     return true;
 }
 public Task Save(string path, TvShowMetadata metadata)
 {
     return _metadataRepository.Save(path, metadata);
 }
 private async Task UpdateActorsMetadata(string path, TvShowMetadata metadata)
 {
     IEnumerable<Actor> actors = await _metadataUpdater.FindActors(metadata.Id);
     foreach (Actor thetvdbActor in actors)
     {
         ActorMetadata actor = new ActorMetadata
         {
             Name = thetvdbActor.Name,
             Role = thetvdbActor.Role,
             Thumb = TvShowHelper.ExpandImagesUrl(thetvdbActor.Image),
             ThumbPath = ActorMetadata.GetActorThumbPath(path, thetvdbActor.Name)
         };
         metadata.Actors.Add(actor);
     }
 }
        private TvShowMetadata MapFullSerieToMetadata(FullSerie serie)
        {
            TvShowMetadata metadata = new TvShowMetadata();
            metadata.Genres = MapGenres(serie);
            metadata.Id = serie.Id;
            metadata.ImdbId = serie.ImdbId;
            metadata.Language = serie.Language;
            metadata.MpaaRating = serie.ContentRating;
            metadata.Plot = serie.Overview;
            metadata.Premiered = serie.FirstAired;
            metadata.Rating = serie.Rating;
            metadata.RuntimeInMinutes = serie.Runtime;
            //metadata.State = serie.Status;
            metadata.Studio = serie.Network;
            metadata.Title = serie.SeriesName;

            return metadata;
        }
 public Task Save(string path, TvShowMetadata metadata)
 {
     return(_metadataRepository.Save(path, metadata));
 }