From 5d0ad2f593386530d77908c5f11a7b1b1016cafe Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Fri, 12 Apr 2024 06:17:48 -0400 Subject: [PATCH 1/7] Update Spoti15.cs --- Spoti15.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Spoti15.cs b/Spoti15.cs index 89ecd67..2e01658 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -812,7 +812,7 @@ private void DrawPlaylistStatus(Graphics g) } else { - DrawText(g, 3, "Unknown"); + DrawText(g, 0, "Liked Songs"); // liked shows as unknown, but can't think of any case where it wouldn't be liked } } @@ -1041,15 +1041,7 @@ public void UpdateLcd() var playback = cachedPlayback; if (playback == null || playback.Item == null) { - if (playback == null) - { - g.Clear(bgColor); - DrawTextScroll(g, 1, "ERROR"); - DrawTextScroll(g, 2, "SPOTIFY PLAYBACK NOT DETECTED"); - DoRender(); - return; - } - else if (playback.CurrentlyPlayingType == TrackType.Ad) + if (playback.CurrentlyPlayingType == TrackType.Ad) { g.Clear(bgColor); DrawTextScroll(g, 2, "Advertisement"); @@ -1062,8 +1054,12 @@ public void UpdateLcd() DrawTextScroll(g, 1, "ERROR"); DrawTextScroll(g, 2, playback.Error.Message); } - else + else // for some reason stopping playback after previously playing won't trigger the "playback == null" condition { + g.Clear(bgColor); + DrawTextScroll(g, 1, "ERROR"); + DrawTextScroll(g, 2, "NO SPOTIFY PLAYBACK DETECTED"); + DoRender(); return; } } From 333bbb3b884b0f9dcc97e8e7f6866efe5299d16f Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:21:14 -0400 Subject: [PATCH 2/7] Update Spoti15.cs fixed bugs, primarily no-playback related crashes polished ui --- Spoti15.cs | 162 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 97 insertions(+), 65 deletions(-) diff --git a/Spoti15.cs b/Spoti15.cs index 2e01658..3f00aa2 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Windows.Forms; using System.Drawing; using System.Threading.Tasks; @@ -8,6 +8,7 @@ using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Models; using System.Globalization; +using Unosquare.Swan; namespace Spoti15 { @@ -41,6 +42,7 @@ class Spoti15 private bool cachedLikedTrack = false; private bool likedSongNotification = false; private bool unlikedSongNotification = false; + private bool noSongPlayingNotification = false; private bool showingError = false; private string errorString = ""; private FullTrack likedOrUnlikedSong; @@ -115,25 +117,13 @@ private void CheckInput(object source, EventArgs e) inControlMenu = lcd.IsButtonPressed(LogiLcd.LcdButton.Mono3); if(inControlMenu && !seeking) { - bool btn2InCtlNow = lcd.IsButtonPressed(LogiLcd.LcdButton.Mono2); - if(btn2InCtlNow && !btn2Before) - { - var error = api.PausePlayback(); - if(error.HasError()) - { - showingError = true; - errorString = error.Error.Message; - hideErrorTimer = new Timer(); - hideErrorTimer.Enabled = true; - hideErrorTimer.Interval = 3000; - hideErrorTimer.Tick += OnErrorHidden; - } - } - btn2Before = btn2InCtlNow; - bool btn1InCtlNow = lcd.IsButtonPressed(LogiLcd.LcdButton.Mono1); if(btn1InCtlNow && !btn1Before) { + if (cachedPlayback == null || cachedPlayback.Item == null) + { + return; + } var error = api.SkipPlaybackToNext(); if (error.HasError()) { @@ -150,6 +140,10 @@ private void CheckInput(object source, EventArgs e) bool btn0InCtlNow = lcd.IsButtonPressed(LogiLcd.LcdButton.Mono0); if(btn0InCtlNow && !btn0Before) { + if (cachedPlayback == null || cachedPlayback.Item == null) + { + return; + } var error = api.SkipPlaybackToPrevious(); if (error.HasError()) { @@ -165,10 +159,18 @@ private void CheckInput(object source, EventArgs e) return; } - if (seeking && !btn2Before && cachedPlayback != null && cachedPlayback.CurrentlyPlayingType != TrackType.Ad) + if ((seeking) && (!btn2Before) && (cachedPlayback != null) && (cachedPlayback.CurrentlyPlayingType != TrackType.Ad)) { + //skip seek position if nothing playing to prevent crash + if (cachedPlayback == null || cachedPlayback.Item == null) + { + return; + } // set seek position to current - currentSeekPosition = (double)cachedPlayback.ProgressMs / cachedPlayback.Item.DurationMs; + else + { + currentSeekPosition = (double)cachedPlayback.ProgressMs / cachedPlayback.Item.DurationMs; + } } btn2Before = seeking; @@ -222,12 +224,18 @@ private void CheckInput(object source, EventArgs e) var thisItem = cachedPlayback; if(thisItem == null || thisItem.Item == null) { + noSongPlayingNotification = true; + disableLikedSongNotificationTimer = new Timer(); + disableLikedSongNotificationTimer.Enabled = true; + disableLikedSongNotificationTimer.Interval = 5000; + disableLikedSongNotificationTimer.Tick += OnLikedSongNotificationFinished; + btn0Before = btn0Now; return; } - if(likedSongNotification || unlikedSongNotification) + if(likedSongNotification || unlikedSongNotification || noSongPlayingNotification) { - likedSongNotification = unlikedSongNotification = false; + likedSongNotification = unlikedSongNotification = noSongPlayingNotification = false; btn0Before = btn0Now; disableLikedSongNotificationTimer.Enabled = false; return; @@ -345,7 +353,7 @@ private void OnErrorHidden(object source, EventArgs e) private void OnLikedSongNotificationFinished(object source, EventArgs e) { - likedSongNotification = unlikedSongNotification = false; + likedSongNotification = unlikedSongNotification = noSongPlayingNotification = false; disableLikedSongNotificationTimer.Enabled = false; } @@ -812,7 +820,7 @@ private void DrawPlaylistStatus(Graphics g) } else { - DrawText(g, 0, "Liked Songs"); // liked shows as unknown, but can't think of any case where it wouldn't be liked + DrawText(g, 0, playback.Context.Type); // liked shows as unknown, but can't think of any case where it wouldn't be liked } } @@ -844,7 +852,7 @@ public void UpdateLcd() { // TODO: draw spotify logo g.Clear(bgColor); - DrawTextScroll(g, 2, "SPOTIFY"); + DrawTextScroll(g, 2, "SPOTI15"); } else if(showingError) { @@ -875,33 +883,50 @@ public void UpdateLcd() DrawPlaybackStatus(g, false); } - else if(seeking && cachedPlayback != null && cachedPlayback.Item != null) + else if (noSongPlayingNotification) { g.Clear(bgColor); + DrawTextScroll(g, 1, "CANNOT LIKE SONG", bigFont); + DrawTextScroll(g, 3, "Error: Spotify not playing"); + } + else if(seeking && cachedPlayback != null) + { + if (cachedPlayback.Item == null) + { + g.Clear(bgColor); - DrawTextScroll(g, 1, "SEEKING"); + DrawTextScroll(g, 1, "SEEKING", bigFont); - var posInMs = (int)(cachedPlayback.Item.DurationMs * currentSeekPosition); - DrawTextScroll(g, 3, string.Format("{0:D2}:{1:D2}", posInMs / 60000, (posInMs % 60000) / 1000)); + DrawTextScroll(g, 3, "Error: Spotify not playing"); + } + else + { + g.Clear(bgColor); - // Draw progress bar - g.DrawRectangle(Pens.White, 8, LogiLcd.MonoHeight - 16, (LogiLcd.MonoWidth - 24), 6); - g.FillRectangle(Brushes.White, 8, LogiLcd.MonoHeight - 16, (int)((LogiLcd.MonoWidth - 24) * currentSeekPosition), 6); + DrawTextScroll(g, 1, "SEEKING", bigFont); - g.FillPolygon(Brushes.White, new Point[] { - new Point((LogiLcd.MonoWidth - 19), LogiLcd.MonoHeight - 7), - new Point((LogiLcd.MonoWidth - 19), LogiLcd.MonoHeight - 1), - new Point((LogiLcd.MonoWidth - 14), LogiLcd.MonoHeight - 4) - }); + var posInMs = (int)(cachedPlayback.Item.DurationMs * currentSeekPosition); + DrawTextScroll(g, 3, string.Format("{0:D2}:{1:D2}", posInMs / 60000, (posInMs % 60000) / 1000)); - g.FillPolygon(Brushes.White, new Point[] { - new Point(60, LogiLcd.MonoHeight - 7), - new Point(60, LogiLcd.MonoHeight - 1), - new Point(55, LogiLcd.MonoHeight - 4) - }); + // Draw progress bar + g.DrawRectangle(Pens.White, 8, LogiLcd.MonoHeight - 16, (LogiLcd.MonoWidth - 24), 6); + g.FillRectangle(Brushes.White, 8, LogiLcd.MonoHeight - 16, (int)((LogiLcd.MonoWidth - 24) * currentSeekPosition), 6); - DrawText(g, 6, "OK", iconFont, 8); - DrawPlaylistStatus(g); + g.FillPolygon(Brushes.White, new Point[] { + new Point((LogiLcd.MonoWidth - 19), LogiLcd.MonoHeight - 7), + new Point((LogiLcd.MonoWidth - 19), LogiLcd.MonoHeight - 1), + new Point((LogiLcd.MonoWidth - 14), LogiLcd.MonoHeight - 4) + }); + + g.FillPolygon(Brushes.White, new Point[] { + new Point(60, LogiLcd.MonoHeight - 7), + new Point(60, LogiLcd.MonoHeight - 1), + new Point(55, LogiLcd.MonoHeight - 4) + }); + + DrawText(g, 6, "OK", iconFont, 8); + DrawPlaylistStatus(g); + } } else if(inControlMenu && cachedPlayback != null) { @@ -931,25 +956,11 @@ public void UpdateLcd() new Point(18, LogiLcd.MonoHeight - 4) }); - if (cachedPlayback.IsPlaying) - { - g.FillRectangle(Brushes.White, new Rectangle((LogiLcd.MonoWidth - 58), LogiLcd.MonoHeight - 6, 2, 5)); - g.FillRectangle(Brushes.White, new Rectangle((LogiLcd.MonoWidth - 61), LogiLcd.MonoHeight - 6, 2, 5)); - } - else - { - g.FillPolygon(Brushes.White, new Point[] { - new Point((LogiLcd.MonoWidth - 64), LogiLcd.MonoHeight - 7), - new Point((LogiLcd.MonoWidth - 64), LogiLcd.MonoHeight - 1), - new Point((LogiLcd.MonoWidth - 59), LogiLcd.MonoHeight - 4) - }); - } - DrawTextScroll(g, 1, "UP NEXT", bigFont); if(cachedPlayback.Context == null) { - + DrawTextScroll(g, 3, "Error: Spotify not playing"); } else if (cachedPlayback.Context.Type == "playlist" && upNextPlaylistTrack != null) { @@ -986,7 +997,8 @@ public void UpdateLcd() if(cachedPlayback.Context == null) { - + DrawTextScroll(g, 1, "STOPPED", bigFont); + DrawTextScroll(g, 3, "Error: Spotify not playing"); } else if(cachedPlayback.Context.Type == "playlist") { @@ -1025,14 +1037,22 @@ public void UpdateLcd() DrawTextScroll(g, 1, "ARTIST", bigFont); DrawTextScroll(g, 3, cachedArtist.Name); DrawTextScroll(g, 4, GetStringFromGenres(cachedArtist.Genres.ToArray())); + Console.WriteLine(cachedPlayback.ToJson().ToString()); DrawText(g, 0, string.Format("e {0}", cachedArtist.Followers.Total), iconFont, 5, 5); DrawPlaybackStatus(g, true); } + else if(cachedPlayback.Context.Type == "collection") + { + DrawTextScroll(g, 1, "LIKED SONGS", bigFont); //tested, can't find anything that isn't liked music that shows as a "collection" + DrawTextScroll(g, 3, "Details unavailable"); + + DrawPlaybackStatus(g, true); + } else { - DrawTextScroll(g, 1, cachedPlayback.Context.Type); + DrawTextScroll(g, 1, cachedPlayback.Context.Type, bigFont); } } else @@ -1041,7 +1061,18 @@ public void UpdateLcd() var playback = cachedPlayback; if (playback == null || playback.Item == null) { - if (playback.CurrentlyPlayingType == TrackType.Ad) + string currentTime1 = DateTime.Now.ToString("h:mm:ss tt"); + Size textSize1 = TextRenderer.MeasureText(currentTime1, mainFont); + DrawText(g, 0, currentTime1, LogiLcd.MonoWidth - textSize1.Width); + if (playback == null) + { + g.Clear(bgColor); + DrawTextScroll(g, 1, "STARTING", bigFont); + DrawTextScroll(g, 3, "Wait for API to initialize"); + DoRender(); + return; + } + else if (playback.CurrentlyPlayingType == TrackType.Ad) { g.Clear(bgColor); DrawTextScroll(g, 2, "Advertisement"); @@ -1053,12 +1084,13 @@ public void UpdateLcd() g.Clear(bgColor); DrawTextScroll(g, 1, "ERROR"); DrawTextScroll(g, 2, playback.Error.Message); + DoRender(); + return; } - else // for some reason stopping playback after previously playing won't trigger the "playback == null" condition + else { - g.Clear(bgColor); - DrawTextScroll(g, 1, "ERROR"); - DrawTextScroll(g, 2, "NO SPOTIFY PLAYBACK DETECTED"); + DrawTextScroll(g, 1, "ERROR", bigFont); + DrawTextScroll(g, 3, "No Spotify playback detected"); DoRender(); return; } From 01f5ae1d531a45996f71f642ea0815434a4f9969 Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Mon, 15 Apr 2024 03:23:58 -0400 Subject: [PATCH 3/7] Update Spoti15.cs fixed additional bugs, made startup screen draw logo instead of writing text, added comments to lines 261 and 583 to mark bugs i couldn't figure out how to fix without removing features or rewriting the entire program --- Spoti15.cs | 95 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 25 deletions(-) diff --git a/Spoti15.cs b/Spoti15.cs index 3f00aa2..d5fa758 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -9,6 +9,10 @@ using SpotifyAPI.Web.Models; using System.Globalization; using Unosquare.Swan; +using static System.Net.Mime.MediaTypeNames; +using System.Drawing.Imaging; +using System.IO; +using System.Text; namespace Spoti15 { @@ -140,11 +144,20 @@ private void CheckInput(object source, EventArgs e) bool btn0InCtlNow = lcd.IsButtonPressed(LogiLcd.LcdButton.Mono0); if(btn0InCtlNow && !btn0Before) { + var error = new ErrorResponse(); if (cachedPlayback == null || cachedPlayback.Item == null) { return; } - var error = api.SkipPlaybackToPrevious(); + if ((double)cachedPlayback.ProgressMs >= 3000) + { + error = api.SeekPlayback(0); + } + else + { + error = api.SkipPlaybackToPrevious(); + } + if (error.HasError()) { showingError = true; @@ -245,7 +258,8 @@ private void CheckInput(object source, EventArgs e) likedOrUnlikedSong = thisItem.Item; ListedItem.Add(likedOrUnlikedSong.Id); - if(cachedLikedTrack) + bool isAlreadyLiked = api.CheckSavedTracks(ListedItem).ToBoolean(); //in my testing, for whatever reason, this will always return false and result in the program attempting to like an already liked song + if (isAlreadyLiked) { api.RemoveSavedTracks(ListedItem); likedSongNotification = false; @@ -566,7 +580,7 @@ public void UpdateSpot() cachedArtist = thisArtist; } - for (int i = 0; i < artistTracks.Tracks.Count; i++) + for (int i = 0; i < artistTracks.Tracks.Count; i++) //this line causes a crash if listening from artist page { if (artistTracks.Tracks[i].Id == cachedPlayback.Item.Id) { @@ -820,7 +834,7 @@ private void DrawPlaylistStatus(Graphics g) } else { - DrawText(g, 0, playback.Context.Type); // liked shows as unknown, but can't think of any case where it wouldn't be liked + DrawText(g, 0, "Liked Songs"); // refer to line 1043 } } @@ -850,9 +864,17 @@ public void UpdateLcd() { if(api == null) { - // TODO: draw spotify logo + // TODO: draw spotify logo (done) + var spotlogo = new byte[] { 66, 77, 150, 1, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0, 0, 43, 0, 0, 0, 43, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 14, 0, 0, 196, 14, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 128, 0, 0, 0, 0, 0, 3, 255, 248, 0, 0, 0, 0, 0, 15, 255, 254, 0, 0, 0, 0, 0, 31, 255, 255, 0, 0, 0, 0, 0, 127, 255, 255, 192, 0, 0, 0, 0, 255, 255, 255, 224, 0, 0, 0, 1, 255, 255, 255, 240, 0, 0, 0, 3, 255, 255, 255, 248, 0, 0, 0, 7, 255, 255, 255, 252, 0, 0, 0, 7, 255, 255, 255, 252, 0, 0, 0, 15, 255, 255, 255, 254, 0, 0, 0, 31, 255, 255, 241, 255, 0, 0, 0, 31, 255, 255, 193, 255, 0, 0, 0, 31, 195, 254, 3, 255, 0, 0, 0, 63, 192, 0, 15, 255, 128, 0, 0, 63, 224, 0, 127, 255, 128, 0, 0, 63, 255, 255, 254, 127, 128, 0, 0, 63, 255, 255, 248, 127, 128, 0, 0, 63, 255, 255, 192, 127, 192, 0, 0, 127, 129, 248, 0, 255, 192, 0, 0, 127, 128, 0, 3, 255, 192, 0, 0, 127, 192, 0, 31, 255, 192, 0, 0, 63, 252, 3, 255, 223, 128, 0, 0, 63, 255, 255, 255, 15, 128, 0, 0, 63, 255, 255, 248, 15, 128, 0, 0, 63, 7, 255, 128, 31, 128, 0, 0, 63, 0, 0, 0, 63, 128, 0, 0, 31, 0, 0, 0, 255, 0, 0, 0, 31, 128, 0, 15, 255, 0, 0, 0, 31, 252, 0, 255, 255, 0, 0, 0, 15, 255, 255, 255, 254, 0, 0, 0, 7, 255, 255, 255, 252, 0, 0, 0, 7, 255, 255, 255, 252, 0, 0, 0, 3, 255, 255, 255, 248, 0, 0, 0, 1, 255, 255, 255, 240, 0, 0, 0, 0, 255, 255, 255, 224, 0, 0, 0, 0, 127, 255, 255, 192, 0, 0, 0, 0, 31, 255, 255, 0, 0, 0, 0, 0, 7, 255, 254, 0, 0, 0, 0, 0, 1, 255, 240, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + Bitmap bmp; + using (var ms = new MemoryStream(spotlogo)) + { + bmp = new Bitmap(ms); + } + int x = (LogiLcd.MonoWidth / 2) - 43 / 2; g.Clear(bgColor); - DrawTextScroll(g, 2, "SPOTI15"); + g.DrawImage(bmp, x, 0); + //DrawTextScroll(g, 2, "SPOTI15", bigFont); } else if(showingError) { @@ -887,24 +909,19 @@ public void UpdateLcd() { g.Clear(bgColor); DrawTextScroll(g, 1, "CANNOT LIKE SONG", bigFont); - DrawTextScroll(g, 3, "Error: Spotify not playing"); + DrawTextScroll(g, 3, "Spotify not playing"); } else if(seeking && cachedPlayback != null) { + g.Clear(bgColor); + DrawTextScroll(g, 1, "SEEKING", bigFont); + if (cachedPlayback.Item == null) { - g.Clear(bgColor); - - DrawTextScroll(g, 1, "SEEKING", bigFont); - - DrawTextScroll(g, 3, "Error: Spotify not playing"); + DrawTextScroll(g, 3, "Spotify not playing"); } else { - g.Clear(bgColor); - - DrawTextScroll(g, 1, "SEEKING", bigFont); - var posInMs = (int)(cachedPlayback.Item.DurationMs * currentSeekPosition); DrawTextScroll(g, 3, string.Format("{0:D2}:{1:D2}", posInMs / 60000, (posInMs % 60000) / 1000)); @@ -960,7 +977,14 @@ public void UpdateLcd() if(cachedPlayback.Context == null) { - DrawTextScroll(g, 3, "Error: Spotify not playing"); + if (cachedPlayback.Item == null) + { + DrawTextScroll(g, 3, "Spotify not playing"); + } + else + { + DrawTextScroll(g, 3, "Unknown"); + } } else if (cachedPlayback.Context.Type == "playlist" && upNextPlaylistTrack != null) { @@ -997,8 +1021,31 @@ public void UpdateLcd() if(cachedPlayback.Context == null) { - DrawTextScroll(g, 1, "STOPPED", bigFont); - DrawTextScroll(g, 3, "Error: Spotify not playing"); + if (cachedPlayback.Item == null) + { + DrawTextScroll(g, 1, "STOPPED", bigFont); + DrawTextScroll(g, 3, "Spotify not playing"); + } + else + { + DrawTextScroll(g, 1, "SINGLE", bigFont); + DrawTextScroll(g, 3, cachedPlayback.Item.Album.Name); + DrawTextScroll(g, 4, GetStringFromArtists(cachedPlayback.Item.Artists.ToArray())); + DrawTextScroll(g, 5, string.Format("Released {0}", cachedPlayback.Item.Album.ReleaseDate)); + + if (cachedAlbum != null) + { + string genres = GetStringFromGenres(cachedAlbum.Genres.ToArray()); + if (genres == "") + { + DrawText(g, 0, string.Format("e {0}", cachedAlbum.Popularity), iconFont, 5, 5); + } + else + { + DrawTextScroll(g, 6, string.Format("{0} - {1} followers", GetStringFromGenres(cachedAlbum.Genres.ToArray()), cachedAlbum.Popularity)); + } + } + } } else if(cachedPlayback.Context.Type == "playlist") { @@ -1037,7 +1084,6 @@ public void UpdateLcd() DrawTextScroll(g, 1, "ARTIST", bigFont); DrawTextScroll(g, 3, cachedArtist.Name); DrawTextScroll(g, 4, GetStringFromGenres(cachedArtist.Genres.ToArray())); - Console.WriteLine(cachedPlayback.ToJson().ToString()); DrawText(g, 0, string.Format("e {0}", cachedArtist.Followers.Total), iconFont, 5, 5); @@ -1045,8 +1091,7 @@ public void UpdateLcd() } else if(cachedPlayback.Context.Type == "collection") { - DrawTextScroll(g, 1, "LIKED SONGS", bigFont); //tested, can't find anything that isn't liked music that shows as a "collection" - DrawTextScroll(g, 3, "Details unavailable"); + DrawTextScroll(g, 1, "LIKED SONGS", bigFont); //tested, can't find anything that shows as a "collection" other than liked songs DrawPlaybackStatus(g, true); } @@ -1082,15 +1127,15 @@ public void UpdateLcd() else if (playback.HasError()) { g.Clear(bgColor); - DrawTextScroll(g, 1, "ERROR"); + DrawTextScroll(g, 1, "API ERROR"); DrawTextScroll(g, 2, playback.Error.Message); DoRender(); return; } else { - DrawTextScroll(g, 1, "ERROR", bigFont); - DrawTextScroll(g, 3, "No Spotify playback detected"); + DrawTextScroll(g, 1, "NO TRACK INFORMATION", bigFont); + DrawTextScroll(g, 3, "Spotify not playing"); DoRender(); return; } From 20ea9be7a8f394641209e1d552e43c0c9858a18c Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Tue, 16 Apr 2024 04:47:03 -0400 Subject: [PATCH 4/7] Update Spoti15.cs fixed like toggle by just reverting it because either my code or the library don't format the url properly or the api doesnt consider "saved" and "liked" tracks to be the same thing --- Spoti15.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Spoti15.cs b/Spoti15.cs index d5fa758..3824034 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -258,8 +258,7 @@ private void CheckInput(object source, EventArgs e) likedOrUnlikedSong = thisItem.Item; ListedItem.Add(likedOrUnlikedSong.Id); - bool isAlreadyLiked = api.CheckSavedTracks(ListedItem).ToBoolean(); //in my testing, for whatever reason, this will always return false and result in the program attempting to like an already liked song - if (isAlreadyLiked) + if (cachedLikedSong) { api.RemoveSavedTracks(ListedItem); likedSongNotification = false; From 641fdf818fdd5680c7f327458c4226f8efae55e6 Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Tue, 16 Apr 2024 05:08:10 -0400 Subject: [PATCH 5/7] Update Spoti15.cs fixed typo --- Spoti15.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spoti15.cs b/Spoti15.cs index 3824034..ea16ebb 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -258,7 +258,7 @@ private void CheckInput(object source, EventArgs e) likedOrUnlikedSong = thisItem.Item; ListedItem.Add(likedOrUnlikedSong.Id); - if (cachedLikedSong) + if (cachedLikedTrack) { api.RemoveSavedTracks(ListedItem); likedSongNotification = false; From c8b1df4a1abc02caf4836beaa531649c07751b69 Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Tue, 16 Apr 2024 05:13:32 -0400 Subject: [PATCH 6/7] Update Spoti15.cs removed references that vs added for me for some reason --- Spoti15.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Spoti15.cs b/Spoti15.cs index ea16ebb..13d7ecb 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -8,11 +8,7 @@ using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Models; using System.Globalization; -using Unosquare.Swan; -using static System.Net.Mime.MediaTypeNames; -using System.Drawing.Imaging; using System.IO; -using System.Text; namespace Spoti15 { From 26d9cfa83d7f721fd30c2870fe68be462bedbfa2 Mon Sep 17 00:00:00 2001 From: k4zo <40926602+k4zo@users.noreply.github.com> Date: Tue, 16 Apr 2024 05:17:33 -0400 Subject: [PATCH 7/7] Update Spoti15.cs removed error comment because for some reason it just stopped happening --- Spoti15.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spoti15.cs b/Spoti15.cs index 13d7ecb..a1871a1 100644 --- a/Spoti15.cs +++ b/Spoti15.cs @@ -575,7 +575,7 @@ public void UpdateSpot() cachedArtist = thisArtist; } - for (int i = 0; i < artistTracks.Tracks.Count; i++) //this line causes a crash if listening from artist page + for (int i = 0; i < artistTracks.Tracks.Count; i++) { if (artistTracks.Tracks[i].Id == cachedPlayback.Item.Id) {