mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 13:53:15 -07:00
Revert "Added minSize option to all category subsections, this allows you to set a minimum size requirement for downloads to pass to be considered a valid media file and if they fail this check there ignored and removed from disk, Default size is 200MB."
This reverts commit 8f93dc5354
.
This commit is contained in:
parent
8f93dc5354
commit
dea39ba4cc
3 changed files with 25 additions and 27 deletions
|
@ -37,8 +37,6 @@
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
wait_for = 2
|
wait_for = 2
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -62,8 +60,6 @@
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
process_method =
|
process_method =
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -86,8 +82,6 @@
|
||||||
# Enable/Disable linking for Torrents
|
# Enable/Disable linking for Torrents
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -108,8 +102,6 @@
|
||||||
# Enable/Disable linking for Torrents
|
# Enable/Disable linking for Torrents
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -130,8 +122,6 @@
|
||||||
# Enable/Disable linking for Torrents
|
# Enable/Disable linking for Torrents
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -151,8 +141,6 @@
|
||||||
# Enable/Disable linking for Torrents
|
# Enable/Disable linking for Torrents
|
||||||
Torrent_NoLink = 0
|
Torrent_NoLink = 0
|
||||||
extract = 1
|
extract = 1
|
||||||
# Set this to minimum required size to consider a media file valid (in MB, eg 200mb)
|
|
||||||
minSize = 200
|
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Set to path where completed downloads are found on remote server for this category
|
||||||
remote_path =
|
remote_path =
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
|
@ -199,6 +187,10 @@
|
||||||
mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.m4v
|
mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso,.m4v
|
||||||
audioExtensions = .mp3, .aac, .ogg, .ape, .m4a, .asf, .wma, .flac
|
audioExtensions = .mp3, .aac, .ogg, .ape, .m4a, .asf, .wma, .flac
|
||||||
metaExtensions = .nfo,.sub,.srt,.jpg,.gif
|
metaExtensions = .nfo,.sub,.srt,.jpg,.gif
|
||||||
|
###### minSampleSize - Minimum required size to consider a media file not a sample file (in MB, eg 200mb)
|
||||||
|
minSampleSize = 200
|
||||||
|
###### SampleIDs - a list of common sample identifiers. Use SizeOnly to ignore this and delete all media files less than minSampleSize
|
||||||
|
SampleIDs = sample,-s.
|
||||||
|
|
||||||
[Transcoder]
|
[Transcoder]
|
||||||
transcode = 0
|
transcode = 0
|
||||||
|
|
|
@ -268,6 +268,9 @@ def initialize(section=None):
|
||||||
if isinstance(AUDIOCONTAINER, str): AUDIOCONTAINER = AUDIOCONTAINER.split(',')
|
if isinstance(AUDIOCONTAINER, str): AUDIOCONTAINER = AUDIOCONTAINER.split(',')
|
||||||
if isinstance(METACONTAINER, str): METACONTAINER = METACONTAINER.split(',')
|
if isinstance(METACONTAINER, str): METACONTAINER = METACONTAINER.split(',')
|
||||||
|
|
||||||
|
MINSAMPLESIZE = int(CFG["Extensions"]["minSampleSize"]) # 200 (in MB)
|
||||||
|
SAMPLEIDS = CFG["Extensions"]["SampleIDs"]
|
||||||
|
|
||||||
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
||||||
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
||||||
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
||||||
|
|
|
@ -117,14 +117,19 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
|
|
||||||
return inputDirectory, inputName, inputCategory, root, single
|
return inputDirectory, inputName, inputCategory, root, single
|
||||||
|
|
||||||
def is_minSize(inputName, minSize):
|
|
||||||
if os.path.getsize(inputName) < minSize * 1048576:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def is_sample(inputName):
|
def is_sample(inputName, minSampleSize, SampleIDs):
|
||||||
# Ignore 'sample' in files
|
# 200 MB in bytes
|
||||||
if re.search('(^|[\W_])sample\d*[\W_]', inputName.lower()):
|
SIZE_CUTOFF = minSampleSize * 1024 * 1024
|
||||||
return True
|
if os.path.getsize(inputName) < SIZE_CUTOFF:
|
||||||
|
if 'SizeOnly' in SampleIDs:
|
||||||
|
return True
|
||||||
|
# Ignore 'sample' in files
|
||||||
|
for ident in SampleIDs:
|
||||||
|
if re.search(ident,inputName,flags=re.I):
|
||||||
|
return True
|
||||||
|
# Return False if none of these were met.
|
||||||
|
return False
|
||||||
|
|
||||||
def copy_link(filePath, targetDirectory, useLink, outputDestination):
|
def copy_link(filePath, targetDirectory, useLink, outputDestination):
|
||||||
if os.path.isfile(targetDirectory):
|
if os.path.isfile(targetDirectory):
|
||||||
|
@ -437,10 +442,7 @@ def cleanProcDirs():
|
||||||
if nzbtomedia.CFG[section][category].isenabled():
|
if nzbtomedia.CFG[section][category].isenabled():
|
||||||
dirNames = get_dirnames(section, category)
|
dirNames = get_dirnames(section, category)
|
||||||
for dirName in dirNames:
|
for dirName in dirNames:
|
||||||
try:
|
num_files = len(listMediaFiles(dirName))
|
||||||
minSize = nzbtomedia.CFG[section][category]['minSize']
|
|
||||||
except:minSize = 200
|
|
||||||
num_files = len(listMediaFiles(dirName, minSize=minSize))
|
|
||||||
if num_files > 0:
|
if num_files > 0:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Directory %s still contains %s unprocessed file(s), skipping ..." % (dirName, num_files),
|
"Directory %s still contains %s unprocessed file(s), skipping ..." % (dirName, num_files),
|
||||||
|
@ -589,7 +591,7 @@ def isMediaFile(mediafile, media=True, audio=True, meta=True, archives=True):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def listMediaFiles(path, minSize=200, media=True, audio=True, meta=True, archives=True, ignoreSample=True):
|
def listMediaFiles(path, media=True, audio=True, meta=True, archives=True, ignoreSample=True):
|
||||||
if not dir or not os.path.isdir(path):
|
if not dir or not os.path.isdir(path):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -603,13 +605,14 @@ def listMediaFiles(path, minSize=200, media=True, audio=True, meta=True, archive
|
||||||
|
|
||||||
elif isMediaFile(curFile, media, audio, meta, archives):
|
elif isMediaFile(curFile, media, audio, meta, archives):
|
||||||
# Optionally ignore sample files
|
# Optionally ignore sample files
|
||||||
if is_sample(fullCurFile) or not is_minSize(fullCurFile, minSize):
|
if ignoreSample and is_sample(fullCurFile, nzbtomedia.MINSAMPLESIZE, nzbtomedia.SAMPLEIDS):
|
||||||
try:
|
try:
|
||||||
os.unlink(fullCurFile)
|
os.unlink(fullCurFile)
|
||||||
logger.debug('Sample file %s has been removed.' % (curFile))
|
logger.debug('Sample file %s has been removed.' % (curFile))
|
||||||
except:continue
|
except:continue
|
||||||
else:
|
continue
|
||||||
files.append(fullCurFile)
|
|
||||||
|
files.append(fullCurFile)
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue