1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

New: Import subtitles from sub folders

Closes #2513
This commit is contained in:
Stéphane Dupont
2022-02-27 21:37:23 +01:00
committed by GitHub
parent c10677dfe7
commit 4bfcd0de1d
10 changed files with 733 additions and 74 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ namespace NzbDrone.Core.Parser
RegexOptions.Compiled);
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})([-_. ](?<tags>full|forced|foreign|default|cc|psdh|sdh))*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static Language ParseLanguage(string title, bool defaultToEnglish = true)
{
@@ -124,12 +124,12 @@ namespace NzbDrone.Core.Parser
if (languageMatch.Success)
{
var isoCode = languageMatch.Groups["iso_code"].Value;
var isoLanguage = IsoLanguages.Find(isoCode);
var isoLanguage = IsoLanguages.Find(isoCode.ToLower());
return isoLanguage?.Language ?? Language.Unknown;
}
foreach (Language language in Enum.GetValues(typeof(Language)))
foreach (Language language in Language.All)
{
if (simpleFilename.EndsWith(language.ToString(), StringComparison.OrdinalIgnoreCase))
{