public void UpdateSection(PlexServerSettings settings, int key) { _logger.Trace("Updating Plex host: {0}, Section: {1}", settings.Host, key); var url = String.Format("http://{0}:{1}/library/sections/{2}/refresh", settings.Host, settings.Port, key); _httpProvider.DownloadString(url); }
private string SendCommand(string host, int port, string command, string username, string password) { var url = string.Format("http://{0}:{1}/xbmcCmds/xbmcHttp?command={2}", host, port, command); if (!string.IsNullOrEmpty(username)) { return(_httpProvider.DownloadString(url, username, password)); } return(_httpProvider.DownloadString(url)); }
private string SendCommand(XbmcSettings settings, string command) { var url = String.Format("http://{0}/xbmcCmds/xbmcHttp?command={1}", settings.Address, command); if (!String.IsNullOrEmpty(settings.Username)) { return(_httpProvider.DownloadString(url, settings.Username, settings.Password)); } return(_httpProvider.DownloadString(url)); }
private string SendCommand(XbmcSettings settings, string command) { var url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, $"xbmcCmds/xbmcHttp?command={command}"); if (!string.IsNullOrEmpty(settings.Username)) { return(_httpProvider.DownloadString(url, settings.Username, settings.Password)); } return(_httpProvider.DownloadString(url)); }
public IEnumerable <int> GetDailySeriesIds() { try { var dailySeriesIds = _httpProvider.DownloadString(Services.RootUrl + "/v1/DailySeries"); var seriesIds = Json.Deserialize <List <int> >(dailySeriesIds); return(seriesIds); } catch (Exception ex) { _logger.WarnException("Failed to get Daily Series", ex); return(new List <int>()); } }
public void Test(IIndexer indexer) { var releases = _feedFetcher.FetchRss(indexer); if (releases.Any()) { return; } try { var url = indexer.RecentFeed.First(); var xml = _httpProvider.DownloadString(url); NewznabPreProcessor.Process(xml, url); } catch (ApiKeyException apiKeyException) { _logger.Warn("Indexer returned result for Newznab RSS URL, API Key appears to be invalid"); var apiKeyFailure = new ValidationFailure("ApiKey", "Invalid API Key"); throw new ValidationException(new List <ValidationFailure> { apiKeyFailure }.ToArray()); } catch (Exception ex) { _logger.Warn("Indexer doesn't appear to be Newznab based"); var failure = new ValidationFailure("Url", "Invalid Newznab URL entered"); throw new ValidationException(new List <ValidationFailure> { failure }.ToArray()); } }
public void DownloadNzb(RemoteEpisode remoteEpisode) { var url = remoteEpisode.Release.DownloadUrl; var title = remoteEpisode.Release.Title; string cat = _configService.SabTvCategory; int priority = remoteEpisode.IsRecentEpisode() ? (int)_configService.SabRecentTvPriority : (int)_configService.SabOlderTvPriority; string name = url.Replace("&", "%26"); string nzbName = HttpUtility.UrlEncode(title); string action = string.Format("mode=addurl&name={0}&priority={1}&pp=3&cat={2}&nzbname={3}&output=json", name, priority, cat, nzbName); string request = GetSabRequest(action); _logger.Info("Adding report [{0}] to the queue.", title); var response = _httpProvider.DownloadString(request); _logger.Debug("Queue Response: [{0}]", response); CheckForError(response); }
private List <ReleaseInfo> Fetch(IIndexer indexer, IEnumerable <string> urls) { var result = new List <ReleaseInfo>(); foreach (var url in urls) { try { _logger.Debug("Downloading Feed " + url); var xml = _httpProvider.DownloadString(url); if (!string.IsNullOrWhiteSpace(xml)) { result.AddRange(indexer.Parser.Process(xml, url)); } else { _logger.Warn("{0} returned empty response.", url); } } catch (WebException webException) { if (webException.Message.Contains("502") || webException.Message.Contains("503") || webException.Message.Contains("timed out")) { _logger.Warn("{0} server is currently unavailable. {1} {2}", indexer, url, webException.Message); } else { _logger.Warn("{0} {1} {2}", indexer, url, webException.Message); } } catch (ApiKeyException) { _logger.Warn("Invalid API Key for {0} {1}", indexer, url); } catch (Exception feedEx) { feedEx.Data.Add("FeedUrl", url); _logger.ErrorException("An error occurred while processing feed. " + url, feedEx); } } result.ForEach(c => c.Indexer = indexer.Definition.Name); return(result); }
public List <SceneMapping> Fetch() { var mappingsJson = _httpProvider.DownloadString(Services.RootUrl + "/v1/SceneMapping"); return(Json.Deserialize <List <SceneMapping> >(mappingsJson)); }