- my $dir = shift;
- my $pattern = shift;
- my $type = shift;
- my @list;
- my $p;
- my $g;
- my @g = ();
-
- unshift(@INC, $dir);
-
- opendir(D, $dir) || return ();
- @list = grep {/$pattern/ && -f File::Spec->catfile($dir, $_) } readdir(D);
- closedir(D);
-
- foreach $p (@list) {
- $p =~ s/\.pm$//;
- eval qq{ require videosite::$p; };
- if ($@) {
- print("Failed to load plugin: $@");
- next;
- }
-
- $g = eval qq{ videosite::$p->new();};
- if ($@) {
- print("Failed to instanciate: $@");
- delete($INC{$p});
- next;
- }
-
- if ($type eq $g->{'TYPE'}) {
- push(@g, $g);
- } else {
- printf('%s has wrong type (got %s, expected %s)', $p, $g->{'TYPE'}, $type);
- delete($INC{$p});
+my $info = 0;
+my $debug = 0;
+my %config = (
+ mode => 'download',
+ getter => 'filegetter',
+ 'plugin.youtube.QUALITY' => 'hd',
+ 'plugin.filegetter.FILEPATTERN' => './%3$s.flv',
+);
+my @options;
+
+sub link_callback {
+ my $m = shift;
+
+ if ($info) {
+ foreach (keys(%{$m})) {
+ printf("%s: %s\n", $_, defined($m->{$_})?$m->{$_}:'(undef)');