use strict;
use warnings;
use DBI;
+use ID3FS::File;
our $SCHEMA_VERSION=1;
sub add
{
my($self,$path)=@_;
+ my $file=ID3FS::File->new($path);
}
sub cmd
--- /dev/null
+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::Ogg->new($path);
+ }
+ else
+ {
+ print("Unknown extension: $ext\n");
+ return undef;
+ }
+}
+
+1;
--- /dev/null
+package ID3FS::File::Flac;
+
+use strict;
+use warnings;
+
+sub new
+{
+ my $proto=shift;
+ my $class=ref($proto) || $proto;
+ my $self={};
+ bless($self,$class);
+ # FIXME
+ print "FLAC UNIMPLEMENTED\n";
+ $self->{path}=shift;
+ return $self;
+}
+
+1;
--- /dev/null
+package ID3FS::File::Mp3;
+
+use strict;
+use warnings;
+
+sub new
+{
+ my $proto=shift;
+ my $class=ref($proto) || $proto;
+ my $self={};
+ bless($self,$class);
+
+ $self->{path}=shift;
+ return $self;
+}
+
+1;
+
--- /dev/null
+package ID3FS::File::Ogg;
+
+use strict;
+use warnings;
+
+sub new
+{
+ my $proto=shift;
+ my $class=ref($proto) || $proto;
+ my $self={};
+ bless($self,$class);
+ # FIXME
+ print "OGG UNIMPLEMENTED\n";
+ $self->{path}=shift;
+ return $self;
+}
+
+1;