private void OnRadioLoginFailed() { _currentState = StreamPlaybackState.offline; _currentSession = String.Empty; _isInit = false; // need to check that.. RadioSettingsError(); }
private void OnRadioLoginSuccess() { // for now.. _currentStreamsUser = _currentUser; _currentSession = AudioscrobblerBase.RadioSession; if (_currentSession != String.Empty) { _isSubscriber = AudioscrobblerBase.IsSubscriber; //_currentRadioURL = "http://streamer1.last.fm/last.mp3?Session=" + _currentSession; _currentRadioURL = AudioscrobblerBase.RadioStreamLocation; _currentState = StreamPlaybackState.initialized; _isInit = true; RadioSettingsSuccess(); } else { RadioSettingsError(); } }
private void OnParseAsyncResponse(List <string> responseList, HttpStatusCode responseCode, String requestedURLCommand) { // parse the response try { string responseMessage = String.Empty; if (responseList.Count > 0) { List <string> responseStrings = new List <string>(responseList); if (responseCode == HttpStatusCode.OK) { responseMessage = responseStrings[0]; { if (responseMessage.StartsWith("response=OK")) { ParseSuccessful(responseStrings, requestedURLCommand); return; } //if (responseMessage.StartsWith("price=")) //{ // ParseNowPlaying(responseStrings); // return; //} } } else { string logmessage = "StreamControl: ***** Unknown response! - " + responseMessage; foreach (String unkStr in responseStrings) { logmessage += "\n" + unkStr; } if (logmessage.Contains("Not enough content")) { _currentState = StreamPlaybackState.nocontent; Log.Warn("StreamControl: Not enough content left to play this station"); return; } else { Log.Warn(logmessage); } } } else { Log.Debug("StreamControl: SendCommandRequest: Reader object already destroyed"); } } catch (Exception e) { Log.Error("StreamControl: SendCommandRequest: Parsing response failed {0}", e.Message); return; } finally { httpcommand.workerFinished -= new AsyncGetRequest.AsyncGetRequestCompleted(OnParseAsyncResponse); } }
private void OnParseAsyncResponse(List<string> responseList, HttpStatusCode responseCode, String requestedURLCommand) { // parse the response try { string responseMessage = String.Empty; if (responseList.Count > 0) { List<string> responseStrings = new List<string>(responseList); if (responseCode == HttpStatusCode.OK) { responseMessage = responseStrings[0]; { if (responseMessage.StartsWith("response=OK")) { ParseSuccessful(responseStrings, requestedURLCommand); return; } //if (responseMessage.StartsWith("price=")) //{ // ParseNowPlaying(responseStrings); // return; //} } } else { string logmessage = "StreamControl: ***** Unknown response! - " + responseMessage; foreach (String unkStr in responseStrings) { logmessage += "\n" + unkStr; } if (logmessage.Contains("Not enough content")) { _currentState = StreamPlaybackState.nocontent; Log.Warn("StreamControl: Not enough content left to play this station"); return; } else { Log.Warn(logmessage); } } } else { Log.Debug("StreamControl: SendCommandRequest: Reader object already destroyed"); } } catch (Exception e) { Log.Error("StreamControl: SendCommandRequest: Parsing response failed {0}", e.Message); return; } finally { httpcommand.workerFinished -= new AsyncGetRequest.AsyncGetRequestCompleted(OnParseAsyncResponse); } }