X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FIdiotBox%2FImporter.pm;h=a19451c0961f6c510c93ad2e14b02fec9c989dbd;hb=625f105e80e46edfcae9732c6591842a87c91e1e;hp=b7ba15371e7b039997544794843cd4d758d01878;hpb=ebba317f0281d7818fff5584f3b202e30c53182f;p=catagits%2FApp-IdiotBox.git diff --git a/lib/App/IdiotBox/Importer.pm b/lib/App/IdiotBox/Importer.pm index b7ba153..a19451c 100644 --- a/lib/App/IdiotBox/Importer.pm +++ b/lib/App/IdiotBox/Importer.pm @@ -2,12 +2,15 @@ package App::IdiotBox::Importer; use strict; use warnings FATAL => 'all'; +use App::IdiotBox::Common qw(@SupportedFormats); use Cwd; use IO::All; use ExtUtils::MakeMaker qw(prompt); use File::Spec::Functions qw(catfile catdir); use POSIX qw(strftime); +my $supported_formats_re = join('|', @SupportedFormats); + sub log_info (&) { print $_[0]->(), "\n"; } sub run { @@ -79,6 +82,7 @@ sub run { $info->{slug} = prompt('What is the slug for this talk?', $slug); $info->{bucket} = $bucket; $info->{announcement} = $ann; + $info->{announcement_id} = $ann->id; # Temp fix so INSERT behaves -- alh $videos{$video_file} = bless($info, 'App::IdiotBox::Video'); } foreach my $video_file (keys %videos) { @@ -100,7 +104,7 @@ sub video_files_from_dir { my ($class, $dir) = @_; my %videos; foreach my $file (io($dir)->all_files) { - $file->filename =~ /^([^\.]+)\.([^\.]+)$/ or next; + $file->filename =~ /^([^\.]+)\.($supported_formats_re)$/ or next; push(@{$videos{$1}||=[]}, $2); } \%videos;