mirror of
https://github.com/Jackett/Jackett.git
synced 2025-10-02 16:42:01 +02:00
Add GetLongFromString()
This commit is contained in:
@@ -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);
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user