mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
Fixxed Login Issues |
This commit is contained in:
parent
968bbad18e
commit
659a45fdf5
@ -31,10 +31,13 @@ namespace SpotifyAPIv1
|
|||||||
wc.Headers.Add("Origin", "https://embed.spotify.com");
|
wc.Headers.Add("Origin", "https://embed.spotify.com");
|
||||||
wc.Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
|
wc.Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
|
||||||
}
|
}
|
||||||
internal void Init()
|
internal Boolean Init()
|
||||||
{
|
{
|
||||||
oauthKey = GetOAuthKey();
|
oauthKey = GetOAuthKey();
|
||||||
cfidKey = GetCFID();
|
cfidKey = GetCFID();
|
||||||
|
if (cfidKey == "")
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
internal void SendPauseRequest()
|
internal void SendPauseRequest()
|
||||||
{
|
{
|
||||||
@ -81,7 +84,7 @@ namespace SpotifyAPIv1
|
|||||||
if (d.Count != 1)
|
if (d.Count != 1)
|
||||||
throw new Exception("CFID couldn't be loaded");
|
throw new Exception("CFID couldn't be loaded");
|
||||||
if (d[0].error != null)
|
if (d[0].error != null)
|
||||||
throw new Exception("SpotifyWebHelper Error: " + d[0].error.message);
|
return "";
|
||||||
return d[0].token;
|
return d[0].token;
|
||||||
}
|
}
|
||||||
internal string query(string request, bool oauth, bool cfid, int wait)
|
internal string query(string request, bool oauth, bool cfid, int wait)
|
||||||
@ -111,7 +114,9 @@ namespace SpotifyAPIv1
|
|||||||
string response = "";
|
string response = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response = "[ " + wc.DownloadString(a) + " ]";
|
//Need to find a better solution...
|
||||||
|
if(SpotifyAPI.IsSpotifyRunning())
|
||||||
|
response = "[ " + wc.DownloadString(a) + " ]";
|
||||||
}
|
}
|
||||||
catch (Exception z)
|
catch (Exception z)
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,9 @@ namespace SpotifyAPIv1
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connects with Spotify. Needs to be called before all other SpotifyAPI functions
|
/// Connects with Spotify. Needs to be called before all other SpotifyAPI functions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Connect()
|
public Boolean Connect()
|
||||||
{
|
{
|
||||||
rh.Init();
|
return rh.Init();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the MusicHandler
|
/// Returns the MusicHandler
|
||||||
@ -95,7 +95,7 @@ namespace SpotifyAPIv1
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (!SpotifyAPI.IsSpotifyWebHelperRunning())
|
if (!SpotifyAPI.IsSpotifyWebHelperRunning() || !SpotifyAPI.IsSpotifyRunning())
|
||||||
return;
|
return;
|
||||||
mh.Update(rh.Update());
|
mh.Update(rh.Update());
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,6 @@ namespace SpotifyAPIv1
|
|||||||
public void ListenForEvents(Boolean listen)
|
public void ListenForEvents(Boolean listen)
|
||||||
{
|
{
|
||||||
timer.Enabled = listen;
|
timer.Enabled = listen;
|
||||||
if (listen)
|
|
||||||
timer.Start();
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets a synchronizing object, so you don't need to Invoke
|
/// Sets a synchronizing object, so you don't need to Invoke
|
||||||
@ -65,13 +63,16 @@ namespace SpotifyAPIv1
|
|||||||
StatusResponse new_response = mh.GetStatusResponse();
|
StatusResponse new_response = mh.GetStatusResponse();
|
||||||
if (!new_response.running && new_response.track == null)
|
if (!new_response.running && new_response.track == null)
|
||||||
return;
|
return;
|
||||||
if (new_response.track.GetTrackName() != response.track.GetTrackName() && OnTrackChange != null)
|
if (new_response.track != null && response.track != null)
|
||||||
{
|
{
|
||||||
OnTrackChange(new TrackChangeEventArgs()
|
if (new_response.track.GetTrackName() != response.track.GetTrackName() && OnTrackChange != null)
|
||||||
{
|
{
|
||||||
old_track = response.track,
|
OnTrackChange(new TrackChangeEventArgs()
|
||||||
new_track = new_response.track
|
{
|
||||||
});
|
old_track = response.track,
|
||||||
|
new_track = new_response.track
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (new_response.playing != response.playing && OnPlayStateChange != null)
|
if (new_response.playing != response.playing && OnPlayStateChange != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user