specify max tag depth (default: 15)
[id3fs.git] / sbin / id3fsd
index 96a4f57..b46706a 100755 (executable)
@@ -10,16 +10,18 @@ use ID3FS::Fuse;
 use vars qw($me);
 $me=($0=~/(?:.*\/)?(.*)/)[0];
 
+our $VERSION="1.00";
 my $verbose=0;
 my $help=0;
 my $dbpath=undef;
+my $tagdepth=undef;
 
 Configure(qw(bundling no_ignore_case));
 my $optret=GetOptions(
-    "verbose|v"  => \$verbose,
-    "quiet|q"    => sub { $verbose=0; },
-    "help|h"     => \$help,
-    "database|db=s"  => \$dbpath,
+    "verbose|v"    => sub { $verbose++; },
+    "help|h"       => \$help,
+    "database|f=s" => \$dbpath,
+    "t|tagdepth=s" => \$tagdepth,
     );
 
 usage() if(scalar(@ARGV) != 2 || !$optret || $help);
@@ -27,65 +29,100 @@ usage() if(scalar(@ARGV) != 2 || !$optret || $help);
 my $source=shift;
 my $mountpoint=shift;
 
-my $db=ID3FS::DB->new($me, $dbpath, $source);
-my $fuse=ID3FS::Fuse->new($db, $source, $mountpoint, $verbose);
+my $db=ID3FS::DB->new($me, $verbose, 0, $dbpath, $source);
+exit unless($db);
+
+my $fuse=ID3FS::Fuse->new($db, $source, $mountpoint, $verbose, $tagdepth);
 $fuse->run();
 
 sub usage
 {
-    die("Usage: $me [-v] [-q] [-h] [--] file...\n".
-       " -v\tVerbose\n".
-       " -q\tQuiet (default)\n".
-       " -h\tThis help\n".
-       " --\tEnd of options\n");
+    die("Usage: $me [-vqh] [-f <dbfile>] [--] <sourcedir> <mountpoint>\n".
+       " -v\t\t\tVerbose (repeat for more verbosity)\n".
+       " -h\t\t\tThis help\n".
+       " -f|--database=FILE\tPath to database file\n" .
+       " --\t\t\tEnd of options\n");
 }
 
 __END__
 
 =head1 NAME
 
-program - description
+id3fsd - FUSE filesystem for browsing id3 tags
 
 =head1 SYNOPSIS
 
-B<> [I<-v>] [I<-q>] [I<-h>] [I<file>...]
+B<id3fsd> [B<-vh>] S<B<[-f >I<dbfile>]> [B<-->] I<SOURCEDIR> I<MOUNTPOINT>
 
 =head1 DESCRIPTION
 
+id3fsd provides a browsable filesystem of your music files, organised
+into sub-directories by id3 tags (or flac/ogg comments).
+
+An index should first be created with L<id3fs-index(1)>, then id3fsd
+can mount the files in I<SOURCEDIR> on the directory I<MOUNTPOINT>.
+
+If not explicitly specified (with B<-f>), the index is searched for
+at I<SOURCEDIR>/B<.id3fs>.
+
+The resulting filesystem is read-only. Tags appear as directories,
+and files appear as symlinks to the actual files in I<SOURCEDIR>.
+
+FIXME: better description, allow_others/fuse.conf, fstab, explain genre tag
+
 =head1 OPTIONS
 
 =over 4
 
 =item B<-v>
 
-Enable verbose operation.
-
-=item B<-q>
-
-Quiet (no output). This is the default.
+Enable verbose operation. Repeat for more verbosity.
 
 =item B<-h>
 
 Show a short help message.
 
+=item S<B<-f >I<FILE>> | S<B<--database=>I<FILE>>
+
+Use database in I<FILE>. The default is I<SOURCEDIR>/B<.id3fs>.
+
 =item B<-->
 
 End of options.
 
 =back
 
-=head1 FILES
+=head1 EXAMPLES
 
-=head1 ENVIRONMENT
+To mount an id3fs filesystem which indexes B<~/music/albums> on
+B<~/music/tags>:
 
-=head1 DIAGNOSTICS
+First create the index:
+
+    id3fs-index -v ~/music/albums
+
+If you have a large collection of music, this may take some time.
+
+Then create the mountpoint:
+
+    mkdir ~/music/tags
+
+and mount the filesystem:
+
+    id3fsd ~/music/albums ~/music/tags
+
+Then explore the tags in ~/music/tags/
+
+FIXME: fstab
 
 =head1 BUGS
 
-None known. Please report any found to ianb@erislabs.net
+Please report any found to ianb@erislabs.net
 
 =head1 SEE ALSO
 
+L<id3fs-index(1)>, L<http://fuse.sourceforge.net>
+
 =head1 AUTHOR
 
 Ian Beckwith <ianb@erislabs.net>