diff options
author | Yorhel <git@yorhel.nl> | 2010-01-24 14:21:26 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-01-24 14:22:46 +0100 |
commit | b04c46baec8aef93d21898ef7f52b9d6d2442ce3 (patch) | |
tree | ca68ca3d952b4dc84ef21bac844c97b1523d323a /util/vndb.pl | |
parent | 9b7a44bee4f47dca175be2f38bc516aa34e14104 (diff) |
SkinFile: Abstracted access to the skin configuration files
And updated skingen.pl and vndb.pl to make use of this abstraction.
Diffstat (limited to 'util/vndb.pl')
-rwxr-xr-x | util/vndb.pl | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/util/vndb.pl b/util/vndb.pl index 32e1bdb4..07ad20aa 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -18,6 +18,7 @@ use lib $ROOT.'/lib'; use YAWF ':html'; use VNDB::L10N; +use SkinFile; our(%O, %S); @@ -104,21 +105,12 @@ sub readskins { my %skins; # dirname => skin name my @regen; my $lasttemplate = [stat "$ROOT/data/style.css"]->[9]; - for my $f (glob "$ROOT/static/s/*") { - next if !-e "$f/conf"; - my $n = $1 if $f =~ m{([^/]+)$}; - open my $F, '<', "$f/conf" or die $!; - while(<$F>) { - chomp; - s/\r//; - s{[\t\s]*//.*$}{}; - next if !/^name[\t\s]+(.+)$/; - $skins{$n} = $1; - last; - } - close $F; + my $skin = SkinFile->new("$ROOT/static/s"); + for my $n ($skin->list) { + $skins{$n} = $skin->get($n, 'name'); next if !$skins{$n}; + my $f = "$ROOT/static/s/$n"; my $css = -f "$f/style.css" && [stat "$f/style.css"]->[9] || 0; my $boxbg = -f "$f/boxbg.png" && [stat "$f/boxbg.png"]->[9] || 0; my $lastgen = $css < $boxbg ? $css : $boxbg; |