jellyfin/Emby.Naming/Common/NamingOptions.cs

765 lines
26 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
using System;
2018-09-12 10:26:21 -07:00
using System.Linq;
using System.Text.RegularExpressions;
2019-01-13 12:17:29 -07:00
using Emby.Naming.Video;
2019-12-06 12:40:06 -07:00
using MediaBrowser.Model.Entities;
2018-09-12 10:26:21 -07:00
namespace Emby.Naming.Common
{
public class NamingOptions
{
public NamingOptions()
{
2019-05-10 11:37:42 -07:00
VideoFileExtensions = new[]
2018-09-12 10:26:21 -07:00
{
".m4v",
".3gp",
".nsv",
".ts",
".ty",
".strm",
".rm",
".rmvb",
".ifo",
".mov",
".qt",
".divx",
".xvid",
".bivx",
".vob",
".nrg",
".img",
".iso",
".pva",
".wmv",
".asf",
".asx",
".ogm",
".m2v",
".avi",
".bin",
".dvr-ms",
".mpg",
".mpeg",
".mp4",
".mkv",
".avc",
".vp3",
".svq3",
".nuv",
".viv",
".dv",
".fli",
".flv",
".001",
".tp"
};
VideoFlagDelimiters = new[]
{
'(',
')',
'-',
'.',
'_',
'[',
']'
};
StubFileExtensions = new[]
{
".disc"
};
StubTypes = new[]
{
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "dvd",
Token = "dvd"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "hddvd",
Token = "hddvd"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "bluray",
Token = "bluray"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "bluray",
Token = "brrip"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "bluray",
Token = "bd25"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "bluray",
Token = "bd50"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "vhs",
Token = "vhs"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "tv",
Token = "HDTV"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "tv",
Token = "PDTV"
2018-09-12 10:26:21 -07:00
},
new StubTypeRule
{
2019-05-10 11:37:42 -07:00
StubType = "tv",
Token = "DSR"
2018-09-12 10:26:21 -07:00
}
};
VideoFileStackingExpressions = new[]
{
"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[0-9]+)(.*?)(\\.[^.]+)$",
"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[a-d])(.*?)(\\.[^.]+)$",
"(.*?)([ ._-]*[a-d])(.*?)(\\.[^.]+)$"
};
CleanDateTimes = new[]
{
2020-08-12 08:02:19 -07:00
@"(.+[^_\,\.\(\)\[\]\-])[_\.\(\)\[\]\-](19[0-9]{2}|20[0-9]{2})(?![0-9]+|\W[0-9]{2}\W[0-9]{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19[0-9]{2}|20[0-9]{2})*",
@"(.+[^_\,\.\(\)\[\]\-])[ _\.\(\)\[\]\-]+(19[0-9]{2}|20[0-9]{2})(?![0-9]+|\W[0-9]{2}\W[0-9]{2})([ _\,\.\(\)\[\]\-][^0-9]|).*(19[0-9]{2}|20[0-9]{2})*"
2018-09-12 10:26:21 -07:00
};
CleanStrings = new[]
{
@"[ _\,\.\(\)\[\]\-](3d|sbs|tab|hsbs|htab|mvc|HDR|HDC|UHD|UltraHD|4k|ac3|dts|custom|dc|divx|divx5|dsr|dsrip|dutch|dvd|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|cd[1-9]|r3|r5|bd5|bd|se|svcd|swedish|german|read.nfo|nfofix|unrated|ws|telesync|ts|telecine|tc|brrip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|2160p|hrhd|hrhdtv|hddvd|bluray|x264|h264|xvid|xvidvd|xxx|www.www|\[.*\])([ _\,\.\(\)\[\]\-]|$)",
2018-09-12 10:26:21 -07:00
@"(\[.*\])"
};
SubtitleFileExtensions = new[]
{
".srt",
".ssa",
".ass",
".sub"
};
SubtitleFlagDelimiters = new[]
{
'.'
};
SubtitleForcedFlags = new[]
{
"foreign",
"forced"
};
SubtitleDefaultFlags = new[]
{
"default"
};
AlbumStackingPrefixes = new[]
{
"disc",
"cd",
"disk",
"vol",
"volume"
};
AudioFileExtensions = new[]
{
".nsv",
".m4a",
".flac",
".aac",
".strm",
".pls",
".rm",
".mpa",
".wav",
".wma",
".ogg",
".opus",
".mp3",
".mp2",
".mod",
".amf",
".669",
".dmf",
".dsm",
".far",
".gdm",
".imf",
".it",
".m15",
".med",
".okt",
".s3m",
".stm",
".sfx",
".ult",
".uni",
".xm",
".sid",
".ac3",
".dts",
".cue",
".aif",
".aiff",
".ape",
".mac",
".mpc",
".mp+",
".mpp",
".shn",
".wv",
".nsf",
".spc",
".gym",
".adplug",
".adx",
".dsp",
".adp",
".ymf",
".ast",
".afc",
".hps",
".xsp",
".acc",
".m4b",
".oga",
".dsf",
".mka"
};
EpisodeExpressions = new[]
{
// *** Begin Kodi Standard Naming
// <!-- foo.s01.e01, foo.s01_e01, S01E02 foo, S01 - E02 -->
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?![Ss]([0-9]+)[][ ._-]*[Ee]([0-9]+))[^\\\/])*)?[Ss](?<seasonnumber>[0-9]+)[][ ._-]*[Ee](?<epnumber>[0-9]+)([^\\/]*)$")
{
IsNamed = true
2019-01-07 16:27:46 -07:00
},
2018-09-12 10:26:21 -07:00
// <!-- foo.ep01, foo.EP_01 -->
new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
{
2019-05-10 11:37:42 -07:00
DateTimeFormats = new[]
2018-09-12 10:26:21 -07:00
{
"yyyy.MM.dd",
"yyyy-MM-dd",
"yyyy_MM_dd"
}
},
new EpisodeExpression("([0-9]{2})[\\.-]([0-9]{2})[\\.-]([0-9]{4})", true)
{
2019-05-10 11:37:42 -07:00
DateTimeFormats = new[]
2018-09-12 10:26:21 -07:00
{
"dd.MM.yyyy",
"dd-MM-yyyy",
"dd_MM_yyyy"
}
},
2019-11-09 12:26:56 -07:00
// This isn't a Kodi naming rule, but the expression below causes false positives,
// so we make sure this one gets tested first.
2019-11-08 11:59:48 -07:00
// "Foo Bar 889"
new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>[\w\s]+?)\s(?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*[^\\\/x]*$")
2019-11-08 11:59:48 -07:00
{
IsNamed = true
},
2018-09-12 10:26:21 -07:00
new EpisodeExpression("[\\\\/\\._ \\[\\(-]([0-9]+)x([0-9]+(?:(?:[a-i]|\\.[1-9])(?![0-9]))?)([^\\\\/]*)$")
{
SupportsAbsoluteEpisodeNumbers = true
},
new EpisodeExpression(@"[\\\\/\\._ -](?<seriesname>(?![0-9]+[0-9][0-9])([^\\\/])*)[\\\\/\\._ -](?<seasonnumber>[0-9]+)(?<epnumber>[0-9][0-9](?:(?:[a-i]|\\.[1-9])(?![0-9]))?)([\\._ -][^\\\\/]*)$")
{
IsOptimistic = true,
IsNamed = true,
SupportsAbsoluteEpisodeNumbers = false
},
new EpisodeExpression("[\\/._ -]p(?:ar)?t[_. -]()([ivx]+|[0-9]+)([._ -][^\\/]*)$")
{
SupportsAbsoluteEpisodeNumbers = true
},
// *** End Kodi Standard Naming
2020-01-11 11:39:11 -07:00
// [bar] Foo - 1 [baz]
new EpisodeExpression(@".*?(\[.*?\])+.*?(?<seriesname>[\w\s]+?)[-\s_]+(?<epnumber>[0-9]+).*$")
2019-11-08 11:59:48 -07:00
{
IsNamed = true
},
new EpisodeExpression(@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]+)[xX](?<epnumber>[0-9]+)[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsNamed = true
},
new EpisodeExpression(@".*(\\|\/)[sS](?<seasonnumber>[0-9]+)[x,X]?[eE](?<epnumber>[0-9]+)[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsNamed = true
},
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?![sS]?[0-9]{1,4}[xX][0-9]{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]+))[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsNamed = true
},
new EpisodeExpression(@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>[0-9]{1,4})[xX\.]?[eE](?<epnumber>[0-9]+)[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsNamed = true
},
// "01.avi"
new EpisodeExpression(@".*[\\\/](?<epnumber>[0-9]+)(-(?<endingepnumber>[0-9]+))*\.\w+$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
},
// "1-12 episode title"
2019-05-10 11:37:42 -07:00
new EpisodeExpression(@"([0-9]+)-([0-9]+)"),
2018-09-12 10:26:21 -07:00
// "01 - blah.avi", "01-blah.avi"
new EpisodeExpression(@".*(\\|\/)(?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*\s?-\s?[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
},
// "01.blah.avi"
new EpisodeExpression(@".*(\\|\/)(?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*\.[^\\\/]+$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
},
// "blah - 01.avi", "blah 2 - 01.avi", "blah - 01 blah.avi", "blah 2 - 01 blah", "blah - 01 - blah.avi", "blah 2 - 01 - blah"
new EpisodeExpression(@".*[\\\/][^\\\/]* - (?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
},
// "01 episode title.avi"
new EpisodeExpression(@"[Ss]eason[\._ ](?<seasonnumber>[0-9]+)[\\\/](?<epnumber>[0-9]{1,3})([^\\\/]*)$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
},
// "Episode 16", "Episode 16 - Title"
new EpisodeExpression(@".*[\\\/][^\\\/]* (?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*[^\\\/]*$")
2018-09-12 10:26:21 -07:00
{
IsOptimistic = true,
IsNamed = true
}
};
EpisodeWithoutSeasonExpressions = new[]
{
@"[/\._ \-]()([0-9]+)(-[0-9]+)?"
};
EpisodeMultiPartExpressions = new[]
{
@"^[-_ex]+([0-9]+(?:(?:[a-i]|\\.[1-9])(?![0-9]))?)"
};
VideoExtraRules = new[]
{
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Trailer,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Filename,
Token = "trailer",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Trailer,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-trailer",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Trailer,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = ".trailer",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Trailer,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "_trailer",
MediaType = MediaType.Video
},
2019-05-10 11:37:42 -07:00
new ExtraRule
2018-09-12 10:26:21 -07:00
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Trailer,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = " trailer",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Sample,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Filename,
Token = "sample",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Sample,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-sample",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Sample,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = ".sample",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Sample,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "_sample",
MediaType = MediaType.Video
},
2019-05-10 11:37:42 -07:00
new ExtraRule
2018-09-12 10:26:21 -07:00
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Sample,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = " sample",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.ThemeSong,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Filename,
Token = "theme",
MediaType = MediaType.Audio
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Scene,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-scene",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Clip,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-clip",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Interview,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-interview",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.BehindTheScenes,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-behindthescenes",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.DeletedScene,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-deleted",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Clip,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-featurette",
MediaType = MediaType.Video
},
new ExtraRule
{
2019-12-06 12:40:06 -07:00
ExtraType = ExtraType.Clip,
2018-09-12 10:26:21 -07:00
RuleType = ExtraRuleType.Suffix,
Token = "-short",
MediaType = MediaType.Video
},
2020-04-01 10:41:52 -07:00
new ExtraRule
{
ExtraType = ExtraType.BehindTheScenes,
RuleType = ExtraRuleType.DirectoryName,
Token = "behind the scenes",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.DeletedScene,
RuleType = ExtraRuleType.DirectoryName,
Token = "deleted scenes",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Interview,
RuleType = ExtraRuleType.DirectoryName,
Token = "interviews",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Scene,
RuleType = ExtraRuleType.DirectoryName,
Token = "scenes",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Sample,
RuleType = ExtraRuleType.DirectoryName,
Token = "samples",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Clip,
RuleType = ExtraRuleType.DirectoryName,
Token = "shorts",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Clip,
RuleType = ExtraRuleType.DirectoryName,
Token = "featurettes",
MediaType = MediaType.Video,
},
new ExtraRule
{
ExtraType = ExtraType.Unknown,
RuleType = ExtraRuleType.DirectoryName,
Token = "extras",
MediaType = MediaType.Video,
},
2018-09-12 10:26:21 -07:00
};
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
Format3DRules = new[]
{
// Kodi rules:
new Format3DRule
{
PreceedingToken = "3d",
Token = "hsbs"
},
new Format3DRule
{
PreceedingToken = "3d",
Token = "sbs"
},
new Format3DRule
{
PreceedingToken = "3d",
Token = "htab"
},
new Format3DRule
{
PreceedingToken = "3d",
Token = "tab"
},
// Media Browser rules:
new Format3DRule
{
Token = "fsbs"
},
new Format3DRule
{
Token = "hsbs"
},
new Format3DRule
{
Token = "sbs"
},
new Format3DRule
{
Token = "ftab"
},
new Format3DRule
{
Token = "htab"
},
new Format3DRule
{
Token = "tab"
},
new Format3DRule
{
Token = "sbs3d"
},
new Format3DRule
{
Token = "mvc"
}
};
AudioBookPartsExpressions = new[]
{
// Detect specified chapters, like CH 01
@"ch(?:apter)?[\s_-]?(?<chapter>[0-9]+)",
2018-09-12 10:26:21 -07:00
// Detect specified parts, like Part 02
@"p(?:ar)?t[\s_-]?(?<part>[0-9]+)",
2018-09-12 10:26:21 -07:00
// Chapter is often beginning of filename
"^(?<chapter>[0-9]+)",
2018-09-12 10:26:21 -07:00
// Part if often ending of filename
"(?<part>[0-9]+)$",
2018-09-12 10:26:21 -07:00
// Sometimes named as 0001_005 (chapter_part)
"(?<chapter>[0-9]+)_(?<part>[0-9]+)",
2018-09-12 10:26:21 -07:00
// Some audiobooks are ripped from cd's, and will be named by disk number.
@"dis(?:c|k)[\s_-]?(?<chapter>[0-9]+)"
2018-09-12 10:26:21 -07:00
};
var extensions = VideoFileExtensions.ToList();
extensions.AddRange(new[]
{
".mkv",
".m2t",
".m2ts",
".img",
".iso",
".mk3d",
".ts",
".rmvb",
".mov",
".avi",
".mpg",
".mpeg",
".wmv",
".mp4",
".divx",
".dvr-ms",
".wtv",
".ogm",
".ogv",
".asf",
".m4v",
".flv",
".f4v",
".3gp",
".webm",
".mts",
".m2v",
".rec",
".mxf"
});
MultipleEpisodeExpressions = new string[]
{
@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})((-| - )[0-9]{1,4}[eExX](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})((-| - )[0-9]{1,4}[xX][eE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})((-| - )?[xXeE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})(-[xE]?[eE]?(?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>((?![sS]?[0-9]{1,4}[xX][0-9]{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3}))((-| - )[0-9]{1,4}[xXeE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>((?![sS]?[0-9]{1,4}[xX][0-9]{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3}))((-| - )[0-9]{1,4}[xX][eE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>((?![sS]?[0-9]{1,4}[xX][0-9]{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3}))((-| - )?[xXeE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>((?![sS]?[0-9]{1,4}[xX][0-9]{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3}))(-[xX]?[eE]?(?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>[0-9]{1,4})[xX\.]?[eE](?<epnumber>[0-9]{1,3})((-| - )?[xXeE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$",
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>[0-9]{1,4})[xX\.]?[eE](?<epnumber>[0-9]{1,3})(-[xX]?[eE]?(?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$"
2018-09-12 10:26:21 -07:00
}.Select(i => new EpisodeExpression(i)
{
IsNamed = true
}).ToArray();
2018-09-12 10:26:21 -07:00
VideoFileExtensions = extensions
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
Compile();
}
2020-01-22 14:18:56 -07:00
public string[] AudioFileExtensions { get; set; }
public string[] AlbumStackingPrefixes { get; set; }
public string[] SubtitleFileExtensions { get; set; }
public char[] SubtitleFlagDelimiters { get; set; }
public string[] SubtitleForcedFlags { get; set; }
public string[] SubtitleDefaultFlags { get; set; }
public EpisodeExpression[] EpisodeExpressions { get; set; }
public string[] EpisodeWithoutSeasonExpressions { get; set; }
public string[] EpisodeMultiPartExpressions { get; set; }
public string[] VideoFileExtensions { get; set; }
public string[] StubFileExtensions { get; set; }
public string[] AudioBookPartsExpressions { get; set; }
public StubTypeRule[] StubTypes { get; set; }
public char[] VideoFlagDelimiters { get; set; }
public Format3DRule[] Format3DRules { get; set; }
public string[] VideoFileStackingExpressions { get; set; }
public string[] CleanDateTimes { get; set; }
public string[] CleanStrings { get; set; }
public EpisodeExpression[] MultipleEpisodeExpressions { get; set; }
public ExtraRule[] VideoExtraRules { get; set; }
2018-09-12 10:26:21 -07:00
public Regex[] VideoFileStackingRegexes { get; private set; }
2020-01-22 14:18:56 -07:00
2018-09-12 10:26:21 -07:00
public Regex[] CleanDateTimeRegexes { get; private set; }
2020-01-22 14:18:56 -07:00
2018-09-12 10:26:21 -07:00
public Regex[] CleanStringRegexes { get; private set; }
public Regex[] EpisodeWithoutSeasonRegexes { get; private set; }
2020-01-22 14:18:56 -07:00
2018-09-12 10:26:21 -07:00
public Regex[] EpisodeMultiPartRegexes { get; private set; }
public void Compile()
{
VideoFileStackingRegexes = VideoFileStackingExpressions.Select(Compile).ToArray();
CleanDateTimeRegexes = CleanDateTimes.Select(Compile).ToArray();
CleanStringRegexes = CleanStrings.Select(Compile).ToArray();
EpisodeWithoutSeasonRegexes = EpisodeWithoutSeasonExpressions.Select(Compile).ToArray();
EpisodeMultiPartRegexes = EpisodeMultiPartExpressions.Select(Compile).ToArray();
}
private Regex Compile(string exp)
{
return new Regex(exp, RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
}
}