Merge branch 'refs/heads/develop'

This commit is contained in:
Ruud committed 2014-06-01 14:31:39 +02:00
commit e64d0e33fc
8 files changed
+27 -14

No files matched your search

+2 -2
View File
@@ -130,7 +130,7 @@ class NZBVortex(DownloaderBase):
url = cleanHost(self.conf('host'), ssl = self.conf('ssl')) + 'api/' + call url = cleanHost(self.conf('host'), ssl = self.conf('ssl')) + 'api/' + call
try: try:
data = self.urlopen('%s?%s' % (url, params), *args, **kwargs) data = self.urlopen('%s?%s' % (url, params), *args, verify_ssl = False, **kwargs)
if data: if data:
return json.loads(data) return json.loads(data)
@@ -154,7 +154,7 @@ class NZBVortex(DownloaderBase):
url = cleanHost(self.conf('host')) + 'api/app/apilevel' url = cleanHost(self.conf('host')) + 'api/app/apilevel'
try: try:
data = self.urlopen(url, show_error = False) data = self.urlopen(url, show_error = False, verify_ssl = False)
self.api_level = float(json.loads(data).get('apilevel')) self.api_level = float(json.loads(data).get('apilevel'))
except URLError as e: except URLError as e:
if hasattr(e, 'code') and e.code == 403: if hasattr(e, 'code') and e.code == 403:
+1 -1
View File
@@ -194,7 +194,7 @@ class Sabnzbd(DownloaderBase):
'output': 'json' 'output': 'json'
})) }))
data = self.urlopen(url, timeout = 60, show_error = False, headers = {'User-Agent': Env.getIdentifier()}, **kwargs) data = self.urlopen(url, timeout = 60, show_error = False, verify_ssl = False, headers = {'User-Agent': Env.getIdentifier()}, **kwargs)
if use_json: if use_json:
d = json.loads(data) d = json.loads(data)
if d.get('error'): if d.get('error'):
+2 -2
View File
@@ -174,8 +174,8 @@ class TransmissionRPC(object):
self.session = {} self.session = {}
if username and password: if username and password:
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(realm = None, uri = self.url, user = username, passwd = password) password_manager.add_password(realm = 'Transmission', uri = self.url, user = username, passwd = password)
opener = urllib2.build_opener(urllib2.HTTPBasicAuthHandler(password_manager), urllib2.HTTPDigestAuthHandler(password_manager)) opener = urllib2.build_opener(urllib2.HTTPBasicAuthHandler(password_manager))
opener.addheaders = [('User-agent', 'couchpotato-transmission-client/1.0')] opener.addheaders = [('User-agent', 'couchpotato-transmission-client/1.0')]
urllib2.install_opener(opener) urllib2.install_opener(opener)
elif username or password: elif username or password:
-1
View File
@@ -229,7 +229,6 @@ class uTorrentAPI(object):
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(realm = None, uri = self.url, user = username, passwd = password) password_manager.add_password(realm = None, uri = self.url, user = username, passwd = password)
self.opener.add_handler(urllib2.HTTPBasicAuthHandler(password_manager)) self.opener.add_handler(urllib2.HTTPBasicAuthHandler(password_manager))
self.opener.add_handler(urllib2.HTTPDigestAuthHandler(password_manager))
elif username or password: elif username or password:
log.debug('User or password missing, not using authentication.') log.debug('User or password missing, not using authentication.')
self.token = self.get_token() self.token = self.get_token()
@@ -252,7 +252,7 @@ MA.Release = new Class({
self.trynext_container.adopt( self.trynext_container.adopt(
new Element('span.or', { new Element('span.or', {
'text': 'This movie is snatched, if anything went wrong, download' 'text': 'If anything went wrong, download'
}), }),
lr ? new Element('a.button.orange', { lr ? new Element('a.button.orange', {
'text': 'the same release again', 'text': 'the same release again',
@@ -3,6 +3,7 @@ import re
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from couchpotato import fireEvent from couchpotato import fireEvent
from couchpotato.core.helpers.encoding import ss
from couchpotato.core.helpers.rss import RSS from couchpotato.core.helpers.rss import RSS
from couchpotato.core.helpers.variable import getImdb, splitString, tryInt from couchpotato.core.helpers.variable import getImdb, splitString, tryInt
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
@@ -51,7 +52,7 @@ class IMDBBase(Automation, RSS):
except: except:
log.error('Failed parsing IMDB page "%s": %s', (url, traceback.format_exc())) log.error('Failed parsing IMDB page "%s": %s', (url, traceback.format_exc()))
html = str(html) html = ss(html)
imdbs = getImdb(html, multiple = True) if html else [] imdbs = getImdb(html, multiple = True) if html else []
return imdbs return imdbs
@@ -104,13 +105,14 @@ class IMDBWatchlist(IMDBBase):
log.debug('Found %s movies on %s', (len(imdbs), w_url)) log.debug('Found %s movies on %s', (len(imdbs), w_url))
if len(imdbs) < 250: if len(imdbs) < 225:
break break
start += 250 start = len(movies)
except: except:
log.error('Failed loading IMDB watchlist: %s %s', (watchlist_url, traceback.format_exc())) log.error('Failed loading IMDB watchlist: %s %s', (watchlist_url, traceback.format_exc()))
break
return movies return movies
+2 -1
View File
@@ -161,7 +161,7 @@ class Plugin(object):
log.error('Couldn\'t remove empty directory %s: %s', (folder, traceback.format_exc())) log.error('Couldn\'t remove empty directory %s: %s', (folder, traceback.format_exc()))
# http request # http request
def urlopen(self, url, timeout = 30, data = None, headers = None, files = None, show_error = True): def urlopen(self, url, timeout = 30, data = None, headers = None, files = None, show_error = True, verify_ssl = True):
url = urllib2.quote(ss(url), safe = "%/:=&?~#+!$,;'@()*[]") url = urllib2.quote(ss(url), safe = "%/:=&?~#+!$,;'@()*[]")
if not headers: headers = {} if not headers: headers = {}
@@ -200,6 +200,7 @@ class Plugin(object):
'data': data if len(data) > 0 else None, 'data': data if len(data) > 0 else None,
'timeout': timeout, 'timeout': timeout,
'files': files, 'files': files,
'verify': verify_ssl,
} }
method = 'post' if len(data) > 0 or files else 'get' method = 'post' if len(data) > 0 or files else 'get'
+14 -3
View File
@@ -210,7 +210,8 @@ Running on: ...\n\
version = Updater.getInfo(), version = Updater.getInfo(),
body = self.report_text body = self.report_text
.replace('{issue}', text) .replace('{issue}', text)
.replace('{version}', version ? version.version.repr : '...'); .replace('{version}', version ? version.version.repr : '...'),
textarea;
var overlay = new Element('div.report', { var overlay = new Element('div.report', {
'method': 'post', 'method': 'post',
@@ -243,7 +244,7 @@ Running on: ...\n\
'text': ' before posting, then copy the text below' 'text': ' before posting, then copy the text below'
}) })
), ),
new Element('textarea', { textarea = new Element('textarea', {
'text': body, 'text': body,
'events': { 'events': {
'click': function(){ 'click': function(){
@@ -254,7 +255,17 @@ Running on: ...\n\
new Element('a.button', { new Element('a.button', {
'target': '_blank', 'target': '_blank',
'text': 'Create a new issue on GitHub with the text above', 'text': 'Create a new issue on GitHub with the text above',
'href': 'https://github.com/RuudBurger/CouchPotatoServer/issues/new?body=' + (body.length < 2000 ? encodeURIComponent(body) : 'Paste the text here') 'href': 'https://github.com/RuudBurger/CouchPotatoServer/issues/new',
'events': {
'click': function(e){
(e).stop();
var body = textarea.get('value'),
bdy = '?body=' + (body.length < 2000 ? encodeURIComponent(body) : 'Paste the text here'),
win = window.open(e.target.get('href') + bdy, '_blank');
win.focus();
}
}
}) })
) )
); );