From 182ccb60c4bf152f576064e12e9f2a5f721ba75d Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Tue, 24 Jan 2023 18:52:09 +0000 Subject: [PATCH] testing some stuff --- build | 7 +++++++ extract | 11 +++++++++++ hugo-server | 22 ++++++++++++++++++++++ publish | 12 ++++++++++++ push-asset | 25 +++++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100755 build create mode 100755 extract create mode 100755 hugo-server create mode 100755 publish create mode 100755 push-asset diff --git a/build b/build new file mode 100755 index 0000000..c32bee5 --- /dev/null +++ b/build @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +# commit and push... +git add .;git commit -m"$@";git push -u origin master + +# build the site +hugo -D diff --git a/extract b/extract new file mode 100755 index 0000000..9fd2e48 --- /dev/null +++ b/extract @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [[ -z "$1" ]]; then + echo "Supply the full filepath of the video from which to extract audio" + exit 1 +fi + +filename=$(basename -- "${1}") +filename="${filename%.*}" + +ffmpeg -i "${1}" -f mp3 -ab 192000 -vn "${filename}.mp3" diff --git a/hugo-server b/hugo-server new file mode 100755 index 0000000..b0cc1a7 --- /dev/null +++ b/hugo-server @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +export LOG=./logs/hugo-server.log + +if ! [ -z "$1" ]; then + if [[ "$1" == "start" ]]; then + hugo server -D --disableFastRender --enableGitInfo -v --debug > $LOG 2>&1 & + echo "Server started on $(pidof hugo)" + elif [[ "$1" == "stop" ]]; then + kill -9 $(pidof hugo) + elif [[ "$1" == "status" ]]; then + pid=$(pidof hugo) + if ! [ -z "$pid" ]; then + echo "Hugo Server Active. PID: ${pid}" + else + echo "Hugo Server Is Inactive." + fi + fi +else + echo "You can 'start' or 'stop' the server, or get the 'status'." + exit 1 +fi diff --git a/publish b/publish new file mode 100755 index 0000000..cf07d7d --- /dev/null +++ b/publish @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# commit and push... +git add .;git commit -m"$@";git push -u origin master + +rm -rf public # destroy the old build first +hugo # build the new site +sudo chown -R gmgauthier:www-data ./public/* # set the ownership before transfer + +rsync --super -avh -e ssh ./public/* gmgauthier@boethius:/hosting/sites/gmgauthier.com +# echo "ls -lA /hosting/sites/gmgauthier.com" | ssh gmgauthier@boethius /bin/bash + diff --git a/push-asset b/push-asset new file mode 100755 index 0000000..ee07a5a --- /dev/null +++ b/push-asset @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +if [[ -z "$1" ]]; then + echo "Supply a file with full path to be published" + exit 1 +fi + +file=$(basename "${1}") + +# The assumption is all images are for the blog +if [[ "$1" =~ .*\.(gif|jpg|png) ]]; then + s3cmd put -P "${1}" s3://gmgauthier/blog/img/"${file}" +fi + +# The assumption is all audio is for the podcast +if [[ "$1" =~ .*\.(mp3|ogg|wav) ]]; then + s3cmd put -P "${1}" s3://gmgauthier/podcast/audio/"${file}" +fi + +# The assumption is all video is generic +if [[ "$1" =~ .*\.(mp4|mkv|m4v) ]]; then + s3cmd put -P "${1}" s3://gmgauthier/videos/"${file}" +fi + +