mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
fix is_sample and add exit to create_destination
This commit is contained in:
parent
c9ca8d7560
commit
5ec0fce884
1 changed files with 4 additions and 4 deletions
|
@ -122,7 +122,7 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
return inputDirectory, inputName, inputCategory, root
|
return inputDirectory, inputName, inputCategory, root
|
||||||
|
|
||||||
|
|
||||||
def is_sample(filePath, inputName):
|
def is_sample(filePath, inputName, minSampleSize):
|
||||||
# 200 MB in bytes
|
# 200 MB in bytes
|
||||||
SIZE_CUTOFF = minSampleSize * 1024 * 1024
|
SIZE_CUTOFF = minSampleSize * 1024 * 1024
|
||||||
# Ignore 'sample' in files unless 'sample' in Torrent Name
|
# Ignore 'sample' in files unless 'sample' in Torrent Name
|
||||||
|
@ -135,8 +135,8 @@ def create_destination(outputDestination):
|
||||||
Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination)
|
Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination)
|
||||||
os.makedirs(outputDestination)
|
os.makedirs(outputDestination)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s", e)
|
Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s. Exiting", e)
|
||||||
return False
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
def copy_link(source, target, useLink, outputDestination):
|
def copy_link(source, target, useLink, outputDestination):
|
||||||
|
@ -279,7 +279,7 @@ for dirpath, dirnames, filenames in os.walk(inputDirectory):
|
||||||
filePath = os.path.join(dirpath, file)
|
filePath = os.path.join(dirpath, file)
|
||||||
fileExtention = os.path.splitext(file)[1]
|
fileExtention = os.path.splitext(file)[1]
|
||||||
if fileExtention in mediaContainer: # If the file is a video file
|
if fileExtention in mediaContainer: # If the file is a video file
|
||||||
if is_sample(filePath, inputName): # Ignore samples
|
if is_sample(filePath, inputName, minSampleSize): # Ignore samples
|
||||||
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
Logger.info("MAIN: Ignoring sample file: %s ", filePath)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue