示例#1
0
        public override String RetryDownload(String id)
        {
            // Sabnzbd changed the nzo_id for retried downloads without reporting it back to us. We need to try to determine the new ID.

            var history = GetHistory().Where(v => v.DownloadClientId == id).ToList();

            _proxy.RetryDownload(id, Settings);

            if (history.Count() != 1)
            {
                _logger.Warn("History item missing. Couldn't get the new nzoid.");
                return(id);
            }

            for (int i = 0; i < 3; i++)
            {
                var queue = GetQueue().Where(v => v.Category == history.First().Category&& v.Title == history.First().Title).ToList();

                if (queue.Count() == 1)
                {
                    return(queue.First().DownloadClientId);
                }

                if (queue.Count() > 2)
                {
                    _logger.Warn("Multiple items with the correct title. Couldn't get the new nzoid.");
                    return(id);
                }

                Thread.Sleep(500);
            }

            _logger.Warn("No items with the correct title. Couldn't get the new nzoid.");
            return(id);
        }
示例#2
0
        public override String RetryDownload(String id)
        {
            // Sabnzbd changed the nzo_id for retried downloads without reporting it back to us. We need to try to determine the new ID.
            // Check both the queue and history because sometimes SAB keeps item in history to retry post processing (depends on failure reason)

            var currentHistory      = GetHistory().ToList();
            var currentHistoryItems = currentHistory.Where(v => v.DownloadClientId == id).ToList();

            if (currentHistoryItems.Count != 1)
            {
                _logger.Warn("History item missing. Couldn't get the new nzoid.");
                return(id);
            }

            var currentHistoryItem      = currentHistoryItems.First();
            var otherItemsWithSameTitle = currentHistory.Where(h => h.Title == currentHistoryItem.Title &&
                                                               h.DownloadClientId != currentHistoryItem.DownloadClientId).ToList();

            _proxy.RetryDownload(id, Settings);

            for (int i = 0; i < 3; i++)
            {
                var queue = GetQueue().Where(v => v.Category == currentHistoryItem.Category &&
                                             v.Title == currentHistoryItem.Title).ToList();

                var history = GetHistory().Where(v => v.Category == currentHistoryItem.Category &&
                                                 v.Title == currentHistoryItem.Title &&
                                                 !otherItemsWithSameTitle.Select(h => h.DownloadClientId)
                                                 .Contains(v.DownloadClientId)).ToList();

                if (queue.Count == 1)
                {
                    return(queue.First().DownloadClientId);
                }

                if (history.Count == 1)
                {
                    return(history.First().DownloadClientId);
                }

                if (queue.Count > 1 || history.Count > 1)
                {
                    _logger.Warn("Multiple items with the correct title. Couldn't get the new nzoid.");
                    return(id);
                }

                Thread.Sleep(500);
            }

            _logger.Warn("No items with the correct title. Couldn't get the new nzoid.");
            return(id);
        }
示例#3
0
 public override void RetryDownload(string id)
 {
     _proxy.RetryDownload(id, Settings);
 }