diff options
Diffstat (limited to 'tools/intro-outro')
-rw-r--r-- | tools/intro-outro | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/tools/intro-outro b/tools/intro-outro new file mode 100644 index 0000000..99682e4 --- /dev/null +++ b/tools/intro-outro @@ -0,0 +1,125 @@ +#!/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; + +my $file = 'test.csv'; +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]; + + print "#$.. Filename: $filename\n"; + + print "\tIntro:\n"; + print "\t\tSlide 1: Logo: $logo\n"; + print "\t\tSlide 2: Name: $name\n"; + print "\t\tSlide 2: Title: $title\n"; + print "\t\tSlide 2: What: $what\n"; + print "\t\tSlide 2: Date: $date\n"; + print "\t\tSlide 2: Location: $location\n"; + print "\t\tSlide 3: License: $license\n"; + + system("bash ./image_logo $filename.dv $counter white $logo"); $counter++; + system("bash ./image_logo $filename.dv $counter white $logo"); $counter++; + system("bash ./image_logo $filename.dv $counter white $logo"); $counter++; + + system("bash ./image_text $filename.dv $counter white '$what' '$date - $location'"); $counter++; + system("bash ./image_text $filename.dv $counter white '$what' '$date - $location'"); $counter++; + system("bash ./image_text $filename.dv $counter white '$what' '$date - $location'"); $counter++; + + system("bash ./image_text $filename.dv $counter white '$title' '$name'"); $counter++; + system("bash ./image_text $filename.dv $counter white '$title' '$name'"); $counter++; + system("bash ./image_text $filename.dv $counter white '$title' '$name'"); $counter++; + + system("cp $license.png $filename-$counter.png"); $counter++; + system("cp $license.png $filename-$counter.png"); $counter++; + system("cp $license.png $filename-$counter.png"); $counter++; + + # .dv buh fix! + system("./image2video $filename.dv intro"); + system("rm $filename-*.png"); + $counter="000"; + + print "\tOutro:\n"; + + system("bash ./image_text $filename.dv $counter black 'TAKK TIL'"); $counter++; + system("bash ./image_text $filename.dv $counter black 'TAKK TIL'"); $counter++; + system("bash ./image_text $filename.dv $counter black 'TAKK TIL'"); $counter++; + + print "\t\tName: $name\n"; + print "\t\tLocation: $location\n"; + + system("bash ./image_text $filename.dv $counter black '$name' Foredragsholder"); $counter++; + system("bash ./image_text $filename.dv $counter black '$location' Lokaler"); $counter++; + + foreach (@takk) { + my $test = $columns[$_]; + my @takk = split(/:/, $test); + my $hva = $takk[0]; + my $hvem = $takk[1]; + # if takk1 "" + print "\t\t$hvem - $hva\n"; + system("bash ./image_text $filename.dv $counter black '$hvem' '$hva'"); $counter++; + } + + foreach (@url) { + my $lenke = $columns[$_]; + print "\t\tURL: $lenke\n"; + system("bash ./image_text $filename.dv $counter black ' '"); $counter++; + system("bash ./image_text $filename.dv $counter black '$lenke'"); $counter++; + system("bash ./image_text $filename.dv $counter black '$lenke'"); $counter++; + } + + # .dv buh fix! + system("./image2video $filename.dv outro"); + system("rm $filename-*.png"); + + } else { + my $err = $csv->error_input; + print "Failed to parse line #$..: $err"; + } +} + +close CSV; |