More iTunes: Playlist Sharing

pudge on 2003-05-01T11:33:46

In Playlist Sharing, you don't get some of the information for a song, like the disc number, or the artwork. The playlist sharing window doesn't have disc number as an option for the information you can see in View Options. If you click Get Info you can see it. Weird. But worse is that if you stream the file, you don't get the artwork. It's right there embedded in the file, before the actual music; you'd think iTunes would/could pull it out.

Now Playing: Narcolepsy - Ben Folds Five (The Unauthorized Biography Of Reinhold Messner)


Incompatible artwork

extra88 on 2003-05-01T14:44:52

I've found that artwork added to tracks by other programs won't necessarily display in iTunes. I typically add artwork to the OpenBSD theme songs using MusicMatch for Windows but iTunes4 doesn't display it in the album window or the artwork window.

I also spent some frustrated time trying to use your perl script for extracting artwork before I decided that the ID3 tags must be different. I'm still a Perl noob, how can I use 'keys' with the hash reference get_mp3tag returns so I know what all the keys are? BTW, while fooling around with that script, I also found that the extraction didn't work even for existing key names (like TITLE) if the parameter RAW_V2 was specified. Changing get_mp3tag($file, 2, 2) to get_mp3tag($file, 2) or even just get_mp3tag($file) made it work. This was all with Perl 5.8, MP3::Info 1.02, and files tagged by MusicMatch for Windows.

Re:Incompatible artwork

chromatic on 2003-05-01T15:52:11

my $hash_ref   = { Gharlane => 'Eddore', Mentor => 'Arisia' };
my @nonhumans  = keys %{ $hash_ref };

Re:Incompatible artwork

extra88 on 2003-05-01T16:41:12

Thanks.

Key 0: YEAR
Key 1: ARTIST
Key 2: COMMENT
Key 3: ALBUM
Key 4: TITLE
Key 5: GENRE
Key 6: TRACKNUM
Key 7: TAGVERSION

I'm interested in using Perl to access the art because I'd really like a script which can remove the art from an mp3. We're using MusicMatch to rip a bunch of CDs and its pretty good but one bug is you can't tell it not to add the album art to a ripped track if it finds some. The problem with album art is when we use Apache::MP3 to steam files containing album art, some clients won't play the tracks (tested with iTunes2, iTunes3, RealPlayer 8 for Win). Currently we just added album art removal to the ripping procedure but since we're already using Perl scripts to manipulate the files before they're uploaded, it would be nice to just add stripping out album art as well.

BTW, my guess is the problem on those stream clients isn't the art per se. I think the problem is the amount of data at the head of the files before the mp3 data is too big. Since there's no limit to how much data can go in ID3v2 tags, clients should be fixed to play the mp3 data where ever they can find it.

Re:Incompatible artwork

wgalway on 2007-02-18T19:56:28

#!/usr/bin/perl -w
#-------------------------------
# Artwork: artwork.pl v.1 2007-02-18 14:52:09
# Pull album art from id3v2 tags
# Copyright (c) 2007 William Galway. All Rights Reserved.
#
#-------------------------------
$VERSION = '.1';

use MP3::Tag;
use File::Find;
open( LOGF, ">>logfile.txt" ) || die "$!";
print LOGF `date`;
print LOGF "The follwing directories are w/o ablum art.\n";

# MP3 Dirctory
print "Type the path to your mp3s and press Enter. \n";
$mp3dir = <STDIN>;
chomp $mp3dir;
print "\n";

# Album Art File Name
print "Type the name of the album art file you\n";
print "would like extracted to your mp3 folder and press Enter.\n";
print "For example cover.jpg\n";
$cover = <STDIN>;
chomp $cover;
print "\n";

if ( -e $mp3dir ) {
    print "Checking $mp3dir for mp3s.\n";
}
else {
    print("MP3 directory does not exist\n");
    exit;
}

find( \&ExtractTagInfo, $mp3dir );

sub ExtractTagInfo {

    if (/\.mp3$/) {

        my $art;

        $mp3 = MP3::Tag->new($_);

        $mp3->get_tags();
        if ( exists $mp3->{ID3v2} ) {
            $id3v2_tagdata = $mp3->{ID3v2};
            $info          = $id3v2_tagdata->get_frame("APIC");
            $mp3->close();
            while ( my ( $key, $value ) = each(%$info) ) {
                if ( $key eq "_Data" ) {
                    $art = $value;
                }
            }
        }
        if ( -e "$File::Find::dir/$cover" ) {

            #print "$File::Find::dir/$cover already exists \n";
        }

        # write the art to file
        elsif ($art) {
            open ARTWORK, ">$cover"
              or die "Could not open \n$File::Find::dir/$cover\n Check your permissions.\n";
            binmode(ARTWORK);
            print ARTWORK $art;
            print "Pulling Art From $File::Find::name\n";
            close ARTWORK;
        }
        else {
            print LOGF "$File::Find::dir\n";
        }
    }
}
close(LOGF);
print(
"All Done! Open logfile.txt for a list of mp3 directories w/o album art information.\n"
);
exit