Commit 53f62c7b authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

merged changes re making filename join bug (regression)

parents 52388e81 acaa942b
......@@ -14,9 +14,8 @@
--output $@
.index/%.{{ext}}/play.mp3: %.{{ext}}
mkdir -p .index/$*.{{ext}}
mkdir -p '.index/$*.{{ext}}'
TMP=/home/videos/tmp ffmpeg-normalize $< -o $@ -t -16 -tp -1.5 -lrt 11 -c:a mp3
# ffmpeg-loudnorm $< --output $@
{% endfor %}
#############################
......@@ -29,15 +28,15 @@
# {{pdf}}_all=$({{pdf}}_meta) $({{pdf}}_poster) $({{pdf}}_thumb)
.index/%.{{pdf}}/metadata.json: %.{{pdf}} .index/%.{{pdf}}/poster.png .index/%.{{pdf}}/thumb.png
indexalist pdfinfo $< | \
indexalist pdfinfo '$<' | \
indexalist jsonaddkeyvalue \
--keyvalue "id" "$$(indexalist urlencode $<)" \
--keyvalue "poster" .index/$*.{{pdf}}/poster.png \
--keyvalue "thumbnail" .index/$*.{{pdf}}/thumb.png \
--output $@
--output '$@'
.index/%.{{pdf}}/poster.png: %.{{pdf}}
mkdir -p .index/$*.{{pdf}}
mkdir -p '.index/$*.{{pdf}}'
MAGICK_TMPDIR=/home/videos/tmp convert $<[0] -background white -flatten $@
.index/%.{{pdf}}/thumb.png: .index/%.{{pdf}}/poster.png
......@@ -53,15 +52,15 @@
{{jpg}}_meta=$({{jpg}}:%.{{jpg}}=.index/%.{{jpg}}/metadata.json)
.index/%.{{jpg}}/metadata.json: %.{{jpg}} .index/%.{{jpg}}/poster.jpg .index/%.{{jpg}}/thumb.jpg
indexalist imageinfo $< | \
indexalist imageinfo "$<" | \
indexalist jsonaddkeyvalue \
--keyvalue "id" "$$(indexalist urlencode $<)" \
--keyvalue "poster" .index/$*.{{jpg}}/poster.jpg \
--keyvalue "thumbnail" .index/$*.{{jpg}}/thumb.jpg \
--output $@
--keyvalue "id" "$$(indexalist urlencode '$<')" \
--keyvalue "poster" ".index/$*.{{jpg}}/poster.jpg" \
--keyvalue "thumbnail" ".index/$*.{{jpg}}/thumb.jpg" \
--output "$@"
.index/%.{{jpg}}/poster.jpg: %.{{jpg}}
mkdir -p .index/$*.{{jpg}}
mkdir -p '.index/$*.{{jpg}}'
MAGICK_TMPDIR=/home/videos/tmp convert $<[0] -auto-orient -resize 640x640 $@
.index/%.{{jpg}}/thumb.jpg: .index/%.{{jpg}}/poster.jpg
......@@ -90,13 +89,11 @@
.index/%.{{mp4}}/play.mp4: %.{{mp4}}
mkdir -p .index/$*.{{mp4}}
# ffmpeg-loudnorm-240p $< --output $@
TMP=/home/videos/tmp ffmpeg-normalize $< -o $@ -t -16 -tp -1.5 -lrt 11 -c:a aac -c:v h264 -e="-vf scale=-2:240" || \
ffmpeg -i $< -vf scale=-2:240 $@
.index/%.{{mp4}}/poster.png: %.{{mp4}}
mkdir -p .index/$*.{{mp4}}
mkdir -p '.index/$*.{{mp4}}'
ffmpeg -i $< -ss {{video_poster_time|default(0)}} -vframes 1 $@
.index/%.{{mp4}}/thumb.png: .index/%.{{mp4}}/poster.png
......@@ -120,6 +117,8 @@ all: index.html
# replace spaces
fixnames:
rename "s/ /_/g" *
rename "s/'//g" *
rename "s/\"//g" *
# special rule for debugging variables
print-%:
@echo '$*=$($*)'
......
{
"audio_extensions": ["mp3", "MP3", "wav", "WAV", "ogg", "OGG", "oga", "OGA", "m4a", "M4A", "opus", "OPUS"],
"pdf_extensions": ["pdf", "PDF"],
"video_extensions": ["mp4", "MP4", "m4v", "ogv", "OGV", "mpeg", "MPEG", "webm", "WEBM", "3gp", "3GP", "mov", "MOV"],
"video_extensions": ["mp4", "MP4", "m4v", "ogv", "OGV", "mpeg", "MPEG", "webm", "WEBM", "mkv", "MKV", "avi", "AVI", "mov", "MOV", "flv", "FLV"],
"image_extensions": ["jpg", "JPG", "tiff", "TIFF", "png", "PNG", "gif", "GIF", "svg", "SVG"]
}
{
"audio_extensions": ["mp3", "MP3", "wav", "WAV", "oga", "OGA", "m4a", "M4A"],
"pdf_extensions": ["pdf", "PDF"],
"video_extensions": ["mp4", "MP4", "m4v", "ogg", "OGG", "ogv", "OGV", "mpeg", "MPEG", "webm", "WEBM", "mkv", "avi", "AVI", "mov", "MOV"],
"image_extensions": ["jpg", "JPG", "tiff", "TIFF", "png", "PNG"]
}
......@@ -19,7 +19,7 @@ from gitignore_parser import parse_gitignore
# return data
def joiniter (set1, set2, key):
# print ("join", set1, set2)
# print ("join", [key(x) for x in set1], [key(x) for x in set2])
index1 = {key(item): item for item in set1}
index2 = {key(item): item for item in set2}
enter, update = [], []
......@@ -121,6 +121,8 @@ class FileWalker (object):
curpath = os.path.join(curpath, dirname)
indexignore = os.path.join(curpath, ".indexignore")
if os.path.exists(indexignore):
if self.verbose:
print ("parse_gitignore", indexignore, file=sys.stderr)
ignores.append(parse_gitignore(indexignore))
if self.verbose:
print ("Using", os.path.relpath(indexignore, self.path), file=sys.stderr)
......@@ -142,7 +144,7 @@ class FileWalker (object):
child_dirs = []
indexignore = os.path.join(path, ".indexignore")
if os.path.exists(indexignore):
ignores = ignores + [parse_gitignore(indexignore)]
ignores = ignores + [parse_gitignore(os.path.abspath(indexignore))]
# don't alter ignores
# ignores.append(parse_gitignore(indexignore))
if self.verbose:
......@@ -153,6 +155,8 @@ class FileWalker (object):
ignore_item = False
for ignore in ignores:
if ignore(os.path.abspath(item_fp)):
if self.verbose:
print ("Ignoring {} based on {}".format(os.path.abspath(item_fp), ignore), file=sys.stderr)
ignore_item = True
break
if not ignore_item:
......@@ -268,12 +272,10 @@ class FileWalker (object):
# put back the filenames
# for n, d in zip(dirnodes, dirs):
# n['filename'] = d
print ("JOIN")
print ("n[dirs]", n['dirs'])
print ("dirnodes", dirnodes)
for jdir, oldnode, newnode in joiniter(n['dirs'], dirnodes, lambda d: d['id']):
# print ("dirnodes", dirnodes)
# print ("n[dirs]", n['dirs'])
# important to join on filename ... as directory nodes have blank ids
for jdir, oldnode, newnode in joiniter(n['dirs'], dirnodes, lambda d: d['filename']):
if jdir == 'exit':
index_changed = True
yield ('exit', 'd', os.path.join(path, oldnode['filename']))
......@@ -384,8 +386,9 @@ class FileWalker (object):
cmdargs.append(makefile)
if self.verbose:
print ("Using {}".format(os.path.relpath(makefile, self.path)), file=sys.stderr)
p = subprocess.run(cmdargs, cwd = path)
print ("make returned {}".format(p.returncode))
p = subprocess.run(cmdargs, cwd = path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if p.returncode != 0:
print ("make returned {}: {}".format(p.returncode, p.stdout.decode("utf-8")))
def make (self, target=None, force=False):
# sync first
......@@ -393,7 +396,7 @@ class FileWalker (object):
pass
# Call make on ALL directories in walk (bottom up) order
for base,dirs,files in self.walk(self.path):
print ("==={}===".format(base))
print ("==={}===".format(base), file=sys.stderr)
self._make(base, target=target, force=force)
# # Combine make with sync -- calling only on changed dirs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment