summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2005-04-12 16:07:01 +0000
committerJonas Häggqvist <rasher@rasher.dk>2005-04-12 16:07:01 +0000
commit34e2f722f778defa9be7fffe9bb4ee415b799890 (patch)
treef27d748562709dfa18a71d0f9e0368c37d5f0a0b /tools
parent7bf2af6d0f163e377cd0aa0a7813dec067b05a0e (diff)
downloadrockbox-34e2f722f778defa9be7fffe9bb4ee415b799890.tar.gz
rockbox-34e2f722f778defa9be7fffe9bb4ee415b799890.zip
Improved handling of multi-artist albums and tags with different cases
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6275 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/songdb.pl29
1 files changed, 26 insertions, 3 deletions
diff --git a/tools/songdb.pl b/tools/songdb.pl
index 5d95ea5a87..11bf878057 100755
--- a/tools/songdb.pl
+++ b/tools/songdb.pl
@@ -47,6 +47,9 @@ my %albums;
my %years;
my %filename;
+my %lcartists;
+my %lcalbums;
+
my $dbver = 1;
if(! -d $dir or $help) {
@@ -160,9 +163,29 @@ sub dodir {
$$id3{'ALBUM'} = "<no album tag>" if ($$id3{'ALBUM'} eq "");
$$id3{'TITLE'} = "<no title tag>" if ($$id3{'TITLE'} eq "");
- # prepend Artist name to handle duplicate album names from other
- # artists
- my $albumid = $id3->{'ALBUM'}."___".$id3->{'ARTIST'};
+ # Only use one case-variation of each album/artist
+ if (exists($lcalbums{lc($$id3{'ALBUM'})})) {
+ # if another album with different case exists
+ # use that case (store it in $$id3{'ALBUM'}
+ $$id3{'ALBUM'} = $lcalbums{lc($$id3{'ALBUM'})};
+ }
+ else {
+ # else create a new entry in the hash
+ $lcalbums{lc($$id3{'ALBUM'})} = $$id3{'ALBUM'};
+ }
+
+ if (exists($lcartists{lc($$id3{'ARTIST'})})) {
+ $$id3{'ARTIST'} = $lcartists{lc($$id3{'ARTIST'})};
+ }
+ else {
+ $lcartists{lc($$id3{'ARTIST'})} = $$id3{'ARTIST'};
+ }
+
+ # prepend Dir name to handle duplicate album names in different
+ # dirs. Meaning multi-artist cds will be handled correctly if
+ # put in a single directory.
+ my $albumid = $id3->{'ALBUM'}."___".$dir;
+
if($albumid ne "<no album tag>___<no artist tag>") {
my $num = ++$albums{$albumid};
if($num > $maxsongperalbum) {