#!/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


