1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00
Files
Radarr/src/NzbDrone.Core/Parser/SceneChecker.cs
T
Gabriel Patzleiner 40b630ef10 Fixed: Updated GetSceneName. It will clean the ReleaseTitle now.
Added some SceneChecker tests
2020-06-07 16:48:25 -04:00

44 lines
1.2 KiB
C#

namespace NzbDrone.Core.Parser
{
public static class SceneChecker
{
//This method should prefer false negatives over false positives.
//It's better not to use a title that might be scene than to use one that isn't scene
public static string GetSceneTitle(string title)
{
if (title == null)
{
return null;
}
if (!title.Contains("."))
{
return null;
}
if (title.Contains(" "))
{
return null;
}
var parsedTitle = Parser.ParseMovieTitle(title);
if (parsedTitle == null ||
parsedTitle.ReleaseGroup == null ||
parsedTitle.Quality.Quality == Qualities.Quality.Unknown ||
string.IsNullOrWhiteSpace(parsedTitle.MovieTitle) ||
string.IsNullOrWhiteSpace(parsedTitle.ReleaseTitle))
{
return null;
}
return parsedTitle.ReleaseTitle;
}
public static bool IsSceneTitle(string title)
{
return GetSceneTitle(title) != null;
}
}
}