예제 #1
0
        public void RenameOtherExtraFile(Movie movie, string path)
        {
            if (!_diskProvider.FileExists(path))
            {
                return;
            }

            var relativePath = movie.Path.GetRelativePath(path);

            var otherExtraFile = _otherExtraFileService.GetFilesByMovie(movie.Id).Where(e => e.RelativePath == relativePath).SingleOrDefault();

            if (otherExtraFile != null)
            {
                var newPath = path + "-orig";

                // Recycle an existing -orig file.
                RemoveOtherExtraFile(movie, newPath);

                // Rename the file to .*-orig
                _diskProvider.MoveFile(path, newPath);
                otherExtraFile.RelativePath = relativePath + "-orig";
                otherExtraFile.Extension   += "-orig";
                _otherExtraFileService.Upsert(otherExtraFile);
            }
        }
예제 #2
0
        public override IEnumerable <ExtraFile> MoveFilesAfterRename(Movie movie, List <MovieFile> movieFiles)
        {
            var extraFiles = _otherExtraFileService.GetFilesByMovie(movie.Id);
            var movedFiles = new List <OtherExtraFile>();

            foreach (var movieFile in movieFiles)
            {
                var extraFilesForMovieFile = extraFiles.Where(m => m.MovieFileId == movieFile.Id).ToList();

                foreach (var extraFile in extraFilesForMovieFile)
                {
                    movedFiles.AddIfNotNull(MoveFile(movie, movieFile, extraFile));
                }
            }

            _otherExtraFileService.Upsert(movedFiles);

            return(movedFiles);
        }