From 9279470ace54211d29673ce810c3eb084762930a Mon Sep 17 00:00:00 2001 From: Marconi Gomes Date: Sun, 10 Sep 2023 11:53:07 -0300 Subject: [PATCH] fix: Capitalized JSON attributes --- AMRPC WatchDog Desktop/Payload.cs | 32 +++++++++++++++--------------- AMRPC WatchDog Desktop/Program.cs | 3 +-- AMRPC WatchDog Desktop/Provider.cs | 10 +++++----- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/AMRPC WatchDog Desktop/Payload.cs b/AMRPC WatchDog Desktop/Payload.cs index 12a2927..4f0fbb7 100644 --- a/AMRPC WatchDog Desktop/Payload.cs +++ b/AMRPC WatchDog Desktop/Payload.cs @@ -6,7 +6,7 @@ namespace AMRPC_WatchDog_Desktop { public class Payload { - private string _playingStatusValue; + private string _playerStateValue; private double _endTimeValue = -1; public event PropertyChangedEventHandler PropertyChanged; @@ -18,23 +18,23 @@ public static class PlayingStatuses public const string Paused = "paused"; } - public string Title { get; set; } - public string Album { get; set; } - public string Artist { get; set; } - public string ThumbnailPath { get; set; } + public string title { get; set; } + public string album { get; set; } + public string artist { get; set; } + public string thumbnailPath { get; set; } - public string PlayingStatus + public string playerState { - get => _playingStatusValue; + get => _playerStateValue; set { - if (value == _playingStatusValue) return; - _playingStatusValue = value; + if (value == _playerStateValue) return; + _playerStateValue = value; NotifyPropertyChanged(); } } - public double EndTime + public double endTime { get => _endTimeValue; set @@ -52,12 +52,12 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") public void ResetToInitialState() { - Title = null; - Artist = null; - Album = null; - ThumbnailPath = null; - PlayingStatus = PlayingStatuses.NotStarted; - EndTime = -1; + title = null; + artist = null; + album = null; + thumbnailPath = null; + playerState = PlayingStatuses.NotStarted; + endTime = -1; } } } \ No newline at end of file diff --git a/AMRPC WatchDog Desktop/Program.cs b/AMRPC WatchDog Desktop/Program.cs index 8a0d9a7..94955fd 100644 --- a/AMRPC WatchDog Desktop/Program.cs +++ b/AMRPC WatchDog Desktop/Program.cs @@ -1,13 +1,12 @@ using System; using System.Windows.Forms; -using Microsoft.Win32; namespace AMRPC_WatchDog_Desktop { internal static class Program { - private const string AppVersion = "v0.2.1"; + private const string AppVersion = "v0.2.3"; [STAThread] private static void Main() { diff --git a/AMRPC WatchDog Desktop/Provider.cs b/AMRPC WatchDog Desktop/Provider.cs index a2e1fae..790f70d 100644 --- a/AMRPC WatchDog Desktop/Provider.cs +++ b/AMRPC WatchDog Desktop/Provider.cs @@ -65,12 +65,12 @@ private void OnPlaybackInfoChanged(GlobalSystemMediaTransportControlsSession sen var playbackInfo = _ampSession.GetPlaybackInfo(); var timelineProperties = _ampSession.GetTimelineProperties(); - _payload.PlayingStatus = playbackInfo.PlaybackStatus.ToString().ToLower() == Payload.PlayingStatuses.Playing + _payload.playerState = playbackInfo.PlaybackStatus.ToString().ToLower() == Payload.PlayingStatuses.Playing ? Payload.PlayingStatuses.Playing : Payload.PlayingStatuses.Paused; Double newEndTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + timelineProperties.EndTime.TotalMilliseconds; - _payload.EndTime = newEndTime; + _payload.endTime = newEndTime; } private async void OnMediaPropertiesChanged(GlobalSystemMediaTransportControlsSession sender, MediaPropertiesChangedEventArgs args) @@ -88,10 +88,10 @@ private async void OnMediaPropertiesChanged(GlobalSystemMediaTransportControlsSe private void ParseMediaProperties(GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties) { - _payload.Artist = mediaProperties.AlbumArtist.Split('-').First().Trim(); - _payload.Album = mediaProperties.AlbumArtist.Split('—').Last().Trim(); + _payload.artist = mediaProperties.AlbumArtist.Split('-').First().Trim(); + _payload.album = mediaProperties.AlbumArtist.Split('—').Last().Trim(); // payload.ThumbnailPath = mediaProperties.Thumbnail; - _payload.Title = mediaProperties.Title; + _payload.title = mediaProperties.Title; OnPlaybackInfoChanged(null, null); }