From 49240c47f3fa81d869009974e6a3834662891aac Mon Sep 17 00:00:00 2001 From: eugenr Date: Fri, 11 Mar 2022 04:40:46 -0800 Subject: [PATCH] Transliterate the songs metadata --- music.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/music.go b/music.go index 5c46bae..8c52f50 100644 --- a/music.go +++ b/music.go @@ -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...)) } } })