mirror of https://github.com/lidarr/Lidarr
Fix HealthCheck Warning for Artist Folders with 'ro'
This commit is contained in:
parent
889b963429
commit
4c916f9186
|
@ -113,6 +113,7 @@ namespace NzbDrone.Common.Test
|
|||
[TestCase(@"C:\Test\", @"C:\Test\mydir")]
|
||||
[TestCase(@"C:\Test\", @"C:\Test\mydir\")]
|
||||
[TestCase(@"C:\Test", @"C:\Test\30.Rock.S01E01.Pilot.avi")]
|
||||
[TestCase(@"C:\", @"C:\Test\30.Rock.S01E01.Pilot.avi")]
|
||||
public void path_should_be_parent(string parentPath, string childPath)
|
||||
{
|
||||
parentPath.AsOsAgnostic().IsParentPath(childPath.AsOsAgnostic()).Should().BeTrue();
|
||||
|
|
|
@ -80,11 +80,11 @@ namespace NzbDrone.Common.Extensions
|
|||
|
||||
public static bool IsParentPath(this string parentPath, string childPath)
|
||||
{
|
||||
if (parentPath != "/")
|
||||
if (parentPath != "/" && !parentPath.EndsWith(":\\"))
|
||||
{
|
||||
parentPath = parentPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||
}
|
||||
if (childPath != "/")
|
||||
if (childPath != "/" && !parentPath.EndsWith(":\\"))
|
||||
{
|
||||
childPath = childPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -251,7 +251,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
|||
video.Add(new XElement("framerate", episodeFile.MediaInfo.VideoFps));
|
||||
video.Add(new XElement("height", episodeFile.MediaInfo.Height));
|
||||
video.Add(new XElement("scantype", episodeFile.MediaInfo.ScanType));
|
||||
video.Add(new XElement("width", episodeFile.MediaInfo.Height));
|
||||
video.Add(new XElement("width", episodeFile.MediaInfo.Width));
|
||||
|
||||
if (episodeFile.MediaInfo.RunTime != null)
|
||||
{
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MountCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly IArtistService _artistService;
|
||||
|
||||
public MountCheck(IDiskProvider diskProvider, ISeriesService seriesService)
|
||||
public MountCheck(IDiskProvider diskProvider, IArtistService artistService)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_seriesService = seriesService;
|
||||
_artistService = artistService;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
// Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution.
|
||||
var mounts = _seriesService.GetAllSeries()
|
||||
.Select(series => _diskProvider.GetMount(series.Path))
|
||||
var mounts = _artistService.GetAllArtists()
|
||||
.Select(artist => _diskProvider.GetMount(artist.Path))
|
||||
.Where(m => m != null && m.MountOptions != null && m.MountOptions.IsReadOnly)
|
||||
.DistinctBy(m => m.RootDirectory)
|
||||
.Where(m => m.MountOptions != null && m.MountOptions.IsReadOnly)
|
||||
.ToList();
|
||||
|
||||
if (mounts.Any())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a series path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#series-mount-ro");
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a artist path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#artist-mount-ro");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
|
|
@ -573,7 +573,6 @@
|
|||
<Compile Include="HealthCheck\Checks\AppDataLocationCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DownloadClientCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\MountCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DroneFactoryCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\ImportMechanismCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\IndexerRssCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\IndexerStatusCheck.cs" />
|
||||
|
|
Loading…
Reference in New Issue