mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Cutoff Unmet Sorting by Downloaded Quality not working.
Fixes #2678
This commit is contained in:
parent
802768bd24
commit
00877ad361
@ -1,21 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ContentModelStore">
|
||||
<e p="$PROJECT_DIR$/../_output" t="ExcludeRecursive">
|
||||
<e p="E:\C++ Projects\Sonarr\_output" t="ExcludeRecursive">
|
||||
<e p="NzbDrone.Update" t="ExcludeRecursive" />
|
||||
</e>
|
||||
<e p="$PROJECT_DIR$/../Logo/1024.png" t="Include" />
|
||||
<e p="$PROJECT_DIR$/../Logo/64.png" t="Include" />
|
||||
<e p="$PROJECT_DIR$" t="IncludeFlat">
|
||||
<e p="E:\C++ Projects\Sonarr\Logo\1024.png" t="Include" />
|
||||
<e p="E:\C++ Projects\Sonarr\Logo\64.png" t="Include" />
|
||||
<e p="E:\C++ Projects\Sonarr\src" t="IncludeFlat">
|
||||
<e p=".nuget" t="Include">
|
||||
<e p="NuGet.exe" t="Include" />
|
||||
</e>
|
||||
<e p="_ReSharper.Caches/ReSharperHost12.NzbDrone.00" t="ExcludeRecursive" />
|
||||
<e p="Common/CommonAssemblyInfo.cs" t="Include" />
|
||||
<e p="Common/CommonVersionInfo.cs" t="Include" />
|
||||
<e p="Common/GlobalSuppressions.cs" t="Include" />
|
||||
<e p="_ReSharper.Caches\ReSharperHost11.NzbDrone.00" t="ExcludeRecursive" />
|
||||
<e p="Common" t="Include">
|
||||
<e p="CodeAnalysisDictionary.xml" t="Include" />
|
||||
<e p="CommonAssemblyInfo.cs" t="Include" />
|
||||
<e p="CommonVersionInfo.cs" t="Include" />
|
||||
<e p="GlobalSuppressions.cs" t="Include" />
|
||||
</e>
|
||||
<e p="External" t="Include" />
|
||||
<e p="ExternalModules/CurlSharp/CurlSharp" t="IncludeRecursive">
|
||||
<e p="ExternalModules\CurlSharp\CurlSharp" t="IncludeRecursive">
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="Callbacks" t="Include">
|
||||
<e p="CurlEasyCallbacks.cs" t="Include" />
|
||||
@ -67,10 +70,10 @@
|
||||
</e>
|
||||
</e>
|
||||
<e p="Host" t="Include" />
|
||||
<e p="Libraries/MediaInfo/libmediainfo.0.dylib" t="Include" />
|
||||
<e p="Libraries/MediaInfo/MediaInfo.dll" t="Include" />
|
||||
<e p="Libraries/Sqlite/libsqlite3.0.dylib" t="Include" />
|
||||
<e p="Libraries/Sqlite/sqlite3.dll" t="Include" />
|
||||
<e p="Libraries\MediaInfo\libmediainfo.0.dylib" t="Include" />
|
||||
<e p="Libraries\MediaInfo\MediaInfo.dll" t="Include" />
|
||||
<e p="Libraries\Sqlite\libsqlite3.0.dylib" t="Include" />
|
||||
<e p="Libraries\Sqlite\sqlite3.dll" t="Include" />
|
||||
<e p="LogentriesCore" t="IncludeRecursive">
|
||||
<e p="AsyncLogger.cs" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
@ -1367,6 +1370,7 @@
|
||||
<e p="BlacklistSpecification.cs" t="Include" />
|
||||
<e p="CutoffSpecification.cs" t="Include" />
|
||||
<e p="LanguageSpecification.cs" t="Include" />
|
||||
<e p="MaximumSizeSpecification.cs" t="Include" />
|
||||
<e p="MinimumAgeSpecification.cs" t="Include" />
|
||||
<e p="NotSampleSpecification.cs" t="Include" />
|
||||
<e p="ProtocolSpecification.cs" t="Include" />
|
||||
@ -2558,6 +2562,7 @@
|
||||
<e p="DownloadDecisionMakerFixture.cs" t="Include" />
|
||||
<e p="HistorySpecificationFixture.cs" t="Include" />
|
||||
<e p="LanguageSpecificationFixture.cs" t="Include" />
|
||||
<e p="MaximumSizeSpecificationFixture.cs" t="Include" />
|
||||
<e p="MinimumAgeSpecificationFixture.cs" t="Include" />
|
||||
<e p="MonitoredMovieSpecificationFixture.cs" t="Include" />
|
||||
<e p="PrioritizeDownloadDecisionFixture.cs" t="Include" />
|
||||
@ -3277,7 +3282,7 @@
|
||||
</e>
|
||||
<e p="packages" t="ExcludeRecursive" />
|
||||
<e p="Platform" t="Include" />
|
||||
<e p="ServiceHelpers/ServiceInstall" t="IncludeRecursive">
|
||||
<e p="ServiceHelpers\ServiceInstall" t="IncludeRecursive">
|
||||
<e p="app.config" t="Include" />
|
||||
<e p="app.manifest" t="Include" />
|
||||
<e p="green_puzzle.ico" t="Include" />
|
||||
@ -3289,7 +3294,7 @@
|
||||
<e p="ServiceHelper.cs" t="Include" />
|
||||
<e p="ServiceInstall.csproj" t="IncludeRecursive" />
|
||||
</e>
|
||||
<e p="ServiceHelpers/ServiceUninstall" t="IncludeRecursive">
|
||||
<e p="ServiceHelpers\ServiceUninstall" t="IncludeRecursive">
|
||||
<e p="app.config" t="Include" />
|
||||
<e p="app.manifest" t="Include" />
|
||||
<e p="obj" t="ExcludeRecursive" />
|
||||
|
@ -140,7 +140,7 @@ public PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec)
|
||||
|
||||
return pagingSpec;
|
||||
}*/
|
||||
|
||||
|
||||
/*protected override SortBuilder<Movie> GetPagedQuery(QueryBuilder<Movie> query, PagingSpec<Movie> pagingSpec)
|
||||
{
|
||||
return DataMapper.Query<Movie>().Join<Movie, AlternativeTitle>(JoinType.Left, m => m.AlternativeTitles,
|
||||
@ -149,7 +149,7 @@ public PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec)
|
||||
.Skip(pagingSpec.PagingOffset())
|
||||
.Take(pagingSpec.PageSize);
|
||||
}*/
|
||||
|
||||
|
||||
/*protected override SortBuilder<Movie> GetPagedQuery(QueryBuilder<Movie> query, PagingSpec<Movie> pagingSpec)
|
||||
{
|
||||
var newQuery = base.GetPagedQuery(query.Join<Movie, AlternativeTitle>(JoinType.Left, m => m.JoinAlternativeTitles, (movie, title) => title.MovieId == movie.Id), pagingSpec);
|
||||
@ -168,46 +168,15 @@ public SortBuilder<Movie> GetMoviesWithoutFilesQuery(PagingSpec<Movie> pagingSpe
|
||||
|
||||
public PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
//I know this is bad, but if you have a better Idea please tell me.
|
||||
if (pagingSpec.SortKey == "downloadedQuality")
|
||||
{
|
||||
var mapper = _database.GetDataMapper();
|
||||
var offset = pagingSpec.PagingOffset();
|
||||
var limit = pagingSpec.PageSize;
|
||||
var direction = "ASC";
|
||||
if (pagingSpec.SortDirection == NzbDrone.Core.Datastore.SortDirection.Descending)
|
||||
{
|
||||
direction = "DESC";
|
||||
}
|
||||
|
||||
var whereClause = BuildQualityCutoffWhereClauseSpecial(qualitiesBelowCutoff);
|
||||
|
||||
var q = mapper.Query<Movie>($"SELECT * from \"Movies\" , \"MovieFiles\", \"QualityDefinitions\" WHERE Movies.MovieFileId=MovieFiles.Id AND instr(MovieFiles.Quality, ('quality\": ' || QualityDefinitions.Quality || \",\")) > 0 AND {whereClause} ORDER BY QualityDefinitions.Title {direction} LIMIT {offset},{limit};");
|
||||
var q2 = mapper.Query<Movie>($"SELECT * from \"Movies\" , \"MovieFiles\", \"QualityDefinitions\" WHERE Movies.MovieFileId=MovieFiles.Id AND instr(MovieFiles.Quality, ('quality\": ' || QualityDefinitions.Quality || \",\")) > 0 AND {whereClause} ORDER BY QualityDefinitions.Title ASC;");
|
||||
|
||||
var q3 = Query.OrderBy(m => m.MovieFile.Quality.Quality);
|
||||
var ok = q3.BuildQuery();
|
||||
var t = ok;
|
||||
|
||||
pagingSpec.Records = q.ToList();
|
||||
pagingSpec.TotalRecords = q2.Count();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
pagingSpec.TotalRecords = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).GetRowCount();
|
||||
pagingSpec.Records = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).ToList();
|
||||
|
||||
}
|
||||
pagingSpec.TotalRecords = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).GetRowCount();
|
||||
pagingSpec.Records = MoviesWhereCutoffUnmetQuery(pagingSpec, qualitiesBelowCutoff).ToList();
|
||||
|
||||
return pagingSpec;
|
||||
}
|
||||
|
||||
private SortBuilder<Movie> MoviesWhereCutoffUnmetQuery(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
return Query.Join<Movie, MovieFile>(JoinType.Left, e => e.MovieFile, (e, s) => e.MovieFileId == s.Id)
|
||||
.Where(pagingSpec.FilterExpression)
|
||||
return Query.Where(pagingSpec.FilterExpression)
|
||||
.AndWhere(m => m.MovieFileId != 0)
|
||||
.AndWhere(BuildQualityCutoffWhereClause(qualitiesBelowCutoff))
|
||||
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
||||
@ -290,8 +259,8 @@ private Movie FindByTitle(string cleanTitle, int? year)
|
||||
return result;
|
||||
/*return year.HasValue
|
||||
? results?.FirstOrDefault(movie => movie.Year == year.Value)
|
||||
|
||||
|
||||
|
||||
|
||||
: results?.FirstOrDefault();*/
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ module.exports = Marionette.Layout.extend({
|
||||
cellValue : 'this',
|
||||
},
|
||||
{
|
||||
name : "downloadedQuality",
|
||||
label : "Downloaded",
|
||||
name : "movieFile.quality",
|
||||
label : "Downloaded",
|
||||
cell : DownloadedQualityCell,
|
||||
sortable : true
|
||||
},
|
||||
@ -157,7 +157,7 @@ module.exports = Marionette.Layout.extend({
|
||||
icon : 'icon-sonarr-movie-announced',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
{
|
||||
key : 'incinemas',
|
||||
title : '',
|
||||
tooltip : 'In Cinemas Only',
|
||||
|
Loading…
Reference in New Issue
Block a user