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
|
||||
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=vlcOnly -v -o ./AynaLivePlayerVlc.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
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
22
README.md
22
README.md
@@ -6,6 +6,28 @@ Provider By Aynakeya
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func Initialize() {
|
||||
}
|
||||
App = app.NewWithID(config.ProgramName)
|
||||
//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(
|
||||
container.NewTabItem(i18n.T("gui.tab.player"),
|
||||
|
||||
@@ -39,7 +39,7 @@ func handlePlayNext() {
|
||||
events.PlaylistInsertUpdate(model.PlaylistIDPlayer),
|
||||
"internal.controller.playcontrol.playnext_when_insert.player",
|
||||
func(event *event.Event) {
|
||||
if isIdle {
|
||||
if isIdle && config.General.PlayNextOnFail {
|
||||
global.EventManager.CallA(events.PlayerPlayNextCmd,
|
||||
events.PlayerPlayNextCmdEvent{})
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func handlePlayNext() {
|
||||
events.PlaylistInsertUpdate(model.PlaylistIDSystem),
|
||||
"internal.controller.playcontrol.playnext_when_insert.system",
|
||||
func(event *event.Event) {
|
||||
if isIdle {
|
||||
if isIdle && config.General.PlayNextOnFail {
|
||||
global.EventManager.CallA(events.PlayerPlayNextCmd,
|
||||
events.PlayerPlayNextCmdEvent{})
|
||||
}
|
||||
|
||||
@@ -195,6 +195,10 @@ func registerCmdHandler() {
|
||||
mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny)
|
||||
if err != nil || len(mediaUrls) == 0 {
|
||||
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(
|
||||
events.PlayerPlayErrorUpdate,
|
||||
events.PlayerPlayErrorUpdateEvent{
|
||||
|
||||
@@ -223,6 +223,10 @@ func registerCmdHandler() {
|
||||
mediaUrls, err := miaosic.GetMediaUrl(mediaInfo.Meta, miaosic.QualityAny)
|
||||
if err != nil || len(mediaUrls) == 0 {
|
||||
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(
|
||||
events.PlayerPlayErrorUpdate,
|
||||
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
|
||||
|
||||
import (
|
||||
@@ -34,9 +36,6 @@ var sourceCfg = &_sourceConfig{
|
||||
func Initialize() {
|
||||
config.LoadConfig(sourceCfg)
|
||||
kugou.UseInstrumental()
|
||||
if config.General.DistributionChannel != "github" {
|
||||
miaosic.UnregisterAllProvider()
|
||||
}
|
||||
miaosic.RegisterProvider(local.NewLocal(sourceCfg.LocalSourcePath))
|
||||
|
||||
global.EventManager.CallA(
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
const (
|
||||
ProgramName = "卡西米尔唱片机"
|
||||
Version uint32 = 0x010200
|
||||
Version uint32 = 0x010201
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -13,7 +13,6 @@ type _GeneralConfig struct {
|
||||
FixedSize bool
|
||||
EnableSMC bool // enable system media control
|
||||
CustomFonts string // use custom fonts, under ./assets file
|
||||
DistributionChannel string // app distribution channel, default fanfan
|
||||
}
|
||||
|
||||
func (c *_GeneralConfig) Name() string {
|
||||
@@ -32,5 +31,4 @@ var General = &_GeneralConfig{
|
||||
FixedSize: true,
|
||||
EnableSMC: true,
|
||||
CustomFonts: "",
|
||||
DistributionChannel: "fanfan",
|
||||
}
|
||||
|
||||
@@ -410,7 +410,11 @@ func (d *Diange) CreatePanel() fyne.CanvasObject {
|
||||
skipPlaylistCheck,
|
||||
)
|
||||
sourceCfgs := []fyne.CanvasObject{}
|
||||
prvdrs := miaosic.ListAvailableProviders()
|
||||
for source, cfg := range d.sourceConfigs {
|
||||
if !slices.Contains(prvdrs, source) {
|
||||
continue
|
||||
}
|
||||
sourceCfgs = append(
|
||||
sourceCfgs, container.NewGridWithColumns(2,
|
||||
widget.NewLabel(source),
|
||||
|
||||
Reference in New Issue
Block a user