minor fix: lyric_cn.go http response handling and popup.go searchpopup left border fix

This commit is contained in:
tramhao 2021-03-26 16:36:53 +08:00
parent 5c616bdbd9
commit 39c0207637
2 changed files with 12 additions and 1 deletions

View File

@ -78,6 +78,10 @@ func (cn GetLyricCn) GetLyric(songTag *SongTag) (lyricString string, err error)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return "", fmt.Errorf("http response error: %d", resp.StatusCode)
}
var tagLyric tagLyric
err = json.NewDecoder(resp.Body).Decode(&tagLyric)
if err != nil {
@ -109,6 +113,10 @@ func getLyricOptionsCnByProvider(search string, serviceProvider string) (resultT
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return nil, fmt.Errorf("http response error: %d", resp.StatusCode)
}
switch serviceProvider {
case "kugou":
var tagKugou []tagKugou

View File

@ -510,7 +510,10 @@ func searchPopup(title string, stringsToMatch []string, handler func(selected st
popup.Box = popupBox
gomu.pages.AddPage("search-input-popup", center(popup, 70, 40), true, true)
// this is to fix the left border of search popup
popupFrame := tview.NewFrame(popup)
gomu.pages.AddPage("search-input-popup", center(popupFrame, 70, 40), true, true)
gomu.popups.push(popup)
// This is to ensure the popup is shown even when paused
gomu.app.Draw()