module for mp3 tag handling 
Author Message
 module for mp3 tag handling

Does anyone know of a module or script which handles V2 ID3 MP3 tags
(read/modify/write).

tnX

--
De Nederlandse geluidstechniek site is op komst!
 check alvast het forum http://www.*-*-*.com/



Thu, 03 Nov 2005 04:30:32 GMT  
 module for mp3 tag handling
Hi Paul,


Quote:

> Does anyone know of a module or script which handles V2 ID3 MP3 tags
> (read/modify/write).

> tnX

> --
> De Nederlandse geluidstechniek site is op komst!
>  check alvast het forum http://forum.geluidstechniek.nl/

here's a script that will add a USLT lyrics frame to
an ID3 v2 tag and write the new Mp3 to a Temp file.

Read through it and you can see the module name and
where to get it...

#--------- begin AddUSLT.pl ------------
#!/usr/bin/perl
#
# Author:   Mark
# script: AddUSLT.pl
# Description: ID3v2 utility to add a USLT tag frame to an Mp3 file
# keywords: uslt xmp3 frame id3v2 lyric
# Date:  8/4/01 2:05PM

use MP3::ID3v2Tag;   #CPAN in MPEG directory/originally by Mp3.com
use FileHandle;

#
# need two file handles, one for the
#    target song, inorder to read it,
#    and one for the resulting file that contains the lyric frame.
#

 my ($buffer, $lyrics, $lyrdir, $songdir) = '';
 $lyrdir  =  "c:\\guitar\\";
 $songdir = "d:\\mp3\\Brazil";
 $tmpdir = "d:\\mp3\\temp\\";

# ========== user defined ==========
 my $stfile = '(jo?o_gilberto)-15_coisa_mais_linda.mp3';
 my $lyfile = $lyrdir . 'coisa_mais_linda.txt';
    my $desc = 'joao - coisa mais linda';
# ======== end user defined ==========

 chdir($songdir);
 # song file to alter by adding the USLT frame
 # tmp~corcavado1.mp3 (tom_jobim)-corcovado.mp3

 my $gh = new FileHandle "<$stfile";
 #
 my $tag = MP3::ID3v2Tag->parse($gh) ;

 ##############################
 # build a new tag to write to the temp file
 $newtag = MP3::ID3v2Tag->new() ;
 $newtag->set_padding_size(0);
 foreach $frame ( $tag->frames() ) {

  # padding is treated as a frame with null id, OMG
  # replace any USLT frame, if found
  if ( ($frame->frameid() !~ /^\x00|^US/)  )
  {
   # uncomment below for debug
   #    print 'id=' . $frame->frameid() .
   #     ' Text=' . $frame->text() . "\n";
   $newtag->add_frame( $frame);
  }
 }
 my $stpos = $tag->{ORIGINAL_SIZE} + 10;
 print "tagsize= $tag->{ORIGINAL_SIZE} \n";
 #close $gh;
 undef $tag ;

 #########################################
 # read the lyrics in from a file

 open ( IN, "<$lyfile" ) || die $! ;
 binmode IN;

 #
 while (read(IN,$buffer,1024))
  {$lyrics .= $buffer};
 close IN;
 $buffer = '';

 #################################
 #
 $newtag->add_frame("USLT",   0,
                "por",
         $desc,
        $lyrics ) ;

# name the temp file in which to insert the new tag
 $out = $tmpdir . $stfile;

 open ( TEMP, ">$out" ) || die $! ;
 binmode TEMP;

 # write the new tag to the temp file
 print TEMP $newtag->as_string();

 binmode $gh;

# skip to the end of the ID3 tag, at the synch header
 seek($gh, 0,0);
 seek($gh, $stpos ,0) or die $!;

# print the remainder of the songfile to the temp file
 while (read($gh,$buffer,1024)) {
     print TEMP $buffer;
 }
 close $gh;
 close TEMP;

__END__

hth,
Mark Pryor



Thu, 03 Nov 2005 04:57:19 GMT  
 module for mp3 tag handling



Quote:

> Does anyone know of a module or script which handles V2 ID3 MP3 tags
> (read/modify/write).

> tnX

You can do a serach at CPAN ofr a module
http://www.*-*-*.com/

Ice Demon
http://{*filter*}-xxx-newsgroups.com
http://{*filter*}-{*filter*}games.com
http://{*filter*}-spider.com



Thu, 03 Nov 2005 14:48:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. tagged-0.30 (MP3::Tag) released

2. Namespace advise for yet another mp3-tagging module sought

3. Read MP3 tag

4. MP3::Tag 0.40 released

5. ANNOUNCE: MP3::Tag v0.1

6. Read MP3 tag

7. MP3 server with Apache::MP3 and Xmms::Remote

8. Handling user defined tags with CGI.pm

9. New Module: Apache::MP3::RemoteControl (addendum)

10. New Module: Apache::MP3::RemoteControl

11. wav or mp3 module wanted

12. MP3::Napster module problems with disconnecting

 

 
Powered by phpBB® Forum Software