This commit is contained in:
bel
2021-11-28 22:04:01 -07:00
commit 5aa2cbb7d7
129 changed files with 3776 additions and 0 deletions

1
gdrive/config.sh Normal file
View File

@@ -0,0 +1 @@
rclone --config ./rclone.conf config

1
gdrive/download.sh Normal file
View File

@@ -0,0 +1 @@
rclone --config ./rclone.conf --fast-list --drive-shared-with-me copy hugo:shared_from_bbarl64/'a "world" %.zip' ./

40
gdrive/extract.sh Normal file
View File

@@ -0,0 +1,40 @@
set -e
f="$(ls ./*.zip | head -n 1)"
echo f=$f
d="$(date -r "$f" +%Y-%m-%d)_$(basename "$f" | sed 's/.zip$//' | sed 's/[^a-zA-Z0-9]/_/g')"
echo d=$d
rm -rf "$d"
mkdir -p "$d"
7z x -o"$d" "$f"
cat "$d"/*.html \
| sed 's/.*<body/<body/' \
| sed 's/<\/body>.*/<\/body>/' \
>> "$d"/index.html
tags=($(cat "$d"/index.html | sed '/^$/!{s/<[^>]*>//g;p;}' | grep -o '#[a-zA-Z0-9]*' | grep '[a-zA-Z]' | sed 's/^#//' | sort -u))
printf '
---
title: "%s"
date: %s
draft: true
tags: [%s]
---
' \
"$(basename "$f" | sed 's/.zip$//' | sed 's/"/\\"/g')" \
"$(date -u +%Y-%m-%dT%H:%M:%S)-00:00" \
"$(first=false; for tag in "${tags[@]}"; do true; if $first; then echo -n ","; fi; first=true; echo -n "$tag"; done)" \
| grep . > "$d/index.md"
cat "$d"/index.html >> "$d"/index.md
rm "$d"/index.html
echo >> "$d"/index.md
rm "$d"/*.html
for ext in png jpg jpeg gif JPG; do find "$d" -name "*.$ext"; done | while read -r line; do
convert "$line" -ordered-dither o8x8,8,8,4 "$line.2"
mv "$line.2" "$line"
done

1
gdrive/list.sh Normal file
View File

@@ -0,0 +1 @@
rclone --config ./rclone.conf --fast-list --drive-shared-with-me ls hugo:shared_from_bbarl64

10
gdrive/rclone.conf Normal file
View File

@@ -0,0 +1,10 @@
[hugo]
type = drive
client_id = 859269034513-ak4su1sg7q5jsgr3e1d72v02sfkvrhaa.apps.googleusercontent.com
client_secret = zCqs6bTjTm6TivvdU4BxhR19
scope = drive
#team_drive = 1-p043gwMk88rj4-Sm5otARi_AJZYskbj
#root_folder_id = 1-p043gwMk88rj4-Sm5otARi_AJZYskbj
formats = zip,html,rtf,odt,docx,xlsx,pptx,svg
token = {"access_token":"ya29.a0ARrdaM-ArgZiZZmAser1tLUer7X9UUW_9zJsTFDAmp3F9unWlX1qKNYpXA52RS7coQDFN54Nzhn6-C-1AT6ya2IBvJTG5CWnBZHDVO405pJMkMwE033m6bYBn7SRDqvoxYm5O9tdxlfVKAsbw9TOdPK3HSDY","token_type":"Bearer","refresh_token":"1//04sQD4800FsqyCgYIARAAGAQSNwF-L9IrB1_7BV8ScFnqmIz8FNWgXfr80--6VG6KX1pTnneQKAz6Ss3YtxqmCdf2tRBy2ndkhek","expiry":"2021-11-28T22:28:28.221751671-07:00"}