From f61eb05c5462d05ab1ce09627f2f40d1f9ce6b30 Mon Sep 17 00:00:00 2001 From: Stefan Lengauer Date: Sun, 10 Jul 2022 22:22:25 +0200 Subject: [PATCH] Add file properties to placeholders --- DiscordBee.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DiscordBee.cs b/DiscordBee.cs index d24ba14..3bebd14 100644 --- a/DiscordBee.cs +++ b/DiscordBee.cs @@ -204,16 +204,18 @@ private AlbumCoverData GetAlbumCoverData(string artworkData, Dictionary GenerateMetaDataDictionary(string fileUrl = null) { - var ret = new Dictionary(Enum.GetNames(typeof(MetaDataType)).Length); + var ret = new Dictionary(Enum.GetNames(typeof(MetaDataType)).Length + Enum.GetNames(typeof(FilePropertyType)).Length); foreach (MetaDataType elem in Enum.GetValues(typeof(MetaDataType))) { ret.Add(elem.ToString(), string.IsNullOrWhiteSpace(fileUrl) ? _mbApiInterface.NowPlaying_GetFileTag(elem) : _mbApiInterface.Library_GetFileTag(fileUrl, elem)); } + foreach (FilePropertyType elem in Enum.GetValues(typeof(FilePropertyType))) + { + ret.Add(elem.ToString(), string.IsNullOrWhiteSpace(fileUrl) ? _mbApiInterface.NowPlaying_GetFileProperty(elem) : _mbApiInterface.Library_GetFileProperty(fileUrl, elem)); + } ret.Add("PlayState", _mbApiInterface.Player_GetPlayState().ToString()); ret.Add("Volume", Convert.ToInt32(_mbApiInterface.Player_GetVolume() * 100.0f).ToString()); - var duration = TimeSpan.FromMilliseconds(_mbApiInterface.NowPlaying_GetDuration()); - ret.Add("Duration", string.Format("{0:D}:{1:D2}", (int)Math.Floor(duration.TotalMinutes), duration.Seconds)); return ret; }