1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-24 23:22:46 +00:00

Add GetLongFromString()

This commit is contained in:
kaso17 2017-02-02 12:12:57 +01:00
parent c43ff9ff49
commit 2ea2bf53b3
2 changed files with 13 additions and 4 deletions

View file

@ -1139,10 +1139,7 @@ namespace Jackett.Indexers
release.MinimumSeedTime = ParseUtil.CoerceLong(value);
break;
case "imdb":
Regex IMDBRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var IMDBMatch = IMDBRegEx.Match(value);
var IMDBId = IMDBMatch.Groups[1].Value;
release.Imdb = ParseUtil.CoerceLong(IMDBId);
release.Imdb = ParseUtil.GetLongFromString(value);
break;
case "rageid":
Regex RageIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);

View file

@ -74,6 +74,18 @@ namespace Jackett.Utils
return long.TryParse(NormalizeNumber(str), NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
public static long? GetLongFromString(string str)
{
if (str == null)
return null;
Regex IdRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var IdMatch = IdRegEx.Match(str);
if (!IdMatch.Success)
return null;
var Id = IdMatch.Groups[1].Value;
return CoerceLong(Id);
}
public static int? GetImdbID(string imdbstr)
{
if (imdbstr == null)