/// <summary> /// Download the episode rating without rating /// </summary> /// <param name="_userId">id of the user</param> /// <param name="_episodeId">id of the episode</param> /// <returns></returns> internal double DownloadEpisodeRating(String _userId, int _episodeId) { String xml = ""; String link = ""; try { link = TvdbLinks.CreateUserEpisodeRating(_userId, _episodeId); xml = m_webClient.DownloadString(link); return(m_xmlHandler.ExtractRating(xml)); } catch (XmlException ex) { Log.Error("Error parsing the xml file " + link + "\n\n" + xml, ex); throw new TvdbInvalidXmlException("Error parsing the xml file " + link + "\n\n" + xml); } catch (WebException ex) { Log.Warn("Request not successfull", ex); if (ex.Message.Equals("The remote server returned an error: (404) Not Found.")) { throw new TvdbInvalidApiKeyException("Couldn't connect to Thetvdb.com to retrieve rating of series " + _episodeId + ", it seems like you use an invalid api key"); } else { throw new TvdbNotAvailableException("Couldn't connect to Thetvdb.com to retrieve rating of series " + _episodeId + ", check your internet connection and the status of http://thetvdb.com"); } } }
/// <summary> /// Make the request for rating an episode /// </summary> /// <param name="_userId"></param> /// <param name="_episodeId"></param> /// <param name="_rating"></param> /// <returns></returns> internal double RateEpisode(String _userId, int _episodeId, int _rating) { try { String xml = m_webClient.DownloadString(TvdbLinks.CreateUserEpisodeRating(_userId, _episodeId, _rating)); return(m_xmlHandler.ExtractRating(xml)); } catch (WebException ex) { Log.Warn("Request not successfull", ex); if (ex.Message.Equals("The remote server returned an error: (404) Not Found.")) { throw new TvdbInvalidApiKeyException("Couldn't connect to Thetvdb.com to rate episode " + _episodeId + ", it seems like you use an invalid api key (" + m_apiKey + ")"); } else { throw new TvdbNotAvailableException("Couldn't connect to Thetvdb.com to rate episode " + _episodeId + ", check your internet connection and the status of http://thetvdb.com"); } } }
/// <summary> /// Download the episode rating without rating /// </summary> /// <param name="_userId"></param> /// <param name="_seriesId"></param> /// <returns></returns> internal double DownloadEpisodeRating(String _userId, int _seriesId) { String xml = m_webClient.DownloadString(TvdbLinks.CreateUserEpisodeRating(_userId, _seriesId)); return(m_xmlHandler.ExtractRating(xml)); }
/// <summary> /// Make the request for rating an episode /// </summary> /// <param name="_userId"></param> /// <param name="_episodeId"></param> /// <param name="_rating"></param> /// <returns></returns> internal double RateEpisode(String _userId, int _episodeId, int _rating) { String xml = m_webClient.DownloadString(TvdbLinks.CreateUserEpisodeRating(_userId, _episodeId, _rating)); return(m_xmlHandler.ExtractRating(xml)); }