Skip to content

Commit

Permalink
🐛 fixed false positive movie versions if in subdirectory that doesn't…
Browse files Browse the repository at this point in the history
… contain movie-title
  • Loading branch information
redinsch committed Jan 31, 2025
1 parent 785e193 commit f6ca2b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public DiscoveryMovieServiceShould()
[InlineData("/media/Movies/Hunger Games - Directors Cut.mp4", "Hunger Games - Directors Cut", null)]
[InlineData("/media/Movies/Hunger Games - Directors Cut (2024).mkv", "Hunger Games - Directors Cut", null)]
[InlineData("/media/Movies/This is - Movie Name/This is - Movie Name.mp4", "This is - Movie Name", "/media/Movies/This is - Movie Name")]
[InlineData("/media/Movies/3D/This is - Movie Name-3D-HSBS.mkv", "This is - Movie Name", "/media/Movies/3D")]
[InlineData("/media/Movies/3D/This is - Movie Name-3D-HSBS.mkv", "This is - Movie Name", null)]
[InlineData("/media/Movies/Hunger Games (german) - 3d-hou.mkv", "Hunger Games", null)]
[InlineData("/media/Movies/Crouching.Tiger.Hidden.Dragon.4K.UltraHD.HDR.BDrip-HDC.mkv", "Crouching Tiger Hidden Dragon", null)]
[InlineData("/media/Movies/Divergent 3: Allegiant/Divergent 3: Allegiant.mp4", "Divergent 3: Allegiant", "/media/Movies/Divergent 3: Allegiant")]
Expand Down
2 changes: 1 addition & 1 deletion OpenMediaServer/Services/DiscoveryMovieService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public async Task CreateMovie(string path)

string? folderPath = null;

if (!string.IsNullOrEmpty(folderTitle))
if (!string.IsNullOrEmpty(folderTitle) && title.StartsWith(folderTitle))
{
folderPath = Path.Combine(parts.Take(parts.Length - 1).Prepend(Globals.MediaFolder).ToArray());
existingMovie = movies?.Where(i => i.FolderPath == folderPath).FirstOrDefault();
Expand Down

0 comments on commit f6ca2b7

Please sign in to comment.