videosite-dl: Add -i command line option to print information instead of downloading
authorRalf Ertzinger <ralf@skytale.net>
Sat, 3 Sep 2011 19:44:14 +0000 (21:44 +0200)
committerRalf Ertzinger <ralf@skytale.net>
Sat, 3 Sep 2011 19:44:14 +0000 (21:44 +0200)
videosite-dl.pl

index 8b1b161..7313bf5 100755 (executable)
@@ -55,6 +55,9 @@ my $f;
 my $m;
 my @g;
 my $bp;
+my $info = 0;
+
+GetOptions("i" => \$info);
 
 # This is some dark magic to find out our real base directory,
 # where we hope to find our plugins.
@@ -75,8 +78,14 @@ foreach (@ARGV) {
     foreach $y (@g) {
         ($m, undef) = $y->get($_);
         if (defined($m)) {
-            print("Downloading $m->{'TITLE'}\n");
-            $f->get($m);
+            if ($info) {
+                foreach (keys(%{$m})) {
+                    printf("%s: %s\n", $_, defined($m->{$_})?$m->{$_}:'(undef)');
+                }
+            } else {
+                print("Downloading $m->{'TITLE'}\n");
+                $f->get($m);
+            }
         }
     }
 }