add another parser case and allow parsing of seasonless

Add another parser case and we now allow parsing of seasonless series which hopefully should cover more cases of directory structure
This commit is contained in:
Narfinger 2019-10-11 19:24:55 +09:00
parent 45f906c556
commit 4a20260a27
3 changed files with 15 additions and 6 deletions

View File

@ -328,6 +328,10 @@ namespace Emby.Naming.Common
// *** End Kodi Standard Naming
                // [bar] Foo - 1 [baz]
                new EpisodeExpression(@".*?(\[.*?\])+.*?(?<seriesname>(\w+\s)+?)[-\s_]+(?<epnumber>\d{1,3}).*$"){
IsNamed=false,
},
new EpisodeExpression(@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})[^\\\/]*$")
{
IsNamed = true

View File

@ -2487,6 +2487,10 @@ namespace Emby.Server.Implementations.Library
{
episode.ParentIndexNumber = season.IndexNumber;
}
else
{
episode.ParentIndexNumber = 1;
}
if (episode.ParentIndexNumber.HasValue)
{

View File

@ -30,12 +30,13 @@ namespace Emby.Naming.TV
}
[Theory]
[InlineData("/media/Foo/Foo 889.avi", "Foo", 889)]
[InlineData("/media/Foo/Foo 889", "Foo", 889)]
[InlineData("/media/Foo/[Bar] Foo Baz - 11 [1080p]", "Foo Baz", 11)]
public void ParseEpisodeWithoutSeason(string path, string name, int episode)
{
NamingOptions o = new NamingOptions();
EpisodePathParser p = new EpisodePathParser(o);
var res = p.Parse(path, false, null, null, true);
var res = p.Parse(path, true, null, null, true);
Assert.True(res.Success);
Assert.Equal(name, res.SeriesName);