[Gllug] Idv3 Tag Command line tool recommendation.

Philip Davies pdavies1 at bitbucket.plus.com
Sun Dec 19 16:21:28 UTC 2004


On Sat, Dec 18, 2004 at 12:13:18PM -0000, David Abbishaw wrote:
> Hi Guys,
> 
> Has anyone come across a command line tool to add empty IDv3 tags to MP3
> files.
<snip>

I've never come across one, but it looks like there are several Perl modules whioh would achieve this, for example:- 

  http://search.cpan.org/~svanzoest/MP3-ID3v1Tag-1.11/lib/MP3/ID3v1Tag.pm

If you were to install this module you could use the following Perl script:-

  #!/usr/local/bin/perl -w

  # Name: create-id3-tag.pl

  use strict;
  use MP3::ID3v1Tag;

  my $status = 0;
  my $filename = shift;

  my $mp3_file = new MP3::ID3v1Tag($filename);

  unless($mp3_file->got_tag()) {

          print "\'$filename\'\n";

          $mp3_file->set_title("No Title Name");
          $mp3_file->set_artist("No Artist Name");
          $mp3_file->set_album("No Album Title");
          $mp3_file->set_year(1999);
          $mp3_file->set_comment('No Comment');
          $mp3_file->set_genre_num(0);
          $status = $mp3_file->save();
  }

  exit 0;

Then it would be simply a case of something like:-

find <path-to-mp3s> -type f -name "*.mp3" -exec ./create-id3-tag.pl {} \;

Hope this gives you something to play with :) I've given it a quick test and it appears to work. 
-- 
Regards
Phil
-----------------------------------------------------------------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list