Skip to content

Commit

Permalink
fix(subsonic): order some browse-by-tag responses
Browse files Browse the repository at this point in the history
closes #512
  • Loading branch information
mikuta0407 authored and sentriz committed Feb 15, 2025
1 parent 5c7d065 commit 39df00e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/ctrlsubsonic/handlers_by_folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Where("parent_id=?", id.Value).
Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID).
Order("tag_year").
Order("albums.right_path COLLATE NOCASE").
Find(&childFolders)
for _, ch := range childFolders {
childrenObj = append(childrenObj, spec.NewTCAlbumByFolder(ch))
}

// start looking for child childTracks in the current dir
var childTracks []*db.Track
c.dbc.
Expand All @@ -94,6 +96,7 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response {
Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID).
Order("tag_track_number").
Order("filename").
Find(&childTracks)

Expand Down
1 change: 1 addition & 0 deletions server/ctrlsubsonic/spec/construct_by_folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
ParentID: f.ParentSID(),
CreatedAt: f.CreatedAt,
AverageRating: formatRating(f.AverageRating),
Year: f.TagYear,
}
if f.AlbumStar != nil {
trCh.Starred = &f.AlbumStar.StarDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -39,6 +40,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -55,6 +57,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
}
Expand Down
9 changes: 9 additions & 0 deletions server/ctrlsubsonic/testdata/test_search_two_q_alb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -36,6 +37,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -52,6 +54,7 @@
"isVideo": false,
"parent": "al-2",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -68,6 +71,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -84,6 +88,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -100,6 +105,7 @@
"isVideo": false,
"parent": "al-6",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -116,6 +122,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-0",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -132,6 +139,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-1",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
},
Expand All @@ -148,6 +156,7 @@
"isVideo": false,
"parent": "al-10",
"title": "album-2",
"year": 2021,
"musicBrainzId": "",
"replayGain": null
}
Expand Down

0 comments on commit 39df00e

Please sign in to comment.