mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
commit
3377cb338e
15 changed files with 100 additions and 44 deletions
|
@ -56,8 +56,8 @@ FORK_SICKRAGE = "sickrage"
|
|||
FORKS[FORK_DEFAULT] = {"dir": None}
|
||||
FORKS[FORK_FAILED] = {"dirName": None, "failed": None}
|
||||
FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": None}
|
||||
FORKS[FORK_SICKRAGE] = {"dir": None, "failed": None, "process_method": None, "force": None}
|
||||
ALL_FORKS = {"dir": None, "dirName": None, "failed": None, "process_method": None, "force": None}
|
||||
FORKS[FORK_SICKRAGE] = {"dir": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
||||
ALL_FORKS = {"dir": None, "dirName": None, "failed": None, "process_method": None, "force": None, "delete_on": None}
|
||||
SICKBEARD_FAILED = [FORK_FAILED, FORK_FAILED_TORRENT, FORK_SICKRAGE]
|
||||
SICKBEARD_TORRENT = [FORK_FAILED_TORRENT, FORK_SICKRAGE]
|
||||
|
||||
|
@ -98,7 +98,9 @@ USELINK = None
|
|||
OUTPUTDIRECTORY = None
|
||||
NOFLATTEN = []
|
||||
DELETE_ORIGINAL = None
|
||||
TORRENT_CHMOD_DIRECTORY = None
|
||||
TORRENT_DEFAULTDIR = None
|
||||
TORRENT_RESUME_ON_FAILURE = None
|
||||
|
||||
REMOTEPATHS = []
|
||||
|
||||
|
@ -210,9 +212,9 @@ def initialize(section=None):
|
|||
ACODEC2, ACODEC2_ALLOW, ABITRATE2, ACODEC3, ACODEC3_ALLOW, ABITRATE3, ALLOWSUBS, SEXTRACT, SEMBED, SLANGUAGES, \
|
||||
SINCLUDE, SUBSDIR, SCODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, BURN, GETSUBS, HWACCEL, LOG_DIR, LOG_FILE, \
|
||||
NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \
|
||||
DELETE_ORIGINAL, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \
|
||||
DELETE_ORIGINAL, TORRENT_CHMOD_DIRECTORY, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \
|
||||
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, CHECK_MEDIA, SAFE_MODE, \
|
||||
TORRENT_DEFAULTDIR, NZB_DEFAULTDIR, REMOTEPATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \
|
||||
TORRENT_DEFAULTDIR, TORRENT_RESUME_ON_FAILURE, NZB_DEFAULTDIR, REMOTEPATHS, LOG_ENV, PID_FILE, MYAPP, ACHANNELS, ACHANNELS2, ACHANNELS3, \
|
||||
PLEXSSL, PLEXHOST, PLEXPORT, PLEXTOKEN, PLEXSEC
|
||||
|
||||
if __INITIALIZED__:
|
||||
|
@ -339,6 +341,8 @@ def initialize(section=None):
|
|||
if isinstance(NOFLATTEN, str): NOFLATTEN = NOFLATTEN.split(',')
|
||||
if isinstance(CATEGORIES, str): CATEGORIES = CATEGORIES.split(',')
|
||||
DELETE_ORIGINAL = int(CFG["Torrent"]["deleteOriginal"])
|
||||
TORRENT_CHMOD_DIRECTORY = int(CFG["Torrent"]["chmodDirecotry"], 8)
|
||||
TORRENT_RESUME_ON_FAILURE = int(CFG["Torrent"]["resumeOnFailure"])
|
||||
UTORRENTWEBUI = CFG["Torrent"]["uTorrentWEBui"] # http://localhost:8090/gui/
|
||||
UTORRENTUSR = CFG["Torrent"]["uTorrentUSR"] # mysecretusr
|
||||
UTORRENTPWD = CFG["Torrent"]["uTorrentPWD"] # mysecretpwr
|
||||
|
@ -740,3 +744,15 @@ def restart():
|
|||
status = p.returncode
|
||||
|
||||
os._exit(status)
|
||||
|
||||
def rchmod(path, mod):
|
||||
logger.log("Changing file mode of %s to %s" % (path, oct(mod)))
|
||||
os.chmod(path, mod)
|
||||
if not os.path.isdir(path):
|
||||
return # Skip files
|
||||
|
||||
for root, dirs, files in os.walk(path):
|
||||
for d in dirs:
|
||||
os.chmod(os.path.join(root, d), mod)
|
||||
for f in files:
|
||||
os.chmod(os.path.join(root, f), mod)
|
||||
|
|
|
@ -3,10 +3,13 @@ import time
|
|||
import core
|
||||
import requests
|
||||
import time
|
||||
|
||||
from core.nzbToMediaUtil import convert_to_ascii, remoteDir, server_responding
|
||||
from core.nzbToMediaSceneExceptions import process_all_exceptions
|
||||
from core import logger
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
class autoProcessComics:
|
||||
def processEpisode(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
|
||||
if int(status) != 0:
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import core
|
||||
import requests
|
||||
import shutil
|
||||
|
||||
from core.nzbToMediaUtil import convert_to_ascii, server_responding
|
||||
from core.nzbToMediaSceneExceptions import process_all_exceptions
|
||||
from core import logger
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
class autoProcessGames:
|
||||
def process(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
|
||||
status = int(status)
|
||||
|
|
|
@ -8,6 +8,7 @@ from core.nzbToMediaUtil import convert_to_ascii, rmDir, find_imdbid, find_downl
|
|||
from core import logger
|
||||
from core.transcoder import transcoder
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
class autoProcessMovie:
|
||||
def get_release(self, baseURL, imdbid=None, download_id=None, release_id=None):
|
||||
|
|
|
@ -7,6 +7,8 @@ from core.nzbToMediaUtil import convert_to_ascii, remoteDir, listMediaFiles, ser
|
|||
from core.nzbToMediaSceneExceptions import process_all_exceptions
|
||||
from core import logger
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
class autoProcessMusic:
|
||||
def get_status(self, url, apikey, dirName):
|
||||
logger.debug("Attempting to get current status for release:%s" % (os.path.basename(dirName)))
|
||||
|
|
|
@ -12,6 +12,8 @@ from core.nzbToMediaUtil import convert_to_ascii, flatten, rmDir, listMediaFiles
|
|||
from core import logger
|
||||
from core.transcoder import transcoder
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
class autoProcessTV:
|
||||
def command_complete(self, url, params, headers, section):
|
||||
r = None
|
||||
|
@ -104,6 +106,10 @@ class autoProcessTV:
|
|||
force = int(core.CFG[section][inputCategory]["force"])
|
||||
except:
|
||||
force = 0
|
||||
try:
|
||||
delete_on = int(core.CFG[section][inputCategory]["delete_on"])
|
||||
except:
|
||||
delete_on = 0
|
||||
try:
|
||||
extract = int(section[inputCategory]["extract"])
|
||||
except:
|
||||
|
@ -211,6 +217,12 @@ class autoProcessTV:
|
|||
else:
|
||||
del fork_params[param]
|
||||
|
||||
if param == "delete_on":
|
||||
if delete_on:
|
||||
fork_params[param] = delete_on
|
||||
else:
|
||||
del fork_params[param]
|
||||
|
||||
# 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]
|
||||
|
||||
|
@ -276,6 +288,8 @@ class autoProcessTV:
|
|||
for line in r.iter_lines():
|
||||
if line:
|
||||
logger.postprocess("%s" % (line), section)
|
||||
if "Moving file from" in line:
|
||||
inputName = os.path.split(line)[1]
|
||||
if "Processing succeeded" in line or "Successfully processed" in line:
|
||||
Success = True
|
||||
elif section == "NzbDrone":
|
||||
|
|
|
@ -798,7 +798,10 @@ def find_download(clientAgent, download_id):
|
|||
if clientAgent == 'deluge':
|
||||
return False
|
||||
if clientAgent == 'sabnzbd':
|
||||
baseURL = "http://%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
if "http" in core.SABNZBDHOST:
|
||||
baseURL = "%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
else:
|
||||
baseURL = "http://%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
url = baseURL
|
||||
params = {}
|
||||
params['apikey'] = core.SABNZBDAPIKEY
|
||||
|
@ -819,7 +822,10 @@ def find_download(clientAgent, download_id):
|
|||
def get_nzoid(inputName):
|
||||
nzoid = None
|
||||
logger.debug("Searching for nzoid from SAbnzbd ...")
|
||||
baseURL = "http://%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
if "http" in core.SABNZBDHOST:
|
||||
baseURL = "%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
else:
|
||||
baseURL = "http://%s:%s/api" % (core.SABNZBDHOST, core.SABNZBDPORT)
|
||||
url = baseURL
|
||||
params = {}
|
||||
params['apikey'] = core.SABNZBDAPIKEY
|
||||
|
@ -1057,7 +1063,7 @@ def server_responding(baseURL):
|
|||
|
||||
def plex_update(category):
|
||||
if core.PLEXSSL:
|
||||
ulr = 'https://'
|
||||
url = 'https://'
|
||||
else:
|
||||
url = 'http://'
|
||||
url = url + core.PLEXHOST + ':' + core.PLEXPORT + '/library/sections/'
|
||||
|
|
|
@ -277,8 +277,6 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd.extend(['-c:a:' + str(used_audio), core.ACODEC])
|
||||
else:
|
||||
audio_cmd.extend(['-c:a:' + str(used_audio), 'copy'])
|
||||
if core.ACODEC == 'aac':
|
||||
audio_cmd.extend(['-strict', '-2'])
|
||||
elif audio3: # just pick the default audio track
|
||||
map_cmd.extend(['-map', '0:' + str(audio3[0]["index"])])
|
||||
a_mapped.extend([audio3[0]["index"]])
|
||||
|
@ -292,8 +290,6 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd.extend(['-c:a:' + str(used_audio), core.ACODEC])
|
||||
else:
|
||||
audio_cmd.extend(['-c:a:' + str(used_audio), 'copy'])
|
||||
if core.ACODEC == 'aac':
|
||||
audio_cmd.extend(['-strict', '-2'])
|
||||
|
||||
if core.ACHANNELS and channels and channels > core.ACHANNELS:
|
||||
audio_cmd.extend(['-ac:a:' + str(used_audio), str(core.ACHANNELS)])
|
||||
|
@ -307,6 +303,8 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd.extend(['-q:a:' + str(used_audio), str(core.OUTPUTQUALITYPERCENT)])
|
||||
if audio_cmd[1] == 'copy':
|
||||
audio_cmd[1] = core.ACODEC
|
||||
if audio_cmd[1] == 'aac':
|
||||
audio_cmd[2:2] = ['-strict', '-2']
|
||||
|
||||
if core.ACODEC2_ALLOW:
|
||||
used_audio += 1
|
||||
|
@ -334,8 +332,6 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd2.extend(['-c:a:' + str(used_audio), core.ACODEC2])
|
||||
else:
|
||||
audio_cmd2.extend(['-c:a:' + str(used_audio), 'copy'])
|
||||
if core.ACODEC2 == 'aac':
|
||||
audio_cmd2.extend(['-strict', '-2'])
|
||||
elif audio3: # just pick the default audio track
|
||||
map_cmd.extend(['-map', '0:' + str(audio3[0]["index"])])
|
||||
a_mapped.extend([audio3[0]["index"]])
|
||||
|
@ -349,8 +345,6 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd2.extend(['-c:a:' + str(used_audio), core.ACODEC2])
|
||||
else:
|
||||
audio_cmd2.extend(['-c:a:' + str(used_audio), 'copy'])
|
||||
if core.ACODEC2 == 'aac':
|
||||
audio_cmd2.extend(['-strict', '-2'])
|
||||
|
||||
if core.ACHANNELS2 and channels and channels > core.ACHANNELS2:
|
||||
audio_cmd2.extend(['-ac:a:' + str(used_audio), str(core.ACHANNELS2)])
|
||||
|
@ -364,6 +358,8 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd2.extend(['-q:a:' + str(used_audio), str(core.OUTPUTQUALITYPERCENT)])
|
||||
if audio_cmd2[1] == 'copy':
|
||||
audio_cmd2[1] = core.ACODEC2
|
||||
if audio_cmd2[1] == 'aac':
|
||||
audio_cmd2[2:2] = ['-strict', '-2']
|
||||
audio_cmd.extend(audio_cmd2)
|
||||
|
||||
if core.AINCLUDE and audio3 and core.ACODEC3:
|
||||
|
@ -386,8 +382,6 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd3.extend(['-c:a:' + str(used_audio), core.ACODEC3])
|
||||
else:
|
||||
audio_cmd3.extend(['-c:a:' + str(used_audio), 'copy'])
|
||||
if core.ACODEC3 == 'aac':
|
||||
audio_cmd3.extend(['-strict', '-2'])
|
||||
|
||||
if core.ACHANNELS3 and channels and channels > core.ACHANNELS3:
|
||||
audio_cmd3.extend(['-ac:a:' + str(used_audio), str(core.ACHANNELS3)])
|
||||
|
@ -401,6 +395,8 @@ def buildCommands(file, newDir, movieName, bitbucket):
|
|||
audio_cmd3.extend(['-q:a:' + str(used_audio), str(core.OUTPUTQUALITYPERCENT)])
|
||||
if audio_cmd3[1] == 'copy':
|
||||
audio_cmd3[1] = core.ACODEC3
|
||||
if audio_cmd3[1] == 'aac':
|
||||
audio_cmd3[2:2] = ['-strict', '-2']
|
||||
audio_cmd.extend(audio_cmd3)
|
||||
|
||||
s_mapped = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue