public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem) { if (downloadClientItem == null) { return(Decision.Accept()); } var grabbedHistory = _historyService.FindByDownloadId(downloadClientItem.DownloadId) .Where(h => h.EventType == MovieHistoryEventType.Grabbed) .ToList(); if (grabbedHistory.Empty()) { _logger.Debug("No grabbed history for this download client item"); return(Decision.Accept()); } foreach (var item in grabbedHistory) { if (item.Quality.Quality != Quality.Unknown && item.Quality != localMovie.Quality) { // Log only for info, spec removed due to common webdl/webrip mismatches _logger.Debug("Quality for grabbed release ({0}) does not match the quality of the file ({1})", item.Quality, localMovie.Quality); } } return(Decision.Accept()); }
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem) { var qualityComparer = new QualityModelComparer(localMovie.Movie.Profile); if (localMovie.Movie.MovieFileId > 0) { var movieFile = localMovie.Movie.MovieFile; if (movieFile == null) { _logger.Trace("Unable to get movie file details from the DB. MovieId: {0} MovieFileId: {1}", localMovie.Movie.Id, localMovie.Movie.MovieFileId); return(Decision.Accept()); } var qualityCompare = qualityComparer.Compare(localMovie.Quality.Quality, movieFile.Quality.Quality); if (qualityCompare < 0) { _logger.Debug("This file isn't a quality upgrade for movie. Skipping {0}", localMovie.Path); return(Decision.Reject("Not an upgrade for existing movie file(s)")); } } return(Decision.Accept()); }
public AugmentQualityResult AugmentQuality(LocalMovie localMovie, DownloadClientItem downloadClientItem) { var quality = localMovie.DownloadClientMovieInfo?.Quality; if (quality == null) { return(null); } var sourceConfidence = quality.SourceDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var resolutionConfidence = quality.ResolutionDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var modifierConfidence = quality.ModifierDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var revisionConfidence = quality.RevisionDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; return(new AugmentQualityResult(quality.Quality.Source, sourceConfidence, quality.Quality.Resolution, resolutionConfidence, quality.Quality.Modifier, modifierConfidence, quality.Revision, revisionConfidence)); }
public AugmentQualityResult AugmentQuality(LocalMovie localMovie, DownloadClientItem downloadClientItem) { // Don't try to augment if we can't lookup the grabbed history by downloadId if (downloadClientItem == null) { return(null); } var history = _downloadHistoryService.GetLatestGrab(downloadClientItem.DownloadId); if (history == null) { return(null); } var historyQuality = QualityParser.ParseQuality(history.SourceTitle); var sourceConfidence = historyQuality.SourceDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var resolutionConfidence = historyQuality.ResolutionDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var modifierConfidence = historyQuality.ModifierDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; var revisionConfidence = historyQuality.RevisionDetectionSource == QualityDetectionSource.Name ? Confidence.Tag : Confidence.Fallback; return(new AugmentQualityResult(historyQuality.Quality.Source, sourceConfidence, historyQuality.Quality.Resolution, resolutionConfidence, historyQuality.Quality.Modifier, modifierConfidence, historyQuality.Revision, revisionConfidence)); }
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalMovie localMovie, DownloadClientItem downloadClientItem) { try { var result = spec.IsSatisfiedBy(localMovie, downloadClientItem); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (NotImplementedException e) { _logger.Warn(e, "Spec " + spec.ToString() + " currently does not implement evaluation for movies."); return(null); } catch (Exception e) { //e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); _logger.Error(e, "Couldn't evaluate decision on " + localMovie.Path); return(new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message))); } return(null); }
public void should_use_file_name_for_source_title_if_scene_name_is_null() { var movie = Builder <Movie> .CreateNew().Build(); var movieFile = Builder <MovieFile> .CreateNew() .With(f => f.SceneName = null) .Build(); var localMovie = new LocalMovie() { Movie = movie, Path = @"C:\Test\Unsorted\Movie.2011.mkv" }; var downloadClientItem = new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo { Protocol = DownloadProtocol.Usenet, Id = 1, Name = "sab" }, DownloadId = "abcd" }; Subject.Handle(new MovieImportedEvent(localMovie, movieFile, true, downloadClientItem, "abcd")); Mocker.GetMock <IHistoryRepository>() .Verify(v => v.Insert(It.Is <MovieHistory>(h => h.SourceTitle == Path.GetFileNameWithoutExtension(localMovie.Path)))); }
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem) { if (downloadClientItem == null) { _logger.Debug("No download client item provided, skipping."); return(Decision.Accept()); } var grabbedHistory = _historyService.FindByDownloadId(downloadClientItem.DownloadId) .Where(h => h.EventType == HistoryEventType.Grabbed) .ToList(); if (grabbedHistory.Empty()) { _logger.Debug("No grabbed history for this download client item"); return(Decision.Accept()); } foreach (var item in grabbedHistory) { if (item.Quality.Quality != Quality.Unknown && item.Quality != localMovie.Quality) { _logger.Debug("Quality for grabbed release ({0}) does not match the quality of the file ({1})", item.Quality, localMovie.Quality); //return Decision.Reject("File quality does not match quality of the grabbed release"); return(Decision.Accept()); } } return(Decision.Accept()); }
public LocalMovie Augment(LocalMovie localMovie, DownloadClientItem downloadClientItem, bool otherFiles) { var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localMovie.Path)); if (localMovie.DownloadClientMovieInfo == null && localMovie.FolderMovieInfo == null && localMovie.FileMovieInfo == null) { if (isMediaFile) { throw new AugmentingFailedException("Unable to parse movie info from path: {0}", localMovie.Path); } } localMovie.Size = _diskProvider.GetFileSize(localMovie.Path); if (isMediaFile && (!localMovie.ExistingFile || _configService.EnableMediaInfo)) { localMovie.MediaInfo = _videoFileInfoReader.GetMediaInfo(localMovie.Path); } foreach (var augmenter in _augmenters) { try { augmenter.Aggregate(localMovie, downloadClientItem, otherFiles); } catch (Exception ex) { _logger.Warn(ex, ex.Message); } } return(localMovie); }
public Decision IsSatisfiedBy(LocalMovie localMovie) { if (localMovie.ExistingFile) { return(Decision.Accept()); } var dirInfo = new FileInfo(localMovie.Path).Directory; if (dirInfo == null) { return(Decision.Accept()); } var folderInfo = Parser.Parser.ParseTitle(dirInfo.Name); if (folderInfo == null) { return(Decision.Accept()); } if (folderInfo.FullSeason) { return(Decision.Accept()); } return(Decision.Accept()); }
public void should_delete_folder_if_files_were_imported_and_only_sample_files_remain() { GivenValidMovie(); var localMovie = new LocalMovie(); var imported = new List <ImportDecision>(); imported.Add(new ImportDecision(localMovie)); Mocker.GetMock <IMakeImportDecision>() .Setup(s => s.GetImportDecisions(It.IsAny <List <string> >(), It.IsAny <Movie>(), null, true)) .Returns(imported); Mocker.GetMock <IImportApprovedMovie>() .Setup(s => s.Import(It.IsAny <List <ImportDecision> >(), true, null, ImportMode.Auto)) .Returns(imported.Select(i => new ImportResult(i)).ToList()); Mocker.GetMock <IDetectSample>() .Setup(s => s.IsSample(It.IsAny <Movie>(), It.IsAny <QualityModel>(), It.IsAny <string>(), It.IsAny <long>(), It.IsAny <bool>())) .Returns(true); Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory)); Mocker.GetMock <IDiskProvider>() .Verify(v => v.DeleteFolder(It.IsAny <string>(), true), Times.Once()); }
public List <ImportDecision> GetImportDecisions(List <string> videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource, bool filterExistingFiles) { var newFiles = filterExistingFiles ? _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie) : videoFiles.ToList(); _logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count); ParsedMovieInfo downloadClientItemInfo = null; if (downloadClientItem != null) { downloadClientItemInfo = Parser.Parser.ParseMovieTitle(downloadClientItem.Title); downloadClientItemInfo = _parsingService.EnhanceMovieInfo(downloadClientItemInfo); } var nonSampleVideoFileCount = GetNonSampleVideoFileCount(newFiles, movie); var decisions = new List <ImportDecision>(); foreach (var file in newFiles) { var localMovie = new LocalMovie { Movie = movie, DownloadClientMovieInfo = downloadClientItemInfo, FolderMovieInfo = folderInfo, Path = file, SceneSource = sceneSource, ExistingFile = movie.Path.IsParentPath(file) }; decisions.AddIfNotNull(GetDecision(localMovie, downloadClientItem, nonSampleVideoFileCount > 1)); } return(decisions); }
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem) { if (localMovie.ExistingFile) { return(Decision.Accept()); } var dirInfo = new FileInfo(localMovie.Path).Directory; if (dirInfo == null) { return(Decision.Accept()); } //TODO: Actually implement this!!!! /*var folderInfo = Parser.Parser.ParseMovieTitle(dirInfo.Name, false); * * if (folderInfo == null) * { * return Decision.Accept(); * }*/ return(Decision.Accept()); }
public void should_not_delete_folder_if_files_were_imported_and_video_files_remain() { GivenValidMovie(); var localMovie = new LocalMovie(); var imported = new List <ImportDecision>(); imported.Add(new ImportDecision(localMovie)); Mocker.GetMock <IMakeImportDecision>() .Setup(s => s.GetImportDecisions(It.IsAny <List <string> >(), It.IsAny <Movie>(), It.IsAny <DownloadClientItem>(), null, true)) .Returns(imported); Mocker.GetMock <IImportApprovedMovie>() .Setup(s => s.Import(It.IsAny <List <ImportDecision> >(), true, null, ImportMode.Auto)) .Returns(imported.Select(i => new ImportResult(i)).ToList()); Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory)); Mocker.GetMock <IDiskProvider>() .Verify(v => v.DeleteFolder(It.IsAny <string>(), true), Times.Never()); ExceptionVerification.ExpectedWarns(1); }
public void should_use_folder_if_folder_import() { GivenValidMovie(); var folderName = @"C:\media\ba09030e-1234-1234-1234-123456789abc\[HorribleSubs] American Psycho (2000) [720p]".AsOsAgnostic(); var fileName = @"C:\media\ba09030e-1234-1234-1234-123456789abc\[HorribleSubs] American Psycho (2000) [720p]\[HorribleSubs] American Psycho (2000) [720p].mkv".AsOsAgnostic(); Mocker.GetMock <IDiskProvider>().Setup(c => c.FolderExists(folderName)) .Returns(true); Mocker.GetMock <IDiskProvider>().Setup(c => c.GetFiles(folderName, SearchOption.TopDirectoryOnly)) .Returns(new[] { fileName }); var localMovie = new LocalMovie(); var imported = new List <ImportDecision>(); imported.Add(new ImportDecision(localMovie)); Subject.ProcessPath(fileName); Mocker.GetMock <IMakeImportDecision>() .Verify(s => s.GetImportDecisions(It.IsAny <List <string> >(), It.IsAny <Movie>(), It.IsAny <ParsedMovieInfo>(), true, false), Times.Once()); }
public void Setup() { _series = Builder <Movie> .CreateNew() .With(s => s.Path = @"C:\Test\TV\Series".AsOsAgnostic()) .Build(); _episodeFile = Builder <MovieFile> .CreateNew() .With(f => f.Path = null) .With(f => f.RelativePath = @"Season 1\File.avi") .Build(); _localEpisode = Builder <LocalMovie> .CreateNew() .With(l => l.Movie = _series) .Build(); Mocker.GetMock <IBuildFileNames>() .Setup(s => s.BuildFileName(It.IsAny <Movie>(), It.IsAny <MovieFile>(), null)) .Returns("File Name"); Mocker.GetMock <IBuildFileNames>() .Setup(s => s.BuildFilePath(It.IsAny <Movie>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(@"C:\Test\TV\Series\File Name.avi".AsOsAgnostic()); var rootFolder = @"C:\Test\TV\".AsOsAgnostic(); Mocker.GetMock <IDiskProvider>() .Setup(s => s.FolderExists(rootFolder)) .Returns(true); Mocker.GetMock <IDiskProvider>() .Setup(s => s.FileExists(It.IsAny <string>())) .Returns(true); }
public Decision IsSatisfiedBy(LocalMovie localMovie, DownloadClientItem downloadClientItem) { if (localMovie.ExistingFile) { _logger.Debug("{0} is in movie folder, skipping unpacking check", localMovie.Path); return(Decision.Accept()); } foreach (var workingFolder in _configService.DownloadClientWorkingFolders.Split('|')) { DirectoryInfo parent = Directory.GetParent(localMovie.Path); while (parent != null) { if (parent.Name.StartsWith(workingFolder)) { if (OsInfo.IsNotWindows) { _logger.Debug("{0} is still being unpacked", localMovie.Path); return(Decision.Reject("File is still being unpacked")); } if (_diskProvider.FileGetLastWrite(localMovie.Path) > DateTime.UtcNow.AddMinutes(-5)) { _logger.Debug("{0} appears to be unpacking still", localMovie.Path); return(Decision.Reject("File is still being unpacked")); } } parent = parent.Parent; } } return(Decision.Accept()); }
public void Setup() { _localMovie = new LocalMovie { Path = @"C:\Test\Downloaded\somemovie.avi".AsOsAgnostic() }; }
public LocalMovie Aggregate(LocalMovie localMovie, DownloadClientItem downloadClientItem, bool otherFiles) { var languages = new List <Language> { localMovie.Movie?.OriginalLanguage ?? Language.Unknown }; var languagesConfidence = Confidence.Default; foreach (var augmentLanguage in _augmentLanguages) { var augmentedLanguage = augmentLanguage.AugmentLanguage(localMovie, downloadClientItem); if (augmentedLanguage == null) { continue; } _logger.Trace("Considering Languages {0} ({1}) from {2}", string.Join(", ", augmentedLanguage.Languages ?? new List <Language>()), augmentedLanguage.Confidence, augmentLanguage.Name); if (augmentedLanguage?.Languages != null && augmentedLanguage.Languages.Count > 0 && !(augmentedLanguage.Languages.Count == 1 && augmentedLanguage.Languages.Contains(Language.Unknown))) { languages = augmentedLanguage.Languages; languagesConfidence = augmentedLanguage.Confidence; } } _logger.Debug("Selected languages: {0}", string.Join(", ", languages.ToList())); localMovie.Languages = languages; return(localMovie); }
public void should_not_delete_if_no_files_were_imported() { GivenValidMovie(); var localMovie = new LocalMovie(); var imported = new List <ImportDecision>(); imported.Add(new ImportDecision(localMovie)); Mocker.GetMock <IMakeImportDecision>() .Setup(s => s.GetImportDecisions(It.IsAny <List <string> >(), It.IsAny <Movie>(), It.IsAny <DownloadClientItem>(), null, true)) .Returns(imported); Mocker.GetMock <IImportApprovedMovie>() .Setup(s => s.Import(It.IsAny <List <ImportDecision> >(), true, null, ImportMode.Auto)) .Returns(new List <ImportResult>()); Mocker.GetMock <IDetectSample>() .Setup(s => s.IsSample(It.IsAny <Movie>(), It.IsAny <string>())) .Returns(DetectSampleResult.Sample); Mocker.GetMock <IDiskProvider>() .Setup(s => s.GetFileSize(It.IsAny <string>())) .Returns(15.Megabytes()); Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory)); Mocker.GetMock <IDiskProvider>() .Verify(v => v.DeleteFolder(It.IsAny <string>(), true), Times.Never()); }
private ImportDecision GetDecision(LocalMovie localMovie, DownloadClientItem downloadClientItem) { var reasons = _specifications.Select(c => EvaluateSpec(c, localMovie, downloadClientItem)) .Where(c => c != null); return(new ImportDecision(localMovie, reasons.ToArray())); }
public ManualImportItem ReprocessItem(string path, string downloadId, int movieId, string releaseGroup, QualityModel quality, List <Language> languages) { var rootFolder = Path.GetDirectoryName(path); var movie = _movieService.GetMovie(movieId); var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem; var languageParse = LanguageParser.ParseLanguages(path); if (languageParse.Count <= 1 && languageParse.First() == Language.Unknown && movie != null) { languageParse = new List <Language> { movie.OriginalLanguage }; _logger.Debug("Language couldn't be parsed from release, fallback to movie original language: {0}", movie.OriginalLanguage.Name); } var localEpisode = new LocalMovie { Movie = movie, FileMovieInfo = Parser.Parser.ParseMoviePath(path), DownloadClientMovieInfo = downloadClientItem == null ? null : Parser.Parser.ParseMovieTitle(downloadClientItem.Title), Path = path, SceneSource = SceneSource(movie, rootFolder), ExistingFile = movie.Path.IsParentPath(path), Size = _diskProvider.GetFileSize(path), Languages = (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? languageParse : languages, Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality, ReleaseGroup = releaseGroup.IsNullOrWhiteSpace() ? Parser.Parser.ParseReleaseGroup(path) : releaseGroup, }; return(MapItem(_importDecisionMaker.GetDecision(localEpisode, downloadClientItem), rootFolder, downloadId, null)); }
private string GetSceneName(DownloadClientItem downloadClientItem, LocalMovie localMovie) { if (downloadClientItem != null) { var sceneNameTitle = SceneChecker.GetSceneTitle(downloadClientItem.Title); if (sceneNameTitle != null) { return(sceneNameTitle); } } var fileName = Path.GetFileNameWithoutExtension(localMovie.Path.CleanFilePath()); var sceneNameFile = SceneChecker.GetSceneTitle(fileName); if (sceneNameFile != null) { return(sceneNameFile); } var folderTitle = localMovie.FolderMovieInfo?.ReleaseTitle; if (folderTitle.IsNotNullOrWhiteSpace() && SceneChecker.IsSceneTitle(folderTitle)) { return(folderTitle); } return(null); }
private ManualImportItem ProcessFile(string rootFolder, string baseFolder, string file, string downloadId, Movie movie = null) { var trackedDownload = GetTrackedDownload(downloadId); var relativeFile = baseFolder.GetRelativePath(file); if (movie == null) { _parsingService.GetMovie(relativeFile.Split('\\', '/')[0]); } if (movie == null) { movie = _parsingService.GetMovie(relativeFile); } if (trackedDownload != null && movie == null) { movie = trackedDownload?.RemoteMovie?.Movie; } if (movie == null) { var relativeParseInfo = Parser.Parser.ParseMoviePath(relativeFile); if (relativeParseInfo != null) { movie = _movieService.FindByTitle(relativeParseInfo.MovieTitle, relativeParseInfo.Year); } } if (movie == null) { var localMovie = new LocalMovie(); localMovie.Path = file; localMovie.Quality = QualityParser.ParseQuality(file); localMovie.Languages = LanguageParser.ParseLanguages(file); localMovie.Size = _diskProvider.GetFileSize(file); return(MapItem(new ImportDecision(localMovie, new Rejection("Unknown Movie")), rootFolder, downloadId, null)); } var importDecisions = _importDecisionMaker.GetImportDecisions(new List <string> { file }, movie, trackedDownload?.DownloadItem, null, SceneSource(movie, baseFolder)); if (importDecisions.Any()) { return(MapItem(importDecisions.First(), rootFolder, downloadId, null)); } return(new ManualImportItem { DownloadId = downloadId, Path = file, RelativePath = rootFolder.GetRelativePath(file), Name = Path.GetFileNameWithoutExtension(file), Rejections = new List <Rejection>() }); }
//TODO add some good tests for this! public void Execute(UpdateMovieFileQualityCommand command) { var movieFiles = _mediaFileService.GetMovies(command.MovieFileIds); var count = 1; foreach (var movieFile in movieFiles) { _logger.ProgressInfo("Updating quality for {0}/{1} files.", count, movieFiles.Count); var history = _historyService.FindByMovieId(movieFile.MovieId).OrderByDescending(h => h.Date); var latestImported = history.FirstOrDefault(h => h.EventType == HistoryEventType.DownloadFolderImported); var latestImportedName = latestImported?.SourceTitle; var latestGrabbed = history.FirstOrDefault(h => h.EventType == HistoryEventType.Grabbed); var sizeMovie = new LocalMovie(); sizeMovie.Size = movieFile.Size; var helpers = new List <object> { sizeMovie }; if (movieFile.MediaInfo != null) { helpers.Add(movieFile.MediaInfo); } if (latestGrabbed != null) { helpers.Add(latestGrabbed); } ParsedMovieInfo parsedMovieInfo = null; if (latestImportedName?.IsNotNullOrWhiteSpace() == true) { parsedMovieInfo = _parsingService.ParseMovieInfo(latestImportedName, helpers); } if (parsedMovieInfo == null) { _logger.Debug("Could not parse movie info from history source title, using current path instead: {0}.", movieFile.RelativePath); parsedMovieInfo = _parsingService.ParseMovieInfo(movieFile.RelativePath, helpers); } //Only update Custom formats for now. if (parsedMovieInfo != null) { movieFile.Quality.CustomFormats = parsedMovieInfo.Quality.CustomFormats; _mediaFileService.Update(movieFile); _eventAggregator.PublishEvent(new MovieFileUpdatedEvent(movieFile)); } else { _logger.Warn("Could not update custom formats for {0}, since it's title could not be parsed!", movieFile); } count++; } }
public MovieImportedEvent(LocalMovie movieInfo, MovieFile importedMovie, bool newDownload, DownloadClientItem downloadClientItem, string downloadId) { MovieInfo = movieInfo; ImportedMovie = importedMovie; NewDownload = newDownload; DownloadClientInfo = downloadClientItem.DownloadClientInfo; DownloadId = downloadId; }
private ManualImportItem ProcessFile(string file, string downloadId, string folder = null) { if (folder.IsNullOrWhiteSpace()) { folder = new FileInfo(file).Directory.FullName; } DownloadClientItem downloadClientItem = null; var relativeFile = folder.GetRelativePath(file); var movie = _parsingService.GetMovie(relativeFile.Split('\\', '/')[0]); if (movie == null) { movie = _parsingService.GetMovie(relativeFile); } if (downloadId.IsNotNullOrWhiteSpace()) { var trackedDownload = _trackedDownloadService.Find(downloadId); downloadClientItem = trackedDownload.DownloadItem; if (movie == null) { movie = trackedDownload.RemoteMovie.Movie; } } if (movie == null) { var localMovie = new LocalMovie() { Path = file, Quality = QualityParser.ParseQuality(file), Size = _diskProvider.GetFileSize(file) }; return(MapItem(new ImportDecision(localMovie, new Rejection("Unknown Movie")), folder, downloadId)); } var importDecisions = _importDecisionMaker.GetImportDecisions(new List <string> { file }, movie, downloadClientItem, null, SceneSource(movie, folder), true); return(importDecisions.Any() ? MapItem(importDecisions.First(), folder, downloadId) : new ManualImportItem { DownloadId = downloadId, Path = file, RelativePath = folder.GetRelativePath(file), Name = Path.GetFileNameWithoutExtension(file), Rejections = new List <Rejection> { new Rejection("Unable to process file") } }); }
public void Setup() { _localMovie = Builder <LocalMovie> .CreateNew() .With(l => l.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic()) .With(l => l.FileMovieInfo = Builder <ParsedMovieInfo> .CreateNew() .Build()) .Build(); }
public MovieImportedEvent(LocalMovie episodeInfo, MovieFile importedMovie, bool newDownload, string downloadClient, string downloadId, bool isReadOnly) { MovieInfo = episodeInfo; ImportedMovie = importedMovie; NewDownload = newDownload; DownloadClient = downloadClient; DownloadId = downloadId; IsReadOnly = isReadOnly; }
public void Setup() { _localMovie = Builder <LocalMovie> .CreateNew() .With(l => l.Quality = new QualityModel(Quality.Bluray720p)) .Build(); _downloadClientItem = Builder <DownloadClientItem> .CreateNew() .Build(); }
public MovieDownloadedEvent(LocalMovie movie, MovieFile movieFile, List <MovieFile> oldFiles, DownloadClientItem downloadClientItem) { Movie = movie; MovieFile = movieFile; OldFiles = oldFiles; if (downloadClientItem != null) { DownloadId = downloadClientItem.DownloadId; } }