Compare commits

...

2 Commits

Author SHA1 Message Date
b3258d9f5f
refactor db creation 2025-03-02 10:14:20 +01:00
d793bca3ea
search video audio 2025-02-28 17:10:25 +01:00
2 changed files with 47 additions and 15 deletions

View File

@ -24,35 +24,34 @@ $(foreach dir, $(categories), \
$(eval .dbs/$(dir).rec: $(wildcard $(dir)/*)) \
)
$(databases): .dbs/%.rec: %/
.dbs/:
mkdir $@
$(databases): .dbs/%.rec: %/ | .dbs/
$(info making $(@F))
@mkdir -p $(@D)
for entry in $(shell find $< -type f -name "*.md") ; do \
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
sed -e 's/\[ //' -e 's/ \]//' |\
tr -d '"' ;\
printf "wordcount: %s\n" "$$(wc -w < $$entry)" ;\
printf "file: %s\n\n" "$$entry" ;\
printf "file: %s\n" "$$entry" ;\
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$entry" |\
tr -d '[]' | tr -s ' ' |\
sed '/tags: /s/, /\ntag: /g ; s/tags:/tag:/ ; /requires/s/, /\nrequires: /g' ;\
printf "wordcount: %s\n\n" "$$(wc -w < $$entry)" ;\
done > $@
for entry in $(shell find $< -type f -name "*.md"); do \
recset $@ -e "file = '$${entry}'" -f wordcount --set-add="$$(wc -w < $${entry})" ;\
recset $@ -e "file = '$${entry}'" -f content --set-add="$$($(spill_contents) $${entry})" ;\
done
# This two-variable read can only happen because of the quotes in the titles.
db.rec: $(databases)
printf '%s\n' '%rec: guide' > $@
printf '%s\n' '%key: title' >> $@
printf '%s\n' '%type: wordcount int' >> $@
printf '%s\n\n' '%sort: title' >> $@
recsel $^ >> $@
printf '%s\n\n' '%sort: wordcount' >> $@
cat $^ >> $@
recsel $@ -e "requires != ''" -CR title,requires |\
while read title requires; do \
IFS=', ' && for provider in $$requires; do \
for provider in "$$requires" ; do \
recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
done ;\
done
$(info Created main database: $@)
sed -i 's/"//g' $@
recfix --sort $@
$(info Created main database: $@)
default += db.rec

View File

@ -0,0 +1,33 @@
---
title: "Search Video Audio"
tags: [ "data", "video" ]
---
Check subtitles available:
```sh
url='https://videos.domainepublic.net/videos/watch/d9567d5b-1add-477c-bce3-a58cef84c28c'
yt-dlp --list-subs "$url" | grep --max-count=1 '^en'
```
The original language often displays with `-orig`, e.g. `en-orig (Original)`.
```
Language Formats
ar vtt
az vtt
bg vtt
ca vtt
cs vtt
da vtt
de vtt
el vtt
en vtt
```
Search youtube.com for videos on a topic, and download subtitles:
```sh
url="$(ytfzf -I l "$search" )" && \
yt-dlp --write-subs --sub-format 'ass/srt/best/vtt' --sub-langs "en.*" --skip-download "$url"
```