X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=sbin%2Fid3fsd;h=9333c78e5d45b9fb2c64faece1fa651fd89aa041;hb=5083c8eb3103daaf471be64614df04ccf7bb55d7;hp=93d2d6c16326a2f33e58b1615c6ee0ed593fa277;hpb=994377a7cc7464bb0156a004b10ccf65df0cb89c;p=id3fs.git diff --git a/sbin/id3fsd b/sbin/id3fsd index 93d2d6c..9333c78 100755 --- a/sbin/id3fsd +++ b/sbin/id3fsd @@ -16,11 +16,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -use lib '/home/ianb/projects/id3fs/id3fs/lib'; +use lib '/home/ianb/projects/id3fs/id3fs/lib'; # FIXME: remove use strict; use Getopt::Long qw(Configure); use ID3FS::DB; use ID3FS::Fuse; +use POSIX; + use vars qw($me); $me=($0=~/(?:.*\/)?(.*)/)[0]; @@ -48,14 +50,31 @@ my $db=ID3FS::DB->new($me, $verbose, 0, $source, $dbpath); exit unless($db); my $fuse=ID3FS::Fuse->new($db, $source, $mountpoint, $verbose, $tagdepth); + +# disassociate from terminal +unless($verbose) +{ + my $pid=fork(); + if(defined($pid)) + { + exit if($pid); # parent + POSIX::setsid(); # child + } + else + { + print "$me: couldn't drop terminal: $!\n"; + } +} + $fuse->run(); sub usage { - die("Usage: $me [-vqh] [-f ] [--] \n". + die("Usage: $me [-vh] [-f ] [-t ] [--] \n". + " -t|--tagdepth=NUM\tMaximum number of tags in expression (default: 6)\n" . + " -f|--database=FILE\tPath to database file\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"); } @@ -107,18 +126,35 @@ You may need to be in the I group, or be root. =over 4 -=item B<-v> +=item I -Enable verbose operation. Repeat for more verbosity. +Directory containing actual audio files and database file F<.id3fs> +(unless otherwise specified with B<-f>). -=item B<-h> +=item I -Show a short help message. +Directory to mount the id3fs view of the files. + +=item SI> | SI> + +Maximum number of tags in an expression. A query with many ANDs and +NOTs can get quite slow. This option allows a cutoff before things get +too slow, as well as providing some eventual limit when processes +recurse into the filesystem. The default is 6. =item SI> | SI> Use database in I. The default is I/B<.id3fs>. +=item B<-v> + +Enable verbose operation. Repeat for more verbosity. If verbose is +enabled, id3fsd does not detach from the terminal. + +=item B<-h> + +Show a short help message. + =item B<--> End of options. @@ -142,6 +178,10 @@ Example paths: /krautrock/AND/year/1971/NOARTIST/unknown-track.mp3 /krautrock/AND/year/1971/TRACKS/01-Paperhouse.mp3 +id3fs supports OR, AND and NOT. NOT has the highest precedence, +followed by AND, so F is parsed as +(foo OR ((NOT bar) AND baz)). + =head2 Tags Tags are extracted from the B tag of audio files with @@ -150,37 +190,13 @@ L. Within the genre frame/comment, tags are separated by commas. Tags can have values, separated by a slash, eg I, -I. Certain tags are automatically filled in from other file -metadata, see L. - -=head2 Special Directories - -=over 4 - -=item B - -This is a special directory in the root of the filesystem, that -provides access to all the indexed files, regardless of tags assigned. - -=item B - -All tracks that match the given tag expression, whether they have an -assigned artist and album or not. - -=item B - -Tracks matching the given expression that do not have an artist tag. - -=item B - -Tracks matching the given expression that do not have an album tag. - -=back +I. Certain special tags are automatically filled in from +other file metadata. =head2 Special Tags -Several tags are automatically derived from other metadata in the -audio files: +The following tags are automatically derived from other metadata in +the audio files: =over 4 @@ -205,6 +221,30 @@ Type of audio file (mp3, ogg, flac). Always set. =back +=head2 Special Directories + +=over 4 + +=item B + +All tracks that match the given tag expression, whether they have an +assigned artist and album or not. + +=item B + +Tracks matching the given expression that do not have an artist tag. + +=item B + +Tracks matching the given expression that do not have an album tag. + +=item B + +This is a special directory in the root of the filesystem, that +provides access to all the indexed files, regardless of tags assigned. + +=back + =head1 FUSE AND MOUNTING AUTOMATICALLY For others to be able to view your id3fs mount(s), you need to set the @@ -224,27 +264,6 @@ traverse it. Ensure your backups, cron jobs, F, etc. are configured to exclude the mount point. -=head1 EXAMPLES - -To mount an id3fs filesystem which indexes B<~/music/albums> on -B<~/music/tags>: - -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/ - =head1 BUGS Please report any found to ianb@erislabs.net