mirror of
https://github.com/Jackett/Jackett.git
synced 2025-10-03 00:47:21 +02:00
Add GetLongFromString()
This commit is contained in:
@@ -1139,10 +1139,7 @@ namespace Jackett.Indexers
|
|||||||
release.MinimumSeedTime = ParseUtil.CoerceLong(value);
|
release.MinimumSeedTime = ParseUtil.CoerceLong(value);
|
||||||
break;
|
break;
|
||||||
case "imdb":
|
case "imdb":
|
||||||
Regex IMDBRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
|
release.Imdb = ParseUtil.GetLongFromString(value);
|
||||||
var IMDBMatch = IMDBRegEx.Match(value);
|
|
||||||
var IMDBId = IMDBMatch.Groups[1].Value;
|
|
||||||
release.Imdb = ParseUtil.CoerceLong(IMDBId);
|
|
||||||
break;
|
break;
|
||||||
case "rageid":
|
case "rageid":
|
||||||
Regex RageIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
|
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);
|
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)
|
public static int? GetImdbID(string imdbstr)
|
||||||
{
|
{
|
||||||
if (imdbstr == null)
|
if (imdbstr == null)
|
||||||
|
Reference in New Issue
Block a user