Merge pull request #48 from AynaLivePlayer/dev

1.2.1
This commit is contained in:
Aynakeya
2025-07-31 00:33:39 +08:00
committed by GitHub
12 changed files with 172 additions and 31 deletions

View File

@@ -63,10 +63,22 @@ jobs:
- name: Build application - name: Build application
run: | run: |
go build -tags=mpvOnly,nosource -v -o ./AynaLivePlayerMpvNoSource.exe -ldflags -H=windowsgui app/main.go
go build -tags=vlcOnly,nosource -v -o ./AynaLivePlayerVlcNoSource.exe -ldflags -H=windowsgui app/main.go
go build -tags=nosource -v -o ./AynaLivePlayerAllPlayerNoSource.exe -ldflags -H=windowsgui app/main.go
go build -tags=mpvOnly -v -o ./AynaLivePlayerMpv.exe -ldflags -H=windowsgui app/main.go go build -tags=mpvOnly -v -o ./AynaLivePlayerMpv.exe -ldflags -H=windowsgui app/main.go
go build -tags=vlcOnly -v -o ./AynaLivePlayerVlc.exe -ldflags -H=windowsgui app/main.go go build -tags=vlcOnly -v -o ./AynaLivePlayerVlc.exe -ldflags -H=windowsgui app/main.go
go build -v -o ./AynaLivePlayerAllPlayer.exe -ldflags -H=windowsgui app/main.go go build -v -o ./AynaLivePlayerAllPlayer.exe -ldflags -H=windowsgui app/main.go
- name: Upload artifact (NoSource)
uses: actions/upload-artifact@v4
with:
name: windows-build-nosource
path: |
./AynaLivePlayerMpvNoSource.exe
./AynaLivePlayerVlcNoSource.exe
./AynaLivePlayerAllPlayerNoSource.exe
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:

View File

@@ -6,6 +6,28 @@ Provider By Aynakeya
QQ group: 621035845 QQ group: 621035845
## Disclaimer
All APIs used in this project are **publicly available** on the internet and not obtained through illegal means such as
reverse engineering.
The use of this project may involve access to copyrighted content. This project does **not** own or claim any rights to
such content. **To avoid potential infringement**, all users are **required to delete any copyrighted data obtained
through this project within 24 hours.**
Any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of goodwill, work
stoppage, computer failure or malfunction, or any and all other commercial damages or losses) that arise from the use or
inability to use this project are **solely the responsibility of the user**.
This project is completely free and open-source, published on GitHub for global users for **technical learning and
research purposes only**. This project does **not** guarantee compliance with local laws or regulations in all
jurisdictions.
**Using this project in violation of local laws is strictly prohibited.** Any legal consequences arising from
intentional or unintentional violations are the user's responsibility. The project maintainers accept **no liability**
for such outcomes.
## build ## build

View File

