annotate tools/bins_addtext @ 2:c44d020e5f8a 1.1.29-extended

Importing extended patched version from http://www.uli-eckhardt.de/bins/index.en.html
author Peter Gervai <grin@grin.hu>
date Wed, 15 Oct 2008 23:31:54 +0200
parents a84c32f131df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
1 #!/usr/bin/perl -w
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
2 #-*- mode: perl -*-
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
3
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
4 sub process_file {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
5 my ($dir, $file, $title, $desc) = @_;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
6 chomp $desc;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
7 #print "File: $file\n\tTitle: $title\n\tDesc: $desc\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
8 #print "\n$file\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
9 if($file eq "album") {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
10 ($longdesc, $shortdesc, $sample) = split /\|/, $desc;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
11 if($sample) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
12 $cmd_str = "bins_edit -a -m --sample \"$sample\" $dir";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
13 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
14 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
15 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
16 if($shortdesc) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
17 $cmd_str = "bins_edit -a -m --shortdesc \"$shortdesc\" $dir";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
18 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
19 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
20 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
21 if($longdesc) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
22 $cmd_str = "bins_edit -a -m --longdesc \"$longdesc\" $dir";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
23 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
24 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
25 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
26 #print "\t$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
27 $cmd_str = "bins_edit -a -m --title \"$title\" $dir";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
28 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
29 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
30 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
31 else {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
32 $cmd_str = "bins_edit -m -t \"$title\" $dir/$file";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
33 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
34 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
35 #print "\t$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
36 $cmd_str = "bins_edit -m -d \"$desc\" $dir/$file";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
37 print "$cmd_str\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
38 `$cmd_str`;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
39 #print "\t$cmd_str\n\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
40 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
41 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
42
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
43 $inc_file = "include_images.txt";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
44
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
45 for($i=0; $i<=$#ARGV; $i++) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
46 $dir = $ARGV[$i];
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
47 if($dir eq "-f" && $i<$#ARGV ) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
48 $i++;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
49 $inc_file=$ARGV[$i];
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
50 next;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
51 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
52
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
53 open(FILE, "$dir/$inc_file") or die "Could not open: $dir/$inc_file";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
54
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
55 $title = "";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
56 $desc = "";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
57 $img_file = "album";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
58 $section = 1;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
59
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
60 while(<FILE>)
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
61 {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
62 chomp;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
63 $line=$_;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
64 if(substr($line, 0 , 1) eq "") {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
65 next;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
66 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
67
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
68 if(substr($line, 0 , 1) ne "#") {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
69 process_file($dir, $img_file, $title, $desc);
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
70 $img_file = $line;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
71 $title = "";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
72 $desc = "";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
73 $section = 1;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
74 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
75 else {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
76 if ($section == 1) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
77 $title = substr($line, 1);
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
78 $section++;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
79 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
80 elsif ($section == 2) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
81 $desc .= substr($line, 1)."\n";
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
82 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
83 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
84
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
85 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
86
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
87 if($section) {
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
88 process_file($dir, $img_file, $title, $desc);
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
89 }
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
90
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
91 close(FILE) ;
a84c32f131df Import vendor version
Peter Gervai <grin@grin.hu>
parents:
diff changeset
92 }