|
|
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
bool MoviePathExists(string folder);
|
|
|
|
bool MoviePathExists(string folder);
|
|
|
|
void RemoveAddOptions(Movie movie);
|
|
|
|
void RemoveAddOptions(Movie movie);
|
|
|
|
List<Movie> MoviesWithFiles(int movieId);
|
|
|
|
List<Movie> MoviesWithFiles(int movieId);
|
|
|
|
System.Linq.Expressions.Expression<Func<Core.Tv.Movie, bool>> ConstructFilterExpression(string FilterKey, string FilterValue);
|
|
|
|
System.Linq.Expressions.Expression<Func<Core.Tv.Movie, bool>> ConstructFilterExpression(string FilterKey, string FilterValue, string filterType = null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class MovieService : IMovieService, IHandle<MovieFileAddedEvent>,
|
|
|
|
public class MovieService : IMovieService, IHandle<MovieFileAddedEvent>,
|
|
|
@ -69,42 +69,65 @@ namespace NzbDrone.Core.Tv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public System.Linq.Expressions.Expression<Func<Core.Tv.Movie, bool>> ConstructFilterExpression(string FilterKey, string FilterValue)
|
|
|
|
public System.Linq.Expressions.Expression<Func<Core.Tv.Movie, bool>> ConstructFilterExpression(string FilterKey, string FilterValue, string FilterType = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (FilterKey == "all" && FilterValue == "all")
|
|
|
|
//if (FilterKey == "all" && FilterValue == "all")
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
return v => v.Monitored == true || v.Monitored == false;
|
|
|
|
// return v => v.Monitored == true || v.Monitored == false;
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
else if (FilterKey == "monitored" && FilterValue == "false")
|
|
|
|
if (FilterKey == "moviemonitored" && FilterValue == "false")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return v => v.Monitored == false;
|
|
|
|
return v => v.Monitored == false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (FilterKey == "monitored" && FilterValue == "true")
|
|
|
|
else if (FilterKey == "moviemonitored" && FilterValue == "true")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return v => v.Monitored == true;
|
|
|
|
return v => v.Monitored == true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (FilterKey == "moviestatus" && FilterValue == "available")
|
|
|
|
else if (FilterKey == "moviestatus")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (FilterValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//TODO: might need to handle PreDB here
|
|
|
|
case "released":
|
|
|
|
|
|
|
|
return v => v.Status == MovieStatusType.Released;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "inCinemas":
|
|
|
|
|
|
|
|
return v => v.Status == MovieStatusType.InCinemas;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "announced":
|
|
|
|
|
|
|
|
return v => v.Status == MovieStatusType.Announced;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "available":
|
|
|
|
return v => v.Monitored == true &&
|
|
|
|
return v => v.Monitored == true &&
|
|
|
|
((v.MinimumAvailability == MovieStatusType.Released && v.Status >= MovieStatusType.Released) ||
|
|
|
|
((v.MinimumAvailability == MovieStatusType.Released && v.Status >= MovieStatusType.Released) ||
|
|
|
|
(v.MinimumAvailability == MovieStatusType.InCinemas && v.Status >= MovieStatusType.InCinemas) ||
|
|
|
|
(v.MinimumAvailability == MovieStatusType.InCinemas && v.Status >= MovieStatusType.InCinemas) ||
|
|
|
|
(v.MinimumAvailability == MovieStatusType.Announced && v.Status >= MovieStatusType.Announced) ||
|
|
|
|
(v.MinimumAvailability == MovieStatusType.Announced && v.Status >= MovieStatusType.Announced) ||
|
|
|
|
(v.MinimumAvailability == MovieStatusType.PreDB && v.Status >= MovieStatusType.Released));
|
|
|
|
(v.MinimumAvailability == MovieStatusType.PreDB && v.Status >= MovieStatusType.Released));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (FilterKey == "moviestatus" && FilterValue == "announced")
|
|
|
|
else if (FilterKey == "moviedownloaded")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return v => v.Status == MovieStatusType.Announced;
|
|
|
|
return v => v.MovieFileId == 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (FilterKey == "moviestatus" && FilterValue == "incinemas")
|
|
|
|
else if (FilterKey == "title")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return v => v.Status == MovieStatusType.InCinemas;
|
|
|
|
if (FilterValue == string.Empty || FilterValue == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return v => true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (FilterKey == "moviestatus" && FilterValue == "released")
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return v => v.Status == MovieStatusType.Released;
|
|
|
|
if (FilterType == "contains")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return v => v.CleanTitle.Contains(FilterValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return v => v.Monitored == true;
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return v => v.CleanTitle == FilterValue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return v => true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Movie GetMovie(int movieId)
|
|
|
|
public Movie GetMovie(int movieId)
|
|
|
|