mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Added ability to post-processing folders for HeadPhones via thier API, to use this feature HeadPhones needs to support sending folder names to there API for post processing, echel0n already has a fork of HeadPhones that does this at http://github.com/echel0n/HeadPhones
This commit is contained in:
parent
0ca0e43752
commit
3c5e46c212
1 changed files with 10 additions and 5 deletions
|
@ -2,6 +2,7 @@ import time
|
|||
import datetime
|
||||
import logging
|
||||
import socket
|
||||
import urllib
|
||||
from lib import requests
|
||||
from nzbtomedia.nzbToMediaConfig import config
|
||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, getDirectorySize
|
||||
|
@ -60,12 +61,16 @@ class autoProcessMusic:
|
|||
TIME_OUT += 60 # Add an extra minute for over-head/processing/metadata.
|
||||
socket.setdefaulttimeout(int(TIME_OUT)) #initialize socket timeout.
|
||||
|
||||
baseURL = protocol + host + ":" + port + web_root + "/api?apikey=" + apikey + "&cmd="
|
||||
baseURL = protocol + host + ":" + port + web_root + "/api?"
|
||||
|
||||
if status == 0:
|
||||
command = "forceProcess"
|
||||
|
||||
url = baseURL + command
|
||||
params = {}
|
||||
params['apikey'] = apikey
|
||||
params['cmd'] = "forceProcess"
|
||||
params['dir'] = dirName
|
||||
|
||||
url = baseURL + + urllib.urlencode(params)
|
||||
|
||||
Logger.info("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay))
|
||||
|
||||
|
@ -81,9 +86,9 @@ class autoProcessMusic:
|
|||
|
||||
Logger.info("HeadPhones returned %s", r.text)
|
||||
if r.text == "OK":
|
||||
Logger.info("%s started on HeadPhones for %s", command, nzbName)
|
||||
Logger.info("Post-processing started on HeadPhones for %s in folder %s", nzbName, dirName)
|
||||
else:
|
||||
Logger.error("%s has NOT started on HeadPhones for %s. Exiting", command, nzbName)
|
||||
Logger.error("Post-proecssing has NOT started on HeadPhones for %s in folder %s. Exiting", nzbName, dirName)
|
||||
return 1 # failure
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue