mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Relative episode file paths
This commit is contained in:
parent
10fc875715
commit
6671934c0f
63 changed files with 571 additions and 464 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
|
@ -39,25 +40,20 @@ namespace NzbDrone.Core.MediaFiles
|
|||
|
||||
foreach (var episodeFile in seriesFile)
|
||||
{
|
||||
var episodeFilePath = Path.Combine(series.Path, episodeFile.RelativePath);
|
||||
|
||||
try
|
||||
{
|
||||
if (!_diskProvider.FileExists(episodeFile.Path))
|
||||
if (!_diskProvider.FileExists(episodeFilePath))
|
||||
{
|
||||
_logger.Debug("File [{0}] no longer exists on disk, removing from db", episodeFile.Path);
|
||||
_logger.Debug("File [{0}] no longer exists on disk, removing from db", episodeFilePath);
|
||||
_mediaFileService.Delete(episodeFile);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!series.Path.IsParentPath(episodeFile.Path))
|
||||
{
|
||||
_logger.Debug("File [{0}] does not belong to this series, removing from db", episodeFile.Path);
|
||||
_mediaFileService.Delete(episodeFile);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!episodes.Any(e => e.EpisodeFileId == episodeFile.Id))
|
||||
{
|
||||
_logger.Debug("File [{0}] is not assigned to any episodes, removing from db", episodeFile.Path);
|
||||
_logger.Debug("File [{0}] is not assigned to any episodes, removing from db", episodeFilePath);
|
||||
_mediaFileService.Delete(episodeFile);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue