Skip to content

Commit

Permalink
Order playlists by name (resolves #90)
Browse files Browse the repository at this point in the history
  • Loading branch information
yktoo committed Aug 5, 2024
1 parent fddd194 commit 8529f98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/player/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package player
import (
"github.com/fhs/gompd/v2/mpd"
"github.com/pkg/errors"
"sort"
"sync"
"time"
)
Expand Down Expand Up @@ -131,6 +132,9 @@ func (c *Connector) GetPlaylists() []string {
for i, a := range attrs {
names[i] = a["playlist"]
}

// Sort the list by name
sort.Strings(names)
return names
}

Expand All @@ -143,7 +147,7 @@ func (c *Connector) IfConnected(funcIfConnected func(client *mpd.Client)) {
}
}

// IsConnected returns whether there's a connection with MPD and whether it's being established
// ConnectStatus returns whether there's a connection with MPD and whether it's being established
func (c *Connector) ConnectStatus() (bool, bool) {
c.mpdClientMutex.RLock()
defer c.mpdClientMutex.RUnlock()
Expand Down

0 comments on commit 8529f98

Please sign in to comment.