diff --git a/SpotifyAPI.dll b/SpotifyAPI.dll index c7b23b6d..31d7df71 100644 Binary files a/SpotifyAPI.dll and b/SpotifyAPI.dll differ diff --git a/SpotifyAPI/CFID.cs b/SpotifyAPI/CFID.cs index 3a05342e..a72df7c7 100644 --- a/SpotifyAPI/CFID.cs +++ b/SpotifyAPI/CFID.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace SpotifyAPIv1 { diff --git a/SpotifyAPI/Enum.cs b/SpotifyAPI/Enum.cs index bac4f820..5a716644 100644 --- a/SpotifyAPI/Enum.cs +++ b/SpotifyAPI/Enum.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; namespace SpotifyAPIv1 { diff --git a/SpotifyAPI/Events.cs b/SpotifyAPI/Events.cs index 097c8888..e3463c09 100644 --- a/SpotifyAPI/Events.cs +++ b/SpotifyAPI/Events.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; namespace SpotifyAPIv1 { diff --git a/SpotifyAPI/RemoteHandler.cs b/SpotifyAPI/RemoteHandler.cs index 7f3ac59b..f3d804d9 100644 --- a/SpotifyAPI/RemoteHandler.cs +++ b/SpotifyAPI/RemoteHandler.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using System.Net; using Newtonsoft.Json; @@ -49,10 +48,6 @@ namespace SpotifyAPIv1 { query("remote/play.json?uri=" + url, true, true, -1); } - public void SendVolumeRequest() - { - String s = query("remote/volume.json?volume=" + 50, false, false, -1); - } internal StatusResponse Update() { String response = query("remote/status.json", true, true, -1); diff --git a/SpotifyAPI/SpotifyAPI.cs b/SpotifyAPI/SpotifyAPI.cs index 99595416..18ed5ab1 100644 --- a/SpotifyAPI/SpotifyAPI.cs +++ b/SpotifyAPI/SpotifyAPI.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Net; using Newtonsoft.Json; using System.Text.RegularExpressions; -using System.Windows; -using System.Management; using System.Diagnostics; -using System.Drawing; namespace SpotifyAPIv1 { @@ -40,20 +33,14 @@ namespace SpotifyAPIv1 public static Boolean IsSpotifyRunning() { if (Process.GetProcessesByName("spotify").Length < 1) - { return false; - } - else - return true; + return true; } public static Boolean IsSpotifyWebHelperRunning() { if (Process.GetProcessesByName("SpotifyWebHelper").Length < 1) - { return false; - } - else - return true; + return true; } public void RunSpotify() { @@ -65,7 +52,7 @@ namespace SpotifyAPIv1 if (!IsSpotifyWebHelperRunning()) Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Spotify\\Data\\SpotifyWebHelper.exe"); } - public Boolean IsValidSpotifyURL(String url) + public static Boolean IsValidSpotifyURL(String url) { String[] types = new String[] { "track","album","local","artist"}; String[] split = url.Split(':'); @@ -78,7 +65,6 @@ namespace SpotifyAPIv1 if (!SpotifyAPI.IsSpotifyWebHelperRunning()) return; mh.Update(rh.Update()); - rh.SendVolumeRequest(); } } } diff --git a/SpotifyAPI/SpotifyEventHandler.cs b/SpotifyAPI/SpotifyEventHandler.cs index 4b7293fa..43782cb4 100644 --- a/SpotifyAPI/SpotifyEventHandler.cs +++ b/SpotifyAPI/SpotifyEventHandler.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using SpotifyAPIv1; namespace SpotifyAPIv1 diff --git a/SpotifyAPI/SpotifyMusicHandler.cs b/SpotifyAPI/SpotifyMusicHandler.cs index 542177d2..6d8da130 100644 --- a/SpotifyAPI/SpotifyMusicHandler.cs +++ b/SpotifyAPI/SpotifyMusicHandler.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using System.Runtime.InteropServices; using System.Windows.Forms; using System.IO; @@ -18,8 +17,11 @@ namespace SpotifyAPIv1 RemoteHandler rh; StatusResponse sr; + const byte VK_MEDIA_NEXT_TRACK = 0xb0; const byte VK_MEDIA_PREV_TRACK = 0xb1; + const int KEYEVENTF_EXTENDEDKEY = 0x1; + const int KEYEVENTF_KEYUP = 0x2; public SpotifyMusicHandler() { @@ -27,8 +29,6 @@ namespace SpotifyAPIv1 } void PressKey(byte keyCode) { - const int KEYEVENTF_EXTENDEDKEY = 0x1; - const int KEYEVENTF_KEYUP = 0x2; keybd_event(keyCode, 0x45, KEYEVENTF_EXTENDEDKEY, 0); keybd_event(keyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); } @@ -77,7 +77,7 @@ namespace SpotifyAPIv1 public void Pause() { rh.SendPauseRequest(); - + } public void Play() { @@ -87,7 +87,6 @@ namespace SpotifyAPIv1 { return sr; } - internal void Update(StatusResponse sr) { this.sr = sr; diff --git a/SpotifyAPI/StatusResponse.cs b/SpotifyAPI/StatusResponse.cs index db750f46..7fb310a2 100644 --- a/SpotifyAPI/StatusResponse.cs +++ b/SpotifyAPI/StatusResponse.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SpotifyAPI/Track.cs b/SpotifyAPI/Track.cs index 26d5c16e..b5e6982e 100644 --- a/SpotifyAPI/Track.cs +++ b/SpotifyAPI/Track.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; using System.Drawing; @@ -93,7 +92,7 @@ namespace SpotifyAPIv1 { data = await wc.DownloadDataTaskAsync(url); } - catch(WebException e) + catch(WebException) { throw; } diff --git a/SpotifyAPI_Example/Form1.cs b/SpotifyAPI_Example/Form1.cs index dc37ac57..bef64070 100644 --- a/SpotifyAPI_Example/Form1.cs +++ b/SpotifyAPI_Example/Form1.cs @@ -106,7 +106,7 @@ namespace SpotifyAPI_Example private void button5_Click(object sender, EventArgs e) { - if (spotify.IsValidSpotifyURL(textBox1.Text)) + if (SpotifyAPI.IsValidSpotifyURL(textBox1.Text)) mh.PlayURL(textBox1.Text); }