Keep copy in ~/.zen/tmp/tube . TODO . Delay download to 3AM
This commit is contained in:
parent
78e94d1ef2
commit
8fb41c72ff
|
@ -32,17 +32,19 @@ for yurl in $(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].text' | grep 'http'); do
|
||||||
echo "Detected $yurl"
|
echo "Detected $yurl"
|
||||||
echo "Start Downloading"
|
echo "Start Downloading"
|
||||||
|
|
||||||
rm -Rf ~/.zen/tmp/tube
|
|
||||||
mkdir -p ~/.zen/tmp/tube
|
mkdir -p ~/.zen/tmp/tube
|
||||||
|
|
||||||
# https://github.com/yt-dlp/yt-dlp#format-selection-examples
|
# https://github.com/yt-dlp/yt-dlp#format-selection-examples
|
||||||
yt-dlp -f "bv*[ext=mp4][height<=480]+ba/b[height<=480] / wv*+ba/w" --no-mtime --embed-thumbnail --add-metadata -o "$HOME/.zen/tmp/tube/%(title)s.%(ext)s"yt-dlp -f "bv*[ext=mp4][height<=480]+ba/b[height<=480] / wv*+ba/w" --no-mtime --embed-thumbnail --add-metadata -o "$HOME/.zen/tmp/tube/%(title)s.%(ext)s" ${yurl}
|
# TODO : DELAY COPY OPERATION... Astro can download quicker at 03:00 AM
|
||||||
FILE=$(ls -t ~/.zen/tmp/tube/ | tail -n 1)
|
echo "yt-dlp -f \"bv*[ext=mp4][height<=480]+ba/b[height<=480] / wv*+ba/w\" --no-mtime --embed-thumbnail --add-metadata -o \"$HOME/.zen/tmp/tube/%(title)s.%(ext)s\" ${yurl}"
|
||||||
|
yt-dlp -f "bv*[ext=mp4][height<=480]+ba/b[height<=480] / wv*+ba/w" --no-mtime --embed-thumbnail --add-metadata -o "$HOME/.zen/tmp/tube/%(title)s.%(ext)s" ${yurl}
|
||||||
|
|
||||||
|
# Get last writen file... TOTDO: Could we do better ?
|
||||||
|
FILE=$(ls -t ~/.zen/tmp/tube/ | tail -n 1)
|
||||||
[[ ! -f ~/.zen/tmp/tube/$FILE ]] && echo "No FILE -- EXIT --" && exit 1
|
[[ ! -f ~/.zen/tmp/tube/$FILE ]] && echo "No FILE -- EXIT --" && exit 1
|
||||||
|
|
||||||
echo "~/.zen/tmp/tube/$FILE downloaded"
|
echo "~/.zen/tmp/tube/$FILE downloaded"
|
||||||
|
mv
|
||||||
echo "Adding to IPFS"
|
echo "Adding to IPFS"
|
||||||
ILINK=$(ipfs add -q "$HOME/.zen/tmp/tube/$FILE" | tail -n 1)
|
ILINK=$(ipfs add -q "$HOME/.zen/tmp/tube/$FILE" | tail -n 1)
|
||||||
echo "/ipfs/$ILINK ready"
|
echo "/ipfs/$ILINK ready"
|
||||||
|
@ -62,7 +64,7 @@ for yurl in $(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].text' | grep 'http'); do
|
||||||
"tags": "'ipfs youtube ${MIME}'"
|
"tags": "'ipfs youtube ${MIME}'"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
' > ~/.zen/tmp/tube.json
|
' > "$HOME/.zen/tmp/$FILE.TW.json"
|
||||||
|
|
||||||
echo "=========================="
|
echo "=========================="
|
||||||
echo "Adding tiddler to TW"
|
echo "Adding tiddler to TW"
|
||||||
|
@ -70,7 +72,7 @@ for yurl in $(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].text' | grep 'http'); do
|
||||||
rm -f ~/.zen/tmp/newindex.html
|
rm -f ~/.zen/tmp/newindex.html
|
||||||
|
|
||||||
tiddlywiki --verbose --load $INDEX \
|
tiddlywiki --verbose --load $INDEX \
|
||||||
--import ~/.zen/tmp/tube.json "application/json" \
|
--import "$HOME/.zen/tmp/$FILE.TW.json" "application/json" \
|
||||||
--deletetiddlers '[tag[tube]]' \
|
--deletetiddlers '[tag[tube]]' \
|
||||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||||
|
|
||||||
|
@ -92,8 +94,10 @@ for yurl in $(cat ~/.zen/tmp/tiddlers.json | jq -r '.[].text' | grep 'http'); do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||||
|
|
||||||
echo "=========================="
|
echo "=========================="
|
||||||
echo "Nouveau TW"
|
echo "Nouveau TW"
|
||||||
echo "http://127.0.0.1:8080/ipns/$WNS"
|
echo "http://$myIP:8080/ipns/$WNS"
|
||||||
# Removing tag=tube
|
# Removing tag=tube
|
||||||
# --deletetiddlers '[tag[tube]]'
|
# --deletetiddlers '[tag[tube]]'
|
||||||
|
|
Loading…
Reference in New Issue