21 opendir(D, $dir) || return ();
22 @list = grep {/$pattern/ && -f File::Spec->catfile($dir, $_) } readdir(D);
27 eval qq{ require videosite::$p; };
29 print("Failed to load plugin: $@");
33 $g = eval qq{ videosite::$p->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');
62 unshift(@INC, dirname(realpath($0)));
64 @g = ploader($bp, '.*Grabber\.pm$', 'grabber');
65 ($f) = ploader($bp, '^FileGetter\.pm$', 'getter');
67 unless(@g and defined($f)) {
68 print("No plugins could be loaded\n");
72 $f->setval('FILEPATTERN', './%3$s' . $ext);
76 ($m, undef) = $y->get($_);
78 print("Downloading $m->{'TITLE'}\n");