aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming
diff options
context:
space:
mode:
authorTthecreator <epostvanthomas@kpnmail.nl>2019-01-22 15:22:42 +0000
committerGitHub <noreply@github.com>2019-01-22 15:22:42 +0000
commit189b99df16bd4c93cc96422d7282d01d9ff5b82f (patch)
tree26d7da95fe3e3b2772b8b39a2463a6c0ac7652fc /Emby.Naming
parenta00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff)
parentedcfd8b565f632088c8b1f826db8e2fbecf9790d (diff)
Merge pull request #1 from jellyfin/dev
Update from jellyfin repo
Diffstat (limited to 'Emby.Naming')
-rw-r--r--Emby.Naming/Audio/AlbumParser.cs6
-rw-r--r--Emby.Naming/Audio/AudioFileParser.cs2
-rw-r--r--Emby.Naming/Audio/MultiPartResult.cs1
-rw-r--r--Emby.Naming/AudioBook/AudioBookFileInfo.cs2
-rw-r--r--Emby.Naming/AudioBook/AudioBookFilePathParser.cs13
-rw-r--r--Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs4
-rw-r--r--Emby.Naming/AudioBook/AudioBookInfo.cs3
-rw-r--r--Emby.Naming/AudioBook/AudioBookListResolver.cs2
-rw-r--r--Emby.Naming/AudioBook/AudioBookResolver.cs4
-rw-r--r--Emby.Naming/Common/EpisodeExpression.cs13
-rw-r--r--Emby.Naming/Common/MediaType.cs1
-rw-r--r--Emby.Naming/Common/NamingOptions.cs3
-rw-r--r--Emby.Naming/Emby.Naming.csproj16
-rw-r--r--Emby.Naming/Extensions/StringExtensions.cs2
-rw-r--r--Emby.Naming/StringExtensions.cs3
-rw-r--r--Emby.Naming/Subtitles/SubtitleInfo.cs1
-rw-r--r--Emby.Naming/Subtitles/SubtitleParser.cs2
-rw-r--r--Emby.Naming/TV/EpisodeInfo.cs1
-rw-r--r--Emby.Naming/TV/EpisodePathParser.cs10
-rw-r--r--Emby.Naming/TV/EpisodePathParserResult.cs1
-rw-r--r--Emby.Naming/TV/EpisodeResolver.cs10
-rw-r--r--Emby.Naming/TV/SeasonPathParser.cs11
-rw-r--r--Emby.Naming/TV/SeasonPathParserResult.cs1
-rw-r--r--Emby.Naming/Video/CleanDateTimeParser.cs5
-rw-r--r--Emby.Naming/Video/CleanDateTimeResult.cs1
-rw-r--r--Emby.Naming/Video/CleanStringResult.cs1
-rw-r--r--Emby.Naming/Video/ExtraResolver.cs4
-rw-r--r--Emby.Naming/Video/ExtraResult.cs2
-rw-r--r--Emby.Naming/Video/ExtraRule.cs2
-rw-r--r--Emby.Naming/Video/ExtraRuleType.cs1
-rw-r--r--Emby.Naming/Video/FileStack.cs2
-rw-r--r--Emby.Naming/Video/FlagParser.cs2
-rw-r--r--Emby.Naming/Video/Format3DParser.cs2
-rw-r--r--Emby.Naming/Video/Format3DResult.cs2
-rw-r--r--Emby.Naming/Video/Format3DRule.cs1
-rw-r--r--Emby.Naming/Video/StackResolver.cs2
-rw-r--r--Emby.Naming/Video/StackResult.cs2
-rw-r--r--Emby.Naming/Video/StubResolver.cs18
-rw-r--r--Emby.Naming/Video/StubResult.cs14
-rw-r--r--Emby.Naming/Video/StubTypeRule.cs1
-rw-r--r--Emby.Naming/Video/VideoFileInfo.cs7
-rw-r--r--Emby.Naming/Video/VideoInfo.cs2
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs4
-rw-r--r--Emby.Naming/Video/VideoResolver.cs19
44 files changed, 68 insertions, 138 deletions
diff --git a/Emby.Naming/Audio/AlbumParser.cs b/Emby.Naming/Audio/AlbumParser.cs
index c88631a0c8..7d029a9f49 100644
--- a/Emby.Naming/Audio/AlbumParser.cs
+++ b/Emby.Naming/Audio/AlbumParser.cs
@@ -1,10 +1,9 @@
-using Emby.Naming.Common;
-using Emby.Naming.Video;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Common;
namespace Emby.Naming.Audio
{
@@ -50,8 +49,7 @@ namespace Emby.Naming.Audio
tmp = tmp.Trim().Split(' ').FirstOrDefault() ?? string.Empty;
- int val;
- if (int.TryParse(tmp, NumberStyles.Integer, CultureInfo.InvariantCulture, out val))
+ if (int.TryParse(tmp, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
{
result.IsMultiPart = true;
break;
diff --git a/Emby.Naming/Audio/AudioFileParser.cs b/Emby.Naming/Audio/AudioFileParser.cs
index 20016915ae..609eb779ad 100644
--- a/Emby.Naming/Audio/AudioFileParser.cs
+++ b/Emby.Naming/Audio/AudioFileParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using Emby.Naming.Common;
diff --git a/Emby.Naming/Audio/MultiPartResult.cs b/Emby.Naming/Audio/MultiPartResult.cs
index fae0ae4d81..b1fa6e5639 100644
--- a/Emby.Naming/Audio/MultiPartResult.cs
+++ b/Emby.Naming/Audio/MultiPartResult.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Audio
{
public class MultiPartResult
diff --git a/Emby.Naming/AudioBook/AudioBookFileInfo.cs b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
index 88a98d0f1e..de66a54022 100644
--- a/Emby.Naming/AudioBook/AudioBookFileInfo.cs
+++ b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
@@ -1,6 +1,4 @@
-
using System;
-using Emby.Naming.Video;
namespace Emby.Naming.AudioBook
{
diff --git a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs
index b4805edd21..5909797947 100644
--- a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs
+++ b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs
@@ -1,12 +1,7 @@
-using System;
-using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Linq;
-using System.Text;
using System.Text.RegularExpressions;
using Emby.Naming.Common;
-using Emby.Naming.TV;
namespace Emby.Naming.AudioBook
{
@@ -21,7 +16,7 @@ namespace Emby.Naming.AudioBook
public AudioBookFilePathParserResult Parse(string path, bool IsDirectory)
{
- AudioBookFilePathParserResult result = Parse(path);
+ var result = Parse(path);
return !result.Success ? new AudioBookFilePathParserResult() : result;
}
@@ -39,8 +34,7 @@ namespace Emby.Naming.AudioBook
var value = match.Groups["chapter"];
if (value.Success)
{
- int intValue;
- if (int.TryParse(value.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue))
+ if (int.TryParse(value.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intValue))
{
result.ChapterNumber = intValue;
}
@@ -51,8 +45,7 @@ namespace Emby.Naming.AudioBook
var value = match.Groups["part"];
if (value.Success)
{
- int intValue;
- if (int.TryParse(value.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue))
+ if (int.TryParse(value.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intValue))
{
result.ChapterNumber = intValue;
}
diff --git a/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs b/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs
index 759e7b8ad2..3a8e3c31f2 100644
--- a/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs
+++ b/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
namespace Emby.Naming.AudioBook
{
public class AudioBookFilePathParserResult
diff --git a/Emby.Naming/AudioBook/AudioBookInfo.cs b/Emby.Naming/AudioBook/AudioBookInfo.cs
index d7af63d915..f6e1d5be43 100644
--- a/Emby.Naming/AudioBook/AudioBookInfo.cs
+++ b/Emby.Naming/AudioBook/AudioBookInfo.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using Emby.Naming.Video;
+using System.Collections.Generic;
namespace Emby.Naming.AudioBook
{
diff --git a/Emby.Naming/AudioBook/AudioBookListResolver.cs b/Emby.Naming/AudioBook/AudioBookListResolver.cs
index 8cf6a03bd8..4e3ad7cac8 100644
--- a/Emby.Naming/AudioBook/AudioBookListResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookListResolver.cs
@@ -1,6 +1,4 @@
-using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using Emby.Naming.Common;
using Emby.Naming.Video;
diff --git a/Emby.Naming/AudioBook/AudioBookResolver.cs b/Emby.Naming/AudioBook/AudioBookResolver.cs
index 7c658f43a8..f8f13bc5e4 100644
--- a/Emby.Naming/AudioBook/AudioBookResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookResolver.cs
@@ -1,9 +1,7 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using Emby.Naming.Common;
-using Emby.Naming.TV;
-using Emby.Naming.Video;
namespace Emby.Naming.AudioBook
{
diff --git a/Emby.Naming/Common/EpisodeExpression.cs b/Emby.Naming/Common/EpisodeExpression.cs
index 3b9687c60b..fd85bf76ad 100644
--- a/Emby.Naming/Common/EpisodeExpression.cs
+++ b/Emby.Naming/Common/EpisodeExpression.cs
@@ -1,12 +1,13 @@
-using System.Text.RegularExpressions;
using System;
+using System.Text.RegularExpressions;
namespace Emby.Naming.Common
{
public class EpisodeExpression
{
private string _expression;
- public string Expression { get { return _expression; } set { _expression = value; _regex = null; } }
+ public string Expression { get => _expression;
+ set { _expression = value; _regex = null; } }
public bool IsByDate { get; set; }
public bool IsOptimistic { get; set; }
@@ -16,13 +17,7 @@ namespace Emby.Naming.Common
public string[] DateTimeFormats { get; set; }
private Regex _regex;
- public Regex Regex
- {
- get
- {
- return _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled));
- }
- }
+ public Regex Regex => _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled));
public EpisodeExpression(string expression, bool byDate)
{
diff --git a/Emby.Naming/Common/MediaType.cs b/Emby.Naming/Common/MediaType.cs
index 2a3d433cf8..49cc9ee39b 100644
--- a/Emby.Naming/Common/MediaType.cs
+++ b/Emby.Naming/Common/MediaType.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Common
{
public enum MediaType
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs
index 014f4ebde6..2ef0208baf 100644
--- a/Emby.Naming/Common/NamingOptions.cs
+++ b/Emby.Naming/Common/NamingOptions.cs
@@ -1,8 +1,7 @@
-using Emby.Naming.Video;
-using System.Collections.Generic;
using System;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Video;
namespace Emby.Naming.Common
{
diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj
index de40a39d20..e344e7811e 100644
--- a/Emby.Naming/Emby.Naming.csproj
+++ b/Emby.Naming/Emby.Naming.csproj
@@ -5,19 +5,19 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
- <PropertyGroup>
- <Authors>Jellyfin Contributors</Authors>
- <PackageId>Jellyfin.Naming</PackageId>
- <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
- <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
- </PropertyGroup>
-
<ItemGroup>
- <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ <Compile Include="..\SharedVersion.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
</ItemGroup>
+ <PropertyGroup>
+ <Authors>Jellyfin Contributors</Authors>
+ <PackageId>Jellyfin.Naming</PackageId>
+ <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
+ <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
+ </PropertyGroup>
+
</Project>
diff --git a/Emby.Naming/Extensions/StringExtensions.cs b/Emby.Naming/Extensions/StringExtensions.cs
index e773dbfe8e..26c09aeb40 100644
--- a/Emby.Naming/Extensions/StringExtensions.cs
+++ b/Emby.Naming/Extensions/StringExtensions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Text;
namespace Emby.Naming.Extensions
diff --git a/Emby.Naming/StringExtensions.cs b/Emby.Naming/StringExtensions.cs
index 5598ddb4c2..7c61922af3 100644
--- a/Emby.Naming/StringExtensions.cs
+++ b/Emby.Naming/StringExtensions.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System;
using System.Text;
namespace Emby.Naming
diff --git a/Emby.Naming/Subtitles/SubtitleInfo.cs b/Emby.Naming/Subtitles/SubtitleInfo.cs
index 3ece0679ea..e4709dfbb6 100644
--- a/Emby.Naming/Subtitles/SubtitleInfo.cs
+++ b/Emby.Naming/Subtitles/SubtitleInfo.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Subtitles
{
public class SubtitleInfo
diff --git a/Emby.Naming/Subtitles/SubtitleParser.cs b/Emby.Naming/Subtitles/SubtitleParser.cs
index 9c279cc096..ac9432d57d 100644
--- a/Emby.Naming/Subtitles/SubtitleParser.cs
+++ b/Emby.Naming/Subtitles/SubtitleParser.cs
@@ -1,7 +1,7 @@
-using Emby.Naming.Common;
using System;
using System.IO;
using System.Linq;
+using Emby.Naming.Common;
namespace Emby.Naming.Subtitles
{
diff --git a/Emby.Naming/TV/EpisodeInfo.cs b/Emby.Naming/TV/EpisodeInfo.cs
index 41397480ec..c8aca7a6f3 100644
--- a/Emby.Naming/TV/EpisodeInfo.cs
+++ b/Emby.Naming/TV/EpisodeInfo.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.TV
{
public class EpisodeInfo
diff --git a/Emby.Naming/TV/EpisodePathParser.cs b/Emby.Naming/TV/EpisodePathParser.cs
index 813be3f7ae..9485d697b1 100644
--- a/Emby.Naming/TV/EpisodePathParser.cs
+++ b/Emby.Naming/TV/EpisodePathParser.cs
@@ -1,9 +1,9 @@
-using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Common;
namespace Emby.Naming.TV
{
@@ -122,8 +122,7 @@ namespace Emby.Naming.TV
}
else if (expression.IsNamed)
{
- int num;
- if (int.TryParse(match.Groups["seasonnumber"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
+ if (int.TryParse(match.Groups["seasonnumber"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var num))
{
result.SeasonNumber = num;
}
@@ -133,7 +132,7 @@ namespace Emby.Naming.TV
result.EpisodeNumber = num;
}
- Group endingNumberGroup = match.Groups["endingepnumber"];
+ var endingNumberGroup = match.Groups["endingepnumber"];
if (endingNumberGroup.Success)
{
// Will only set EndingEpsiodeNumber if the captured number is not followed by additional numbers
@@ -154,8 +153,7 @@ namespace Emby.Naming.TV
}
else
{
- int num;
- if (int.TryParse(match.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
+ if (int.TryParse(match.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var num))
{
result.SeasonNumber = num;
}
diff --git a/Emby.Naming/TV/EpisodePathParserResult.cs b/Emby.Naming/TV/EpisodePathParserResult.cs
index 9890c78a45..e1a48bfbc9 100644
--- a/Emby.Naming/TV/EpisodePathParserResult.cs
+++ b/Emby.Naming/TV/EpisodePathParserResult.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.TV
{
public class EpisodePathParserResult
diff --git a/Emby.Naming/TV/EpisodeResolver.cs b/Emby.Naming/TV/EpisodeResolver.cs
index ec5ae2fbfe..fccf9bdecb 100644
--- a/Emby.Naming/TV/EpisodeResolver.cs
+++ b/Emby.Naming/TV/EpisodeResolver.cs
@@ -1,8 +1,8 @@
-using Emby.Naming.Common;
-using Emby.Naming.Video;
using System;
using System.IO;
using System.Linq;
+using Emby.Naming.Common;
+using Emby.Naming.Video;
namespace Emby.Naming.TV
{
@@ -22,17 +22,17 @@ namespace Emby.Naming.TV
throw new ArgumentNullException(nameof(path));
}
- var isStub = false;
+ bool isStub = false;
string container = null;
string stubType = null;
if (!IsDirectory)
{
- var extension = Path.GetExtension(path) ?? string.Empty;
+ var extension = Path.GetExtension(path);
// Check supported extensions
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
- var stubResult = new StubResolver(_options).ResolveFile(path);
+ var stubResult = StubResolver.ResolveFile(path, _options);
isStub = stubResult.IsStub;
diff --git a/Emby.Naming/TV/SeasonPathParser.cs b/Emby.Naming/TV/SeasonPathParser.cs
index 72277e6b9e..f1dcc50b89 100644
--- a/Emby.Naming/TV/SeasonPathParser.cs
+++ b/Emby.Naming/TV/SeasonPathParser.cs
@@ -1,8 +1,8 @@
-using Emby.Naming.Common;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
+using Emby.Naming.Common;
namespace Emby.Naming.TV
{
@@ -72,8 +72,7 @@ namespace Emby.Naming.TV
if (supportNumericSeasonFolders)
{
- int val;
- if (int.TryParse(filename, NumberStyles.Integer, CultureInfo.InvariantCulture, out val))
+ if (int.TryParse(filename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
{
return new Tuple<int?, bool>(val, true);
}
@@ -83,8 +82,7 @@ namespace Emby.Naming.TV
{
var testFilename = filename.Substring(1);
- int val;
- if (int.TryParse(testFilename, NumberStyles.Integer, CultureInfo.InvariantCulture, out val))
+ if (int.TryParse(testFilename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
{
return new Tuple<int?, bool>(val, true);
}
@@ -121,8 +119,7 @@ namespace Emby.Naming.TV
part = part.Substring(1);
- int value;
- if (int.TryParse(part, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
+ if (int.TryParse(part, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value))
{
return value;
}
diff --git a/Emby.Naming/TV/SeasonPathParserResult.cs b/Emby.Naming/TV/SeasonPathParserResult.cs
index 9a18d0a036..eab27a4a5f 100644
--- a/Emby.Naming/TV/SeasonPathParserResult.cs
+++ b/Emby.Naming/TV/SeasonPathParserResult.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.TV
{
public class SeasonPathParserResult
diff --git a/Emby.Naming/Video/CleanDateTimeParser.cs b/Emby.Naming/Video/CleanDateTimeParser.cs
index ee6ec8ba07..74807ef53f 100644
--- a/Emby.Naming/Video/CleanDateTimeParser.cs
+++ b/Emby.Naming/Video/CleanDateTimeParser.cs
@@ -1,9 +1,9 @@
using System;
-using Emby.Naming.Common;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
@@ -71,8 +71,7 @@ namespace Emby.Naming.Video
if (match.Success && match.Groups.Count == 4)
{
- int year;
- if (match.Groups[1].Success && match.Groups[2].Success && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out year))
+ if (match.Groups[1].Success && match.Groups[2].Success && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year))
{
name = match.Groups[1].Value;
result.Year = year;
diff --git a/Emby.Naming/Video/CleanDateTimeResult.cs b/Emby.Naming/Video/CleanDateTimeResult.cs
index 946fd953c1..6bf24e4d85 100644
--- a/Emby.Naming/Video/CleanDateTimeResult.cs
+++ b/Emby.Naming/Video/CleanDateTimeResult.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Video
{
public class CleanDateTimeResult
diff --git a/Emby.Naming/Video/CleanStringResult.cs b/Emby.Naming/Video/CleanStringResult.cs
index 0282863e06..b3bc597125 100644
--- a/Emby.Naming/Video/CleanStringResult.cs
+++ b/Emby.Naming/Video/CleanStringResult.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Video
{
public class CleanStringResult
diff --git a/Emby.Naming/Video/ExtraResolver.cs b/Emby.Naming/Video/ExtraResolver.cs
index bde1a47656..3459b689ac 100644
--- a/Emby.Naming/Video/ExtraResolver.cs
+++ b/Emby.Naming/Video/ExtraResolver.cs
@@ -1,9 +1,9 @@
-using Emby.Naming.Audio;
-using Emby.Naming.Common;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Audio;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/ExtraResult.cs b/Emby.Naming/Video/ExtraResult.cs
index ca79af9da7..ff6f20c47f 100644
--- a/Emby.Naming/Video/ExtraResult.cs
+++ b/Emby.Naming/Video/ExtraResult.cs
@@ -1,5 +1,3 @@
-using System.Collections.Generic;
-
namespace Emby.Naming.Video
{
public class ExtraResult
diff --git a/Emby.Naming/Video/ExtraRule.cs b/Emby.Naming/Video/ExtraRule.cs
index ef83b3cd6c..b8eb8427e7 100644
--- a/Emby.Naming/Video/ExtraRule.cs
+++ b/Emby.Naming/Video/ExtraRule.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/ExtraRuleType.cs b/Emby.Naming/Video/ExtraRuleType.cs
index 323c7cef60..565239ff9a 100644
--- a/Emby.Naming/Video/ExtraRuleType.cs
+++ b/Emby.Naming/Video/ExtraRuleType.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Video
{
public enum ExtraRuleType
diff --git a/Emby.Naming/Video/FileStack.cs b/Emby.Naming/Video/FileStack.cs
index 2feea4cb3a..2df1e9aed1 100644
--- a/Emby.Naming/Video/FileStack.cs
+++ b/Emby.Naming/Video/FileStack.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/Emby.Naming/Video/FlagParser.cs b/Emby.Naming/Video/FlagParser.cs
index ef785ebf9d..bb129499be 100644
--- a/Emby.Naming/Video/FlagParser.cs
+++ b/Emby.Naming/Video/FlagParser.cs
@@ -1,6 +1,6 @@
-using Emby.Naming.Common;
using System;
using System.IO;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/Format3DParser.cs b/Emby.Naming/Video/Format3DParser.cs
index e335d10554..e6f830c583 100644
--- a/Emby.Naming/Video/Format3DParser.cs
+++ b/Emby.Naming/Video/Format3DParser.cs
@@ -1,6 +1,6 @@
-using Emby.Naming.Common;
using System;
using System.Linq;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/Format3DResult.cs b/Emby.Naming/Video/Format3DResult.cs
index 147ccfc057..e12494079c 100644
--- a/Emby.Naming/Video/Format3DResult.cs
+++ b/Emby.Naming/Video/Format3DResult.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/Format3DRule.cs b/Emby.Naming/Video/Format3DRule.cs
index 3c173efbc7..dc260175af 100644
--- a/Emby.Naming/Video/Format3DRule.cs
+++ b/Emby.Naming/Video/Format3DRule.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Video
{
public class Format3DRule
diff --git a/Emby.Naming/Video/StackResolver.cs b/Emby.Naming/Video/StackResolver.cs
index 995e95d421..4893002c1b 100644
--- a/Emby.Naming/Video/StackResolver.cs
+++ b/Emby.Naming/Video/StackResolver.cs
@@ -1,9 +1,9 @@
-using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using Emby.Naming.Common;
using MediaBrowser.Model.IO;
namespace Emby.Naming.Video
diff --git a/Emby.Naming/Video/StackResult.cs b/Emby.Naming/Video/StackResult.cs
index 920a7dea73..de35d2825a 100644
--- a/Emby.Naming/Video/StackResult.cs
+++ b/Emby.Naming/Video/StackResult.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/StubResolver.cs b/Emby.Naming/Video/StubResolver.cs
index 33d6baefd3..f86bcbdf04 100644
--- a/Emby.Naming/Video/StubResolver.cs
+++ b/Emby.Naming/Video/StubResolver.cs
@@ -1,25 +1,18 @@
-using Emby.Naming.Common;
using System;
using System.IO;
using System.Linq;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
- public class StubResolver
+ public static class StubResolver
{
- private readonly NamingOptions _options;
-
- public StubResolver(NamingOptions options)
- {
- _options = options;
- }
-
- public StubResult ResolveFile(string path)
+ public static StubResult ResolveFile(string path, NamingOptions options)
{
var result = new StubResult();
var extension = Path.GetExtension(path) ?? string.Empty;
- if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+ if (options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
result.IsStub = true;
@@ -27,12 +20,11 @@ namespace Emby.Naming.Video
var token = (Path.GetExtension(path) ?? string.Empty).TrimStart('.');
- foreach (var rule in _options.StubTypes)
+ foreach (var rule in options.StubTypes)
{
if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
{
result.StubType = rule.StubType;
- result.Tokens.Add(token);
break;
}
}
diff --git a/Emby.Naming/Video/StubResult.cs b/Emby.Naming/Video/StubResult.cs
index c9d06c9a7f..7f9509ca56 100644
--- a/Emby.Naming/Video/StubResult.cs
+++ b/Emby.Naming/Video/StubResult.cs
@@ -1,8 +1,6 @@
-using System.Collections.Generic;
-
namespace Emby.Naming.Video
{
- public class StubResult
+ public struct StubResult
{
/// <summary>
/// Gets or sets a value indicating whether this instance is stub.
@@ -14,15 +12,5 @@ namespace Emby.Naming.Video
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }
- /// <summary>
- /// Gets or sets the tokens.
- /// </summary>
- /// <value>The tokens.</value>
- public List<string> Tokens { get; set; }
-
- public StubResult()
- {
- Tokens = new List<string>();
- }
}
}
diff --git a/Emby.Naming/Video/StubTypeRule.cs b/Emby.Naming/Video/StubTypeRule.cs
index 66ebfc3a26..b46050085d 100644
--- a/Emby.Naming/Video/StubTypeRule.cs
+++ b/Emby.Naming/Video/StubTypeRule.cs
@@ -1,4 +1,3 @@
-
namespace Emby.Naming.Video
{
public class StubTypeRule
diff --git a/Emby.Naming/Video/VideoFileInfo.cs b/Emby.Naming/Video/VideoFileInfo.cs
index 3cdc483ff3..6a29ada7ea 100644
--- a/Emby.Naming/Video/VideoFileInfo.cs
+++ b/Emby.Naming/Video/VideoFileInfo.cs
@@ -1,4 +1,4 @@
-
+
namespace Emby.Naming.Video
{
/// <summary>
@@ -65,10 +65,7 @@ namespace Emby.Naming.Video
/// Gets the file name without extension.
/// </summary>
/// <value>The file name without extension.</value>
- public string FileNameWithoutExtension
- {
- get { return !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path); }
- }
+ public string FileNameWithoutExtension => !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path);
public override string ToString()
{
diff --git a/Emby.Naming/Video/VideoInfo.cs b/Emby.Naming/Video/VideoInfo.cs
index 033a8ae2d0..d96d0e7571 100644
--- a/Emby.Naming/Video/VideoInfo.cs
+++ b/Emby.Naming/Video/VideoInfo.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index 45d4593de2..0506d0734c 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -1,10 +1,10 @@
-using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using MediaBrowser.Model.IO;
using System.Text.RegularExpressions;
+using Emby.Naming.Common;
+using MediaBrowser.Model.IO;
namespace Emby.Naming.Video
{
diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.cs
index f6ab8cb87f..a673156517 100644
--- a/Emby.Naming/Video/VideoResolver.cs
+++ b/Emby.Naming/Video/VideoResolver.cs
@@ -1,7 +1,7 @@
-using Emby.Naming.Common;
using System;
using System.IO;
using System.Linq;
+using Emby.Naming.Common;
namespace Emby.Naming.Video
{
@@ -40,7 +40,7 @@ namespace Emby.Naming.Video
/// <param name="path">The path.</param>
/// <param name="IsDirectory">if set to <c>true</c> [is folder].</param>
/// <returns>VideoFileInfo.</returns>
- /// <exception cref="System.ArgumentNullException">path</exception>
+ /// <exception cref="ArgumentNullException">path</exception>
public VideoFileInfo Resolve(string path, bool IsDirectory, bool parseName = true)
{
if (string.IsNullOrEmpty(path))
@@ -48,17 +48,17 @@ namespace Emby.Naming.Video
throw new ArgumentNullException(nameof(path));
}
- var isStub = false;
+ bool isStub = false;
string container = null;
string stubType = null;
if (!IsDirectory)
{
- var extension = Path.GetExtension(path) ?? string.Empty;
+ var extension = Path.GetExtension(path);
// Check supported extensions
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
- var stubResult = new StubResolver(_options).ResolveFile(path);
+ var stubResult = StubResolver.ResolveFile(path, _options);
isStub = stubResult.IsStub;
@@ -79,9 +79,9 @@ namespace Emby.Naming.Video
var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
- var name = !IsDirectory
- ? Path.GetFileNameWithoutExtension(path)
- : Path.GetFileName(path);
+ var name = IsDirectory
+ ? Path.GetFileName(path)
+ : Path.GetFileNameWithoutExtension(path);
int? year = null;
@@ -91,8 +91,7 @@ namespace Emby.Naming.Video
if (string.IsNullOrEmpty(extraResult.ExtraType))
{
- name = cleanDateTimeResult.Name;
- name = CleanString(name).Name;
+ name = CleanString(cleanDateTimeResult.Name).Name;
}
year = cleanDateTimeResult.Year;