package ID3FS::AudioFile;

use strict;
use warnings;
use ID3FS::AudioFile::Mp3;
use ID3FS::AudioFile::Ogg;
use ID3FS::AudioFile::Flac;

# omg a factory class, I feel vaguely dirty
sub new
{
    my (undef,$path)=@_;
    my $ext=($path=~/.*\.(.*)/)[0];
    return undef unless($ext);
    $ext=lc($ext);
    if($ext eq "mp3")
    {
	return ID3FS::AudioFile::Mp3->new($path);
    }
    elsif($ext eq "ogg")
    {
	return ID3FS::AudioFile::Ogg->new($path);
    }
    elsif($ext eq "flac")
    {
	return ID3FS::AudioFile::Flac->new($path);
    }
    else
    {
	print("Unknown extension: $ext\n");
	return undef;
    }
}

1;
