ANALYZE after adds
[id3fs.git] / lib / ID3FS / DB.pm
index d149b6a..15855b2 100644 (file)
@@ -94,6 +94,8 @@ sub find_db
     return $file;
 }
 
+sub base_dir { return shift->{base}; }
+
 sub create
 {
     my($self,$name)=@_;
@@ -136,6 +138,12 @@ sub checkschema
     }
 }
 
+sub analyze
+{
+    my $self=shift;
+    $self->cmd("ANALYZE");
+}
+
 sub enable_foreign_keys
 {
     my $self=shift;
@@ -443,7 +451,7 @@ sub add
     {
        ($pathpart, $filepart) = ($relpath =~ /(.*)\/(.*)/);
     }
-    my $file=ID3FS::AudioFile->new($path);
+    my $file=ID3FS::AudioFile->new($path, $self->{me});
     return unless(defined($file));
     my $artist=$file->artist();
     my $album=$file->album();
@@ -566,7 +574,6 @@ sub files_in
 {
     my ($self, $dir)=@_;
     $dir=~s/^$self->{base}\/?//;
-#    print "Munged dir: $dir\n";
     my $sql=("SELECT files.name FROM files\n" .
             "INNER JOIN paths ON files.paths_id=paths.id\n" .
             "WHERE paths.name=?\n");
@@ -584,7 +591,6 @@ sub prune_directories
     {
        my($path, $id)=@$pathpair;
        my $fullpath="$self->{absbase}/$path";
-#      print "PRUNING PATH $fullpath: ";
        unless(-d $fullpath)
        {
            push(@ids, $id)