summaryrefslogtreecommitdiffstats
path: root/tools/songdb.pl
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2005-01-17 13:50:08 +0000
committerBjörn Stenberg <bjorn@haxx.se>2005-01-17 13:50:08 +0000
commit7396d99027410feda4661f860df90509783b50c5 (patch)
treeb3073fcdb86b59bae41c6b589b9d039d88bb0868 /tools/songdb.pl
parent445d5d5a6eddd63baa8b38fb57f9aed304d3758f (diff)
downloadrockbox-7396d99027410feda4661f860df90509783b50c5.tar.gz
rockbox-7396d99027410feda4661f860df90509783b50c5.tar.bz2
rockbox-7396d99027410feda4661f860df90509783b50c5.zip
Don't die on opendir() failure. Index .mp2 files too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5581 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/songdb.pl')
-rwxr-xr-xtools/songdb.pl16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/songdb.pl b/tools/songdb.pl
index f61bc29661..bfea05314d 100755
--- a/tools/songdb.pl
+++ b/tools/songdb.pl
@@ -59,18 +59,22 @@ if(! -d $dir or $help) {
sub getdir {
my ($dir) = @_;
- opendir(DIR, $dir) || die "can't opendir $dir: $!";
- # my @mp3 = grep { /\.mp3$/ && -f "$dir/$_" } readdir(DIR);
- my @all = readdir(DIR);
- closedir DIR;
- return @all;
+ if (opendir(DIR, $dir)) {
+ # my @mp3 = grep { /\.mp3$/ && -f "$dir/$_" } readdir(DIR);
+ my @all = readdir(DIR);
+ closedir DIR;
+ return @all;
+ }
+ else {
+ warn "can't opendir $dir: $!\n";
+ }
}
sub extractmp3 {
my ($dir, @files) = @_;
my @mp3;
for(@files) {
- if( /\.mp3$/ && -f "$dir/$_" ) {
+ if( /\.mp[23]$/ && -f "$dir/$_" ) {
push @mp3, $_;
}
}