mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
honor dlna sort order to content exceeding the first page (#3747)
This commit is contained in:
parent
124adb3f5b
commit
58a6c22072
2 changed files with 18 additions and 10 deletions
|
|
@ -440,15 +440,21 @@ func getRootObjects() []interface{} {
|
|||
return objs
|
||||
}
|
||||
|
||||
func getSortDirection(sceneFilter *models.SceneFilterType, sort string) models.SortDirectionEnum {
|
||||
direction := models.SortDirectionEnumDesc
|
||||
if sort == "title" {
|
||||
direction = models.SortDirectionEnumAsc
|
||||
}
|
||||
|
||||
return direction
|
||||
}
|
||||
|
||||
func (me *contentDirectoryService) getVideos(sceneFilter *models.SceneFilterType, parentID string, host string) []interface{} {
|
||||
var objs []interface{}
|
||||
|
||||
if err := txn.WithReadTxn(context.TODO(), me.txnManager, func(ctx context.Context) error {
|
||||
sort := me.VideoSortOrder
|
||||
direction := models.SortDirectionEnumDesc
|
||||
if sort == "title" {
|
||||
direction = models.SortDirectionEnumAsc
|
||||
}
|
||||
direction := getSortDirection(sceneFilter, sort)
|
||||
findFilter := &models.FindFilterType{
|
||||
PerPage: &pageSize,
|
||||
Sort: &sort,
|
||||
|
|
@ -497,8 +503,10 @@ func (me *contentDirectoryService) getPageVideos(sceneFilter *models.SceneFilter
|
|||
parentID: parentID,
|
||||
}
|
||||
|
||||
sort := me.VideoSortOrder
|
||||
direction := getSortDirection(sceneFilter, sort)
|
||||
var err error
|
||||
objs, err = pager.getPageVideos(ctx, me.repository.SceneFinder, me.repository.FileFinder, page, host)
|
||||
objs, err = pager.getPageVideos(ctx, me.repository.SceneFinder, me.repository.FileFinder, page, host, sort, direction)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ func (p *scenePager) getPages(ctx context.Context, r scene.Queryer, total int) (
|
|||
return objs, nil
|
||||
}
|
||||
|
||||
func (p *scenePager) getPageVideos(ctx context.Context, r SceneFinder, f file.Finder, page int, host string) ([]interface{}, error) {
|
||||
func (p *scenePager) getPageVideos(ctx context.Context, r SceneFinder, f file.Finder, page int, host string, sort string, direction models.SortDirectionEnum) ([]interface{}, error) {
|
||||
var objs []interface{}
|
||||
|
||||
sort := "title"
|
||||
findFilter := &models.FindFilterType{
|
||||
PerPage: &pageSize,
|
||||
Page: &page,
|
||||
Sort: &sort,
|
||||
Direction: &direction,
|
||||
}
|
||||
|
||||
scenes, err := scene.Query(ctx, r, p.sceneFilter, findFilter)
|
||||
|
|
|
|||
Loading…
Reference in a new issue