mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-23 06:25:22 -07:00
Adjust fork detection for force_next and change to proc_dir (fork SICKRAGE was never detected anymore anyways, so I reused that one)
This commit is contained in:
parent
52cc753881
commit
9118474770
2 changed files with 25 additions and 11 deletions
|
@ -54,12 +54,14 @@ FORK_FAILED = "failed"
|
||||||
FORK_FAILED_TORRENT = "failed-torrent"
|
FORK_FAILED_TORRENT = "failed-torrent"
|
||||||
FORK_SICKRAGETV = "sickragetv"
|
FORK_SICKRAGETV = "sickragetv"
|
||||||
FORK_SICKRAGE = "sickrage"
|
FORK_SICKRAGE = "sickrage"
|
||||||
|
FORK_SICKRAGE2 = "sickrage"
|
||||||
FORKS[FORK_DEFAULT] = {"dir": None}
|
FORKS[FORK_DEFAULT] = {"dir": None}
|
||||||
FORKS[FORK_FAILED] = {"dirName": None, "failed": None}
|
FORKS[FORK_FAILED] = {"dirName": None, "failed": None}
|
||||||
FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": None}
|
FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": None}
|
||||||
FORKS[FORK_SICKRAGETV] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
FORKS[FORK_SICKRAGETV] = {"proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
||||||
FORKS[FORK_SICKRAGE] = {"dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
FORKS[FORK_SICKRAGE] = {"process_directory": None, "failed": None, "process_method": None, "force": None, "delete_on": None, "force_next": True}
|
||||||
ALL_FORKS = {"dir": None, "dirName": None, "proc_dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
ALL_FORKS = {"dir": None, "dirName": None, "proc_dir": None, "process_directory": None, "failed": None, "process_method": None, "force": None,
|
||||||
|
"delete_on": None, "force_next": True}
|
||||||
SICKBEARD_FAILED = [FORK_FAILED, FORK_FAILED_TORRENT, FORK_SICKRAGETV, FORK_SICKRAGE]
|
SICKBEARD_FAILED = [FORK_FAILED, FORK_FAILED_TORRENT, FORK_SICKRAGETV, FORK_SICKRAGE]
|
||||||
SICKBEARD_TORRENT = [FORK_FAILED_TORRENT, FORK_SICKRAGETV, FORK_SICKRAGE]
|
SICKBEARD_TORRENT = [FORK_FAILED_TORRENT, FORK_SICKRAGETV, FORK_SICKRAGE]
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ from core.transcoder import transcoder
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
|
||||||
class autoProcessTV:
|
class autoProcessTV:
|
||||||
def command_complete(self, url, params, headers, section):
|
@staticmethod
|
||||||
|
def command_complete(url, params, headers, section):
|
||||||
r = None
|
r = None
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, params=params, headers=headers, stream=True, verify=False, timeout=(30, 60))
|
r = requests.get(url, params=params, headers=headers, stream=True, verify=False, timeout=(30, 60))
|
||||||
|
@ -110,6 +111,11 @@ class autoProcessTV:
|
||||||
delete_on = int(core.CFG[section][inputCategory]["delete_on"])
|
delete_on = int(core.CFG[section][inputCategory]["delete_on"])
|
||||||
except:
|
except:
|
||||||
delete_on = 0
|
delete_on = 0
|
||||||
|
try:
|
||||||
|
force_next = int(core.CFG[section][inputCategory]["force_next"])
|
||||||
|
except:
|
||||||
|
force_next = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
extract = int(section[inputCategory]["extract"])
|
extract = int(section[inputCategory]["extract"])
|
||||||
except:
|
except:
|
||||||
|
@ -140,7 +146,7 @@ class autoProcessTV:
|
||||||
process_all_exceptions(inputName, dirName)
|
process_all_exceptions(inputName, dirName)
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
# Now check if tv files exist in destination.
|
# Now check if tv files exist in destination.
|
||||||
if not listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False):
|
if not listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False):
|
||||||
if listMediaFiles(dirName, media=False, audio=False, meta=False, archives=True) and extract:
|
if listMediaFiles(dirName, media=False, audio=False, meta=False, archives=True) and extract:
|
||||||
logger.debug('Checking for archives to extract in directory: %s' % (dirName))
|
logger.debug('Checking for archives to extract in directory: %s' % (dirName))
|
||||||
|
@ -148,8 +154,8 @@ class autoProcessTV:
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
if listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False): # Check that a video exists. if not, assume failed.
|
if listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False): # Check that a video exists. if not, assume failed.
|
||||||
flatten(dirName)
|
flatten(dirName)
|
||||||
|
|
||||||
# Check video files for corruption
|
# Check video files for corruption
|
||||||
status = int(failed)
|
status = int(failed)
|
||||||
good_files = 0
|
good_files = 0
|
||||||
|
@ -159,7 +165,7 @@ class autoProcessTV:
|
||||||
if transcoder.isVideoGood(video, status):
|
if transcoder.isVideoGood(video, status):
|
||||||
good_files += 1
|
good_files += 1
|
||||||
import_subs(video)
|
import_subs(video)
|
||||||
if num_files > 0:
|
if num_files > 0:
|
||||||
if good_files == num_files and not status == 0:
|
if good_files == num_files and not status == 0:
|
||||||
logger.info('Found Valid Videos. Setting status Success')
|
logger.info('Found Valid Videos. Setting status Success')
|
||||||
status = 0
|
status = 0
|
||||||
|
@ -200,7 +206,7 @@ class autoProcessTV:
|
||||||
if param == "failed":
|
if param == "failed":
|
||||||
fork_params[param] = failed
|
fork_params[param] = failed
|
||||||
|
|
||||||
if param in ["dirName", "dir", "proc_dir"]:
|
if param in ["dirName", "dir", "proc_dir", "process_directory"]:
|
||||||
fork_params[param] = dirName
|
fork_params[param] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
fork_params[param] = remoteDir(dirName)
|
fork_params[param] = remoteDir(dirName)
|
||||||
|
@ -223,6 +229,12 @@ class autoProcessTV:
|
||||||
else:
|
else:
|
||||||
del fork_params[param]
|
del fork_params[param]
|
||||||
|
|
||||||
|
if param == "force_next":
|
||||||
|
if force_next:
|
||||||
|
fork_params[param] = force_next
|
||||||
|
else:
|
||||||
|
del fork_params[param]
|
||||||
|
|
||||||
# delete any unused params so we don't pass them to SB by mistake
|
# delete any unused params so we don't pass them to SB by mistake
|
||||||
[fork_params.pop(k) for k,v in fork_params.items() if v is None]
|
[fork_params.pop(k) for k,v in fork_params.items() if v is None]
|
||||||
|
|
||||||
|
@ -261,7 +273,7 @@ class autoProcessTV:
|
||||||
if not download_id:
|
if not download_id:
|
||||||
data.pop("downloadClientId")
|
data.pop("downloadClientId")
|
||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if section == "SickBeard":
|
if section == "SickBeard":
|
||||||
logger.debug("Opening URL: %s with params: %s" % (url, str(fork_params)), section)
|
logger.debug("Opening URL: %s with params: %s" % (url, str(fork_params)), section)
|
||||||
|
@ -287,7 +299,7 @@ class autoProcessTV:
|
||||||
Started = False
|
Started = False
|
||||||
if section == "SickBeard":
|
if section == "SickBeard":
|
||||||
for line in r.iter_lines():
|
for line in r.iter_lines():
|
||||||
if line:
|
if line:
|
||||||
logger.postprocess("%s" % (line), section)
|
logger.postprocess("%s" % (line), section)
|
||||||
if "Moving file from" in line:
|
if "Moving file from" in line:
|
||||||
inputName = os.path.split(line)[1]
|
inputName = os.path.split(line)[1]
|
||||||
|
@ -317,7 +329,7 @@ class autoProcessTV:
|
||||||
while n < 6: # set up wait_for minutes to see if command completes..
|
while n < 6: # set up wait_for minutes to see if command completes..
|
||||||
time.sleep(10 * wait_for)
|
time.sleep(10 * wait_for)
|
||||||
command_status = self.command_complete(url, params, headers, section)
|
command_status = self.command_complete(url, params, headers, section)
|
||||||
if command_status and command_status in ['completed', 'failed']:
|
if command_status and command_status in ['completed', 'failed']:
|
||||||
break
|
break
|
||||||
n += 1
|
n += 1
|
||||||
if command_status:
|
if command_status:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue