projects
/
id3fs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5239895
)
start refactoring AudioFile
author
Ian Beckwith
<ianb@erislabs.net>
Sun, 26 Sep 2010 05:36:42 +0000
(06:36 +0100)
committer
Ian Beckwith
<ianb@erislabs.net>
Sun, 26 Sep 2010 05:36:42 +0000
(06:36 +0100)
lib/ID3FS/AudioFile.pm
patch
|
blob
|
history
diff --git
a/lib/ID3FS/AudioFile.pm
b/lib/ID3FS/AudioFile.pm
index
b2e5709
..
398a169
100644
(file)
--- a/
lib/ID3FS/AudioFile.pm
+++ b/
lib/ID3FS/AudioFile.pm
@@
-6,24
+6,28
@@
use ID3FS::AudioFile::Mp3;
use ID3FS::AudioFile::Ogg;
use ID3FS::AudioFile::Flac;
use ID3FS::AudioFile::Ogg;
use ID3FS::AudioFile::Flac;
-# omg a factory class, I feel vaguely dirty
sub new
{
sub new
{
- my (undef,$path)=@_;
+ my $proto=shift;
+ my $class=ref($proto) || $proto;
+ my $self={};
+ bless($self,$class);
+
+ my $path=shift;
my $ext=($path=~/.*\.(.*)/)[0];
return undef unless($ext);
$ext=lc($ext);
if($ext eq "mp3")
{
my $ext=($path=~/.*\.(.*)/)[0];
return undef unless($ext);
$ext=lc($ext);
if($ext eq "mp3")
{
-
return
ID3FS::AudioFile::Mp3->new($path);
+
$self->{audiofile}=
ID3FS::AudioFile::Mp3->new($path);
}
elsif($ext eq "ogg")
{
}
elsif($ext eq "ogg")
{
-
return
ID3FS::AudioFile::Ogg->new($path);
+
$self->{audiofile}=
ID3FS::AudioFile::Ogg->new($path);
}
elsif($ext eq "flac")
{
}
elsif($ext eq "flac")
{
-
return
ID3FS::AudioFile::Flac->new($path);
+
$self->{audiofile}=
ID3FS::AudioFile::Flac->new($path);
}
else
{
}
else
{
@@
-32,4
+36,33
@@
sub new
}
}
}
}
+sub artist
+{
+ return shift->{audiofile}->artist(@_);
+}
+sub album
+{
+ return shift->{audiofile}->album(@_);
+}
+sub audiotype
+{
+ return shift->{audiofile}->audiotype(@_);
+}
+sub haspic
+{
+ return shift->{audiofile}->haspic(@_);
+}
+sub v1genre
+{
+ return shift->{audiofile}->v1genre(@_);
+}
+sub year
+{
+ return shift->{audiofile}->year(@_);
+}
+sub tags
+{
+ return shift->{audiofile}->tags(@_);
+}
+
1;
1;