blob: 383018662b52e12cfc33ef6ed9f7a579ae9dd970 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#!/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;
|