Extract type from the name.
[utils.git] / ANN.pm
diff --git a/ANN.pm b/ANN.pm
index fbf08e5..90bd24a 100644 (file)
--- a/ANN.pm
+++ b/ANN.pm
@@ -92,7 +92,12 @@ sub getseries
     $html = _get "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id";
     
     $ret{"url"} = "http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$id";
-    ($ret{"name"}) = ($html =~ /\<TITLE\>Anime News Network - ([^<]*)<\/TITLE>/);
+    ($buf) = ($html =~ /\<TITLE\>Anime News Network - ([^<]*)<\/TITLE>/);
+    if($buf =~ /\([^\)]+\)$/) {
+       ($ret{"name"}, $ret{"type"}) = ($buf =~ /^(.*[^\s])\s*\(([^\)]+)\)$/);
+    } else {
+       $ret{"name"} = $buf;
+    }
     if(($buf) = ($html =~ /vintage:<\/b>\n([^<]+)</is)) {
        $ret{"vtg"} = $buf;
     }