summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Kristian Lien <ole.k.lien@gmail.com>2009-12-09 23:16:56 +0000
committerOle Kristian Lien <ole.k.lien@gmail.com>2009-12-09 23:16:56 +0000
commit2c2ff1462d288567db0cf90faa5591f0823042ff (patch)
tree5896cf03c40a73e0eb4fff0d027b222770018dc2
parentad4080141ca1d8d1f0539398765c0db381a47f09 (diff)
fixed :)
-rwxr-xr-xtools/csv145
-rw-r--r--tools/image_text9
-rwxr-xr-xtools/intro7
-rw-r--r--tools/intro-outro139
-rwxr-xr-xtools/outro33
-rwxr-xr-xtools/test2.sh31
6 files changed, 93 insertions, 271 deletions
diff --git a/tools/csv b/tools/csv
index 130fb43..f11e444 100755
--- a/tools/csv
+++ b/tools/csv
@@ -1,12 +1,12 @@
#!/usr/bin/perl
#
-# Date: -
+# Date: 2009-12-10
# Author: Ole Kristian Lien
# License: GNU General Public License
#
-# ?
+# Parse csv-file for information
#
-# libtext-csv-perl
+# needs: libtext-csv-perl
use strict;
use warnings;
@@ -21,14 +21,14 @@ my $file=$ARGV[0];
my $video=$ARGV[1];
my $info=$ARGV[2];
-my @filename;
-my @logo;
-my @name;
-my @title;
-my @what;
-my @date;
-my @location;
-my @license;
+my $filename;
+my $logo;
+my $name;
+my $title;
+my $what;
+my $date;
+my $location;
+my $license;
my @takk;
my @url;
@@ -43,23 +43,23 @@ while (<CSV>) {
my $index;
foreach (@columns) {
if ($_ eq "Filename") {
- push(@filename, $index);
+ $filename=$index;
} elsif ($_ eq "Title") {
- push(@title, $index);
+ $title=$index;
} elsif ($_ eq "Logo") {
- push(@logo, $index);
+ $logo=$index;
} elsif ($_ eq "Name") {
- push(@name, $index);
+ $name=$index;
} elsif ($_ eq "Title") {
- push(@title, $index);
+ $title=$index;
} elsif ($_ eq "What") {
- push(@what, $index);
+ $what=$index;
} elsif ($_ eq "Date") {
- push(@date, $index);
+ $date=$index;
} elsif ($_ eq "Location") {
- push(@location, $index);
+ $location=$index;
} elsif ($_ eq "License") {
- push(@license, $index);
+ $license=$index;
} elsif ($_ eq "Takk") {
push(@takk, $index);
} elsif ($_ eq "URL") {
@@ -69,84 +69,43 @@ while (<CSV>) {
}
}
- next if ($. == 1);
+ next if ($. == 1);
-# my $filename = $columns[0];
-# my $logo = $columns[1];
-# my $name = $columns[2];
-# my $title = $columns[3];
-# my $what = $columns[4];
-# my $date = $columns[5];
-# my $location = $columns[6];
-# my $license = $columns[7];
-# my $takk = $columns[8];
-
-# my $filenametmp = fileparse($filename, qr/\.\D.*/);
-
-# unless (-e $filename) {
-# print "File: $filename doesn't Exist!\n";
-# exit 1;
-# }
-
-
- if ($info eq "filename") {
-# foreach (@filename) {
- print "$filename[2]";
-# }
- } elsif ($info eq "logo") {
- foreach (@logo) {
- print "$columns[$_]";
- }
- } elsif ($info eq "name") {
- foreach (@name) {
- print "$columns[$_]";
- }
- } elsif ($info eq "title") {
- foreach (@title) {
- print "$columns[$_]";
- }
- } elsif ($info eq "what") {
- foreach (@what) {
- print "$columns[$_]";
- }
- } elsif ($info eq "date") {
- foreach (@date) {
- print "$columns[$_]";
- }
- } elsif ($info eq "location") {
- foreach (@location) {
- print "$columns[$_]";
- }
- } elsif ($info eq "license") {
- foreach (@license) {
- print "$columns[$_]";
- }
- } elsif ($info eq "takk") {
-# foreach (@takk) {
-# print "$columns[$_]";
-# }
- foreach (@takk) {
- my $test = $columns[$_];
- if($test) {
- my @takk = split(/:/, $test);
- my $hva = $takk[0];
- my $hvem = $takk[1];
- print "$hvem - $hva\n";
+ if ($video eq $columns[0]) {
+ if ($info eq "filename") {
+ print "$columns[0]"; #$filename]";
+ } elsif ($info eq "logo") {
+ print "$columns[$logo]";
+ } elsif ($info eq "name") {
+ print "$columns[$name]";
+ } elsif ($info eq "title") {
+ print "$columns[$title]";
+ } elsif ($info eq "what") {
+ print "$columns[$what]";
+ } elsif ($info eq "date") {
+ print "$columns[$date]";
+ } elsif ($info eq "location") {
+ print "$columns[$location]";
+ } elsif ($info eq "license") {
+ print "$columns[$license]";
+ } elsif ($info eq "takk") {
+ foreach (@takk) {
+ my $takk = $columns[$_];
+ if($takk) {
+ print "$takk\n";
+ }
}
+ } elsif ($info eq "url") {
+ foreach (@url) {
+ my $lenke = $columns[$_];
+ print "$lenke\n";
+ }
+ } else {
+ print "$info column doesn't exist\n";
}
- } elsif ($info eq "url") {
-# foreach (@url) {
-# print "$columns[$_]";
-# }
- foreach (@url) {
- my $lenke = $columns[$_];
- print "$lenke\n";
- }
-
} else {
- print "$info column doesn't exist\n";
+ print "$info row doesn't exist\n";
}
-
} else {
my $err = $csv->error_input;
print "Failed to parse line #$..: $err";
diff --git a/tools/image_text b/tools/image_text
index 97ee450..b14eaab 100644
--- a/tools/image_text
+++ b/tools/image_text
@@ -6,7 +6,6 @@
#
# Make a text-image (intro-outro)
#
-# todo: sjekk hvor lang teksten er.. skaper problemer hvis blir for
# lang. Bli kvitt counter.
EXT=`echo "$1"|awk -F . '{print $NF}'`
@@ -26,15 +25,15 @@ SIZE2="0"
if [ $COUNT1 -ge "30" ] ; then
SIZE1="30"
SIZE2=`echo $SIZE1-10|bc`
- echo "Size1: $SIZE1 - Size2: $SIZE2"
+# echo "Size1: $SIZE1 - Size2: $SIZE2"
elif [ $COUNT1 -ge "25" ] ; then
SIZE1="40"
SIZE2=`echo $SIZE1-10|bc`
- echo "Size1: $SIZE1 - Size2: $SIZE2"
+# echo "Size1: $SIZE1 - Size2: $SIZE2"
elif [ $COUNT1 -ge "20" ] ; then
SIZE1="50"
SIZE2=`echo $SIZE1-20|bc`
- echo "Size1: $SIZE1 - Size2: $SIZE2"
+# echo "Size1: $SIZE1 - Size2: $SIZE2"
else
SIZE1="60"
if [ $COUNT2 -ge "25" ] ; then
@@ -43,7 +42,7 @@ else
SIZE2=`echo $SIZE1-20|bc`
fi
- echo "Size1: $SIZE1 - Size2: $SIZE2"
+# echo "Size1: $SIZE1 - Size2: $SIZE2"
fi
if [ -z "$4" ]; then
diff --git a/tools/intro b/tools/intro
index 4d07934..9b08b23 100755
--- a/tools/intro
+++ b/tools/intro
@@ -1,5 +1,10 @@
#!/bin/bash
-# ikke i svn
+#
+# Date: 2009-12-10
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Generate intro-file to a video
EXT=`echo "$1"|awk -F . '{print $NF}'`
BASENAME=`basename $1 .$EXT`
diff --git a/tools/intro-outro b/tools/intro-outro
deleted file mode 100644
index 3830186..0000000
--- a/tools/intro-outro
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/perl
-#
-# Date: 2009-12-04
-# Author: Ole Kristian Lien
-# License: GNU General Public License
-#
-# Creates a intro and outro video-file from a csv-file
-#
-# libtext-csv-perl
-# see test.csv
-
-use strict;
-use warnings;
-use Text::CSV;
-use File::Basename;
-
-if ($#ARGV != 0 ) {
- print "usage: intro-outro <csv-file>\n";
- exit;
-}
-my $file=$ARGV[0];
-
-my $csv = Text::CSV->new();
-my @takk;
-my @url;
-my $counter = "000";
-
-open (CSV, "<:encoding(utf8)", "$file") or die "$file: $!";
-
-while (<CSV>) {
- if ($csv->parse($_)) {
- my @columns = $csv->fields();
-
- if ($. == 1) {
- my $index;
- foreach (@columns) {
- if ($_ eq "Takk") {
- push(@takk, $index);
- }
- elsif ($_ eq "URL") {
- push(@url, $index);
- }
- $index++;
- }
- }
-
- next if ($. == 1);
-
- my $filename = $columns[0];
- my $logo = $columns[1];
- my $name = $columns[2];
- my $title = $columns[3];
- my $what = $columns[4];
- my $date = $columns[5];
- my $location = $columns[6];
- my $license = $columns[7];
- my $takk = $columns[8];
-
- my $filenametmp = fileparse($filename, qr/\.\D.*/);
-
- unless (-e $filename) {
- print "File: $filename doesn't Exist!\n";
- exit 1;
- }
-
- print "#$.. Filename: $filename\n";
-
- print "\tIntro:\n";
- print "\t\tLogo: $logo\n";
- print "\t\tName: $name\n";
- print "\t\tTitle: $title\n";
- print "\t\tWhat: $what\n";
- print "\t\tDate: $date\n";
- print "\t\tLocation: $location\n";
- print "\t\tLicense: $license\n";
-
- system("bash ./image_logo $filename $counter white $logo"); $counter++;
- system("bash ./image_logo $filename $counter white $logo"); $counter++;
- system("bash ./image_logo $filename $counter white $logo"); $counter++;
-
- system("bash ./image_text $filename $counter white '$what' '$date - $location'"); $counter++;
- system("bash ./image_text $filename $counter white '$what' '$date - $location'"); $counter++;
- system("bash ./image_text $filename $counter white '$what' '$date - $location'"); $counter++;
-
- system("bash ./image_text $filename $counter white '$title' '$name'"); $counter++;
- system("bash ./image_text $filename $counter white '$title' '$name'"); $counter++;
- system("bash ./image_text $filename $counter white '$title' '$name'"); $counter++;
-
- system("cp $license.png $filenametmp-$counter.png"); $counter++;
- system("cp $license.png $filenametmp-$counter.png"); $counter++;
- system("cp $license.png $filenametmp-$counter.png"); $counter++;
-
- # .dv buh fix!
- system("./image2video $filename intro");
- system("rm $filenametmp-*.png");
- $counter="000";
-
- print "\tOutro:\n";
-
- system("bash ./image_text $filename $counter black 'TAKK TIL'"); $counter++;
- system("bash ./image_text $filename $counter black 'TAKK TIL'"); $counter++;
- system("bash ./image_text $filename $counter black 'TAKK TIL'"); $counter++;
-
- print "\t\tName: $name\n";
- print "\t\tLocation: $location\n";
-
- system("bash ./image_text $filename $counter black '$name' Foredragsholder"); $counter++;
- system("bash ./image_text $filename $counter black '$location' Lokaler"); $counter++;
-
- foreach (@takk) {
- my $test = $columns[$_];
- if($test) {
- my @takk = split(/:/, $test);
- my $hva = $takk[0];
- my $hvem = $takk[1];
- # if takk1 ""
- print "\t\tTakk: $hvem - $hva\n";
- system("bash ./image_text $filename $counter black '$hvem' '$hva'"); $counter++;
- }
- }
-
- foreach (@url) {
- my $lenke = $columns[$_];
- print "\t\tURL: $lenke\n";
- system("bash ./image_text $filename $counter black ' '"); $counter++;
- system("bash ./image_text $filename $counter black '$lenke'"); $counter++;
- system("bash ./image_text $filename $counter black '$lenke'"); $counter++;
- }
-
- system("./image2video $filename outro");
- system("rm $filenametmp-*.png");
-
- } else {
- my $err = $csv->error_input;
- print "Failed to parse line #$..: $err";
- }
-}
-
-close CSV;
diff --git a/tools/outro b/tools/outro
index 0e08a8e..a41e4f1 100755
--- a/tools/outro
+++ b/tools/outro
@@ -1,5 +1,10 @@
#!/bin/bash
-# ikke i svn
+#
+# Date: 2009-12-10
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Generate outro-file to a video
EXT=`echo "$1"|awk -F . '{print $NF}'`
BASENAME=`basename $1 .$EXT`
@@ -7,6 +12,8 @@ COUNT=10
NAME=`./csv $2 $1 name`
LOCATION=`./csv $2 $1 location`
+TAKK=`./csv $2 $1 takk`
+URL=`./csv $2 $1 url`
if [ -z "$1" ]; then
echo "Usage: $0 <video-file> <csv-file>"
@@ -24,9 +31,31 @@ COUNT=`expr $COUNT + 1`
COUNT=`expr $COUNT + 1`
./image_text $1 outro-$COUNT black "$LOCATION" Lokaler
COUNT=`expr $COUNT + 1`
-
+
# takk
+# quick hack
+oldIFS=$IFS
+IFS='
+'
+for i in $TAKK ; do
+ HVA=`echo "$i" | cut -d ":" -f 1`
+ HVEM=`echo "$i" | cut -d ":" -f 2`
+# echo "TAKK: $HVA - $HVEM"
+ ./image_text $1 outro-$COUNT black "$HVEM" "$HVA"
+ COUNT=`expr $COUNT + 1`
+done
+IFS=$IFS
+
# url
+for i in $URL ; do
+# echo "URL: $i"
+ ./image_text $1 outro-$COUNT black " "
+ COUNT=`expr $COUNT + 1`
+ ./image_text $1 outro-$COUNT black "$i"
+ COUNT=`expr $COUNT + 1`
+ ./image_text $1 outro-$COUNT black "$i"
+ COUNT=`expr $COUNT + 1`
+done
./image2video $1 outro
rm $BASENAME-outro*.png
diff --git a/tools/test2.sh b/tools/test2.sh
deleted file mode 100755
index e6adb45..0000000
--- a/tools/test2.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# test
-# ikke i svn
-
-FILENAME=`./csv $2 $1 filename`
-LOGO=`./csv $2 $1 logo`
-NAME=`./csv $2 $1 name`
-TITLE=`./csv $2 $1 title`
-WHAT=`./csv $2 $1 what`
-DATE=`./csv $2 $1 date`
-LOCATION=`./csv $2 $1 location`
-LICENSE=`./csv $2 $1 license`
-TAKK=`./csv $2 $1 takk`
-URL=`./csv $2 $1 url`
-
-if [ -z "$1" ]; then
- echo "Usage: $0 <video-file> [<csv-file>]"
- exit 1
-fi
-
-# filename er problemet
-echo "Filename: $FILENAME"
-echo "Logo: $LOGO"
-echo "Name: $NAME"
-echo "Title: $TITLE"
-echo "What: $WHAT"
-echo "Date: $DATE"
-echo "Location: $LOCATION"
-echo "License: $LICENSE"
-echo "Takk: $TAKK"
-echo "URL: $URL"