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