Added: Ability to add custom formats, working similar to qualities. (#2669)

Originally called project metis, this feature allows you to do a lot of cool stuff, such as upgrading to a x265 encode, downloading releases with multiple languages, etc. Check out the wiki page at: https://github.com/Radarr/Radarr/wiki/Custom-Formats to learn more! Note: This feature is currently in "beta" and will get more tags and features in the future. Please let me know, if you have any issues and I hope this will allow for a lot of customization!
This commit is contained in:
Leonardo Galli
2018-08-05 16:28:05 +02:00
committed by GitHub
parent d046a73f78
commit 77f146b262
272 changed files with 12585 additions and 4092 deletions
@@ -70,9 +70,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
.Build();
request.AllowAutoRedirect = true;
// request.SuppressHttpError = true;
request.SuppressHttpError = true;
var response = _httpClient.Get<MovieResourceRoot>(request);
if (response.StatusCode == HttpStatusCode.NotFound)
{
throw new MovieNotFoundException("Movie not found.");
}
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpException(request, response);
@@ -116,7 +120,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
{
altTitles.Add(new AlternativeTitle(resource.original_title, SourceType.TMDB, TmdbId, iso.Language));
}
//movie.AlternativeTitles.Add(resource.original_title);
}
@@ -206,17 +210,17 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
//omdbapi is actually quite good for this info
//except omdbapi has been having problems recently
//so i will just leave this in as a comment
//and use the 3 month logic that we were using before
//and use the 3 month logic that we were using before
/*var now = DateTime.Now;
if (now < movie.InCinemas)
movie.Status = MovieStatusType.Announced;
if (now >= movie.InCinemas)
if (now >= movie.InCinemas)
movie.Status = MovieStatusType.InCinemas;
if (now >= movie.PhysicalRelease)
movie.Status = MovieStatusType.Released;
*/
var now = DateTime.Now;
//handle the case when we have both theatrical and physical release dates
if (movie.InCinemas.HasValue && movie.PhysicalRelease.HasValue)
@@ -251,7 +255,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
}
if (!hasPreDBEntry)
{
{
if (_predbService.HasReleases(movie))
{
movie.HasPreDBEntry = true;
@@ -376,7 +380,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
_logger.Error(exception, "Failed to discover movies for action {0}!", action);
}
return results.SelectList(MapMovie);
return results.SelectList(MapMovie);
}
private string StripTrailingTheFromTitle(string title)
@@ -409,10 +413,18 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
{
yearTerm = parserResult.Year.ToString();
}
if (parserResult.ImdbId.IsNotNullOrWhiteSpace())
{
return new List<Movie> { GetMovieInfo(parserResult.ImdbId) };
try
{
return new List<Movie> { GetMovieInfo(parserResult.ImdbId) };
}
catch (Exception e)
{
return new List<Movie>();
}
}
}
@@ -439,6 +451,27 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
}
}
if (lowerTitle.StartsWith("tmdb:") || lowerTitle.StartsWith("tmdbid:"))
{
var slug = lowerTitle.Split(':')[1].Trim();
int tmdbid = -1;
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace) || !(int.TryParse(slug, out tmdbid)))
{
return new List<Movie>();
}
try
{
return new List<Movie> { GetMovieInfo(tmdbid) };
}
catch (MovieNotFoundException)
{
return new List<Movie>();
}
}
var searchTerm = lowerTitle.Replace("_", "+").Replace(" ", "+").Replace(".", "+");
var firstChar = searchTerm.First();