Skip to content

Commit 03a18e0

Browse files
author
Johnny @PC
committed
Cleaned up Imports and made IsValidSpotifyURL static
1 parent a779063 commit 03a18e0

11 files changed

Lines changed: 9 additions & 39 deletions

File tree

‎SpotifyAPI.dll‎

0 Bytes
Binary file not shown.

‎SpotifyAPI/CFID.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65

76
namespace SpotifyAPIv1
87
{

‎SpotifyAPI/Enum.cs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using System.Text;
5-
using System.Threading.Tasks;
63

74
namespace SpotifyAPIv1
85
{

‎SpotifyAPI/Events.cs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using System.Text;
5-
using System.Threading.Tasks;
63

74
namespace SpotifyAPIv1
85
{

‎SpotifyAPI/RemoteHandler.cs‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using System.Net;
76
using Newtonsoft.Json;
87

@@ -49,10 +48,6 @@ internal void SendPlayRequest(String url)
4948
{
5049
query("remote/play.json?uri=" + url, true, true, -1);
5150
}
52-
public void SendVolumeRequest()
53-
{
54-
String s = query("remote/volume.json?volume=" + 50, false, false, -1);
55-
}
5651
internal StatusResponse Update()
5752
{
5853
String response = query("remote/status.json", true, true, -1);

‎SpotifyAPI/SpotifyAPI.cs‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.Net;
73
using Newtonsoft.Json;
84
using System.Text.RegularExpressions;
9-
using System.Windows;
10-
using System.Management;
115
using System.Diagnostics;
12-
using System.Drawing;
136

147
namespace SpotifyAPIv1
158
{
@@ -40,20 +33,14 @@ public SpotifyEventHandler GetEventHandler()
4033
public static Boolean IsSpotifyRunning()
4134
{
4235
if (Process.GetProcessesByName("spotify").Length < 1)
43-
{
4436
return false;
45-
}
46-
else
47-
return true;
37+
return true;
4838
}
4939
public static Boolean IsSpotifyWebHelperRunning()
5040
{
5141
if (Process.GetProcessesByName("SpotifyWebHelper").Length < 1)
52-
{
5342
return false;
54-
}
55-
else
56-
return true;
43+
return true;
5744
}
5845
public void RunSpotify()
5946
{
@@ -65,7 +52,7 @@ public void RunSpotifyWebHelper()
6552
if (!IsSpotifyWebHelperRunning())
6653
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Spotify\\Data\\SpotifyWebHelper.exe");
6754
}
68-
public Boolean IsValidSpotifyURL(String url)
55+
public static Boolean IsValidSpotifyURL(String url)
6956
{
7057
String[] types = new String[] { "track","album","local","artist"};
7158
String[] split = url.Split(':');
@@ -78,7 +65,6 @@ public void Update()
7865
if (!SpotifyAPI.IsSpotifyWebHelperRunning())
7966
return;
8067
mh.Update(rh.Update());
81-
rh.SendVolumeRequest();
8268
}
8369
}
8470
}

‎SpotifyAPI/SpotifyEventHandler.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using SpotifyAPIv1;
76

87
namespace SpotifyAPIv1

‎SpotifyAPI/SpotifyMusicHandler.cs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using System.Runtime.InteropServices;
76
using System.Windows.Forms;
87
using System.IO;
@@ -18,17 +17,18 @@ public class SpotifyMusicHandler
1817

1918
RemoteHandler rh;
2019
StatusResponse sr;
20+
2121
const byte VK_MEDIA_NEXT_TRACK = 0xb0;
2222
const byte VK_MEDIA_PREV_TRACK = 0xb1;
23+
const int KEYEVENTF_EXTENDEDKEY = 0x1;
24+
const int KEYEVENTF_KEYUP = 0x2;
2325

2426
public SpotifyMusicHandler()
2527
{
2628
rh = RemoteHandler.GetInstance();
2729
}
2830
void PressKey(byte keyCode)
2931
{
30-
const int KEYEVENTF_EXTENDEDKEY = 0x1;
31-
const int KEYEVENTF_KEYUP = 0x2;
3232
keybd_event(keyCode, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
3333
keybd_event(keyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
3434
}
@@ -77,7 +77,7 @@ public void Previous()
7777
public void Pause()
7878
{
7979
rh.SendPauseRequest();
80-
80+
8181
}
8282
public void Play()
8383
{
@@ -87,7 +87,6 @@ public StatusResponse GetStatusResponse()
8787
{
8888
return sr;
8989
}
90-
9190
internal void Update(StatusResponse sr)
9291
{
9392
this.sr = sr;

‎SpotifyAPI/StatusResponse.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
43
using System.Text;
54
using System.Threading.Tasks;

‎SpotifyAPI/Track.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using System.Text;
54
using System.Threading.Tasks;
65
using System.Drawing;
@@ -93,7 +92,7 @@ public async Task<Bitmap> GetAlbumArtAsync(AlbumArtSize size)
9392
{
9493
data = await wc.DownloadDataTaskAsync(url);
9594
}
96-
catch(WebException e)
95+
catch(WebException)
9796
{
9897
throw;
9998
}

0 commit comments

Comments
 (0)