mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
EpisodeFile cleanup and deletion fixes
Upgraded episodes will no longer be auto unmonitored EpsiodeFiles will be removed from db if parsing rules have changed EpisodeFiles will be removed from db if they are not in their series' folder (or subfolder)
This commit is contained in:
parent
19fc3bad6c
commit
4c1e6e14aa
11 changed files with 145 additions and 49 deletions
|
@ -35,6 +35,7 @@ namespace NzbDrone.Common
|
|||
bool IsFileLocked(FileInfo file);
|
||||
string GetPathRoot(string path);
|
||||
void SetPermissions(string filename, string account, FileSystemRights Rights, AccessControlType ControlType);
|
||||
bool IsParent(string parentfolder, string subfolder);
|
||||
}
|
||||
|
||||
public class DiskProvider : IDiskProvider
|
||||
|
@ -383,5 +384,26 @@ namespace NzbDrone.Common
|
|||
directorySecurity.AddAccessRule(accessRule);
|
||||
directoryInfo.SetAccessControl(directorySecurity);
|
||||
}
|
||||
|
||||
public bool IsParent(string parent, string subfolder)
|
||||
{
|
||||
parent = parent.TrimEnd(Path.DirectorySeparatorChar);
|
||||
subfolder = subfolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
||||
var diParent = new DirectoryInfo(parent);
|
||||
var diSubfolder = new DirectoryInfo(subfolder);
|
||||
|
||||
while (diSubfolder.Parent != null)
|
||||
{
|
||||
if (diSubfolder.Parent.FullName == diParent.FullName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
diSubfolder = diSubfolder.Parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue