示例#1
0
        // given a url, retrieves the xml result set and returns the nodelist of Item objects
        private static string getJSONFromURL(string url)
        {
            // Add Fanart.TV personal API Key
            if (!string.IsNullOrWhiteSpace(mvCentralCore.Settings.FanartTVPersonalAPIkey))
            {
                url = url + "&client_key=" + mvCentralCore.Settings.FanartTVPersonalAPIkey;
            }

            logger.Debug("Sending the request: " + url.Replace(APIKey, "<apiKey>").Replace(mvCentralCore.Settings.FanartTVPersonalAPIkey, "<personalAPIkey>"));

            mvWebGrabber grabber = Utility.GetWebGrabberInstance(url);

            grabber.Encoding         = Encoding.UTF8;
            grabber.Timeout          = 10000;
            grabber.TimeoutIncrement = 1000;
            if (grabber.GetResponse(APIKey))
            {
                return(grabber.GetString());
            }
            else
            {
                logger.Debug("***** API ERROR *****: Code:{0} ({1})", grabber.errorCode, grabber.errorText);
                return(null);
            }
        }
示例#2
0
        // given a url, retrieves the xml result set and returns the nodelist of Item objects
        private static XmlNodeList getXMLFromURL(string url)
        {
            logger.Debug("Sending the request: " + url.Replace(APIKey, "<apiKey>"));

            mvWebGrabber grabber = Utility.GetWebGrabberInstance(url);

            grabber.Encoding         = Encoding.UTF8;
            grabber.Timeout          = 5000;
            grabber.TimeoutIncrement = 10;
            if (grabber.GetResponse(APIKey))
            {
                return(grabber.GetXML());
            }
            else
            {
                logger.Debug("***** API ERROR *****: Code:{0} ({1})", grabber.errorCode, grabber.errorText);
                return(null);
            }
        }
示例#3
0
        // given a url, retrieves the xml result set and returns the nodelist of Item objects
        private static XmlNodeList getXMLFromURL(string url)
        {
            Logger.Debug("Sending the request: " + url.Replace(apikey, "<apikey>"));

            mvWebGrabber grabber = Utility.GetWebGrabberInstance(url);

            grabber.Encoding         = Encoding.UTF8;
            grabber.Timeout          = 5000;
            grabber.TimeoutIncrement = 10;
            grabber.Request.AutomaticDecompression = System.Net.DecompressionMethods.GZip;
            if (grabber.GetResponse(apikey))
            {
                return(grabber.GetXML());
            }
            else
            {
                return(null);
            }
        }