NAME

FFRIndexed - SQL Index for your files

SYNOPSIS

In the near future, there should be a File::Find::Rule-like interface to the SQL database (hence the ugly prefix FFR), but for now you need to construct queries conforming to the whims of the SQL::Abstract library.

  use FFRIndexed;
  my $idx = FFRIndexed->new( create_if_needed => 1 );

  $idx->scan('/home/media/mp3/');
  # this will rescan all files and stat them ...

  my $files = $idx->query( { mime_type => 'audio/mpeg', artist => 'Jamiroquai' });
  printf "%s - %s - %s\n", $_->album, $_->title, $_->uri for @$files;

PLUGINS

The main module itself provides almost no functionality and delegates all the heavy lifting to plugins.

There are some remaining questions about plugins:

Can/should we reorder the plugins so the two well-known plugins "File" and "MimeType" come first?

__PACKAGE__->new

Creates a new instance of an index. The following parameters are accepted:

scan

Forces a rescan of all directories (or files?)

create

Creates the table. Wipes all data from the table should it already exist.

create_if_needed

Creates the table if needed.

table

The name of the table where the index gets stored in. Default is fileindex.

dsn

The DBI DSN to use. Default is dbi:SQLite:dbname=$0.sqlite.

If you want an alternate database to be used, you can change that here, or with the dbh parameter, if you already have a database handle.

dbh

If you want to provide an alternate database other than SQLite, you can supply the $dbh you get from a DBI connect call.

row_class

The class into which returned rows are blessed into. This allows you to specify a Class::DBI or DBIx::Class subclass. Default is FFRIndexed::File, which is a lightweight Class::DBI reimplementation.

verbose

Outputs actions to the screen.

stale INFO

Returns a list of columns in the database that are to be considered stale for the hash reference INFO. The returned elements of the list are hashes with the keys plugin, column and, if applicable, new_value and stale_value.

find PARAMS

This will (one day) become the File::Find::Rule drop-in replacement. Not implemented yet.

AUTHOR

Max Maischein, <corion@cpan.org>

SEE ALSO

File::Find::Rule, Class::DBI, Table::Denormalized, SQL::Abstract::Clauses