mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Merge branch 'clinton-hall/dev'
Conflicts: TorrentToMedia.py
This commit is contained in:
commit
5105e03de6
14 changed files with 62 additions and 84 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,6 +3,6 @@ autoProcessMedia.cfg
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.pyo
|
||||||
|
|
||||||
postprocess.log
|
postprocess.log*
|
||||||
/.idea/
|
/.idea/
|
||||||
*.cfg.old
|
*.cfg.old
|
||||||
|
|
|
@ -31,8 +31,12 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from nzbtomedia.nzbToMediaConfig import config
|
|
||||||
|
|
||||||
|
# NZBGet argv: all passed as environment variables.
|
||||||
|
# Exit codes used by NZBGet
|
||||||
|
POSTPROCESS_SUCCESS=93
|
||||||
|
POSTPROCESS_ERROR=94
|
||||||
|
POSTPROCESS_NONE=95
|
||||||
|
|
||||||
def is_sample(filePath, inputName, maxSampleSize, SampleIDs):
|
def is_sample(filePath, inputName, maxSampleSize, SampleIDs):
|
||||||
# 200 MB in bytes
|
# 200 MB in bytes
|
||||||
|
@ -58,13 +62,13 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
|
|
||||||
if os.environ['NZBOP_UNPACK'] != 'yes':
|
if os.environ['NZBOP_UNPACK'] != 'yes':
|
||||||
print "Please enable option \"Unpack\" in nzbget configuration file, exiting."
|
print "Please enable option \"Unpack\" in nzbget configuration file, exiting."
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_ERROR)
|
sys.exit(POSTPROCESS_ERROR)
|
||||||
|
|
||||||
# Check par status
|
# Check par status
|
||||||
if os.environ['NZBPP_PARSTATUS'] == '3':
|
if os.environ['NZBPP_PARSTATUS'] == '3':
|
||||||
print "Par-check successful, but Par-repair disabled, exiting."
|
print "Par-check successful, but Par-repair disabled, exiting."
|
||||||
print "Please check your Par-repair settings for future downloads."
|
print "Please check your Par-repair settings for future downloads."
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_NONE)
|
sys.exit(POSTPROCESS_NONE)
|
||||||
|
|
||||||
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
|
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
|
||||||
print "Par-repair failed, setting status \"failed\"."
|
print "Par-repair failed, setting status \"failed\"."
|
||||||
|
@ -95,7 +99,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
# All checks done, now launching the script.
|
# All checks done, now launching the script.
|
||||||
|
|
||||||
if status == 1:
|
if status == 1:
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_NONE)
|
sys.exit(POSTPROCESS_NONE)
|
||||||
|
|
||||||
mediaContainer = os.environ['NZBPO_MEDIAEXTENSIONS'].split(',')
|
mediaContainer = os.environ['NZBPO_MEDIAEXTENSIONS'].split(',')
|
||||||
SampleIDs = os.environ['NZBPO_SAMPLEIDS'].split(',')
|
SampleIDs = os.environ['NZBPO_SAMPLEIDS'].split(',')
|
||||||
|
@ -112,8 +116,8 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
os.unlink(filePath)
|
os.unlink(filePath)
|
||||||
except:
|
except:
|
||||||
print "Error: unable to delete file", filePath
|
print "Error: unable to delete file", filePath
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_ERROR)
|
sys.exit(POSTPROCESS_ERROR)
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_SUCCESS)
|
sys.exit(POSTPROCESS_SUCCESS)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "This script can only be called from NZBGet (11.0 or later)."
|
print "This script can only be called from NZBGet (11.0 or later)."
|
||||||
|
|
|
@ -17,7 +17,12 @@
|
||||||
# Check if the script is called from nzbget 11.0 or later
|
# Check if the script is called from nzbget 11.0 or later
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from nzbtomedia.nzbToMediaConfig import config
|
|
||||||
|
# NZBGet argv: all passed as environment variables.
|
||||||
|
# Exit codes used by NZBGet
|
||||||
|
POSTPROCESS_SUCCESS=93
|
||||||
|
POSTPROCESS_ERROR=94
|
||||||
|
POSTPROCESS_NONE=95
|
||||||
|
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0':
|
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0':
|
||||||
print "Script triggered from NZBGet (11.0 or later)."
|
print "Script triggered from NZBGet (11.0 or later)."
|
||||||
|
@ -27,13 +32,13 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
|
|
||||||
if os.environ['NZBOP_UNPACK'] != 'yes':
|
if os.environ['NZBOP_UNPACK'] != 'yes':
|
||||||
print "Please enable option \"Unpack\" in nzbget configuration file, exiting."
|
print "Please enable option \"Unpack\" in nzbget configuration file, exiting."
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_ERROR)
|
sys.exit(POSTPROCESS_ERROR)
|
||||||
|
|
||||||
# Check par status
|
# Check par status
|
||||||
if os.environ['NZBPP_PARSTATUS'] == '3':
|
if os.environ['NZBPP_PARSTATUS'] == '3':
|
||||||
print "Par-check successful, but Par-repair disabled, exiting."
|
print "Par-check successful, but Par-repair disabled, exiting."
|
||||||
print "Please check your Par-repair settings for future downloads."
|
print "Please check your Par-repair settings for future downloads."
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_NONE)
|
sys.exit(POSTPROCESS_NONE)
|
||||||
|
|
||||||
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
|
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
|
||||||
print "Par-repair failed, setting status \"failed\"."
|
print "Par-repair failed, setting status \"failed\"."
|
||||||
|
@ -64,7 +69,7 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
# All checks done, now launching the script.
|
# All checks done, now launching the script.
|
||||||
|
|
||||||
if status == 1:
|
if status == 1:
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_NONE)
|
sys.exit(POSTPROCESS_NONE)
|
||||||
|
|
||||||
directory = os.path.normpath(os.environ['NZBPP_DIRECTORY'])
|
directory = os.path.normpath(os.environ['NZBPP_DIRECTORY'])
|
||||||
for dirpath, dirnames, filenames in os.walk(directory):
|
for dirpath, dirnames, filenames in os.walk(directory):
|
||||||
|
@ -76,8 +81,8 @@ if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
print "Error: unable to reset time for file", file
|
print "Error: unable to reset time for file", file
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_ERROR)
|
sys.exit(POSTPROCESS_ERROR)
|
||||||
sys.exit(config.NZBGET_POSTPROCESS_SUCCESS)
|
sys.exit(POSTPROCESS_SUCCESS)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "This script can only be called from NZBGet (11.0 or later)."
|
print "This script can only be called from NZBGet (11.0 or later)."
|
||||||
|
|
|
@ -140,13 +140,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
|
|
||||||
Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory)
|
Logger.debug("MAIN: Scanning files in directory: %s", inputDirectory)
|
||||||
|
|
||||||
if inputCategory in hpCategory:
|
noFlatten.extend(hpCategory) # Make sure we preserve folder structure for HeadPhones.
|
||||||
noFlatten.extend(hpCategory) # Make sure we preserve folder structure for HeadPhones.
|
|
||||||
if useLink in ['sym','move']: # These don't work for HeadPhones.
|
|
||||||
useLink = 'no' # default to copy.
|
|
||||||
|
|
||||||
if inputCategory in sbCategory and fork in config.SICKBEARD_TORRENT: # Don't flatten when sending to SICKBEARD_TORRENT
|
|
||||||
noFlatten.extend(sbCategory)
|
|
||||||
|
|
||||||
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
|
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
|
@ -187,15 +181,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
else:
|
else:
|
||||||
continue # This file has not been recently moved or created, skip it
|
continue # This file has not been recently moved or created, skip it
|
||||||
|
|
||||||
if inputCategory in sbCategory and fork in config.SICKBEARD_TORRENT: # We want to link every file.
|
|
||||||
Logger.info("MAIN: Found file %s in %s", fileExtension, filePath)
|
|
||||||
try:
|
|
||||||
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
|
||||||
copy_list.append([filePath, os.path.join(outputDestination, file)])
|
|
||||||
except:
|
|
||||||
Logger.exception("MAIN: Failed to link file: %s", file)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if fileExtension in mediaContainer: # If the file is a video file
|
if fileExtension in mediaContainer: # If the file is a video file
|
||||||
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
|
if is_sample(filePath, inputName, minSampleSize, SampleIDs) and not inputCategory in hpCategory: # Ignore samples
|
||||||
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
||||||
|
@ -217,13 +202,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
Logger.exception("MAIN: Failed to link file: %s", file)
|
Logger.exception("MAIN: Failed to link file: %s", file)
|
||||||
continue
|
continue
|
||||||
elif fileExtension in compressedContainer:
|
elif fileExtension in compressedContainer:
|
||||||
if inputCategory in hpCategory: # We need to link all files for HP in order to move these back to support seeding.
|
|
||||||
Logger.info("MAIN: Linking compressed archive file %s for file %s", fileExtension, filePath)
|
|
||||||
try:
|
|
||||||
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
|
||||||
copy_list.append([filePath, os.path.join(outputDestination, file)])
|
|
||||||
except:
|
|
||||||
Logger.exception("MAIN: Failed to link file: %s", file)
|
|
||||||
# find part numbers in second "extension" from right, if we have more than 1 compressed file in the same directory.
|
# find part numbers in second "extension" from right, if we have more than 1 compressed file in the same directory.
|
||||||
if re.search(r'\d+', os.path.splitext(fileName)[1]) and os.path.dirname(filePath) in extracted_folder and not any(item in os.path.splitext(fileName)[1] for item in ['.720p','.1080p','.x264']):
|
if re.search(r'\d+', os.path.splitext(fileName)[1]) and os.path.dirname(filePath) in extracted_folder and not any(item in os.path.splitext(fileName)[1] for item in ['.720p','.1080p','.x264']):
|
||||||
part = int(re.search(r'\d+', os.path.splitext(fileName)[1]).group())
|
part = int(re.search(r'\d+', os.path.splitext(fileName)[1]).group())
|
||||||
|
@ -234,10 +212,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
continue
|
continue
|
||||||
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtension, filePath)
|
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtension, filePath)
|
||||||
try:
|
try:
|
||||||
if inputCategory in hpCategory: # HP needs to scan the same dir as passed to downloader.
|
extractor.extract(filePath, outputDestination)
|
||||||
extractor.extract(filePath, inputDirectory)
|
|
||||||
else:
|
|
||||||
extractor.extract(filePath, outputDestination)
|
|
||||||
extractionSuccess = True # we use this variable to determine if we need to pause a torrent or not in uTorrent (don't need to pause archived content)
|
extractionSuccess = True # we use this variable to determine if we need to pause a torrent or not in uTorrent (don't need to pause archived content)
|
||||||
extracted_folder.append(os.path.dirname(filePath))
|
extracted_folder.append(os.path.dirname(filePath))
|
||||||
except:
|
except:
|
||||||
|
@ -257,7 +232,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
flatten(outputDestination)
|
flatten(outputDestination)
|
||||||
|
|
||||||
# Now check if movie files exist in destination:
|
# Now check if movie files exist in destination:
|
||||||
if inputCategory in cpsCategory + sbCategory and not (inputCategory in sbCategory and fork in config.SICKBEARD_TORRENT):
|
if inputCategory in cpsCategory + sbCategory:
|
||||||
for dirpath, dirnames, filenames in os.walk(outputDestination):
|
for dirpath, dirnames, filenames in os.walk(outputDestination):
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
filePath = os.path.join(dirpath, file)
|
filePath = os.path.join(dirpath, file)
|
||||||
|
@ -277,11 +252,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
else:
|
else:
|
||||||
Logger.debug("MAIN: Found %s media files in output. %s were found in input", str(video2), str(video))
|
Logger.debug("MAIN: Found %s media files in output. %s were found in input", str(video2), str(video))
|
||||||
|
|
||||||
if inputCategory in sbCategory and fork in config.SICKBEARD_TORRENT:
|
|
||||||
if len(copy_list) > 0:
|
|
||||||
Logger.debug("MAIN: Found and linked %s files", str(len(copy_list)))
|
|
||||||
status = int(0)
|
|
||||||
|
|
||||||
processCategories = cpsCategory + sbCategory + hpCategory + mlCategory + gzCategory
|
processCategories = cpsCategory + sbCategory + hpCategory + mlCategory + gzCategory
|
||||||
|
|
||||||
if (inputCategory in user_script_categories and not "NONE" in user_script_categories) or ("ALL" in user_script_categories and not inputCategory in processCategories):
|
if (inputCategory in user_script_categories and not "NONE" in user_script_categories) or ("ALL" in user_script_categories and not inputCategory in processCategories):
|
||||||
|
@ -315,25 +285,6 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
if result == 1:
|
if result == 1:
|
||||||
Logger.info("MAIN: A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
Logger.info("MAIN: A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding")
|
||||||
|
|
||||||
if inputCategory in hpCategory:
|
|
||||||
# we need to move the output dir files back...
|
|
||||||
Logger.debug("MAIN: Moving temporary HeadPhones files back to allow seeding.")
|
|
||||||
for item in copy_list:
|
|
||||||
if os.path.isfile(os.path.normpath(item[1])): # check to ensure temp files still exist.
|
|
||||||
if os.path.isfile(os.path.normpath(item[0])): # both exist, remove temp version
|
|
||||||
Logger.debug("MAIN: File %s still present. Removing tempoary file %s", str(item[0]), str(item[1]))
|
|
||||||
os.unlink(os.path.normpath(item[1]))
|
|
||||||
continue
|
|
||||||
else: # move temp version back to allow seeding or Torrent removal.
|
|
||||||
Logger.debug("MAIN: Moving %s to %s", str(item[1]), str(item[0]))
|
|
||||||
newDestination = os.path.split(os.path.normpath(item[0]))
|
|
||||||
try:
|
|
||||||
copy_link(os.path.normpath(item[1]), os.path.normpath(item[0]), 'move', newDestination[0])
|
|
||||||
except:
|
|
||||||
Logger.exception("MAIN: Failed to move file: %s", file)
|
|
||||||
continue
|
|
||||||
shutil.rmtree(outputDestination)
|
|
||||||
|
|
||||||
# Hardlink solution for uTorrent, need to implent support for deluge, transmission
|
# Hardlink solution for uTorrent, need to implent support for deluge, transmission
|
||||||
if clientAgent in ['utorrent', 'transmission', 'deluge'] and inputHash:
|
if clientAgent in ['utorrent', 'transmission', 'deluge'] and inputHash:
|
||||||
# Delete torrent and torrentdata from Torrent client if processing was successful.
|
# Delete torrent and torrentdata from Torrent client if processing was successful.
|
||||||
|
@ -493,10 +444,9 @@ if __name__ == "__main__":
|
||||||
minSampleSize = int(config().get("Extensions", "minSampleSize")) # 200 (in MB)
|
minSampleSize = int(config().get("Extensions", "minSampleSize")) # 200 (in MB)
|
||||||
SampleIDs = (config().get("Extensions", "SampleIDs")).split(',') # sample,-s.
|
SampleIDs = (config().get("Extensions", "SampleIDs")).split(',') # sample,-s.
|
||||||
|
|
||||||
Torrent_ForceLink = int(config().get("SickBeard", "Torrent_ForceLink")) # 1
|
|
||||||
|
|
||||||
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') # movie
|
cpsCategory = (config().get("CouchPotato", "cpsCategory")).split(',') # movie
|
||||||
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
||||||
|
Torrent_NoLink = int(config().get("SickBeard", "Torrent_NoLink")) # 0
|
||||||
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') # music
|
hpCategory = (config().get("HeadPhones", "hpCategory")).split(',') # music
|
||||||
mlCategory = (config().get("Mylar", "mlCategory")).split(',') # comics
|
mlCategory = (config().get("Mylar", "mlCategory")).split(',') # comics
|
||||||
gzCategory = (config().get("Gamez", "gzCategory")).split(',') # games
|
gzCategory = (config().get("Gamez", "gzCategory")).split(',') # games
|
||||||
|
|
|
@ -37,7 +37,7 @@ watch_dir =
|
||||||
fork = auto
|
fork = auto
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
nzbExtractionBy = Downloader
|
nzbExtractionBy = Downloader
|
||||||
Torrent_ForceLink = 1
|
Torrent_NoLink = 0
|
||||||
process_method =
|
process_method =
|
||||||
|
|
||||||
[HeadPhones]
|
[HeadPhones]
|
||||||
|
|
|
@ -7,7 +7,9 @@ Allow Headphones to remove torrents and data after processing.
|
||||||
Delete torrent if uselink = move
|
Delete torrent if uselink = move
|
||||||
Added forceClean for outputDir. Works in file permissions prevent CP/SB from moving files.
|
Added forceClean for outputDir. Works in file permissions prevent CP/SB from moving files.
|
||||||
Ignore .x264 from archive "part" checks.
|
Ignore .x264 from archive "part" checks.
|
||||||
Added dynamic timeout based on directory size.
|
Changed handling of TPB/Pistachitos SB forks. Default is to link/extract here. Disabled by Torrent_NoLink = 1.
|
||||||
|
Changed handling for HeadPhones Now that HeadPhones allows process directory to be defined.
|
||||||
|
|
||||||
|
|
||||||
Impacts NZBs
|
Impacts NZBs
|
||||||
Fix setting of Mylar config from NZBGet.
|
Fix setting of Mylar config from NZBGet.
|
||||||
|
@ -16,6 +18,8 @@ Impacts All
|
||||||
Changes to Couchpotato API for [nosql] added. Keeps aligned with current CouchPotato develop branch.
|
Changes to Couchpotato API for [nosql] added. Keeps aligned with current CouchPotato develop branch.
|
||||||
Add Auto Detection of SickBeard Fork. Thanks @echel0n
|
Add Auto Detection of SickBeard Fork. Thanks @echel0n
|
||||||
Added config class, re-coded migratecfg, misc bugfixes and code cleanup. Thanks @echel0n
|
Added config class, re-coded migratecfg, misc bugfixes and code cleanup. Thanks @echel0n
|
||||||
|
Added dynamic timeout based on directory size.
|
||||||
|
Added process_Method for SickBeard.
|
||||||
|
|
||||||
V9.2 05/03/2014
|
V9.2 05/03/2014
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
#
|
#
|
||||||
# This is a list of media extensions that may be transcoded if transcoder is enabled below.
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
## Transcoder
|
## Transcoder
|
||||||
|
|
|
@ -222,7 +222,7 @@
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
#
|
#
|
||||||
# This is a list of media extensions that may be transcoded if transcoder is enabled below.
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
## Transcoder
|
## Transcoder
|
||||||
|
@ -473,6 +473,8 @@ else:
|
||||||
if process(get_dirnames("Gamez", gzCategory[0]), inputName=get_dirnames("Gamez", gzCategory[0]), status=0,clientAgent="manual", inputCategory=gzCategory[0]) != 0:
|
if process(get_dirnames("Gamez", gzCategory[0]), inputName=get_dirnames("Gamez", gzCategory[0]), status=0,clientAgent="manual", inputCategory=gzCategory[0]) != 0:
|
||||||
Logger.info("MAIN: A problem was reported in the autoProcessGames script.")
|
Logger.info("MAIN: A problem was reported in the autoProcessGames script.")
|
||||||
|
|
||||||
|
result = 0
|
||||||
|
|
||||||
if result == 0:
|
if result == 0:
|
||||||
Logger.info("MAIN: The nzbToMedia script completed successfully.")
|
Logger.info("MAIN: The nzbToMedia script completed successfully.")
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
#
|
#
|
||||||
# This is a list of media extensions that may be transcoded if transcoder is enabled below.
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
## Transcoder
|
## Transcoder
|
||||||
|
@ -227,11 +227,11 @@ elif len(sys.argv) >= config.SABNZB_0717_NO_OF_ARGUMENTS:
|
||||||
clientAgent = "sabnzbd"
|
clientAgent = "sabnzbd"
|
||||||
result = autoProcessTV().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
result = autoProcessTV().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||||
else:
|
else:
|
||||||
result = 0
|
|
||||||
|
|
||||||
Logger.debug("MAIN: Invalid number of arguments received from client.")
|
Logger.debug("MAIN: Invalid number of arguments received from client.")
|
||||||
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
||||||
|
|
||||||
|
sbCategory = (config().get("SickBeard", "sbCategory")).split(',') # tv
|
||||||
|
result = 1
|
||||||
for dirName in get_dirnames("SickBeard", sbCategory[0]):
|
for dirName in get_dirnames("SickBeard", sbCategory[0]):
|
||||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", dirName)
|
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", dirName)
|
||||||
result = autoProcessTV().processEpisode(dirName, dirName, 0)
|
result = autoProcessTV().processEpisode(dirName, dirName, 0)
|
||||||
|
|
|
@ -55,7 +55,7 @@ class autoProcessMusic:
|
||||||
dirSize = getDirectorySize(dirName) # get total directory size to calculate needed processing time.
|
dirSize = getDirectorySize(dirName) # get total directory size to calculate needed processing time.
|
||||||
TIME_OUT = int(TimePerGiB) * dirSize # HeadPhones needs to complete all moving/transcoding and renaming before returning the status.
|
TIME_OUT = int(TimePerGiB) * dirSize # HeadPhones needs to complete all moving/transcoding and renaming before returning the status.
|
||||||
TIME_OUT += 60 # Add an extra minute for over-head/processing/metadata.
|
TIME_OUT += 60 # Add an extra minute for over-head/processing/metadata.
|
||||||
socket.setdefaulttimeout(int(config.NZBTOMEDIA_TIMEOUT)) #initialize socket timeout.
|
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?apikey=" + apikey + "&cmd="
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,11 @@ class autoProcessTV:
|
||||||
process_method = config().get(section, "process_method")
|
process_method = config().get(section, "process_method")
|
||||||
except config.NoOptionError:
|
except config.NoOptionError:
|
||||||
process_method = None
|
process_method = None
|
||||||
|
try:
|
||||||
|
Torrent_NoLink = int(config().get(section, "Torrent_NoLink"))
|
||||||
|
except (config.NoOptionError, ValueError):
|
||||||
|
Torrent_NoLink = 0
|
||||||
|
|
||||||
|
|
||||||
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',')
|
mediaContainer = (config().get("Extensions", "mediaExtensions")).split(',')
|
||||||
minSampleSize = int(config().get("Extensions", "minSampleSize"))
|
minSampleSize = int(config().get("Extensions", "minSampleSize"))
|
||||||
|
@ -121,7 +126,7 @@ class autoProcessTV:
|
||||||
dirSize = getDirectorySize(dirName) # get total directory size to calculate needed processing time.
|
dirSize = getDirectorySize(dirName) # get total directory size to calculate needed processing time.
|
||||||
TIME_OUT = int(TimePerGiB) * dirSize # SickBeard needs to complete all moving and renaming before returning the log sequence via url.
|
TIME_OUT = int(TimePerGiB) * dirSize # SickBeard needs to complete all moving and renaming before returning the log sequence via url.
|
||||||
TIME_OUT += 60 # Add an extra minute for over-head/processing/metadata.
|
TIME_OUT += 60 # Add an extra minute for over-head/processing/metadata.
|
||||||
socket.setdefaulttimeout(int(config.NZBTOMEDIA_TIMEOUT)) #initialize socket timeout.
|
socket.setdefaulttimeout(int(TIME_OUT)) #initialize socket timeout.
|
||||||
|
|
||||||
# configure SB params to pass
|
# configure SB params to pass
|
||||||
params['quiet'] = 1
|
params['quiet'] = 1
|
||||||
|
@ -136,6 +141,8 @@ class autoProcessTV:
|
||||||
params[param] = dirName
|
params[param] = dirName
|
||||||
|
|
||||||
if param == "process_method":
|
if param == "process_method":
|
||||||
|
if fork in SICKBEARD_TORRENT and Torrent_NoLink == 1 and not clientAgent in ['nzbget','sabnzbd']: #use default SickBeard settings here.
|
||||||
|
del params[param]
|
||||||
if process_method:
|
if process_method:
|
||||||
params[param] = process_method
|
params[param] = process_method
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -52,6 +52,8 @@ class migratecfg:
|
||||||
value = "auto"
|
value = "auto"
|
||||||
if option == "fork" and value not in ["default", "failed", "failed-torrent", "auto"]:
|
if option == "fork" and value not in ["default", "failed", "failed-torrent", "auto"]:
|
||||||
value = "auto"
|
value = "auto"
|
||||||
|
if option == "Torrent_ForceLink":
|
||||||
|
continue
|
||||||
if option == "outputDirectory": # move this to new location format
|
if option == "outputDirectory": # move this to new location format
|
||||||
value = os.path.split(os.path.normpath(value))[0]
|
value = os.path.split(os.path.normpath(value))[0]
|
||||||
confignew.set("Torrent", option, value)
|
confignew.set("Torrent", option, value)
|
||||||
|
|
|
@ -6,7 +6,8 @@ from nzbToMediaConfig import config
|
||||||
|
|
||||||
def autoFork(section):
|
def autoFork(section):
|
||||||
Logger = logging.getLogger()
|
Logger = logging.getLogger()
|
||||||
|
if not config().has_section(section):
|
||||||
|
section = "SickBeard"
|
||||||
# config settings
|
# config settings
|
||||||
host = config().get(section, "host")
|
host = config().get(section, "host")
|
||||||
port = config().get(section, "port")
|
port = config().get(section, "port")
|
||||||
|
|
|
@ -465,12 +465,15 @@ def get_dirnames(section, category):
|
||||||
dirNames = []
|
dirNames = []
|
||||||
if watch_dir != "":
|
if watch_dir != "":
|
||||||
if os.path.exists(watch_dir):
|
if os.path.exists(watch_dir):
|
||||||
dirNames = [os.path.join(watch_dir, o) for o in os.listdir(watch_dir) if
|
dirNames.extend([os.path.join(watch_dir, o) for o in os.listdir(watch_dir) if
|
||||||
os.path.isdir(os.path.join(watch_dir, o))]
|
os.path.isdir(os.path.join(watch_dir, o))])
|
||||||
elif outputDirectory != "":
|
if outputDirectory != "":
|
||||||
if os.path.exists(outputDirectory):
|
if os.path.exists(outputDirectory):
|
||||||
dirNames = [os.path.join(outputDirectory, o) for o in os.listdir(outputDirectory) if
|
dirNames.extend([os.path.join(outputDirectory, o) for o in os.listdir(outputDirectory) if
|
||||||
os.path.isdir(os.path.join(outputDirectory, o))]
|
os.path.isdir(os.path.join(outputDirectory, o))])
|
||||||
|
|
||||||
|
if not dirNames:
|
||||||
|
Logger.warn("No Directories identified to Scan.")
|
||||||
|
|
||||||
return dirNames
|
return dirNames
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue