summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--data/global.pl12
-rw-r--r--data/lang.txt31
-rw-r--r--lib/Multi/Anime.pm13
-rw-r--r--lib/VNDB/Handler/VNPage.pm2
-rw-r--r--util/updates/update_2.8.sql15
6 files changed, 64 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index e78fc489..6e360dda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,8 +2,10 @@ git - ?
- Converted relation graphs to use inline SVG
- Relation graphs now use the color scheme of selected skin
- VN relations are translatable in both the interface and the graphs
- - Full date is displayed in graphs instead of only month/year
- - Converted VN relations to an enum data type
+ - Full date is displayed in graphs instead of only month/year
+ - Converted to ENUM data type:
+ - vn_relations.relation
+ - anime.type
2.7 - 2009-09-24
- Improved styling of the threeboxes layout
diff --git a/data/global.pl b/data/global.pl
index aff1c6e1..58ae6a89 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -35,17 +35,7 @@ our %S = (%S,
producer_types => [qw|co in ng|],
discussion_boards => [qw|an db v p u|],
vn_lengths => [ 0..5 ],
- anime_types => [
- # AniDB anime type starts counting at 1, 0 = unknown
- # we start counting at 0, with NULL being unknown
- 'TV Series',
- 'OVA',
- 'Movie',
- 'Other',
- 'Web',
- 'TV Special',
- 'Music Video',
- ],
+ anime_types => [qw|tv ova mov oth web spe mv|],
vn_relations => {
# id => [ order, reverse ]
seq => [ 0, 'preq' ],
diff --git a/data/lang.txt b/data/lang.txt
index 45722c42..197a0cdc 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -364,6 +364,37 @@ en : Trial
ru : Триальный
+# Anime types
+
+:_animetype_tv
+en : TV Series
+ru*:
+
+:_animetype_ova
+en : OVA
+ru*:
+
+:_animetype_mov
+en : Movie
+ru*:
+
+:_animetype_oth
+en : Other
+ru*:
+
+:_animetype_web
+en : Web
+ru*:
+
+:_animetype_spe
+en : TV Special
+ru*:
+
+:_animetype_mv
+en : Music Video
+ru*:
+
+
# Discussion board types
:_dboard_an
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";
}
}
diff --git a/util/updates/update_2.8.sql b/util/updates/update_2.8.sql
index f9704be3..e72af294 100644
--- a/util/updates/update_2.8.sql
+++ b/util/updates/update_2.8.sql
@@ -32,3 +32,18 @@ ALTER TABLE vn_relations ALTER COLUMN relation TYPE vn_relation USING
ELSE 'orig'
END;
+
+-- Anime types stored as enum
+CREATE TYPE anime_type AS ENUM ('tv', 'ova', 'mov', 'oth', 'web', 'spe', 'mv');
+ALTER TABLE anime ALTER COLUMN type TYPE anime_type USING
+ CASE
+ WHEN type = 0 THEN 'tv'::anime_type
+ WHEN type = 1 THEN 'ova'
+ WHEN type = 2 THEN 'mov'
+ WHEN type = 3 THEN 'oth'
+ WHEN type = 4 THEN 'web'
+ WHEN type = 5 THEN 'spe'
+ WHEN type = 6 THEN 'mv'
+ ELSE NULL
+ END;
+