Removed Whitespace

- Travis stuff
This commit is contained in:
Noam
2016-02-04 16:10:22 +02:00
parent de9d77a8ef
commit ca36938a83
4 changed files with 42 additions and 51 deletions
+33 -42
View File
@@ -54,7 +54,7 @@ def addTorrent(link, data=None):
try:
result = {}
retid = False
if link.endswith('.torrent') or data:
if link.endswith('.torrent') or data:
if data:
metainfo = str(base64.b64encode(data))
else:
@@ -70,8 +70,7 @@ def addTorrent(link, data=None):
# remove '.torrent' suffix
if name[-len('.torrent'):] == '.torrent':
name = name[:-len('.torrent')]
result = {
'type' : 'torrent',
result = {'type': 'torrent',
'name' : name,
'content' : metainfo,
}
@@ -101,14 +100,12 @@ def getTorrentFolder(result):
if not any(delugeweb_auth):
_get_auth()
post_data = json.dumps({
"method": "web.get_torrent_status",
"params": [
result['hash'],
["total_done"]
],
"id": 22
})
post_data = json.dumps({"method": "web.get_torrent_status",
"params": [
result['hash'],
["total_done"]
],
"id": 22})
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
result['total_done'] = json.loads(response.text)['result']['total_done']
@@ -120,22 +117,20 @@ def getTorrentFolder(result):
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
result['total_done'] = json.loads(response.text)['result']['total_done']
post_data = json.dumps({
"method": "web.get_torrent_status",
"params": [
result['hash'],
[
"name",
"save_path",
"total_size",
"num_files",
"message",
"tracker",
"comment"
]
],
"id": 23
})
post_data = json.dumps({"method": "web.get_torrent_status",
"params": [
result['hash'],
[
"name",
"save_path",
"total_size",
"num_files",
"message",
"tracker",
"comment"
]
],
"id": 23})
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
@@ -150,14 +145,12 @@ def removeTorrent(torrentid, remove_data=False):
_get_auth()
result = False
post_data = json.dumps({
"method": "core.remove_torrent",
"params": [
torrentid,
remove_data
],
"id": 25
})
post_data = json.dumps({"method": "core.remove_torrent",
"params": [
torrentid,
remove_data
],
"id": 25})
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
result = json.loads(response.text)['result']
@@ -165,7 +158,7 @@ def removeTorrent(torrentid, remove_data=False):
def _get_auth():
global delugeweb_auth, delugeweb_url
global delugeweb_auth, delugeweb_url
delugeweb_auth = {}
delugeweb_host = headphones.CONFIG.DELUGE_HOST
@@ -267,7 +260,6 @@ def _add_torrent_file(result):
post_data = json.dumps({"method": "core.add_torrent_file",
"params": [result['name'] + '.torrent', b64encode(result['content']), {}],
"id": 2})
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
result['hash'] = json.loads(response.text)['result']
@@ -345,10 +337,10 @@ def setTorrentPath(result):
"params": [result['hash'], True],
"id": 7})
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth)
if headphones.CONFIG.DELUGE_DONE_DIRECTORY:
move_to = headphones.CONFIG.DELUGE_DONE_DIRECTORY
else:
else:
move_to = headphones.CONFIG.DOWNLOAD_TORRENT_DIR
if not os.path.exists(move_to):
@@ -364,7 +356,7 @@ def setTorrentPath(result):
return True
def addTorrentPause(result):
if not any(delugeweb_auth):
_get_auth()
@@ -376,5 +368,4 @@ def addTorrentPause(result):
return not json.loads(response.text)['error']
return True
return True
+5 -5
View File
@@ -865,21 +865,21 @@ class TELEGRAM(object):
return
import requests
TELEGRAM_API = "https://api.telegram.org/bot%s/%s"
# Get configuration data
token = headphones.CONFIG.TELEGRAM_TOKEN
userid = headphones.CONFIG.TELEGRAM_USERID
# Construct message
payload = {'chat_id': userid, 'text': status + ': ' + message }
payload = {'chat_id': userid, 'text': status + ': ' + message}
# Send message to user using Telegram's Bot API
try:
response = requests.post(TELEGRAM_API % (token, "sendMessage"), data=payload)
except Exception, e:
logger.info(u'Telegram notify failed: ' + str(e) )
logger.info(u'Telegram notify failed: ' + str(e))
# Error logging
sent_successfuly = True
+3 -3
View File
@@ -919,7 +919,7 @@ def send_to_downloader(data, bestqual, album):
# Set move-to directory
if headphones.CONFIG.DELUGE_DONE_DIRECTORY:
deluge.setTorrentPath({'hash': torrentid})
# I only just realized this function is useless...
folder_name = deluge.getTorrentFolder({'hash': torrentid})
if folder_name:
@@ -927,12 +927,12 @@ def send_to_downloader(data, bestqual, album):
else:
logger.error('Torrent folder name could not be determined')
return
except Exception as e:
#exc_type, exc_obj, exc_tb = sys.exc_info()
#fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
#print(exc_type, fname, exc_tb.tb_lineno)
logger.error( str(e) )
logger.error(str(e))
else: # if headphones.CONFIG.TORRENT_DOWNLOADER == 2:
logger.info("Sending torrent to uTorrent")
+1 -1
View File
@@ -1431,7 +1431,7 @@ class WebInterface(object):
"synoindex_enabled", "pushover_enabled",
"pushover_onsnatch", "pushbullet_enabled", "pushbullet_onsnatch", "subsonic_enabled",
"twitter_enabled", "twitter_onsnatch",
"telegram_enabled", "telegram_onsnatch",
"telegram_enabled", "telegram_onsnatch",
"osx_notify_enabled", "osx_notify_onsnatch", "boxcar_enabled", "boxcar_onsnatch",
"songkick_enabled", "songkick_filter_enabled",
"mpc_enabled", "email_enabled", "email_ssl", "email_tls", "email_onsnatch",