]> iEval git - app-musicexpo.git/blobdiff - lib/App/MusicExpo.pm
Order JSON song list by title (same order as HTML table)
[app-musicexpo.git] / lib / App / MusicExpo.pm
index 0b3276cab35784406e1f29a145af1276d9362ea4..dd3e57565591620d7ab4ff9070e308618f3d1bf0 100644 (file)
@@ -3,7 +3,7 @@ use v5.14;
 use strict;
 use warnings;
 
-our $VERSION = '0.003003';
+our $VERSION = '0.004';
 
 use Audio::FLAC::Header qw//;
 use HTML::Template::Compiled qw//;
@@ -163,10 +163,11 @@ sub run {
                push @files, \%entry
        }
 
+       @files = sort { $a->{title} cmp $b->{title} } @files;
        my $json = JSON::MaybeXS->new(canonical => 1)->encode({files => \@files, prefix => $prefix});
        $json =~ s/</&lt;/g;
        $json =~ s/>/&gt;/g;
-       $ht->param(files=>[sort { $a->{title} cmp $b->{title} } @files], prefix => $prefix, json => $json);
+       $ht->param(files => \@files, prefix => $prefix, json => $json);
        print $ht->output;
 }
 
@@ -175,6 +176,9 @@ $default_template = <<'HTML';
 <title>Music</title>
 <meta charset="utf-8">
 <link rel="stylesheet" href="/music.css">
+<script async defer type="application/javascript" src="player.js"></script>
+
+<div id="player"></div>
 
 <table border>
 <thead>
This page took 0.022626 seconds and 4 git commands to generate.