package ID3FS::File;

use strict;
use warnings;
use ID3FS::File::Mp3;
use ID3FS::File::Ogg;
use ID3FS::File::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::File::Mp3->new($path);
    }
    elsif($ext eq "ogg")
    {
	return ID3FS::File::Ogg->new($path);
    }
    elsif($ext eq "flac")
    {
	return ID3FS::File::Flac->new($path);
    }
    else
    {
	print("Unknown extension: $ext\n");
	return undef;
    }
}

1;
