Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
fm refreshable;
Browse files Browse the repository at this point in the history
  • Loading branch information
Akatsuki7629 committed Jun 4, 2021
1 parent 9e7478a commit 6507ae7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lekima.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ func (l *Lekima) FetchTop(limit int) []*Playlist {

// fetch fm
func (l *Lekima) FetchFM() *Playlist {
bytes := l.Req("fm")
params := Query{"timestamp": strconv.Itoa(int(time.Now().Unix()))}
bytes := l.Req("fm", params)
var resp FMResp
err := json.Unmarshal(bytes, &resp)
chk(err)
Expand All @@ -336,6 +337,11 @@ func (l *Lekima) FetchFM() *Playlist {
}
}

func (l *Lekima) ExpandFMTracks(list []*Track) *Lekima {
l.Playlist.Tracks = append(l.Playlist.Tracks, list...)
return l
}

// fetch daily recommend songs
func (l *Lekima) FetchRecommendSongs() *Playlist {
bytes := l.Req("recommendSongs")
Expand Down Expand Up @@ -582,6 +588,11 @@ func (l *Lekima) EventLoop(uiEvent <-chan ui.Event, quit chan<- bool) {
case "P":
l.Player.TogglePlayMode()
l.RefreshUIHeader()
case "r":
p := l.FetchFM()
l.Playlist = p
l.UI.SetMainContent(p)
l.UI.MainContent.ScrollTop()
}
case SearchBoxTile:
switch e.Type {
Expand Down

0 comments on commit 6507ae7

Please sign in to comment.