mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
Added option to presrve archive files following extraction.
This commit is contained in:
parent
1cd64053b0
commit
b2ac5bbaf8
3 changed files with 16 additions and 4 deletions
|
@ -84,6 +84,11 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
except:
|
||||
Torrent_NoLink = 0
|
||||
|
||||
try:
|
||||
keep_archive = int(section[usercat]["keep_archive"])
|
||||
except:
|
||||
keep_archive = 0
|
||||
|
||||
try:
|
||||
extract = int(section[usercat]['extract'])
|
||||
except:
|
||||
|
@ -173,7 +178,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
|||
|
||||
if extract == 1:
|
||||
logger.debug('Checking for archives to extract in directory: %s' % (outputDestination))
|
||||
core.extractFiles(outputDestination)
|
||||
core.extractFiles(inputDirectory, outputDestination, keep_archive)
|
||||
|
||||
if not inputCategory in core.NOFLATTEN: #don't flatten hp in case multi cd albums, and we need to copy this back later.
|
||||
core.flatten(outputDestination)
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
web_root =
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
method = renamer
|
||||
delete_failed = 0
|
||||
wait_for = 2
|
||||
|
@ -80,6 +81,7 @@
|
|||
delete_failed = 0
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
process_method =
|
||||
# force processing of already processed content when running a manual scan.
|
||||
force = 0
|
||||
|
@ -110,6 +112,7 @@
|
|||
delete_failed = 0
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
extract = 1
|
||||
nzbExtractionBy = Downloader
|
||||
wait_for = 2
|
||||
|
@ -136,6 +139,7 @@
|
|||
wait_for = 2
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
extract = 1
|
||||
# Set this to minimum required size to consider a media file valid (in MB)
|
||||
minSize = 0
|
||||
|
@ -160,6 +164,7 @@
|
|||
ssl=0
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
extract = 1
|
||||
# Set this to minimum required size to consider a media file valid (in MB)
|
||||
minSize = 0
|
||||
|
@ -185,6 +190,7 @@
|
|||
web_root =
|
||||
# Enable/Disable linking for Torrents
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
extract = 1
|
||||
# Set this to minimum required size to consider a media file valid (in MB)
|
||||
minSize = 0
|
||||
|
@ -336,6 +342,7 @@
|
|||
#Enable/Disable this subsection category
|
||||
enabled = 0
|
||||
Torrent_NoLink = 0
|
||||
keep_archive = 1
|
||||
extract = 1
|
||||
#Enable if you are sending commands to a remote server for this category
|
||||
remote_path = 0
|
||||
|
|
|
@ -987,7 +987,7 @@ def find_imdbid(dirName, inputName):
|
|||
logger.warning('Unable to find a imdbID for %s' % (inputName))
|
||||
return imdbid
|
||||
|
||||
def extractFiles(src, dst=None):
|
||||
def extractFiles(src, dst=None, keep_archive = None):
|
||||
extracted_folder = []
|
||||
extracted_archive = []
|
||||
|
||||
|
@ -1012,8 +1012,8 @@ def extractFiles(src, dst=None):
|
|||
fullFileName = os.path.basename(inputFile)
|
||||
archiveName = os.path.splitext(fullFileName)[0]
|
||||
archiveName = re.sub(r"part[0-9]+", "", archiveName)
|
||||
if not archiveName in extracted_archive:
|
||||
continue # don't remove if we haven't extracted this archive.
|
||||
if not archiveName in extracted_archive or keep_archive == True:
|
||||
continue # don't remove if we haven't extracted this archive, or if we want to preserve them.
|
||||
logger.info("Removing extracted archive %s from folder %s ..." % (fullFileName, folder))
|
||||
try:
|
||||
if not os.access(inputFile, os.W_OK):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue