diff --git a/Makefile b/Makefile index 32a9648..bd8208c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ +LATEX=lualatex TARGET=presentation.tex DOT=$(wildcard figs/*.dot) @@ -15,13 +16,17 @@ all: paper twopi -Tsvg -o$(@) $(<) +thumbs: + + python make_video_preview.py ${TARGET} + bib: $(TARGET:.tex=.aux) BSTINPUTS=:./sty bibtex $(TARGET:.tex=.aux) paper: $(TARGET) $(SVG:.svg=.pdf) $(DOT:.dot=.pdf) - TEXINPUTS=:./sty xelatex $(TARGET) + TEXINPUTS=:./sty $(LATEX) $(TARGET) clean: rm -f *.spl *.idx *.aux *.log *.snm *.out *.toc *.nav *intermediate *~ *.glo *.ist *.bbl *.blg $(SVG:.svg=.pdf) $(DOT:.dot=.svg) $(DOT:.dot=.pdf) diff --git a/make_video_preview.py b/make_video_preview.py new file mode 100644 index 0000000..ec2d088 --- /dev/null +++ b/make_video_preview.py @@ -0,0 +1,18 @@ +import sys +import re +from subprocess import call + +video = re.compile('.*video.*{(?P.*\..*?)(\?.*?(start=(?P\d*).*)?)?}') +with open(sys.argv[1],'r') as tex: + for line in tex.readlines(): + found = video.search(line) + if found: + starttime = found.group('starttime') + if starttime: + starttime = int(starttime) + else: + starttime = 0 + cmd = "avconv -i " + found.group('file') + " -r 1 -vframes 1 -ss " + str(starttime) + " " + found.group('file').split('.')[0] + "_thumb.jpg" + print("%s starting at %d" % (found.group('file'), starttime)) + print("> " + cmd) + call(cmd, shell=True)