Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Can't seem to use this to fix tags #1

Open
frioux opened this Issue March 08, 2011 · 1 comment

2 participants

fREW Schmidt Edward J. Allen III
fREW Schmidt

I just got a bunch of music that has misplaced (it seems) tags. Music::Tag reads them fine, but amarok seems to think that the artist is "Various Artists" I've tried a number of ways to fix the file and the following "nuclear" option seemed the most correct:

#!/usr/bin/env perl
use 5.12.2;
use warnings;

use Music::Tag;
use File::Find::Rule;
my $directory = shift || '.';

my @songs
   = File::Find::Rule->file()->name( '*.mp3' )
   ->in( $directory );

foreach my $song (@songs) {
   my $info = Music::Tag->new($song);
   $info->get_tag;
   my $d = $info->data();
   $info->strip_tag;
   $info->set_album($d->{ALBUM});
   $info->set_artist($d->{ARTIST});
   $info->set_comment($d->{COMMENT});
   $info->set_genre($d->{GENRE});
   $info->set_title($d->{TITLE});
   $info->set_track($d->{TRACK});
   $info->set_year($d->{YEAR});
   $info->set_tag;
   $info->close;
}

Sadly it doesn't seem to work. In fact if I just strip_tag it doesn't seem to change the tags at all.

I'll gladly send you a file to look at if you are interested. Just let me know.

Edward J. Allen III
Owner

Sorry for the slow response. I have seen it do this. I think it is a bug in MP3::Tag, but it may not be.

Try setting the tag after striping it.

If that doesn't work, for now, I suggest using id3tag or similar command line utility.

I will try to integrate this into a test and resolve it soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.