X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FMusicExpo.pm;h=3194665a5a0a91bc9d9583425e27c7b06d0a6757;hb=75c564d81acda3f119514960b110f6628deca31e;hp=1595f71cf4933a084bb073cecd562aaf2ff5e4d9;hpb=21cd9240d572994ade62bed83cabba9e0c53e4c1;p=app-musicexpo.git diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index 1595f71..3194665 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -1,5 +1,6 @@ package App::MusicExpo 0.001; use v5.14; +use strict; use warnings; use Audio::FLAC::Header qw//; @@ -17,10 +18,12 @@ use Storable qw/thaw freeze/; ################################################## +my $default_template; + our $prefix='/music/'; our $cache='cache.db'; our $caching=1; -our $template='index.tmpl'; +our $template=''; GetOptions ( "template=s" => \$template, @@ -86,11 +89,25 @@ sub run { push @files, thaw mp3info $file if $file =~ /.mp3$/i; } - my $ht=HTML::Template::Compiled->new(filename => $template); + my $ht=HTML::Template::Compiled->new( $template eq '' ? (scalarref => \$default_template) : (filename => $template)); $ht->param(files=>[sort { $a->{title} cmp $b->{title} } @files]); print $ht->output; } +$default_template = <<'HTML'; + +Music + + + + + + +
TitleArtistAlbumGenreTrackYearType +
/ +
+HTML + 1; __END__ @@ -122,7 +139,7 @@ where the title is a download link. =item B<--template> I