1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Fix sorting when converting a shuffled into a linear playlist

This commit is contained in:
heyarne 2019-03-05 09:44:13 +01:00
commit b529b2fabe
3 changed files with 16 additions and 5 deletions

View file

@ -27,7 +27,7 @@
"This function is used if we switch from linear to shuffled; it allows us to
restore the order of the queue when it was created."
[items]
(->> (sort-by (comp meta :playlist/linear-order) items)
(->> (sort-by (comp :playlist/linear-order meta) items)
(map-indexed (fn [idx item]
(vary-meta item assoc :playlist/linear-order idx)))))
@ -85,7 +85,8 @@
queue-fn (case playback-mode
:shuffled shuffled-queue
:linear linear-queue)
next-playlist (update playlist :items (comp queue-fn vals))
next-playlist (-> (assoc playlist :playback-mode playback-mode)
(update :items (comp queue-fn vals)))
next-idx (first (keep (fn [[idx song]]
(when (= song current-song)
idx))

View file

@ -51,6 +51,7 @@
[:td.sort-handle.is-narrow [:> SortHandle]]
[:td.song-artist [artist-link song]]
[:td.song-title (:title song)]
[:td.meta>code (str (meta song))]
[:td.song-duration (helpers/format-duration (:duration song) :brief? true)]
[:td.song-actions.is-narrow [song-actions]]])