forked from Elara6331/itd
Transliterate the songs metadata
This commit is contained in:
parent
553709ce8d
commit
49240c47f3
9
music.go
9
music.go
@ -22,10 +22,13 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"go.arsenm.dev/infinitime"
|
"go.arsenm.dev/infinitime"
|
||||||
"go.arsenm.dev/infinitime/pkg/player"
|
"go.arsenm.dev/infinitime/pkg/player"
|
||||||
|
"go.arsenm.dev/itd/translit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initMusicCtrl(dev *infinitime.Device) error {
|
func initMusicCtrl(dev *infinitime.Device) error {
|
||||||
player.Init()
|
player.Init()
|
||||||
|
maps := k.Strings("notifs.translit.use")
|
||||||
|
translit.Transliterators["custom"] = translit.Map(k.Strings("notifs.translit.custom"))
|
||||||
|
|
||||||
player.OnChange(func(ct player.ChangeType, val string) {
|
player.OnChange(func(ct player.ChangeType, val string) {
|
||||||
if !firmwareUpdating {
|
if !firmwareUpdating {
|
||||||
@ -33,11 +36,11 @@ func initMusicCtrl(dev *infinitime.Device) error {
|
|||||||
case player.ChangeTypeStatus:
|
case player.ChangeTypeStatus:
|
||||||
dev.Music.SetStatus(val == "Playing")
|
dev.Music.SetStatus(val == "Playing")
|
||||||
case player.ChangeTypeTitle:
|
case player.ChangeTypeTitle:
|
||||||
dev.Music.SetTrack(val)
|
dev.Music.SetTrack(translit.Transliterate(val, maps...))
|
||||||
case player.ChangeTypeAlbum:
|
case player.ChangeTypeAlbum:
|
||||||
dev.Music.SetAlbum(val)
|
dev.Music.SetAlbum(translit.Transliterate(val, maps...))
|
||||||
case player.ChangeTypeArtist:
|
case player.ChangeTypeArtist:
|
||||||
dev.Music.SetArtist(val)
|
dev.Music.SetArtist(translit.Transliterate(val, maps...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user