crediting script

This commit is contained in:
adam 2024-04-16 21:48:59 -04:00
commit 379a99857d
5 changed files with 90 additions and 0 deletions

BIN
crediting/Fandom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

43
crediting/credit.html Normal file
View File

@ -0,0 +1,43 @@
<html>
<head>
<style type="text/css">
body{
background-color: #00FF00;
padding:0;
margin:0;
}
.credit{
color: #DEDEDE;
font-size: 3em;
background-color: #333333;
border: 5px solid #CECECE;
border-radius: 1em;
display:inline-flex;
flex-flow: row nowrap;
}
.number{
padding:0.75em;
border-right: 5px solid #CECECE;
}
.text{
padding: 0.25em 1em 0.25em 0.25em;
}
img.src{
height:1em;
}
</style>
</head>
<body>
<div style="width:3840; height:2160; margin:0">
<div class="credit">
<div class="number">
[num]
</div>
<div class="text">
[title]<br />
[platform img][author]
</div>
</div>
</div>
</body>
</html>

47
crediting/credit.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
WORKING=$PWD
i=0
while read p || [[ -n $p ]]; do
IFS=';' read -ra FIELDS <<< "$p"
i=$(( $i + 1 ))
echo "i: $i"
FIELDS[1]=$( echo "${FIELDS[1]}" | cut -c 2- )
echo "field1: ${FIELDS[1]}"
FIELDS[2]=$( echo "${FIELDS[2]}" | cut -c 2- )
echo "field2: ${FIELDS[2]}"
sed 's/\[num\]/['"$i"']/' "$SCRIPT_DIR/credit.html" > "$SCRIPT_DIR/credit2.html"
echo "first sed, done"
sed -i 's/\[title\]/'"${FIELDS[2]}"'/' "$SCRIPT_DIR/credit2.html"
echo "2nd sed, done"
if [[ "${FIELDS[1]}" =~ ^"[yt]/" ]]
then
echo "tubelike!"
FIELDS[1]=$( echo "${FIELDS[1]}" | cut -c 6- )
echo "${FIELDS[1]}"
sed -i 's/\[platform img\]/<img class="src" src="youtube.png" \/>/' "$SCRIPT_DIR/credit2.html"
elif [[ "${FIELDS[1]}" =~ ^"[vimeo]/" ]]
then
echo "vimeous!"
FIELDS[1]=$( echo "${FIELDS[1]}" | cut -c 9- )
sed -i 's/\[platform img\]/<img class="src" src="vimeo.png" \/>/' "$SCRIPT_DIR/credit2.html"
elif [[ "${FIELDS[1]}" =~ ^"[fandom]/" ]]
then
echo "fandom wiki!"
FIELDS[1]=$( echo "${FIELDS[1]}" | cut -c 10- )
sed -i 's/\[platform img\]/<img class="src" src="Fandom.png" \/>/' "$SCRIPT_DIR/credit2.html"
else
echo "who?!"
sed -i 's/\[platform img\]//' "$SCRIPT_DIR/credit2.html"
fi
echo "setting author to ${FIELDS[1]}!"
sed -i 's/\[author\]/'"${FIELDS[1]}"'/' "$SCRIPT_DIR/credit2.html"
echo "file:///$SCRIPT_DIR/credit2.html"
firefox -P screenshitter --headless --window-size 3840,2160 --screenshot "$WORKING/cs1.png" "file:///$SCRIPT_DIR/credit2.html"
convert "cs1.png" -fuzz 12% -transparent "#00ff00" "cs2.png"
convert cs2.png -trim "c$i.png"
rm cs1.png cs2.png "$SCRIPT_DIR/credit2.html"
done < $1

BIN
crediting/vimeo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
crediting/youtube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB