Peter South
Active Member
This is a Bash script I wrote some months back that does the following:
For more of my scripts see: Index of various Bash Script Threads contributed by Eddie Johnson.
- Uses the Dhyana.pl PERL script to generate contact sheets of videos.
- Uploads the contact sheets using cURL to an imgChili account.
- Retrieves the URLs for each contact sheet.
- Formats the links into [BBCode] which can be then copied and pasted into DDL sites.
- This script specifically for use on a directory of videos which have a 3:4 standard aspect ratio.
- For my similar script for 3:4 standard aspect ratio videos please see:
Bash Script: Video Contact Sheet Generator & ImgChili Uploader | 16:9 Aspect Ratio - This script also works well with my LuckyShare Bash Uploader Script:
Bash Uploader For LuckyShare v1.30923
Code:
#! /bin/bash
# Script: /usr/local/bin/thumberSD.sh
# Version 13.1001
# Written by SpecialEd @ irc.fileguide.org
# Generates a contact sheet for all videos in a directory that the script is run from.
# This script intended only for videos with a 3:4 standard aspect ratio (SD).
# Once all images are generated they are then uploaded into an authenticated imgChili account,
# retrieves the images' links and formats the URLs into [BBCode] for forums & blogs.
####################################################################################################
# System Requirements #
#######################
# * Web server with accessible sub-folder named "jpg" placed in "/var/www/"
# - Public access to URLs in this format: [URL]http://www.192.168.0.1/jpg/someFile.jpg[/URL]
# * imagemagick, perl modules, & mplayer.
# - For Ubuntu 12.04LTS+ users simply run:
# apt-get install imagemagick libgetopt-argvfile-perl libfile-chdir-perl mplayer -y;
# * Dhyana.pl, midentify, VeraSeBd.ttf, & Vera.ttf files - All available in one package:
# 1. wget [URL]http://downloads.fileguide.org/ubuntuVideoThumbnailScript.zip;[/URL]
# 2. unzip thumberTools.zip; cd thumberTools/;
# 3. mv dhyana.pl /usr/local/bin/ && chmod +x /usr/local/bin/dhyana.pl
# 4. mv midentify /usr/bin/midentify && chmod +x /usr/bin/midentify
# 5. mkdir /usr/share/fonts/TTF -f 2> /dev/null; mv *.ttf /usr/share/fonts/TTF/
###################################################################################################
# imgChili.com Credentials:
# * Place applicable information between the "" marks.
# - Example: userName="someDude";
# * cookieString is the 120 character value of your mmh_user_session Cookie for imgChili
# - Log into imgChili, view your Firefox/Chrome Cookies for imgChili, its there.
userName='';
passWord='';
cookieString="";
####################################################################################################
echo "*************************************************************"
echo "* Video Contact Sheet Creator & imgChili Uploader v.13.10.1 *"
echo "* Written by SpecialEd on irc.fileguide.org *"
echo "*************************************************************"
####################################################################################################
# Generates the sequential video thumbnail preview image
dir=*; for file in $dir; do
if [[ ${file: -4} == ".txt" ]]; then
echo `date | sed 's/^/Thumbnails\ Generated\ On\:\ /'` >> imgChiliLinks.txt;
else
dhyana.pl $file --cols=5 --rows=5 --geometry 360x203+5+5 --background=#FFFFFF --colour=#054AA3\
--heading-colour=#054AA3 --heading-font-size=14 --capture-mode=matt --title=$file 2> /dev/null
fi
done;
####################################################################################################
# Optional Logo #
#################
# Add custom logo to top right corner of all contact sheets.
# Custom logo must be no larger than 387x90 pixels to fit in the top right corner of all the images.
# Uncomment next two lines & edit path to desired logo image.
#imageLogo='~/logos/MyLogo.387x90.jpg';
#ls ./* | grep jpeg | xargs -n1 -i composite -geometry +5+5 -gravity northeast $imageLogo {} {};
###################################################################################################
# Uploads the the contact sheets to imgChili using cURL.
publicIP=`curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'`;
svtpai=`find ./ -type f -name \*.jpeg | cut -c3-`;
if [[ $svtpai == *.jpeg ]]; then
mv -f *.jpeg /var/www/jpg/ 2> /dev/null && chmod 777 -R /var/www/jpg/ \
&& chown -R www-data:www-data /var/www/jpg/;
curl -sd "username=$userName&password=$passWord" -H "Cookie: mmh_user_session=$cookieString" \
"http://imgchili.com/remote/http://$publicIP/jpg/$svtpai" | grep 'URL=' | grep -v '<td>' >> \
./imgChiliLinks.txt;
fi
###################################################################################################
# Retrieves the contact sheets' imgChili links & prints their [BBCode] to terminal shell.
cat ./imgChiliLinks.txt | tr -d '\n' | tr -d '\ '
echo " ";
###################################################################################################
# Displays number of files in directory & links generated to help detect if any videos were skipped.
numFiles=`ls ./* | grep -v ".txt" | wc -l`
numLinks=`cat ./imgChiliLinks.txt | wc -l`
echo "Number of files in this directory: "$numFiles;
echo "Total count image links generated: "$numLinks;
For more of my scripts see: Index of various Bash Script Threads contributed by Eddie Johnson.
Last edited: