Reurn indexes in lexigraphical order.

This commit is contained in:
EdwardDowling
2019-06-01 16:43:00 +01:00
parent ad5d2fcd49
commit 6d83072b91
2 changed files with 13 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ package handler
import (
"fmt"
"net/http"
"sort"
"strings"
"github.com/jinzhu/gorm"
@@ -36,6 +37,9 @@ func (c *Controller) GetIndexes(w http.ResponseWriter, r *http.Request) {
index.Artists = append(index.Artists,
makeArtistFromFolder(&folder))
}
sort.Slice(indexes[:], func(i, j int) bool {
return indexes[i].Name < indexes[j].Name
})
sub := subsonic.NewResponse()
sub.Indexes = &subsonic.Indexes{
LastModified: 0,

View File

@@ -5,6 +5,15 @@
"indexes": {
"lastModified": 0,
"index": [
{
"name": "#",
"artist": [
{
"id": 5,
"name": "13th Floor Lowervators"
}
]
},
{
"name": "A",
"artist": [
@@ -17,15 +26,6 @@
"name": "Anika"
}
]
},
{
"name": "#",
"artist": [
{
"id": 5,
"name": "13th Floor Lowervators"
}
]
}
]
}