mirror of
https://github.com/Radarr/Radarr
synced 2025-01-03 05:44:50 +00:00
Simplify parsing IMDb and TMDb urls as search terms
This commit is contained in:
parent
64122b4cfb
commit
f90b43b3e1
1 changed files with 4 additions and 2 deletions
|
@ -406,14 +406,16 @@ public List<Movie> SearchForNewMovie(string title)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var match = new Regex("^https://www.imdb.com/title/(tt[0-9]+).*?$").Match(title);
|
var match = new Regex(@"\bimdb\.com/title/(tt\d{7,})\b", RegexOptions.IgnoreCase).Match(title);
|
||||||
|
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
title = "imdb:" + match.Groups[1].Value;
|
title = "imdb:" + match.Groups[1].Value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
match = new Regex("^https://www.themoviedb.org/movie/([0-9]+).*$").Match(title);
|
match = new Regex(@"\bthemoviedb\.org/movie/(\d+)\b", RegexOptions.IgnoreCase).Match(title);
|
||||||
|
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
title = "tmdb:" + match.Groups[1].Value;
|
title = "tmdb:" + match.Groups[1].Value;
|
||||||
|
|
Loading…
Reference in a new issue