From 50b656ff0cbe94d567755e15895804d55f29ed26 Mon Sep 17 00:00:00 2001 From: Michiel Van Der Kolk Date: Sun, 24 Apr 2005 14:30:11 +0000 Subject: [PATCH] Fall back on directory name if no album tag, instead of . Fall back on basename of the file if no title tag, instead of . git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6337 a1c6a512-1295-4272-9138-f99709370657 --- tools/songdb.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/songdb.pl b/tools/songdb.pl index 2e34360f5a..daa35577a6 100755 --- a/tools/songdb.pl +++ b/tools/songdb.pl @@ -178,8 +178,13 @@ sub dodir { # fallback names $$id3{'ARTIST'} = "" if ($$id3{'ARTIST'} eq ""); - $$id3{'ALBUM'} = "" if ($$id3{'ALBUM'} eq ""); - $$id3{'TITLE'} = "" if ($$id3{'TITLE'} eq ""); + # Fall back on the directory name (not full path dirname), + # if no album tag + $$id3{'ALBUM'} = (split m[/], $dir)[-1] if ($$id3{'ALBUM'} eq ""); + # fall back on basename of the file if no title tag. + my $base; + ($base = $f) =~ s/\.\w+$//; + $$id3{'TITLE'} = $base if ($$id3{'TITLE'} eq ""); # Append dirname, to handle multi-artist albums $$id3{'DIR'} = $dir;