21 opendir(D, $dir) || return ();
22 @list = grep {/$pattern/ && -f File::Spec->catfile($dir, $_) } readdir(D);
27 eval qq{ require $p; };
29 print("Failed to load plugin: $@");
33 $g = eval $p.q{->new();};
35 print("Failed to instanciate: $@");
40 if ($type eq $g->{'TYPE'}) {
43 printf('%s has wrong type (got %s, expected %s)', $p, $g->{'TYPE'}, $type);
59 # This is some dark magic to find out our real base directory,
60 # where we hope to find our plugins.
61 $bp = File::Spec->catdir(dirname(realpath($0)), 'videosite');
63 @g = ploader($bp, '.*Grabber\.pm$', 'grabber');
64 ($f) = ploader($bp, '^FileGetter\.pm$', 'getter');
66 unless(defined(@g) and defined($f)) {
67 print("No plugins could be loaded\n");
71 $f->setval('FILEPATTERN', './%3$s' . $ext);
75 ($m, undef) = $y->get($_);
77 print("Downloading $m->{'TITLE'}\n");