@@ -40,7 +40,7 @@ func Initialize() {
} }
App = app.NewWithID(config.ProgramName) App = app.NewWithID(config.ProgramName)
//App.Settings().SetTheme(&myTheme{}) //App.Settings().SetTheme(&myTheme{})
MainWindow = App.NewWindow(fmt.Sprintf("%s Ver %s-%s", config.ProgramName, model.Version(config.Version), config.General.DistributionChannel)) MainWindow = App.NewWindow(fmt.Sprintf("%s Ver %s", config.ProgramName, model.Version(config.Version)))
tabs := container.NewAppTabs( tabs := container.NewAppTabs(
container.NewTabItem(i18n.T("gui.tab.player"), container.NewTabItem(i18n.T("gui.tab.player"),

View File

@@ -39,7 +39,7 @@ func handlePlayNext() {
events.PlaylistInsertUpdate(model.PlaylistIDPlayer), events.PlaylistInsertUpdate(model.PlaylistIDPlayer),
"internal.controller.playcontrol.playnext_when_insert.player", "internal.controller.playcontrol.playnext_when_insert.player",
func(event *event.Event) { func(event *event.Event) {
if isIdle { if isIdle && config.General.PlayNextOnFail {
global.EventManager.CallA(events.PlayerPlayNextCmd, global.EventManager.CallA(events.PlayerPlayNextCmd,
events.PlayerPlayNextCmdEvent{}) events.PlayerPlayNextCmdEvent{})
} }
@@ -49,7 +49,7 @@ func handlePlayNext() {
events.PlaylistInsertUpdate(model.PlaylistIDSystem), events.PlaylistInsertUpdate(model.PlaylistIDSystem),
"internal.controller.playcontrol.playnext_when_insert.system", "internal.controller.playcontrol.playnext_when_insert.system",
func(event *event.Event) { func(event *event.Event) {
if isIdle { if isIdle && config.General.PlayNextOnFail {
global.EventManager.CallA(events.PlayerPlayNextCmd, global.EventManager.CallA(events.PlayerPlayNextCmd,
events.PlayerPlayNextCmdEvent{}) events.PlayerPlayNextCmdEvent{})
} }

View File

@@ -195,6 +195,10 @@ func registerCmdHandler() {
mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny) mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny)
if err != nil || len(mediaUrls) == 0 { if err != nil || len(mediaUrls) == 0 {
log.Warn("[MPV PlayControl] get media url failed ", mediaInfo.Meta.ID(), err) log.Warn("[MPV PlayControl] get media url failed ", mediaInfo.Meta.ID(), err)
global.EventManager.CallA(events.PlayerPlayingUpdate, events.PlayerPlayingUpdateEvent{
Media: evnt.Data.(events.PlayerPlayCmdEvent).Media,
Removed: false,
})
global.EventManager.CallA( global.EventManager.CallA(
events.PlayerPlayErrorUpdate, events.PlayerPlayErrorUpdate,
events.PlayerPlayErrorUpdateEvent{ events.PlayerPlayErrorUpdateEvent{

View File

@@ -223,6 +223,10 @@ func registerCmdHandler() {
mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny) mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny)
if err != nil || len(mediaUrls) == 0 { if err != nil || len(mediaUrls) == 0 {
log.Warn("[VLC PlayControl] get media url failed ", mediaInfo.Meta.ID(), err) log.Warn("[VLC PlayControl] get media url failed ", mediaInfo.Meta.ID(), err)
global.EventManager.CallA(events.PlayerPlayingUpdate, events.PlayerPlayingUpdateEvent{
Media: evnt.Data.(events.PlayerPlayCmdEvent).Media,
Removed: false,
})
global.EventManager.CallA( global.EventManager.CallA(
events.PlayerPlayErrorUpdate, events.PlayerPlayErrorUpdate,
events.PlayerPlayErrorUpdateEvent{ events.PlayerPlayErrorUpdateEvent{

61
internal/source/dummy.go Normal file
View File

@@ -0,0 +1,61 @@
package source
import (
"github.com/AynaLivePlayer/miaosic"
)
type dummySource struct{}
func (d *dummySource) GetName() string {
return "dummy"
}
func (d *dummySource) Qualities() []miaosic.Quality {
return []miaosic.Quality{}
}
func (d *dummySource) Search(keyword string, page, size int) ([]miaosic.MediaInfo, error) {
return []miaosic.MediaInfo{
miaosic.MediaInfo{
Title: keyword,
Artist: "Unknown",
Album: "Unknown",
Meta: miaosic.MetaData{
Provider: "dummy",
Identifier: keyword,
},
},
}, nil
}
func (d *dummySource) MatchMedia(uri string) (miaosic.MetaData, bool) {
return miaosic.MetaData{}, false
}
func (d *dummySource) GetMediaInfo(meta miaosic.MetaData) (miaosic.MediaInfo, error) {
return miaosic.MediaInfo{
Title: meta.Identifier,
Artist: "Unknown",
Album: "Unknown",
Meta: miaosic.MetaData{
Provider: "dummy",
Identifier: meta.Identifier,
},
}, nil
}
func (d *dummySource) GetMediaUrl(meta miaosic.MetaData, quality miaosic.Quality) ([]miaosic.MediaUrl, error) {
return []miaosic.MediaUrl{}, miaosic.ErrNotImplemented
}
func (d *dummySource) GetMediaLyric(meta miaosic.MetaData) ([]miaosic.Lyrics, error) {
return []miaosic.Lyrics{}, miaosic.ErrNotImplemented
}
func (d *dummySource) MatchPlaylist(uri string) (miaosic.MetaData, bool) {
return miaosic.MetaData{}, false
}
func (d *dummySource) GetPlaylist(meta miaosic.MetaData) (*miaosic.Playlist, error) {
return &miaosic.Playlist{}, miaosic.ErrNotImplemented
}

View File

@@ -0,0 +1,37 @@
//go:build nosource
package source
import (
"AynaLivePlayer/core/events"
"AynaLivePlayer/global"
"AynaLivePlayer/pkg/config"
"github.com/AynaLivePlayer/miaosic"
)
type _sourceConfig struct {
LocalSourcePath string
}
func (_ _sourceConfig) Name() string {
return "Source"
}
func (_ _sourceConfig) OnLoad() {
}
func (_ _sourceConfig) OnSave() {
}
var sourceCfg = &_sourceConfig{
LocalSourcePath: "./music",
}
func Initialize() {
config.LoadConfig(sourceCfg)
miaosic.RegisterProvider(&dummySource{})
global.EventManager.CallA(
events.MediaProviderUpdate, events.MediaProviderUpdateEvent{
Providers: miaosic.ListAvailableProviders(),
})
}

View File

@@ -1,3 +1,5 @@
//go:build !nosource
package source package source
import ( import (
@@ -34,9 +36,6 @@ var sourceCfg = &_sourceConfig{
func Initialize() { func Initialize() {
config.LoadConfig(sourceCfg) config.LoadConfig(sourceCfg)
kugou.UseInstrumental() kugou.UseInstrumental()
if config.General.DistributionChannel != "github" {
miaosic.UnregisterAllProvider()
}
miaosic.RegisterProvider(local.NewLocal(sourceCfg.LocalSourcePath)) miaosic.RegisterProvider(local.NewLocal(sourceCfg.LocalSourcePath))
global.EventManager.CallA( global.EventManager.CallA(

View File

@@ -10,7 +10,7 @@ import (
const ( const (
ProgramName = "卡西米尔唱片机" ProgramName = "卡西米尔唱片机"
Version uint32 = 0x010200 Version uint32 = 0x010201
) )
const ( const (

View File

@@ -13,7 +13,6 @@ type _GeneralConfig struct {
FixedSize bool FixedSize bool
EnableSMC bool // enable system media control EnableSMC bool // enable system media control
CustomFonts string // use custom fonts, under ./assets file CustomFonts string // use custom fonts, under ./assets file
DistributionChannel string // app distribution channel, default fanfan
} }
func (c *_GeneralConfig) Name() string { func (c *_GeneralConfig) Name() string {
@@ -32,5 +31,4 @@ var General = &_GeneralConfig{
FixedSize: true, FixedSize: true,
EnableSMC: true, EnableSMC: true,
CustomFonts: "", CustomFonts: "",
DistributionChannel: "fanfan",
} }

View File

@@ -410,7 +410,11 @@ func (d *Diange) CreatePanel() fyne.CanvasObject {
skipPlaylistCheck, skipPlaylistCheck,
) )
sourceCfgs := []fyne.CanvasObject{} sourceCfgs := []fyne.CanvasObject{}
prvdrs := miaosic.ListAvailableProviders()
for source, cfg := range d.sourceConfigs { for source, cfg := range d.sourceConfigs {
if !slices.Contains(prvdrs, source) {
continue
}
sourceCfgs = append( sourceCfgs = append(
sourceCfgs, container.NewGridWithColumns(2, sourceCfgs, container.NewGridWithColumns(2,
widget.NewLabel(source), widget.NewLabel(source),