diff options
-rwxr-xr-x | makefront/makefront | 96 | ||||
-rwxr-xr-x | makefront/makefront.sh | 66 |
2 files changed, 96 insertions, 66 deletions
diff --git a/makefront/makefront b/makefront/makefront new file mode 100755 index 0000000..1603d2f --- /dev/null +++ b/makefront/makefront @@ -0,0 +1,96 @@ +#!/usr/bin/perl +# +# Generate NUUG video front picture. Based on CC-BY-SA 3.0 licensed +# bourne shell script makefront av Hans-Petter "Atluxity" Fjeld. +# Rewritten by Petter Reinholdtsen as perl to handle title splitting +# and handle command line arguments. + +use warnings; +use strict; + +use Getopt::Std; +use Text::Wrap qw($columns); + +print "Startet Makefront, laget for NUUG 2009.\n"; + +my $filename = "test.png"; +my $count = 0; +do { + $filename="NUUG-vid_front${count}.png"; + $count++; +} until ! -e $filename; + +print "Output til filen ${filename}...\n"; + +#Starte med å putte NUUG-logoen på video-bakgrunnen. +`composite -geometry +52+167 NUUG-logo-2-150.png NUUG-vid_bg.png $filename`; + +print "Laget trinn 1 av 3...\n"; + +#Putte CC-BY-SA-logoen pÃ¥ der igjen +`composite -geometry +632+770 cc-by-sa.png $filename $filename`; + +print "Laget trinn 2 av 3...\n"; + + +#Spør om input til variabler +my $presenter = + prompt(undef, + "Skriv inn navnet på foredragsholder (maks 25 tegn):\n"); +my $title = + prompt(undef, + "Skriv inn tittelen til foredraget (maks 25 tegn):\n"); +my $time = + prompt(undef, + "Skriv inn tid for foredraget: (`date +%d.\ %B\ %Y`):\n"); + +unless ($time) { + $time=`date +%d.\ %B\ %Y`; +} + +my $place = + prompt(undef, "Skriv inn sted for foredraget:\n"); + +my $timeplace; +unless ($place) { + $timeplace=$time; +} else { + $timeplace = "$time - $place"; +} + +$columns = 25; +$title = Text::Wrap::wrap("", "", $title); + +#Sette tekst på bildet +print "Setter teksten på bildet...\n"; +my @cmd = ("convert", $filename, + "-fill", "white", + "-pointsize", "72", + "-draw", "text 400,167 '${presenter}'", + "-draw", "text 400,267 '${title}'", + "-pointsize", "40", + "-draw", "text 400,567 '${timeplace}'", + $filename); +system(@cmd); + +print "Laget trinn 3 av 3 ($filename opprettet).\n"; + +# Convert to PAL size +#convert -size 720x576 +# NUUG-vid_front${count}.png NUUG-vid_front${count}-pal.png + +print "Makefront avslutter\n"; + +exit 0; + + +sub prompt { + my ($curval, $prompt) = @_; + unless ($curval) { + print $prompt; + my $retval = <>; + chomp $retval; + return $retval; + } + return $curval; +} diff --git a/makefront/makefront.sh b/makefront/makefront.sh deleted file mode 100755 index fcfde49..0000000 --- a/makefront/makefront.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -set -e - -LANG=nb_NO -export LANG - -# Makefront av Hans-Petter "Atluxity" Fjeld <atluxity@gmail.com> -# CC-BY-SA 3.0 -echo "Startet Makefront, laget for NUUG 2009." - -#Lag et unikt filnavn Ã¥ spytte ut -count=0 -while [ -e NUUG-vid_front${count}.png ]; do - count=`expr ${count} + 1` -done -echo "Output til filen NUUG-vid_front${count}.png..." - -#Starte med Ã¥ putte NUUG-logoen pÃ¥ video-bakgrunnen. -composite -geometry +52+167 NUUG-logo-2-150.png NUUG-vid_bg.png NUUG-vid_front${count}.png -echo "Laget trinn 1 av 3..." - -#Putte CC-BY-SA-logoen pÃ¥ der igjen -composite -geometry +632+770 cc-by-sa.png NUUG-vid_front${count}.png NUUG-vid_front${count}.png -echo "Laget trinn 2 av 3..." - -#Sette opp standard innhold i variabler for debugging -#presenter="Foredragsholder" -#title="Tittel" -#timeplace="Tid og sted" - -#Spør om input til variabler -echo "Skriv inn navnet pÃ¥ foredragsholder (maks 25 tegn): " -read presenter - -echo "Skriv inn tittelen til foredraget (maks 25 tegn): " -read title - -echo "Skriv inn tid for foredraget: (`date +%d.\ %B\ %Y`)" -read time -if [ -z "${time}" ] ; then - time=`date +%d.\ %B\ %Y` -fi - -echo "Skriv inn sted for foredraget: " -read place -if [ -z "${place}" ] ; then - timeplace="${time}" -else - timeplace="${time} - ${place}" -fi - -#Sette tekst pÃ¥ bildet -echo "Setter teksten pÃ¥ bildet..." -convert NUUG-vid_front${count}.png -pointsize 72 -fill white \ - -draw "text 400,167 '${presenter}'" -draw "text 400,267 '${title}'" \ - -pointsize 40 -draw "text 400,567 '${timeplace}'" NUUG-vid_front${count}.png -echo "Laget trinn 3 av 3 (NUUG-vid_front${count}.png opprettet)." - -# Convert to PAL size -#convert -size 720x576 \ -# NUUG-vid_front${count}.png NUUG-vid_front${count}-pal.png - -echo "Makefront avslutter" - -exit 0 |