Browse Source

Merge branch 'develop' of github.com:RuudBurger/CouchPotatoServer into develop

pull/5495/merge
Ruud 10 years ago
parent
commit
af44272a3b
  1. 2
      README.md
  2. 15
      couchpotato/core/media/_base/providers/base.py
  3. 10
      couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py
  4. 25
      couchpotato/core/media/_base/providers/torrent/passthepopcorn.py

2
README.md

@ -85,4 +85,4 @@ You can now change css and javascript and it wil reload the page when needed.
By default it will combine files used in the core folder. If you're adding a new .scss or .js file, you might need to add it and then restart the grunt process for it to combine it properly.
Don't forget to enable development inside the CP settings. This disables some functions and also makes sure javascript rrors are pushed to console instead of the log.
Don't forget to enable development inside the CP settings. This disables some functions and also makes sure javascript errors are pushed to console instead of the log.

15
couchpotato/core/media/_base/providers/base.py

@ -1,6 +1,7 @@
from urlparse import urlparse
import json
import re
from requests import HTTPError
import time
import traceback
import xml.etree.ElementTree as XMLTree
@ -124,6 +125,7 @@ class YarrProvider(Provider):
size_kb = ['kb', 'kib']
last_login_check = None
login_failures = 0
def __init__(self):
addEvent('provider.enabled_protocols', self.getEnabledProtocol)
@ -160,10 +162,21 @@ class YarrProvider(Provider):
if self.loginSuccess(output):
self.last_login_check = now
self.login_failures = 0
return True
error = 'unknown'
except:
except Exception as e:
if isinstance(e, HTTPError):
if e.response.status_code >= 400 and e.response.status_code < 500:
self.login_failures += 1
if self.login_failures >= 3:
log.error("Failed %s login repeatedly, disabling provider. "
"Please check the configuration. Re-enabling the "
"provider without fixing the problem may result "
"in an IP ban, depending on the site.", self.getName())
self.conf(self.enabled_option, False)
self.login_failures = 0
error = traceback.format_exc()
self.last_login_check = None

10
couchpotato/core/media/_base/providers/nzb/omgwtfnzbs.py

@ -34,6 +34,9 @@ class Base(NZBProvider, RSS):
'user': self.conf('username', default = ''),
'api': self.conf('api_key', default = ''),
})
if len(self.conf('custom_tag')) > 0:
params = '%s&%s' % (params, self.conf('custom_tag'))
nzbs = self.getJsonData(self.urls['search'] % params)
@ -76,6 +79,13 @@ config = [{
'default': '',
},
{
'name': 'custom_tag',
'advanced': True,
'label': 'Custom tag',
'default': '',
'description': 'Add custom parameters, for example add catid=18 to get foreign (non-english) movies',
},
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',

25
couchpotato/core/media/_base/providers/torrent/passthepopcorn.py

@ -26,6 +26,7 @@ class Base(TorrentProvider):
'search': 'https://tls.passthepopcorn.me/search/%s/0/7/%d'
}
login_errors = 0
http_time_between_calls = 2
def _search(self, media, quality, results):
@ -177,9 +178,22 @@ class Base(TorrentProvider):
def loginSuccess(self, output):
try:
return json.loads(output).get('Result', '').lower() == 'ok'
if json.loads(output).get('Result', '').lower() == 'ok':
self.login_errors = 0
return True
except:
return False
pass
self.login_errors += 1
if self.login_errors >= 3:
log.error('Disabling PTP provider after repeated failed logins. '
'Please check your configuration. Re-enabling without '
'solving the problem may cause an IP ban. response=%s',
output)
self.conf('enabled', value=False)
self.login_errors = 0
return False
loginCheckSuccess = loginSuccess
@ -193,7 +207,8 @@ config = [{
'name': 'PassThePopcorn',
'description': '<a href="https://passthepopcorn.me">PassThePopcorn.me</a>',
'wizard': True,
'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAARklEQVQoz2NgIAP8BwMiGWRpIN1JNWn/t6T9f532+W8GkNt7vzz9UkfarZVpb68BuWlbnqW1nU7L2DMx7eCoBlpqGOppCQB83zIgIg+wWQAAAABJRU5ErkJggg==',
'icon': 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAARklEQVQoz2NgIAP8BwMiGWRpIN1JNWn/t6T9f5'
'32+W8GkNt7vzz9UkfarZVpb68BuWlbnqW1nU7L2DMx7eCoBlpqGOppCQB83zIgIg+wWQAAAABJRU5ErkJggg==',
'options': [
{
'name': 'enabled',
@ -255,14 +270,14 @@ config = [{
'name': 'seed_ratio',
'label': 'Seed ratio',
'type': 'float',
'default': 1,
'default': 2,
'description': 'Will not be (re)moved until this seed ratio is met.',
},
{
'name': 'seed_time',
'label': 'Seed time',
'type': 'int',
'default': 40,
'default': 96,
'description': 'Will not be (re)moved until this seed time (in hours) is met.',
},
{

Loading…
Cancel
Save