Skip to content

Commit

Permalink
Add file properties to placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
sll552 committed Jul 10, 2022
1 parent c96e9f2 commit f61eb05
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions DiscordBee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,18 @@ private AlbumCoverData GetAlbumCoverData(string artworkData, Dictionary<string,

public Dictionary<string, string> GenerateMetaDataDictionary(string fileUrl = null)
{
var ret = new Dictionary<string, string>(Enum.GetNames(typeof(MetaDataType)).Length);
var ret = new Dictionary<string, string>(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;
}
Expand Down

0 comments on commit f61eb05

Please sign in to comment.