mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-06 10:22:50 +08:00
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@@ -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:
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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"),
|
||||||
|
|||||||
@@ -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{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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{
|
||||||
|
|||||||
@@ -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
61
internal/source/dummy.go
Normal 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
|
||||||
|
}
|
||||||
37
internal/source/nosource.go
Normal file
37
internal/source/nosource.go
Normal 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(),
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -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(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ProgramName = "卡西米尔唱片机"
|
ProgramName = "卡西米尔唱片机"
|
||||||
Version uint32 = 0x010200
|
Version uint32 = 0x010201
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -2,18 +2,17 @@ package config
|
|||||||
|
|
||||||
type _GeneralConfig struct {
|
type _GeneralConfig struct {
|
||||||
BaseConfig
|
BaseConfig
|
||||||
Width float32
|
Width float32
|
||||||
Height float32
|
Height float32
|
||||||
Language string
|
Language string
|
||||||
InfoApiServer string
|
InfoApiServer string
|
||||||
AutoCheckUpdate bool
|
AutoCheckUpdate bool
|
||||||
ShowSystemTray bool
|
ShowSystemTray bool
|
||||||
PlayNextOnFail bool
|
PlayNextOnFail bool
|
||||||
UseSystemPlaylist bool
|
UseSystemPlaylist bool
|
||||||
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 {
|
||||||
@@ -21,16 +20,15 @@ func (c *_GeneralConfig) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var General = &_GeneralConfig{
|
var General = &_GeneralConfig{
|
||||||
Language: "zh-CN",
|
Language: "zh-CN",
|
||||||
ShowSystemTray: false,
|
ShowSystemTray: false,
|
||||||
InfoApiServer: "http://localhost:9090",
|
InfoApiServer: "http://localhost:9090",
|
||||||
AutoCheckUpdate: true,
|
AutoCheckUpdate: true,
|
||||||
Width: 960,
|
Width: 960,
|
||||||
Height: 480,
|
Height: 480,
|
||||||
PlayNextOnFail: false,
|
PlayNextOnFail: false,
|
||||||
UseSystemPlaylist: true,
|
UseSystemPlaylist: true,
|
||||||
FixedSize: true,
|
FixedSize: true,
|
||||||
EnableSMC: true,
|
EnableSMC: true,
|
||||||
CustomFonts: "",
|
CustomFonts: "",
|
||||||
DistributionChannel: "fanfan",
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user