Compare commits

..

No commits in common. "translit-music" and "master" have entirely different histories.

View File

@ -22,13 +22,10 @@ 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 {
@ -36,11 +33,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(translit.Transliterate(val, maps...)) dev.Music.SetTrack(val)
case player.ChangeTypeAlbum: case player.ChangeTypeAlbum:
dev.Music.SetAlbum(translit.Transliterate(val, maps...)) dev.Music.SetAlbum(val)
case player.ChangeTypeArtist: case player.ChangeTypeArtist:
dev.Music.SetArtist(translit.Transliterate(val, maps...)) dev.Music.SetArtist(val)
} }
} }
}) })