public object DeleteMovieFiles([FromBody] MovieFileListResource resource) { var movieFiles = _mediaFileService.GetMovies(resource.MovieFileIds); var movie = _movieService.GetMovie(movieFiles.First().MovieId); foreach (var movieFile in movieFiles) { _mediaFileDeletionService.DeleteMovieFile(movie, movieFile); } return(new { }); }
public object SetMovieFile([FromBody] MovieFileListResource resource) { var movieFiles = _mediaFileService.GetMovies(resource.MovieFileIds); foreach (var movieFile in movieFiles) { if (resource.Quality != null) { movieFile.Quality = resource.Quality; } if (resource.Languages != null) { // Don't allow user to set movieFile with 'Any' or 'Original' language movieFile.Languages = resource.Languages.Where(l => l != Language.Any || l != Language.Original || l != null).ToList(); } if (resource.IndexerFlags != null) { movieFile.IndexerFlags = (IndexerFlags)resource.IndexerFlags.Value; } if (resource.Edition != null) { movieFile.Edition = resource.Edition; } if (resource.ReleaseGroup != null) { movieFile.ReleaseGroup = resource.ReleaseGroup; } if (resource.SceneName != null && SceneChecker.IsSceneTitle(resource.SceneName)) { movieFile.SceneName = resource.SceneName; } } _mediaFileService.Update(movieFiles); var movie = _movieService.GetMovie(movieFiles.First().MovieId); return(Accepted(movieFiles.ConvertAll(f => f.ToResource(movie, _qualityUpgradableSpecification)))); }