Snotr: Fix video title acquisition
[videosite.git] / videosite.pl
index a5123bc..d7a549f 100644 (file)
@@ -386,6 +386,7 @@ Supported commands:
  disable [modulename]: disable the usage of this module (grabbers only)
  reload: reload all modules (this is somewhat experimental)
  mode [modename]: display or set the operation mode (download/display)
+ connector [subcommand]: manage connectors (proxies)
  debug: enable debugging messages
  nodebug: disable debugging messages
 EOT
@@ -432,8 +433,7 @@ sub cmd_connector {
     my $connconf = $conf->{'videosite'}->{'connectors'};
 
     unless(defined($subcmd)) {
-        write_irssi('No subcommand given');
-        return;
+        $subcmd = "help";
     }
 
     $subcmd = lc($subcmd);
@@ -480,13 +480,13 @@ sub cmd_connector {
 
         $name = lc($name);
 
-        if ($name eq 'direct') {
-            write_irssi("Cannot remove direct connector");
+        unless (exists($connconf->{$name})) {
+            write_irssi("Connector does not exist");
             return;
         }
 
-        unless (exists($connconf->{$_})) {
-            write_irssi("Connector does not exist");
+        if (exists($connconf->{$name}->{'_immutable'})) {
+            write_irssi("Connector cannot be removed");
             return;
         }
 
@@ -510,8 +510,8 @@ sub cmd_connector {
 
         $conn = lc($conn);
 
-        if ($conn eq 'direct') {
-            write_irssi("Connector is not modifiable");
+        if (exists($connconf->{$conn}->{'_immutable'})) {
+            write_irssi("Connector cannot be modified");
             return;
         }
 
@@ -543,8 +543,8 @@ sub cmd_connector {
 
         $conn = lc($conn);
 
-        if ($conn eq 'direct') {
-            write_irssi("Connector is not modifiable");
+        if (exists($connconf->{$conn}->{'_immutable'})) {
+            write_irssi("Connector cannot be modified");
             return;
         }
 
@@ -562,7 +562,7 @@ sub cmd_connector {
 
         delete($connconf->{$conn}->{'schemas'}->{$schema});
     } elsif ($subcmd eq 'select') {
-        my @connlist = @_;
+        my @connlist = map { lc } @_;
 
         if (scalar(@connlist) == 0) {
             write_irssi("No connectors given");
@@ -682,6 +682,7 @@ sub init_videosite {
     unless (exists($conf->{'videosite'}->{'connectors'}->{'direct'})) {
         $conf->{'videosite'}->{'connectors'}->{'direct'} = {
                 'name' => 'direct',
+                '_immutable' => '1',
                 'schemas' => {},
         };
     }