Skip to content

Commit

Permalink
Merge pull request vlanard#8 from MahdiZareie/patch-1
Browse files Browse the repository at this point in the history
output directory in the script arguments
  • Loading branch information
vlanard authored Jun 11, 2016
2 parents 13a59b0 + 0687338 commit 00f05bb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sprites/makesprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ def makeOutDir(videofile):
base,ext = os.path.splitext(videofile)
script = sys.argv[0]
basepath = os.path.dirname(os.path.abspath(script)) #make output dir always relative to this script regardless of shell directory
if len(THUMB_OUTDIR)>0 and THUMB_OUTDIR[0]=='/':
outputdir = THUMB_OUTDIR
else:
outputdir = os.path.join(basepath,THUMB_OUTDIR)
if USE_UNIQUE_OUTDIR:
newoutdir = "%s.%s" % (os.path.join(basepath,THUMB_OUTDIR,base),datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
newoutdir = "%s.%s" % (os.path.join(outputdir,base),datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
else:
newoutdir = "%s_%s" % (os.path.join(basepath,THUMB_OUTDIR,base),"vtt")
newoutdir = "%s_%s" % (os.path.join(outputdir,base),"vtt")
if not os.path.exists(newoutdir):
logger.info("Making dir: %s" % newoutdir)
os.makedirs(newoutdir)
Expand Down Expand Up @@ -281,7 +285,8 @@ def addLogging():
if __name__ == "__main__":
if not len(sys.argv) > 1 :
sys.exit("Please pass the full path or url to the video file for which to create thumbnails.")

if len(sys.argv) == 3:
THUMB_OUTDIR = sys.argv[2]
videofile = sys.argv[1]
task = SpriteTask(videofile)
run(task)

0 comments on commit 00f05bb

Please sign in to comment.