-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to use prefer movie.nfo
- Loading branch information
1 parent
7bd869b
commit 770a1a4
Showing
58 changed files
with
1,010 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
using System.Collections; | ||
using System.Linq; | ||
|
||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Entities.Movies; | ||
using MediaBrowser.Controller.Providers; | ||
using MediaBrowser.Model.Entities; | ||
|
||
using NUnit.Framework; | ||
|
||
namespace NfoMetadata.Tests | ||
{ | ||
public class HelperTests | ||
{ | ||
private class TestItem : Video | ||
{ | ||
} | ||
|
||
[OneTimeSetUp] | ||
public void OneTimeSetup() | ||
{ | ||
BaseItem.MediaSourceManager = new TestMediaSourceManager(); | ||
BaseItem.FileSystem = new TestFileSystem(); | ||
} | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
} | ||
|
||
public static IEnumerable SavePathTestCases_MKV | ||
{ | ||
get | ||
{ | ||
#region MKV (not mix folder) | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Mkv.ToString(), | ||
@"C:\Video\Movies\9 (2009)\9 (2009) - BluRay 1080p DTS x264-Group.mkv", | ||
false, | ||
false | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"C:\Video\Movies\9 (2009)", "9 (2009) - BluRay 1080p DTS x264-Group.nfo"), | ||
(@"C:\Video\Movies\9 (2009)", "movie.nfo") | ||
}); | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Mkv.ToString(), | ||
@"C:\Video\Movies\9 (2009)\9 (2009) - BluRay 1080p DTS x264-Group.mkv", | ||
false, | ||
true | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"C:\Video\Movies\9 (2009)", "movie.nfo"), | ||
(@"C:\Video\Movies\9 (2009)", "9 (2009) - BluRay 1080p DTS x264-Group.nfo") | ||
}); | ||
|
||
#endregion | ||
|
||
#region MKV (Mixed Folder) | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Mkv.ToString(), | ||
@"C:\Video\Movies\9 (2009)\9 (2009) - BluRay 1080p DTS x264-Group.mkv", | ||
true, | ||
false | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"C:\Video\Movies\9 (2009)", "9 (2009) - BluRay 1080p DTS x264-Group.nfo") | ||
}); | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Mkv.ToString(), | ||
@"C:\Video\Movies\9 (2009)\9 (2009) - BluRay 1080p DTS x264-Group.mkv", | ||
true, | ||
true | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"C:\Video\Movies\9 (2009)", "9 (2009) - BluRay 1080p DTS x264-Group.nfo") | ||
}); | ||
|
||
#endregion | ||
} | ||
} | ||
|
||
public static IEnumerable SavePathTestCases_DVD | ||
{ | ||
get | ||
{ | ||
#region Dvd | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Dvd.ToString(), | ||
@"C:\Video\Movies\Léon (1994)", | ||
false, | ||
false | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"C:\Video\Movies\Léon (1994)\VIDEO_TS", "VIDEO_TS.nfo"), | ||
(@"C:\Video\Movies\Léon (1994)", "Léon (1994).nfo") | ||
}); | ||
|
||
#endregion | ||
} | ||
} | ||
|
||
public static IEnumerable SavePathTestCases_BluRay | ||
{ | ||
get | ||
{ | ||
#region BluRay | ||
|
||
yield return | ||
new TestCaseData( | ||
MediaContainer.Bluray.ToString(), | ||
@"E:\Movies\Movies\Alien (1979)", | ||
false, | ||
false | ||
) | ||
.Returns(new[] | ||
{ | ||
(@"E:\Movies\Movies\Alien (1979)\BDMV", "index.nfo"), | ||
(@"E:\Movies\Movies\Alien (1979)", "Alien (1979).nfo") | ||
}); | ||
|
||
#endregion | ||
} | ||
} | ||
|
||
[TestCaseSource(nameof(SavePathTestCases_MKV))] | ||
[TestCaseSource(nameof(SavePathTestCases_DVD))] | ||
[TestCaseSource(nameof(SavePathTestCases_BluRay))] | ||
public (string, string)[] Validate_File_SavePaths(string container, string path, bool isInMixedFolder, bool preferMovieNfo) | ||
{ | ||
var itemInfo = new ItemInfo(new TestItem | ||
{ | ||
Container = container, | ||
Path = path, | ||
IsInMixedFolder = isInMixedFolder, | ||
}); | ||
|
||
var actual = Helpers | ||
.GetMovieSavePaths(itemInfo, new Configuration.XbmcMetadataOptions { PreferMovieNfo = preferMovieNfo }) | ||
.ToArray(); | ||
|
||
return actual; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> | ||
<PackageReference Include="NUnit" Version="4.2.2" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="4.3.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\NfoMetadata\NfoMetadata.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.