Extract type from the name.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Fri, 5 Aug 2005 00:30:32 +0000 (00:30 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Fri, 5 Aug 2005 00:30:32 +0000 (00:30 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@304 959494ce-11ee-0310-bf91-de5d638817bd

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;
     }