Added convert binary detection
This commit is contained in:
20
Qalbum.py
20
Qalbum.py
@@ -409,6 +409,23 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
|
||||
return [int(text) if text.isdigit() else text.lower()
|
||||
for text in re.split(_nsre, s)]
|
||||
|
||||
def which(program):
|
||||
''' emulate shell which command '''
|
||||
def is_exe(fpath):
|
||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||
|
||||
fpath, fname = os.path.split(program)
|
||||
if fpath:
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
exe_file = os.path.join(path, program)
|
||||
if is_exe(exe_file):
|
||||
return exe_file
|
||||
|
||||
return None
|
||||
|
||||
def traverse(path,crumbs,inputs,options):
|
||||
''' The recursive main function to create the index.html and seek sub folders '''
|
||||
|
||||
@@ -509,6 +526,9 @@ def setupoptions():
|
||||
|
||||
def setupdefaultoptions(options):
|
||||
''' Adds the missing options for the options object '''
|
||||
if not which('convert'):
|
||||
print('You don\'t seem to have ImageMagick "convert" in PATH!')
|
||||
sys.exit(1)
|
||||
if 'attachments' not in options:
|
||||
options.attachments=True
|
||||
if 'clean' not in options:
|
||||
|
||||
Reference in New Issue
Block a user