Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(subsonic): add year and genre fields to track-by-folder response
fixes #223
  • Loading branch information
sentriz committed May 18, 2022
1 parent 668c334 commit 53a4247
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
3 changes: 3 additions & 0 deletions server/ctrlsubsonic/spec/construct_by_folder.go
Expand Up @@ -2,6 +2,7 @@ package spec

import (
"path"
"strings"

"go.senan.xyz/gonic/db"
)
Expand Down Expand Up @@ -54,6 +55,8 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
),
ParentID: parent.SID(),
Duration: t.Length,
Genre: strings.Join(t.GenreStrings(), ", "),
Year: parent.TagYear,
Bitrate: t.Bitrate,
IsDir: false,
Type: "music",
Expand Down
Expand Up @@ -25,7 +25,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-2",
Expand All @@ -44,7 +45,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-3",
Expand All @@ -63,7 +65,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
}
]
}
Expand Down
60 changes: 40 additions & 20 deletions server/ctrlsubsonic/testdata/test_search_two_q_tra
Expand Up @@ -22,7 +22,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-2",
Expand All @@ -41,7 +42,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-3",
Expand All @@ -60,7 +62,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-4",
Expand All @@ -79,7 +82,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-5",
Expand All @@ -98,7 +102,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-6",
Expand All @@ -117,7 +122,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-7",
Expand All @@ -136,7 +142,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-8",
Expand All @@ -155,7 +162,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-9",
Expand All @@ -174,7 +182,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-10",
Expand All @@ -193,7 +202,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-11",
Expand All @@ -212,7 +222,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-12",
Expand All @@ -231,7 +242,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-13",
Expand All @@ -250,7 +262,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-14",
Expand All @@ -269,7 +282,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-15",
Expand All @@ -288,7 +302,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-16",
Expand All @@ -307,7 +322,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-17",
Expand All @@ -326,7 +342,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-18",
Expand All @@ -345,7 +362,8 @@
"title": "title-2",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-19",
Expand All @@ -364,7 +382,8 @@
"title": "title-0",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
},
{
"id": "tr-20",
Expand All @@ -383,7 +402,8 @@
"title": "title-1",
"track": 1,
"discNumber": 1,
"type": "music"
"type": "music",
"year": 2021
}
]
}
Expand Down

0 comments on commit 53a4247

Please sign in to comment.