mirror of
https://github.com/Jackett/Jackett
synced 2025-02-24 23:22:46 +00:00
Add GetLongFromString()
This commit is contained in:
parent
c43ff9ff49
commit
2ea2bf53b3
2 changed files with 13 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue