From 4c916f91865f64b0c81684b9f3c2c253d0077a6d Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 7 Oct 2017 23:26:45 -0400 Subject: [PATCH] Fix HealthCheck Warning for Artist Folders with 'ro' --- .../PathExtensionFixture.cs | 1 + .../Extensions/PathExtensions.cs | 4 ++-- .../Metadata/Consumers/Xbmc/XbmcMetadata.cs | 4 ++-- .../HealthCheck/Checks/MountCheck.cs | 18 +++++++++--------- src/NzbDrone.Core/NzbDrone.Core.csproj | 1 - 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs index beedda343..70c75aec4 100644 --- a/src/NzbDrone.Common.Test/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/PathExtensionFixture.cs @@ -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(); diff --git a/src/NzbDrone.Common/Extensions/PathExtensions.cs b/src/NzbDrone.Common/Extensions/PathExtensions.cs index 8a485c253..70c04b773 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -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); } diff --git a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs index 99e384cb9..ca7a366cd 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs @@ -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) { diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs index 263ae2927..91129d1c8 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/MountCheck.cs @@ -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()); diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index d5bfa05c8..27b2ec582 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -573,7 +573,6 @@ -