fix(subsonic): return song artist ID, album and song genres from search3
related: #229
This commit is contained in:
@@ -10,11 +10,11 @@ import (
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/scrobble/lastfm"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/params"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/scrobble/lastfm"
|
||||
)
|
||||
|
||||
func (c *Controller) ServeGetArtists(r *http.Request) *spec.Response {
|
||||
@@ -211,6 +211,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
var albums []*db.Album
|
||||
q = c.DB.
|
||||
Preload("TagArtist").
|
||||
Preload("Genres").
|
||||
Where("tag_title LIKE ? OR tag_title_u_dec LIKE ?", query, query).
|
||||
Offset(params.GetOrInt("albumOffset", 0)).
|
||||
Limit(params.GetOrInt("albumCount", 20))
|
||||
@@ -228,6 +229,8 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
var tracks []*db.Track
|
||||
q = c.DB.
|
||||
Preload("Album").
|
||||
Preload("Album.TagArtist").
|
||||
Preload("Genres").
|
||||
Where("tag_title LIKE ? OR tag_title_u_dec LIKE ?", query, query).
|
||||
Offset(params.GetOrInt("songOffset", 0)).
|
||||
Limit(params.GetOrInt("songCount", 20))
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"name": "album-0",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -29,6 +30,7 @@
|
||||
"name": "album-1",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -42,6 +44,7 @@
|
||||
"name": "album-2",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -55,6 +58,7 @@
|
||||
"name": "album-0",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -68,6 +72,7 @@
|
||||
"name": "album-1",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -81,6 +86,7 @@
|
||||
"name": "album-2",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -94,6 +100,7 @@
|
||||
"name": "album-0",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -107,6 +114,7 @@
|
||||
"name": "album-1",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
},
|
||||
{
|
||||
@@ -120,6 +128,7 @@
|
||||
"name": "album-2",
|
||||
"songCount": 0,
|
||||
"duration": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"year": 2021
|
||||
}
|
||||
]
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-3",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-3",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-3",
|
||||
@@ -31,11 +33,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-3",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-3",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-3",
|
||||
@@ -52,11 +56,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-3",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-3",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-3",
|
||||
@@ -73,11 +79,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-4",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-4",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-4",
|
||||
@@ -94,11 +102,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-4",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-4",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-4",
|
||||
@@ -115,11 +125,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-4",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-4",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-4",
|
||||
@@ -136,11 +148,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-5",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-5",
|
||||
@@ -157,11 +171,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-5",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-5",
|
||||
@@ -178,11 +194,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-5",
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-5",
|
||||
@@ -199,11 +217,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-7",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-7",
|
||||
@@ -220,11 +240,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-7",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-7",
|
||||
@@ -241,11 +263,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-7",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-7",
|
||||
@@ -262,11 +286,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-8",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-8",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-8",
|
||||
@@ -283,11 +309,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-8",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-8",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-8",
|
||||
@@ -304,11 +332,13 @@
|
||||
"album": "album-1",
|
||||
"albumId": "al-8",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-8",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-8",
|
||||
@@ -325,11 +355,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-9",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-9",
|
||||
@@ -346,11 +378,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-9",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-9",
|
||||
@@ -367,11 +401,13 @@
|
||||
"album": "album-2",
|
||||
"albumId": "al-9",
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-9",
|
||||
@@ -388,11 +424,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-11",
|
||||
"artist": "artist-2",
|
||||
"artistId": "ar-3",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-11",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-11",
|
||||
@@ -409,11 +447,13 @@
|
||||
"album": "album-0",
|
||||
"albumId": "al-11",
|
||||
"artist": "artist-2",
|
||||
"artistId": "ar-3",
|
||||
"bitRate": 100,
|
||||
"contentType": "audio/x-flac",
|
||||
"coverArt": "al-11",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"duration": 100,
|
||||
"genre": "Unknown Genre",
|
||||
"isDir": false,
|
||||
"isVideo": false,
|
||||
"parent": "al-11",
|
||||
|
||||
Reference in New Issue
Block a user