summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-27 10:01:46 +0200
committerYorhel <git@yorhel.nl>2009-09-27 10:01:46 +0200
commit9d733c1d82f5b2b8013d3d921f66cc962fea8048 (patch)
tree72be2e064f5b410fe988cb7f417f143f2d63a9e4 /lib
parent2c6f9360a25fd576fce5b35f3f512c05429d9d57 (diff)
Converted anime.type to ENUM and made them translatable
Again, two separate but related things.
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/Anime.pm13
-rw-r--r--lib/VNDB/Handler/VNPage.pm2
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/Multi/Anime.pm b/lib/Multi/Anime.pm
index 03134925..df2f6424 100644
--- a/lib/Multi/Anime.pm
+++ b/lib/Multi/Anime.pm
@@ -70,6 +70,17 @@ sub spawn {
lm => 0, # timestamp of last outgoing message, 0=no running msg
aid => 0, # anime ID of the last sent ANIME command
tag => int(rand()*50000),
+ # anime types as returned by AniDB (lowercased)
+ anime_types => {
+ 'unknown' => undef, # NULL
+ 'tv series' => 'tv',
+ 'ova' => 'ova',
+ 'movie' => 'mov',
+ 'other' => 'oth',
+ 'web' => 'web',
+ 'tv special' => 'spe',
+ 'music video' => 'mv',
+ },
},
);
}
@@ -224,7 +235,7 @@ sub receivepacket { # input, wheelid
$col[2] = undef if !$col[2] || $col[2] =~ /^0,/;
$col[3] = $1 if $col[3] =~ /^([0-9]+)/; # remove multi-year stuff
$col[3] = undef if !$col[3];
- $col[4] = (grep lc($VNDB::S{anime_types}[$_]) eq lc($col[4]), 0..$#{$VNDB::S{anime_types}})[0];
+ $col[4] = $_[HEAP]{anime_types}{ lc($col[4]) };
$col[5] = undef if !$col[5];
$col[6] = undef if !$col[6];
$_[KERNEL]->post(pg => do => 'UPDATE anime
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index f244c098..74aef27f 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -337,7 +337,7 @@ sub _anime {
txt '] ';
end;
acronym title => $_->{title_kanji}||$_->{title_romaji}, shorten $_->{title_romaji}, 50;
- b ' ('.(defined $_->{type} ? $self->{anime_types}[$_->{type}].', ' : '').$_->{year}.')';
+ b ' ('.(defined $_->{type} ? mt("_animetype_$_->{type}").', ' : '').$_->{year}.')';
txt "\n";
}
}