Compare commits

...

1 Commits

Author SHA1 Message Date
49240c47f3 Transliterate the songs metadata 2022-03-11 04:40:46 -08:00

View File

@ -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...))
} }
} }
}) })