1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-06-28 00:44:48 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
HamletDuFromage
24c4ba6f02
Merge 12f8312eec into 5fc63ecb3f 2024-06-18 18:07:33 +05:30
Bogdan
5fc63ecb3f New: Ignore inaccessible folders when getting folders
(cherry picked from commit a30e9da7672a202cb9e9188cf106afc34a5d0361)
2024-06-18 06:55:13 +03:00
flb
12f8312eec move tmdb/imdb link parsing logic to MovieLookupController.cs 2024-02-12 21:08:18 +01:00
flb
467ff799fc fix wrong type for ConvertDbLinkToId() 2024-02-09 20:59:00 +01:00
flb
2b1838517c fix 5f03093b38, add missing namespace 2024-02-09 19:20:17 +01:00
flb
5f03093b38 search movies with imdb/tmdb links 2024-02-09 18:48:49 +01:00
2 changed files with 30 additions and 2 deletions

View File

@ -153,7 +153,11 @@ public IEnumerable<string> GetDirectories(string path)
{
Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs);
return Directory.EnumerateDirectories(path);
return Directory.EnumerateDirectories(path, "*", new EnumerationOptions
{
AttributesToSkip = FileAttributes.System,
IgnoreInaccessible = true
});
}
public IEnumerable<string> GetFiles(string path, bool recursive)

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Languages;
@ -23,6 +24,11 @@ public class MovieLookupController : RestController<MovieResource>
private readonly IMapCoversToLocal _coverMapper;
private readonly IConfigService _configService;
private static readonly Regex ImdbIdRegex = new Regex(@"imdb\.com/title/(?<id>tt\d+)",
RegexOptions.Compiled);
private static readonly Regex TmdbIdRegex = new Regex(@"themoviedb\.org/movie/(?<id>\d+)",
RegexOptions.Compiled);
public MovieLookupController(ISearchForNewMovie searchProxy,
IProvideMovieInfo movieInfo,
IBuildFileNames fileNameBuilder,
@ -71,11 +77,29 @@ public object SearchByImdbId(string imdbId)
[HttpGet]
public object Search([FromQuery] string term)
{
var searchResults = _searchProxy.SearchForNewMovie(term);
var convertedTerm = ConvertDbLinkToId(term);
var searchResults = _searchProxy.SearchForNewMovie(convertedTerm);
return MapToResource(searchResults);
}
private string ConvertDbLinkToId(string title)
{
var match = ImdbIdRegex.Match(title);
if (match.Success)
{
return "imdb:" + match.Groups["id"].Value;
}
match = TmdbIdRegex.Match(title);
if (match.Success)
{
return "tmdb:" + match.Groups["id"].Value;
}
return title;
}
private IEnumerable<MovieResource> MapToResource(IEnumerable<Movie> movies)
{
var movieInfoLanguage = (Language)_configService.MovieInfoLanguage;