Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void DownloadNzb(RemoteEpisode remoteEpisode)
        {
            var url = remoteEpisode.Release.DownloadUrl;
            var title = remoteEpisode.Release.Title + ".nzb";

            string cat = _configService.NzbgetTvCategory;
            int priority = remoteEpisode.IsRecentEpisode() ? (int)_configService.NzbgetRecentTvPriority : (int)_configService.NzbgetOlderTvPriority;

            var command = new JsonRequest
            {
                Method = "appendurl",
                Params = new object[] { title, cat, priority, false, url }
            };

            _logger.Info("Adding report [{0}] to the queue.", title);
            var response = PostCommand(command.ToJson());

            CheckForError(response);

            var success = Json.Deserialize<EnqueueResponse>(response).Result;
            _logger.Debug("Queue Response: [{0}]", success);

        }