Skip to content

Commit 2ae1a57

Browse files
committed
feat: 加入早安歌曲,调整UI
1 parent 3dd9136 commit 2ae1a57

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

fm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func main() {
188188
defer fm.player.close()
189189

190190
UI.app.SetInputCapture(fm.handle)
191-
UI.footerTopic.SetText("| " + strings.Join(s, " | ") + " |")
191+
UI.footerTopic.SetText("|" + strings.Join(s, "|") + "|")
192192

193193
fm.switchTopic()
194194
fm.play()

jike/session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ func WaitLogin(uuid string) bool {
110110
req.URL.RawQuery = q.Encode()
111111
resp, err := client().Do(req)
112112
if err != nil {
113-
log.Println(err, "wait login fail")
113+
//log.Println(err, "wait login fail")
114114
return false
115115
}
116116
body, _ := ioutil.ReadAll(resp.Body)
117117
var data struct {
118118
LoggedIn bool `json:"logged_in"`
119119
}
120120
if err := json.Unmarshal(body, &data); err != nil {
121-
log.Println(err, "wait login fail")
121+
//log.Println(err, "wait login fail")
122122
return false
123123
}
124124
return data.LoggedIn

topic.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type TopicList map[string]*Topic
1919

2020
var topicOrder = []string{
2121
"55483ddee4b03ccbae843925",
22+
"5899dc1063ed1a0015bade08",
2223
"5a1ccf936e6e7c0011037480",
2324
}
2425

@@ -28,6 +29,11 @@ var topics = TopicList{
2829
name: "晚安电台",
2930
playing: -1,
3031
},
32+
"5899dc1063ed1a0015bade08": {
33+
id: "5899dc1063ed1a0015bade08",
34+
name: "早安歌曲",
35+
playing: -1,
36+
},
3137
"5a1ccf936e6e7c0011037480": {
3238
id: "5a1ccf936e6e7c0011037480",
3339
name: "即友在听什么歌",

ui.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var headerTpl = `
3232
3333
`
3434

35-
var footerTpl = `ENTER [green]播放[white] SPACE [green]暂停[white] CTRL-N/CTRL-P [green]下一首/上一首[white] `
35+
var footerTpl = `TAB [green]切换圈子 ENTER [green]播放[white] SPACE [green]暂停[white] CTRL-N/CTRL-P [green]/上一首[white] `
3636
var normalTpl = "[yellow]% 3d) \t[-:-:-]%s"
3737
var playingTpl = "[purple]% 3d) \t->[::b] %s"
3838

@@ -48,11 +48,11 @@ func init() {
4848
SetDynamicColors(true).SetRegions(true).SetWrap(false).SetTextAlign(tview.AlignRight).
4949
SetText(footerTpl),
5050
}
51-
UI.root.SetRect(0, 0, 100, 40)
51+
UI.root.SetRect(0, 0, 110, 40)
5252
UI.header.SetBorder(true).SetTitle("即刻电台 " + version)
5353

5454
footerContainer := tview.NewFlex().SetDirection(tview.FlexColumn).
55-
AddItem(UI.footerTopic, 40, 1, false).
55+
AddItem(UI.footerTopic, 44, 1, false).
5656
AddItem(UI.footerHelp, 0, 1, false)
5757

5858
footerContainer.SetBackgroundColor(tcell.ColorGrey)
@@ -80,7 +80,7 @@ func addTopic(topicId string) *TopicUI {
8080
mainContainer.SetBorder(true).SetBorderPadding(1, 0, 2, 2)
8181

8282
topicUI.root.
83-
AddItem(topicUI.side, 40, 1, true).
83+
AddItem(topicUI.side, 44, 1, true).
8484
AddItem(mainContainer, 0, 1, false)
8585

8686
UI.topics = append(UI.topics, topicUI)

0 commit comments

Comments
 (0)