bug-gnupod
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnupod] Append artist to title in iTunesDB


From: Richard van den Berg
Subject: [Bug-gnupod] Append artist to title in iTunesDB
Date: Thu, 21 May 2009 21:13:54 +0200
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

Since my car iPod adapter is brain dead and only displays the title of songs, I've patched gnupod to append the artist to the title in the iTunesDB. It's stripped again by tunes2pod.pl so the GNUtunesDB.xml stays clean.

If this is a feature that could be useful to others, let me know and I'll make it optional using a switch to mktunes.pl and tunes2pod.pl

Cheers,

Richard
? .gnupod_version
? Makefile
? autom4te.cache
? config.log
? config.status
? configure
Index: src/ext/Mktunes.pm
===================================================================
RCS file: /sources/gnupod/gnupod/src/ext/Mktunes.pm,v
retrieving revision 1.6
diff -u -r1.6 Mktunes.pm
--- src/ext/Mktunes.pm  6 Oct 2007 07:26:52 -0000       1.6
+++ src/ext/Mktunes.pm  21 May 2009 19:09:50 -0000
@@ -275,7 +275,7 @@
                foreach my $key (sort keys(%$object)) {
                        my $value = $object->{$key};
                        next unless $value; # Do not write empty values
-                       my $new_mhod = GNUpod::iTunesDB::mk_mhod({stype=>$key, 
string=>$value});
+                       my $new_mhod = GNUpod::iTunesDB::mk_mhod({stype=>$key, 
string=>($key eq "title"?$value." | ".$object->{artist}:$value)});
                        next unless $new_mhod; # Something went wrong
                        $mhod_chunks .= $new_mhod;
                        $mhod_count++;
Index: src/ext/iTunesDB.pm
===================================================================
RCS file: /sources/gnupod/gnupod/src/ext/iTunesDB.pm,v
retrieving revision 1.113
diff -u -r1.113 iTunesDB.pm
--- src/ext/iTunesDB.pm 12 May 2009 10:36:52 -0000      1.113
+++ src/ext/iTunesDB.pm 21 May 2009 19:09:51 -0000
@@ -1208,7 +1208,12 @@
                $r{string_size} = get_int($seek+28,4,$fd);
                my $tmpstring   = 
get_string($seek+($r{total_size}-$r{string_size}), $r{string_size}, $fd);
                   $tmpstring   = Unicode::String::byteswap2($tmpstring);
+               if($r{type} == 1) {
+                  # Title mhod, strip added artist
+                  $r{string}   = shift(@{[split(/ \| 
/,Unicode::String::utf16($tmpstring)->utf8)]});
+               } else {
                   $r{string}   = Unicode::String::utf16($tmpstring)->utf8;
+               }
        }
        return \%r;
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]