Fixed: Recycle Metadata files on episode removal.

Taloth Saldono 7 years ago committed by Taloth
parent 52588509ed
commit 3573e631c8

@ -49,8 +49,6 @@ namespace NzbDrone.Core.Extras.Files
_logger = logger;
}
public virtual bool PermanentlyDelete => false;
public List<TExtraFile> GetFilesBySeries(int seriesId)
{
return _repository.GetFilesBySeries(seriesId);
@ -122,17 +120,9 @@ namespace NzbDrone.Core.Extras.Files
if (_diskProvider.FileExists(path))
{
if (PermanentlyDelete)
{
_diskProvider.DeleteFile(path);
}
else
{
// Send extra files to the recycling bin so they can be recovered if necessary
var subfolder = _diskProvider.GetParentFolder(series.Path).GetRelativePath(_diskProvider.GetParentFolder(path));
_recycleBinProvider.DeleteFile(path, subfolder);
}
// Send to the recycling bin so they can be recovered if necessary
var subfolder = _diskProvider.GetParentFolder(series.Path).GetRelativePath(_diskProvider.GetParentFolder(path));
_recycleBinProvider.DeleteFile(path, subfolder);
}
}
}

@ -16,7 +16,5 @@ namespace NzbDrone.Core.Extras.Metadata.Files
: base(repository, seriesService, diskProvider, recycleBinProvider, logger)
{
}
public override bool PermanentlyDelete => true;
}
}

@ -19,6 +19,7 @@ namespace NzbDrone.Core.Extras.Metadata
{
private readonly IMetadataFactory _metadataFactory;
private readonly ICleanMetadataService _cleanMetadataService;
private readonly IRecycleBinProvider _recycleBinProvider;
private readonly IDiskTransferService _diskTransferService;
private readonly IDiskProvider _diskProvider;
private readonly IHttpClient _httpClient;
@ -29,6 +30,7 @@ namespace NzbDrone.Core.Extras.Metadata
public MetadataService(IConfigService configService,
IDiskProvider diskProvider,
IDiskTransferService diskTransferService,
IRecycleBinProvider recycleBinProvider,
IMetadataFactory metadataFactory,
ICleanMetadataService cleanMetadataService,
IHttpClient httpClient,
@ -39,6 +41,7 @@ namespace NzbDrone.Core.Extras.Metadata
{
_metadataFactory = metadataFactory;
_cleanMetadataService = cleanMetadataService;
_recycleBinProvider = recycleBinProvider;
_diskTransferService = diskTransferService;
_diskProvider = diskProvider;
_httpClient = httpClient;
@ -443,11 +446,11 @@ namespace NzbDrone.Core.Extras.Metadata
_logger.Debug("Removing duplicate Metadata file: {0}", path);
_diskProvider.DeleteFile(path);
var subfolder = _diskProvider.GetParentFolder(series.Path).GetRelativePath(_diskProvider.GetParentFolder(path));
_recycleBinProvider.DeleteFile(path, subfolder);
_metadataFileService.Delete(file.Id);
}
return matchingMetadataFiles.First();
}
}

Loading…
Cancel
Save