Merge remote-tracking branch 'delphiactual/develop' into develop

This commit is contained in:
rembo10
2014-05-03 18:41:14 -07:00
3 changed files with 24 additions and 30 deletions

View File

@@ -237,7 +237,7 @@
</div>
<div class="row">
<label>uTorrent Password:</label>
<input type="text" name="utorrent_password" value="${config['utorrent_pass']}" size="30">
<input type="password" name="utorrent_password" value="${config['utorrent_pass']}" size="30">
</div>
<div class="row">
<label>uTorrent Label:</label>

View File

@@ -352,7 +352,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
headphones.MOVE_FILES:
if not os.access(downloaded_track, os.W_OK):
logger.error("Track file is not writeable, which is equired for some post processing steps: %s", downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
logger.error("Track file is not writeable, which is required for some post processing steps: %s", downloaded_track.decode(headphones.SYS_ENCODING, 'replace'))
return
#start encoding

View File

@@ -69,36 +69,30 @@ def addTorrent(link):
logger.error("Error sending torrent to uTorrent")
return
# Not really sure how to ID these? Title seems safest)
# Also, not sure when the torrent will pop up in the list, so we'll make sure it exists and is 1% downloaded
tries = 0
folder = None
while tries < 10:
if link.startswith('magnet'):
tor_hash = re.findall('urn:btih:([\w]{32,40})', link)[0]
if len(tor_hash) == 32:
tor_hash = b16encode(b32decode(tor_hash)).lower()
else:
info = bdecode(link.content)["info"]
tor_hash = sha1(bencode(info)).hexdigest()
params = {'action':'setprops', 'hash':tor_hash,'s':'label', 'v':label, 'token':token}
response = request.request_json(host, params=params, auth=auth, cookies=cookies)
if not response:
logger.error("Error setting torrent label in uTorrent")
return
# NOW WE WILL CHECK UTORRENT FOR THE FOLDER NAME & SET THE LABEL
params = {'list':'1', 'token':token}
# folder info can probably be cleaned up with getprops
folder = None
response = request.request_json(host, params=params, auth=auth, cookies=cookies)
if not response:
logger.error("Error getting torrent information from uTorrent")
return
params = {'list':'1', 'token':token}
response = request.request_json(host, params=params, auth=auth, cookies=cookies)
if not response:
logger.error("Error getting torrent information from uTorrent")
return
for torrent in response['torrents']:
folder = os.path.basename(torrent[26])
if torrent[19] == link and torrent[4] > 1:
folder = os.path.basename(torrent[26])
tor_hash = torrent[0]
params = {'action':'setprops', 'hash':tor_hash,'s':'label', 'v':label, 'token':token}
response = request.request_json(host, params=params, auth=auth, cookies=cookies)
break
if folder:
break
else:
time.sleep(5)
tries += 1
return folder
return folder