Skip to content

Commit

Permalink
Fixed some bugs on linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
DECE2183 committed Nov 30, 2024
1 parent 084778e commit d9d1efd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ buffer-size-ms: 80
rewind-duration-s: 5
volume: 0.5
volume-step: 0.05
cache-tracks: likes # none/likes/all
search:
artists: true
albums: false
Expand All @@ -89,6 +90,7 @@ controls:
player-rewind-forward: ctrl+right
player-rewind-backward: ctrl+left
player-like: L
player-cache: S
player-vol-up: +,=
player-vol-donw: '-'
```
Expand Down
2 changes: 1 addition & 1 deletion config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var defaultConfig = Config{
RewindDuration: 5,
Volume: 0.5,
VolumeStep: 0.05,
CacheTracks: CACHE_NONE,
CacheTracks: CACHE_LIKED_ONLY,
Search: &Search{
Artists: true,
Albums: false,
Expand Down
1 change: 1 addition & 0 deletions media/handler/mpris/mpris.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (mh *MprisHandler) Enable() error {
}

func (mh *MprisHandler) Disable() error {
mh.evHandler.Player.OnEnded()
err := mh.server.Stop()
close(mh.msgChan)
close(mh.ansChan)
Expand Down
10 changes: 9 additions & 1 deletion ui/model/mainPage/mainPage.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ func (m *Model) Run() error {
}

m.mediaHandler.Enable()
defer m.mediaHandler.Disable()
go m.mediaHandle()

_, err = m.program.Run()

m.tracker.Stop()
m.mediaHandler.Disable()
return err
}

Expand Down Expand Up @@ -475,6 +477,12 @@ func (m *Model) mediaHandle() {
track := m.tracker.CurrentTrack()
artists := make([]string, 0, len(track.Artists))
albumArtists := make([]string, 0, len(track.Albums[0].Artists))
for i := range track.Artists {
artists = append(artists, track.Artists[i].Name)
}
for i := range track.Albums[0].Artists {
albumArtists = append(albumArtists, track.Albums[0].Artists[i].Name)
}
md := handler.TrackMetadata{
TrackId: track.Id,
Length: time.Duration(track.DurationMs) * time.Millisecond,
Expand Down
2 changes: 1 addition & 1 deletion ui/style/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
IconStop = "■"
IconLiked = "💛"
IconNotLiked = "🤍"
IconCached = "⬇️"
IconCached = "💿"
)

var (
Expand Down

0 comments on commit d9d1efd

Please sign in to comment.