Compare commits
6 Commits
e62e6a4af0
...
1.0
Author | SHA1 | Date | |
---|---|---|---|
0e2fa5f81a | |||
7478741ba2 | |||
b1a3d2685c | |||
5601f76124 | |||
364c1e9ee5 | |||
1b6d562ee8 |
@ -138,9 +138,29 @@ public class DisMediaRP : IDisposable
|
|||||||
|
|
||||||
if (timelineProperties.LastUpdatedTime < DateTimeOffset.UnixEpoch)
|
if (timelineProperties.LastUpdatedTime < DateTimeOffset.UnixEpoch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
GlobalSystemMediaTransportControlsSessionPlaybackInfo playbackInfo =
|
||||||
|
mediaSession.ControlSession.GetPlaybackInfo();
|
||||||
|
|
||||||
this._currentStatus.Timestamps = new Timestamps(DateTime.Now.Subtract(timelineProperties.Position),
|
string? repeatMode = playbackInfo.AutoRepeatMode switch
|
||||||
DateTime.Now.Add(timelineProperties.EndTime - timelineProperties.Position));
|
{
|
||||||
|
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:hh\\:mm\\:ss}/{timelineProperties.EndTime:hh\\:mm\\:ss}");
|
||||||
|
|
||||||
|
if (mediaSession.ControlSession.GetPlaybackInfo().PlaybackStatus is
|
||||||
|
GlobalSystemMediaTransportControlsSessionPlaybackStatus.Playing)
|
||||||
|
this._currentStatus.Timestamps = new Timestamps()
|
||||||
|
{
|
||||||
|
End = DateTime.UtcNow.Add(timelineProperties.EndTime - timelineProperties.Position)
|
||||||
|
};
|
||||||
|
else
|
||||||
|
this._currentStatus.Timestamps = new Timestamps();
|
||||||
|
|
||||||
this._discordRpcClient.SetPresence(this._currentStatus);
|
this._discordRpcClient.SetPresence(this._currentStatus);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ if(loglevelIndex > -1)
|
|||||||
|
|
||||||
int discordKeyIndex = Array.IndexOf(args, "-d");
|
int discordKeyIndex = Array.IndexOf(args, "-d");
|
||||||
string discordKey;
|
string discordKey;
|
||||||
if (loglevelIndex > -1)
|
if (discordKeyIndex > -1)
|
||||||
if(discordKeyIndex + 1 < args.Length)
|
if(discordKeyIndex + 1 < args.Length)
|
||||||
discordKey = args[discordKeyIndex + 1];
|
discordKey = args[discordKeyIndex + 1];
|
||||||
else
|
else
|
||||||
@ -22,7 +22,7 @@ else
|
|||||||
throw new ArgumentNullException(nameof(discordKey));
|
throw new ArgumentNullException(nameof(discordKey));
|
||||||
|
|
||||||
int imageKeyIndex = Array.IndexOf(args, "-i");
|
int imageKeyIndex = Array.IndexOf(args, "-i");
|
||||||
string? imageKey = null;
|
string imageKey = "cat";
|
||||||
if(imageKeyIndex > -1)
|
if(imageKeyIndex > -1)
|
||||||
if (imageKeyIndex + 1 < args.Length)
|
if (imageKeyIndex + 1 < args.Length)
|
||||||
imageKey = args[imageKeyIndex + 1];
|
imageKey = args[imageKeyIndex + 1];
|
||||||
|
Reference in New Issue
Block a user