MP3-Tag

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  new interpolation escapes %w %h %{iT} %{mT} %{aR} for these methods.
  new configuration variables: `is_writable' defaults to writable_by_extension
    (older versions behaved as if it is 1);  `writable_extensions' to
       mp3 mp2 id3 tag ogg mpg mpeg mp4 aiff flac ape ram mpc
  update_tags() checks for can_write().

cddb.tmp was omitted from distribution (==> test failure).

ID3v2.pm: the code to treat compressed fields was completely busted.
	  (Still not tested a lot...)
  Now always write UTF-16 as `UTF-16LE with BOM' to cowtow to M$'s bugs
	(must disable: triggers unsync...; set $ENV{MP3TAG_USE_UTF_16LE}
	 to TRUE to enable).

Music_Fields.pm: could give `uninitialized' warning in presence of
	one-word person names in the tables.

ImageSize.pm: new handler.

mp3info2: -d was busted by the repeated-option logic.
  allow a repeated -u to force update.

lib/MP3/Tag.pm  view on Meta::CPAN

	  if ($e = $self->get_config('decode_encoding_files') and $e->[0]) {
#	  	warn "binmode -> :encoding($e->[0])";
	    eval "binmode F, ':encoding($e->[0])'"; # old binmode won't compile...
	  }
	}

	local $/;
	my $d = <F>;
#		warn "From file $data (\$^OPEN=${^OPEN}, \$^UNICODE=${^UNICODE}): ", join q( ), map ord, split //, $d;
	CORE::close F or die "Can't close file `$data' for parsing: $!";
	$d =~ s/^(?:\x{FEFF}|\xEF\xBB\xBF)// unless $flags =~ /B/;	# strip BOM
	$data = $d;
    }
    my @data = $data;
    if ($flags =~ /[ln]/) {
	my $p = $self->get_config('parse_split')->[0];
	@data = split $p, $data, -1;
    }
    if ($flags =~ /n/) {
	my $track = $self->track1 or return;
	@data = $data[$track - 1];

lib/MP3/Tag/ID3v2.pm  view on Meta::CPAN

  # No ambiguity, since numbers do not contain ";":
  $f = add_frame_split('RBUF', "$n1;$n2;$n3");

For C<COMR> frame, in case when the fields are C<join()>ed by C<';'>,
C<encoding> field may be present only if all the other fields are
present.

=cut 

# 0 = latin1 (effectively: unknown)
# 1 = UTF-16 with BOM	(we always write UTF-16le to cowtow to M$'s bugs)
# 2 = UTF-16be, no BOM
# 3 = UTF-8
my @dec_types = qw( iso-8859-1 UTF-16   UTF-16BE utf8 );
my @enc_types = qw( iso-8859-1 UTF-16LE UTF-16BE utf8 );
my @tail_rex;

# Actually, disable this code: it always triggers unsync...
my $use_utf16le = $ENV{MP3TAG_USE_UTF_16LE};
@enc_types = @dec_types unless $use_utf16le;

sub _add_frame {

lib/MP3/Tag/ID3v2.pm  view on Meta::CPAN

	} elsif (exists $fs->{func}) {
	  if ($fs->{small_max}) { # Allow the old way (byte) and a number
	    # No conflict possible: byte is always smaller than ord '0'
	    $d = pack 'C', $d if $d =~ /^\d+$/;
	  }
	  $d = $self->__format_field($fname, $fs->{name}, $d)
	}
	if ($fs->{encoded}) {
	  if ($encoding) {
	    # 0 = latin1 (effectively: unknown)
	    # 1 = UTF-16 with BOM (we write UTF-16le to cowtow to M$'s bugs)
	    # 2 = UTF-16be, no BOM
	    # 3 = UTF-8
	    require Encode;
	    if ($calc_enc or $encode_utf8) {	# e_u8==1 by default
	      $d = Encode::encode($enc_types[$encoding], $d);
	    } elsif ($encoding < 3) {
	      # Reencode from UTF-8
	      $d = Encode::decode('UTF-8', $d);
	      $d = Encode::encode($enc_types[$encoding], $d);
	    }
	    $d = "\xFF\xFE$d" if $use_utf16le and $encoding == 1;

lib/MP3/Tag/ID3v2.pm  view on Meta::CPAN

		} else {
			if (exists $rule->{encoded}) {	# decode data
			  if ( $encoding > 3 ) {
			    warn "Encoding type '$encoding' not supported: found in $rule->{name}\n";
			    next;
			  } elsif ($encoding and not $trustencoding) {
			    warn "UTF encoding types disabled via MP3TAG_DECODE_UNICODE): found in $rule->{name}\n";
			    next;
			  } elsif ($encoding) {
			    # 0 = latin1 (effectively: unknown)
			    # 1 = UTF-16 with BOM
			    # 2 = UTF-16be, no BOM
			    # 3 = UTF-8
			    require Encode;
			    if ($decode_utf8) {
			      $found = Encode::decode($dec_types[$encoding],
						      $found);
			    } elsif ($encoding < 3) {
			      # Reencode in UTF-8
			      $found = Encode::decode($dec_types[$encoding],
						      $found);
			      $found = Encode::encode('UTF-8', $found);



( run in 0.613 second using v1.01-cache-2.11-cpan-39bf76dae61 )