fix(subsonic): order some browse-by-tag responses

closes #512
This commit is contained in:
mikuta0407
2025-02-15 16:16:10 +00:00
committed by sentriz
parent 5c7d065fd7
commit 39df00ef8f
4 changed files with 16 additions and 0 deletions

No files matched your search

@@ -80,11 +80,13 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Where("parent_id=?", id.Value). Where("parent_id=?", id.Value).
Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID).
Order("tag_year").
Order("albums.right_path COLLATE NOCASE"). Order("albums.right_path COLLATE NOCASE").
Find(&childFolders) Find(&childFolders)
for _, ch := range childFolders { for _, ch := range childFolders {
childrenObj = append(childrenObj, spec.NewTCAlbumByFolder(ch)) childrenObj = append(childrenObj, spec.NewTCAlbumByFolder(ch))
} }
// start looking for child childTracks in the current dir // start looking for child childTracks in the current dir
var childTracks []*db.Track var childTracks []*db.Track
c.dbc. c.dbc.
@@ -94,6 +96,7 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Preload("Artists"). Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID). Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID).
Order("tag_track_number").
Order("filename"). Order("filename").
Find(&childTracks) Find(&childTracks)
@@ -40,6 +40,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
ParentID: f.ParentSID(), ParentID: f.ParentSID(),
CreatedAt: f.CreatedAt, CreatedAt: f.CreatedAt,
AverageRating: formatRating(f.AverageRating), AverageRating: formatRating(f.AverageRating),
Year: f.TagYear,
} }
if f.AlbumStar != nil { if f.AlbumStar != nil {
trCh.Starred = &f.AlbumStar.StarDate trCh.Starred = &f.AlbumStar.StarDate
@@ -23,6 +23,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-0", "title": "album-0",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -39,6 +40,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-1", "title": "album-1",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -55,6 +57,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-2", "title": "album-2",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
} }
+9
View File
@@ -20,6 +20,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-0", "title": "album-0",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -36,6 +37,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-1", "title": "album-1",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -52,6 +54,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-2", "parent": "al-2",
"title": "album-2", "title": "album-2",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -68,6 +71,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-6", "parent": "al-6",
"title": "album-0", "title": "album-0",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -84,6 +88,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-6", "parent": "al-6",
"title": "album-1", "title": "album-1",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -100,6 +105,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-6", "parent": "al-6",
"title": "album-2", "title": "album-2",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -116,6 +122,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-10", "parent": "al-10",
"title": "album-0", "title": "album-0",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -132,6 +139,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-10", "parent": "al-10",
"title": "album-1", "title": "album-1",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
}, },
@@ -148,6 +156,7 @@
"isVideo": false, "isVideo": false,
"parent": "al-10", "parent": "al-10",
"title": "album-2", "title": "album-2",
"year": 2021,
"musicBrainzId": "", "musicBrainzId": "",
"replayGain": null "replayGain": null
} }