private async Task MoveActorImagePath(IActorViewModel actor) { string newActorPath = ActorMetadata.GetActorThumbPath(_path, actor.Name.Value); await _fileSystemService.MoveFile(actor.ThumbPath.Path, newActorPath); actor.ThumbPath.Path = newActorPath; }
private async Task SaveActorMetadata(ActorMetadata actor) { if (!await _fileSystemService.FileExists(actor.ThumbPath) && !string.IsNullOrEmpty(actor.Thumb)) { await _fileSystemService.DownloadImage(actor.ThumbPath, actor.Thumb); } }
private TvShowMetadata CreateMetadata() { TvShowMetadata metadata = new TvShowMetadata { State = State, Title = Title.Value, Id = Id, MpaaRating = MpaaRating, ImdbId = ImdbId, Plot = Plot, RuntimeInMinutes = RuntimeInMinutes, Rating = Rating, Premiered = PremieredDate, Studio = Studio, Language = Language, Genres = new List <string>(Genres.Collection) }; metadata.Actors = new List <ActorMetadata>(); foreach (IActorViewModel actorViewModel in ActorManager.Actors) { ActorMetadata actor = new ActorMetadata { Name = actorViewModel.Name.Value, Role = actorViewModel.Role.Value, Thumb = actorViewModel.ThumbUrl, ThumbPath = actorViewModel.ThumbPath.Path }; metadata.Actors.Add(actor); } return(metadata); }
private void SetActorsThumbPath(string path, MovieMetadata metadata) { string movieFolder = _fileSystemService.GetParentFolder(path, 1); foreach (ActorMetadata actor in metadata.Actors) { actor.ThumbPath = ActorMetadata.GetActorThumbPath(movieFolder, actor.Name); } }
private async Task SaveActorsThumbnails(string path, IEnumerable <ActorMetadata> actors) { string actorFolder = ActorMetadata.GetActorsFolder(path); await _fileSystemService.CreateFolder(actorFolder); foreach (ActorMetadata actor in actors) { await SaveActorMetadata(actor); } }
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 static void UpdateActors(MovieMetadata metadata, string movieFolder, IEnumerable <Cast> actors) { foreach (Cast themoviedbActor in actors) { ActorMetadata actor = new ActorMetadata { Name = themoviedbActor.Name, Role = themoviedbActor.Character, Thumb = themoviedbActor.ProfilePath, ThumbPath = ActorMetadata.GetActorThumbPath(movieFolder, themoviedbActor.Name) }; metadata.Actors.Add(actor); } }
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); } }
public async Task Get_WithActors_SetsActorThumbnailPath() { // Arrange MovieMetadata metadata = new MovieMetadata(); ActorMetadata actor = new ActorMetadata { Name = "Michael Cera" }; metadata.Actors.Add(actor); _metadataRepository.Get(MovieFile) .Returns(metadata.ToTask()); _fileSystemService.GetParentFolder(MovieFile, 1) .Returns(@"C:\Folder\Movies\Scott Pilgrim Vs. The World\"); // Act MovieMetadata actualMetadata = await _service.Get(MovieFile); // Assert Assert.NotEmpty(actualMetadata.Actors); ActorMetadata firstActor = actualMetadata.Actors.First(); Assert.Equal(@"C:\Folder\Movies\Scott Pilgrim Vs. The World\.actors\Michael_Cera.jpg", firstActor.ThumbPath); }
private MovieMetadata CreateMetadata() { MovieMetadata metadata = new MovieMetadata { Certification = Certification, Credits = Credits.Collection.ToList(), Directors = Directors.Collection.ToList(), FileInformation = FileInformation, Genres = Genres.Collection.ToList(), Id = Id, OriginalTitle = OriginalTitle, Outline = Outline, PlayCount = PlayCount, Plot = Plot, Premiered = PremieredDate, Rating = Rating, RuntimeInMinutes = RuntimeInMinutes, Country = Country, SetName = SetName.Value, Studio = Studio, Tagline = Tagline, Title = Title.Value, Year = Year }; metadata.Actors = new List <ActorMetadata>(); foreach (IActorViewModel actorViewModel in ActorManager.Actors) { ActorMetadata actor = new ActorMetadata { Name = actorViewModel.Name.Value, Role = actorViewModel.Role.Value, Thumb = actorViewModel.ThumbUrl, ThumbPath = actorViewModel.ThumbPath.Path }; metadata.Actors.Add(actor); } return(metadata); }
private static void UpdateActors(MovieMetadata metadata, string movieFolder, IEnumerable<Cast> actors) { foreach (Cast themoviedbActor in actors) { ActorMetadata actor = new ActorMetadata { Name = themoviedbActor.Name, Role = themoviedbActor.Character, Thumb = themoviedbActor.ProfilePath, ThumbPath = ActorMetadata.GetActorThumbPath(movieFolder, themoviedbActor.Name) }; metadata.Actors.Add(actor); } }
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); } }