web info first version/fix some lyric not update/update translation.json/fix some media in history list cann't be played again

This commit is contained in:
Aynakeya
2022-07-18 20:37:00 -07:00
parent 24457e0acd
commit 2b7151e1d2
9 changed files with 39 additions and 6 deletions

View File

@@ -363,6 +363,10 @@
"plugin.webinfo.title": {
"en": "Web Output",
"zh-CN": "Web输出"
},
"plugin.webinfo.server_preview": {
"en": "Server Preview",
"zh-CN":"效果预览"
}
}
}

View File

@@ -5,8 +5,8 @@
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" />-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AynaLivePlayer OBS Info</title>
<script type="module" crossorigin src="/assets/index.660dc426.js"></script>
<link rel="stylesheet" href="/assets/index.85c8060c.css">
<script type="module" crossorigin src="/assets/index.eeb86e4b.js"></script>
<link rel="stylesheet" href="/assets/index.4399a077.css">
</head>
<body>
<div id="app"></div>

View File

@@ -8,7 +8,7 @@ import (
const (
ProgramName = "卡西米尔唱片机"
Version = "alpha 0.8.4"
Version = "alpha 0.8.6"
)
const (

View File

@@ -5,6 +5,8 @@ import "AynaLivePlayer/player"
func AddToHistory(media *player.Media) {
l().Tracef("add media %s (%s) to history", media.Title, media.Artist)
media = media.Copy()
// reset url for future use
media.Url = ""
if History.Size() >= 1024 {
History.Replace([]*player.Media{})
}

1
go.mod
View File

@@ -12,7 +12,6 @@ require (
github.com/go-resty/resty/v2 v2.7.0
github.com/gorilla/websocket v1.5.0
github.com/jinzhu/copier v0.3.5
github.com/mitchellh/panicwrap v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/cast v1.3.1

View File

@@ -41,6 +41,9 @@ func (l *Lyric) Reload(lyric string) {
for index, time := range times {
lrcs[index] = tmp[time]
}
if len(lrcs) == 0 {
lrcs = append(lrcs, LyricLine{Time: 0, Lyric: ""})
}
lrcs = append(lrcs, LyricLine{
Time: 99999999999,
Lyric: "",

View File

@@ -8,6 +8,8 @@ import (
"AynaLivePlayer/i18n"
"AynaLivePlayer/logger"
"AynaLivePlayer/player"
"AynaLivePlayer/util"
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
@@ -146,6 +148,10 @@ func (w *WebInfo) getServerStatusText() string {
}
}
func (w *WebInfo) getServerUrl() string {
return fmt.Sprintf("http://localhost:%d/#/previewV2", w.Port)
}
func (w *WebInfo) CreatePanel() fyne.CanvasObject {
if w.panel != nil {
return w.panel
@@ -160,6 +166,11 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
widget.NewLabel(i18n.T("plugin.webinfo.port")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&w.Port))),
)
serverUrl := widget.NewHyperlink(w.getServerUrl(), util.UrlMustParse(w.getServerUrl()))
serverPreview := container.NewHBox(
widget.NewLabel(i18n.T("plugin.webinfo.server_preview")),
serverUrl,
)
stopBtn := gui.NewAsyncButtonWithIcon(
i18n.T("plugin.webinfo.server_control.stop"),
theme.MediaStopIcon(),
@@ -187,6 +198,8 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
w.server.Port = w.Port
w.server.Start()
statusText.SetText(w.getServerStatusText())
serverUrl.SetText(w.getServerUrl())
_ = serverUrl.SetURLFromString(w.getServerUrl())
},
)
restartBtn := gui.NewAsyncButtonWithIcon(
@@ -203,12 +216,14 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
w.server.Port = w.Port
w.server.Start()
statusText.SetText(w.getServerStatusText())
serverUrl.SetText(w.getServerUrl())
_ = serverUrl.SetURLFromString(w.getServerUrl())
},
)
ctrlBtns := container.NewHBox(
widget.NewLabel(i18n.T("plugin.webinfo.server_control")),
startBtn, stopBtn, restartBtn,
)
w.panel = container.NewVBox(serverStatus, serverPort, ctrlBtns)
w.panel = container.NewVBox(serverStatus, serverPreview, serverPort, ctrlBtns)
return w.panel
}

View File

@@ -8,13 +8,15 @@
- web输出 (前端)
- 进入beta版本
alpha
beta
- web 重连
- 黑名单
- bilibili 歌词来源
----
Finished
- 2022.7.16@0.8.6: 网页输出第一版更新/修复历史列表部分歌曲放不出来的bug/修复部分歌词不更新
- 2022.7.15: 更新stderr重定向/添加logo/
- 2022.7.13@0.8.4: 网易云登录
- 2022.7.10: Local Provider

8
util/url.go Normal file
View File

@@ -0,0 +1,8 @@
package util
import "net/url"
func UrlMustParse(rawurl string) *url.URL {
u, _ := url.Parse(rawurl)
return u
}