File: APETags.pm

package info (click to toggle)
libaudio-musepack-perl 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 356 kB
  • sloc: perl: 1,941; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package Audio::APETags;

# Base class wrapper.

use strict;
use Audio::Scan;

our $VERSION = '1.0';

sub new {
    my ($class, $file) = @_;

    my $method = ref $file ? 'scan_fh' : 'scan';
    my $self   = Audio::Scan->$method($file);

    bless $self, $class;

    return $self;
}

sub _extract {
    my ($self, $type, $key) = @_;

    return $self->{$type} unless $key;
    return $self->{$type}{ucfirst $key} if defined $self->{$type}{ucfirst $key};
    return $self->{$type}{$key};
}

sub info {
    return shift->_extract('info', @_);
}

sub tags {
    return shift->_extract('tags', @_);
}

1;

__END__