|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
@ -16,11 +17,9 @@ namespace NzbDrone.Core.Extras.Others
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
private readonly IRecycleBinProvider _recycleBinProvider;
|
|
|
|
private readonly IRecycleBinProvider _recycleBinProvider;
|
|
|
|
private readonly IMovieService _movieService;
|
|
|
|
|
|
|
|
private readonly IOtherExtraFileService _otherExtraFileService;
|
|
|
|
private readonly IOtherExtraFileService _otherExtraFileService;
|
|
|
|
|
|
|
|
|
|
|
|
public OtherExtraFileRenamer(IOtherExtraFileService otherExtraFileService,
|
|
|
|
public OtherExtraFileRenamer(IOtherExtraFileService otherExtraFileService,
|
|
|
|
IMovieService movieService,
|
|
|
|
|
|
|
|
IRecycleBinProvider recycleBinProvider,
|
|
|
|
IRecycleBinProvider recycleBinProvider,
|
|
|
|
IDiskProvider diskProvider,
|
|
|
|
IDiskProvider diskProvider,
|
|
|
|
Logger logger)
|
|
|
|
Logger logger)
|
|
|
@ -28,7 +27,6 @@ namespace NzbDrone.Core.Extras.Others
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
_recycleBinProvider = recycleBinProvider;
|
|
|
|
_recycleBinProvider = recycleBinProvider;
|
|
|
|
_movieService = movieService;
|
|
|
|
|
|
|
|
_otherExtraFileService = otherExtraFileService;
|
|
|
|
_otherExtraFileService = otherExtraFileService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -41,7 +39,7 @@ namespace NzbDrone.Core.Extras.Others
|
|
|
|
|
|
|
|
|
|
|
|
var relativePath = movie.Path.GetRelativePath(path);
|
|
|
|
var relativePath = movie.Path.GetRelativePath(path);
|
|
|
|
|
|
|
|
|
|
|
|
var otherExtraFile = _otherExtraFileService.FindByPath(relativePath);
|
|
|
|
var otherExtraFile = _otherExtraFileService.GetFilesByMovie(movie.Id).Where(e => e.RelativePath == relativePath).SingleOrDefault();
|
|
|
|
if (otherExtraFile != null)
|
|
|
|
if (otherExtraFile != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var newPath = path + "-orig";
|
|
|
|
var newPath = path + "-orig";
|
|
|
@ -66,7 +64,7 @@ namespace NzbDrone.Core.Extras.Others
|
|
|
|
|
|
|
|
|
|
|
|
var relativePath = movie.Path.GetRelativePath(path);
|
|
|
|
var relativePath = movie.Path.GetRelativePath(path);
|
|
|
|
|
|
|
|
|
|
|
|
var otherExtraFile = _otherExtraFileService.FindByPath(relativePath);
|
|
|
|
var otherExtraFile = _otherExtraFileService.GetFilesByMovie(movie.Id).Where(e => e.RelativePath == relativePath).SingleOrDefault();
|
|
|
|
if (otherExtraFile != null)
|
|
|
|
if (otherExtraFile != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_recycleBinProvider.DeleteFile(path);
|
|
|
|
_recycleBinProvider.DeleteFile(path);
|
|
|
|