Better playbackstate
This commit is contained in:
parent
364c1e9ee5
commit
5601f76124
@ -139,8 +139,19 @@ public class DisMediaRP : IDisposable
|
|||||||
if (timelineProperties.LastUpdatedTime < DateTimeOffset.UnixEpoch)
|
if (timelineProperties.LastUpdatedTime < DateTimeOffset.UnixEpoch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._currentStatus.Timestamps = new Timestamps(DateTime.Now.Subtract(timelineProperties.Position),
|
GlobalSystemMediaTransportControlsSessionPlaybackInfo playbackInfo =
|
||||||
DateTime.Now.Add(timelineProperties.EndTime - timelineProperties.Position));
|
mediaSession.ControlSession.GetPlaybackInfo();
|
||||||
|
|
||||||
|
string? repeatMode = playbackInfo.AutoRepeatMode switch
|
||||||
|
{
|
||||||
|
MediaPlaybackAutoRepeatMode.Track => "\ud83d\udd02",
|
||||||
|
MediaPlaybackAutoRepeatMode.List => "\ud83d\udd01",
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
|
||||||
|
string? shuffle = (playbackInfo.IsShuffleActive ?? false) ? "\ud83d\udd00" : null;
|
||||||
|
|
||||||
|
this._currentStatus.State = string.Join(' ', repeatMode, shuffle, $"{timelineProperties.Position.ToString(@"hh\:mm\:ss")}/{timelineProperties.EndTime.ToString(@"hh\:mm\:ss")}");
|
||||||
|
|
||||||
this._discordRpcClient.SetPresence(this._currentStatus);
|
this._discordRpcClient.SetPresence(this._currentStatus);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user