Private GIT

Skip to content
Snippets Groups Projects
Commit 3184b84c authored by sarakha63's avatar sarakha63
Browse files

Merge pull request #288 from sarakha63/development

merge PR
parents 43bc3863 8989a62e
No related branches found
No related tags found
No related merge requests found
...@@ -237,10 +237,12 @@ $(document).ready(function () { ...@@ -237,10 +237,12 @@ $(document).ready(function () {
var devices = jQuery.parseJSON(data).devices; var devices = jQuery.parseJSON(data).devices;
$("#pushbullet_device_list").html(''); $("#pushbullet_device_list").html('');
for (var i = 0; i < devices.length; i++) { for (var i = 0; i < devices.length; i++) {
if(devices[i].active == true && devices[i].pushable == true){
if(current_pushbullet_device == devices[i].iden) { if(current_pushbullet_device == devices[i].iden) {
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].extras.model + '</option>') $("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].nickname + '</option>')
} else { } else {
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].extras.model + '</option>') $("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].nickname + '</option>')
}
} }
} }
if(msg) { if(msg) {
......
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>. # along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
import socket
import base64 import base64
from httplib import HTTPSConnection, HTTPException from httplib import HTTPSConnection, HTTPException
from urllib import urlencode import json
from ssl import SSLError from ssl import SSLError
import sickbeard import sickbeard
from sickbeard import logger, common from sickbeard import logger, common
...@@ -58,7 +59,7 @@ class PushbulletNotifier: ...@@ -58,7 +59,7 @@ class PushbulletNotifier:
if method == 'POST': if method == 'POST':
uri = '/v2/pushes' uri = '/v2/pushes'
else: else:
uri = '/api/devices' uri = '/v2/devices'
logger.log(u"Pushbullet event: " + str(event), logger.DEBUG) logger.log(u"Pushbullet event: " + str(event), logger.DEBUG)
logger.log(u"Pushbullet message: " + str(message), logger.DEBUG) logger.log(u"Pushbullet message: " + str(message), logger.DEBUG)
...@@ -68,14 +69,12 @@ class PushbulletNotifier: ...@@ -68,14 +69,12 @@ class PushbulletNotifier:
http_handler = HTTPSConnection("api.pushbullet.com") http_handler = HTTPSConnection("api.pushbullet.com")
authString = base64.encodestring('%s:' % (pushbullet_api)).replace('\n', '')
if notificationType == None: if notificationType == None:
testMessage = True testMessage = True
try: try:
logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG) logger.log(u"Testing Pushbullet authentication and retrieving the device list.", logger.DEBUG)
http_handler.request(method, uri, None, headers={'Authorization':'Basic %s:' % authString}) http_handler.request(method, uri, None, headers={'Authorization': 'Bearer %s' % pushbullet_api})
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
logger.log(u"Pushbullet notification failed.", logger.ERROR) logger.log(u"Pushbullet notification failed.", logger.ERROR)
return False return False
else: else:
...@@ -86,14 +85,17 @@ class PushbulletNotifier: ...@@ -86,14 +85,17 @@ class PushbulletNotifier:
'body': message.encode('utf-8'), 'body': message.encode('utf-8'),
'device_iden': pushbullet_device, 'device_iden': pushbullet_device,
'type': notificationType} 'type': notificationType}
http_handler.request(method, uri, body = urlencode(data), headers={'Authorization':'Basic %s' % authString}) data = json.dumps(data)
http_handler.request(method, uri, body=data,
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % pushbullet_api})
pass pass
except (SSLError, HTTPException): except (SSLError, HTTPException, socket.error):
return False return False
response = http_handler.getresponse() response = http_handler.getresponse()
request_body = response.read() request_body = response.read()
request_status = response.status request_status = response.status
logger.log(u"Pushbullet response: %s" % request_body, logger.DEBUG)
if request_status == 200: if request_status == 200:
if testMessage: if testMessage:
...@@ -108,5 +110,5 @@ class PushbulletNotifier: ...@@ -108,5 +110,5 @@ class PushbulletNotifier:
logger.log(u"Pushbullet notification failed.", logger.ERROR) logger.log(u"Pushbullet notification failed.", logger.ERROR)
return False return False
notifier = PushbulletNotifier
notifier = PushbulletNotifier
...@@ -99,7 +99,9 @@ class CpasbienProvider(generic.TorrentProvider): ...@@ -99,7 +99,9 @@ class CpasbienProvider(generic.TorrentProvider):
#downloadTorrentLink = torrentSoup.find("a", title.startswith('Cliquer')) #downloadTorrentLink = torrentSoup.find("a", title.startswith('Cliquer'))
tmp = pageURL.split('/')[6].replace('.html','.torrent') tmp = pageURL.split('/')[6].replace('.html','.torrent')
downloadTorrentLink = ('http://www.cpasbien.pe/_torrents/%s' % tmp) downloadTorrentLink = ('http://www.cpasbien.pe/_torrents/%s' % tmp)
if downloadTorrentLink: if downloadTorrentLink:
downloadURL = downloadTorrentLink downloadURL = downloadTorrentLink
......
...@@ -51,7 +51,7 @@ class FTDBProvider(generic.TorrentProvider): ...@@ -51,7 +51,7 @@ class FTDBProvider(generic.TorrentProvider):
'name': searchString, 'name': searchString,
'exact' : 1, 'exact' : 1,
'group': subcat 'group': subcat
} ) + "&adv_cat%5Bs%5D%5B3%5D=101&adv_cat%5Bs%5D%5B4%5D=191&adv_cat%5Bs%5D%5B5%5D=197" } ) + "&adv_cat%5Bs%5D%5B3%5D=101&adv_cat%5Bs%5D%5B4%5D=191"
elif audio_lang == "fr" or french: elif audio_lang == "fr" or french:
return urllib.urlencode( { return urllib.urlencode( {
'name': searchString, 'name': searchString,
......
...@@ -47,7 +47,7 @@ class T411Provider(generic.TorrentProvider): ...@@ -47,7 +47,7 @@ class T411Provider(generic.TorrentProvider):
def getSearchParams(self, searchString, audio_lang, subcat, french=None): def getSearchParams(self, searchString, audio_lang, subcat, french=None):
if audio_lang == "en" and french==None: if audio_lang == "en" and french==None:
return urllib.urlencode( {'search': searchString, 'cat' : 210, 'submit' : 'Recherche', 'subcat': subcat } ) + "&term%5B17%5D%5B%5D=540&term%5B17%5D%5B%5D=721" return urllib.urlencode( {'search': searchString, 'cat' : 210, 'submit' : 'Recherche', 'subcat': subcat } ) + "&term%5B17%5D%5B%5D=721"
elif audio_lang == "fr" or french: elif audio_lang == "fr" or french:
return urllib.urlencode( {'search': searchString, 'cat' : 210, 'submit' : 'Recherche', 'subcat': subcat } ) + "&term%5B17%5D%5B%5D=541&term%5B17%5D%5B%5D=542" return urllib.urlencode( {'search': searchString, 'cat' : 210, 'submit' : 'Recherche', 'subcat': subcat } ) + "&term%5B17%5D%5B%5D=541&term%5B17%5D%5B%5D=542"
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment