From 7778eec709000d434317fdd504735993984cc198 Mon Sep 17 00:00:00 2001 From: Hossy <––Hossy@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:00:35 -0500 Subject: [PATCH] Handle library path locations that are parent paths; Fix fallback library scan to remove artist relative path to prevent not finding new media --- .../Plex/Server/PlexServerService.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Notifications/Plex/Server/PlexServerService.cs b/src/NzbDrone.Core/Notifications/Plex/Server/PlexServerService.cs index 0d8cbf409..ecab8a4ff 100644 --- a/src/NzbDrone.Core/Notifications/Plex/Server/PlexServerService.cs +++ b/src/NzbDrone.Core/Notifications/Plex/Server/PlexServerService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Text.RegularExpressions; using FluentValidation.Results; @@ -119,6 +120,17 @@ private void UpdateSections(Artist artist, List sections, PlexServe return; } + + if (location.Path.IsParentPath(mappedPath.FullPath)) + { + var subfolderPath = location.Path.GetRelativePath(mappedPath.FullPath); + var newArtistRelativePath = Path.Combine(subfolderPath, artistRelativePath); + _logger.Debug("Updating matching section with parent location match, {0}", location.Path); + _logger.Debug("Prepending artist relative path with subfolder : {0} => {1}", artistRelativePath, newArtistRelativePath); + UpdateSectionPath(newArtistRelativePath, section, location, settings); + + return; + } } } @@ -128,7 +140,8 @@ private void UpdateSections(Artist artist, List sections, PlexServe { foreach (var location in section.Locations) { - UpdateSectionPath(artistRelativePath, section, location, settings); + // Do not include artistRelativePath so we trigger a full library scan since we aren't sure where the files actually are! + UpdateSectionPath("", section, location, settings); } } }