From 7719c5d829dc238d2e71b15247541f5d9287f948 Mon Sep 17 00:00:00 2001 From: Ralf Ertzinger Date: Sat, 3 Sep 2011 21:44:14 +0200 Subject: [PATCH] videosite-dl: Add -i command line option to print information instead of downloading --- videosite-dl.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/videosite-dl.pl b/videosite-dl.pl index 8b1b161..7313bf5 100755 --- a/videosite-dl.pl +++ b/videosite-dl.pl @@ -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); + } } } } -- 1.8.3.1