s/File/AudioFile/: fixup code to use new name
[id3fs.git] / lib / ID3FS / AudioFile.pm
1 package ID3FS::AudioFile;
2
3 use strict;
4 use warnings;
5 use ID3FS::AudioFile::Mp3;
6 use ID3FS::AudioFile::Ogg;
7 use ID3FS::AudioFile::Flac;
8
9 # omg a factory class, I feel vaguely dirty
10 sub new
11 {
12     my (undef,$path)=@_;
13     my $ext=($path=~/.*\.(.*)/)[0];
14     return undef unless($ext);
15     $ext=lc($ext);
16     if($ext eq "mp3")
17     {
18         return ID3FS::AudioFile::Mp3->new($path);
19     }
20     elsif($ext eq "ogg")
21     {
22         return ID3FS::AudioFile::Ogg->new($path);
23     }
24     elsif($ext eq "flac")
25     {
26         return ID3FS::AudioFile::Flac->new($path);
27     }
28     else
29     {
30         print("Unknown extension: $ext\n");
31         return undef;
32     }
33 }
34
35 1;