2019-12-22 22:08:53 +00:00
|
|
|
|
namespace NzbDrone.Core.Parser
|
2014-09-01 23:37:59 +00:00
|
|
|
|
{
|
|
|
|
|
public static class SceneChecker
|
|
|
|
|
{
|
|
|
|
|
//This method should prefer false negatives over false positives.
|
2014-09-02 22:12:13 +00:00
|
|
|
|
//It's better not to use a title that might be scene than to use one that isn't scene
|
2020-04-10 12:27:30 +00:00
|
|
|
|
public static string GetSceneTitle(string title)
|
2014-09-01 23:37:59 +00:00
|
|
|
|
{
|
2020-04-10 12:27:30 +00:00
|
|
|
|
if (title == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-22 22:08:53 +00:00
|
|
|
|
if (!title.Contains("."))
|
|
|
|
|
{
|
2020-04-10 12:27:30 +00:00
|
|
|
|
return null;
|
2019-12-22 22:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (title.Contains(" "))
|
|
|
|
|
{
|
2020-04-10 12:27:30 +00:00
|
|
|
|
return null;
|
2019-12-22 22:08:53 +00:00
|
|
|
|
}
|
2014-09-01 23:37:59 +00:00
|
|
|
|
|
2020-04-08 16:54:05 +00:00
|
|
|
|
var parsedTitle = Parser.ParseMovieTitle(title);
|
2015-01-27 05:57:07 +00:00
|
|
|
|
|
|
|
|
|
if (parsedTitle == null ||
|
|
|
|
|
parsedTitle.ReleaseGroup == null ||
|
|
|
|
|
parsedTitle.Quality.Quality == Qualities.Quality.Unknown ||
|
2020-04-10 12:27:30 +00:00
|
|
|
|
string.IsNullOrWhiteSpace(parsedTitle.MovieTitle) ||
|
|
|
|
|
string.IsNullOrWhiteSpace(parsedTitle.ReleaseTitle))
|
2015-01-27 05:57:07 +00:00
|
|
|
|
{
|
2020-04-10 12:27:30 +00:00
|
|
|
|
return null;
|
2015-01-27 05:57:07 +00:00
|
|
|
|
}
|
2014-09-01 23:37:59 +00:00
|
|
|
|
|
2020-04-10 12:27:30 +00:00
|
|
|
|
return parsedTitle.ReleaseTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsSceneTitle(string title)
|
|
|
|
|
{
|
|
|
|
|
return GetSceneTitle(title) != null;
|
2014-09-01 23:37:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|