Add an IMDB lookup module.
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 2 Feb 2011 18:57:22 +0000 (18:57 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 2 Feb 2011 18:57:22 +0000 (18:57 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@113 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml

index 0d5d530..29a0d27 100644 (file)
@@ -2113,3 +2113,15 @@ DETWITTER: |-
       $kernel->post( $src, $replypath, "I have no access token for your account.", $dest );
     }
   }
+
+IMDB: |-
+  sub {
+    my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+    use IMDB::Film;
+    my $imdb = new IMDB::Film( crit => $what );
+    if( $imdb->status ) {
+      $kernel->post( $src, $replypath, $imdb->title()." (".$imdb->year()."): ".join( ', ', @{ $imdb->genres() } )."; Rating ".(scalar $imdb->rating()).": ".$imdb->storyline(), $dest );
+    } else {
+      $kernel-post( $src, $replypath, "An error occured: ".$imdb->error, $dest );
+    }
+  }