Reurn indexes in lexigraphical order.
This commit is contained in:
@@ -3,6 +3,7 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jinzhu/gorm"
|
"github.com/jinzhu/gorm"
|
||||||
@@ -36,6 +37,9 @@ func (c *Controller) GetIndexes(w http.ResponseWriter, r *http.Request) {
|
|||||||
index.Artists = append(index.Artists,
|
index.Artists = append(index.Artists,
|
||||||
makeArtistFromFolder(&folder))
|
makeArtistFromFolder(&folder))
|
||||||
}
|
}
|
||||||
|
sort.Slice(indexes[:], func(i, j int) bool {
|
||||||
|
return indexes[i].Name < indexes[j].Name
|
||||||
|
})
|
||||||
sub := subsonic.NewResponse()
|
sub := subsonic.NewResponse()
|
||||||
sub.Indexes = &subsonic.Indexes{
|
sub.Indexes = &subsonic.Indexes{
|
||||||
LastModified: 0,
|
LastModified: 0,
|
||||||
|
|||||||
@@ -5,6 +5,15 @@
|
|||||||
"indexes": {
|
"indexes": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"index": [
|
"index": [
|
||||||
|
{
|
||||||
|
"name": "#",
|
||||||
|
"artist": [
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"name": "13th Floor Lowervators"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "A",
|
"name": "A",
|
||||||
"artist": [
|
"artist": [
|
||||||
@@ -17,15 +26,6 @@
|
|||||||
"name": "Anika"
|
"name": "Anika"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "#",
|
|
||||||
"artist": [
|
|
||||||
{
|
|
||||||
"id": 5,
|
|
||||||
"name": "13th Floor Lowervators"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user