Transliterate the songs metadata

This commit is contained in:
eugenr 2022-03-11 04:40:46 -08:00
parent 553709ce8d
commit 49240c47f3

View File

@ -22,10 +22,13 @@ import (
"github.com/rs/zerolog/log"
"go.arsenm.dev/infinitime"
"go.arsenm.dev/infinitime/pkg/player"
"go.arsenm.dev/itd/translit"
)
func initMusicCtrl(dev *infinitime.Device) error {
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) {
if !firmwareUpdating {
@ -33,11 +36,11 @@ func initMusicCtrl(dev *infinitime.Device) error {
case player.ChangeTypeStatus:
dev.Music.SetStatus(val == "Playing")
case player.ChangeTypeTitle:
dev.Music.SetTrack(val)
dev.Music.SetTrack(translit.Transliterate(val, maps...))
case player.ChangeTypeAlbum:
dev.Music.SetAlbum(val)
dev.Music.SetAlbum(translit.Transliterate(val, maps...))
case player.ChangeTypeArtist:
dev.Music.SetArtist(val)
dev.Music.SetArtist(translit.Transliterate(val, maps...))
}
}
})