Name

pytagsfs — filesystem mapping media files to an arbitrary directory structure

Synopsis

pytagsfs [OPTIONS] {sourcedir} {mountpoint}

Description

pytagsfs is a FUSE filesystem that was designed to present multiple views of tagged media files. For instance, a directory tree containing audio files could be mapped to a new directory structure organizing those same files by album, genre, release date, etc.

To get a feel for what's possible, see the section called “Examples”.

Options

General Options

-o opt[,opt...]

mount options

-h, --help

show summary of options and exit

-v, --version

show version of program and exit

pytagsfs Options

-o iocharset=ENCODING

mounted tree character encoding (default utf-8)

-o source_iocharset=ENCODING

source directory character encoding (default utf-8)

-o srcfilter

adds a source path filter; may be specified more than once (see the section called “Path Filters”)

-o dstfilter

adds a destination path filter; may be specified more than once (see the section called “Path Filters”)

-o format

format string for destination paths (see the section called “Format Strings”)

-o verbosity

log level; must be one of "debug", "info", "warning", "error", "critical"; defaults to "warning"

FUSE Options

-d, -o debug

enable debug output (implies -f)

-f

foreground operation

-s

disable multi-threaded operation

-o allow_other

allow access to other users

-o allow_root

allow access to root

-o nonempty

allow mounts over non-empty file/dir

-o default_permissions

enable permission checking by kernel

-o fsname=NAME

set filesystem name

-o large_read

issue large read requests (2.4 only)

-o max_read=N

set maximum size of read requests

-o hard_remove

immediate removal (don't hide files)

-o use_ino

let filesystem set inode numbers

-o readdir_ino

try to fill in d_ino in readdir

-o direct_io

use direct I/O

-o kernel_cache

cache files in kernel

-o umask=M

set file permissions (octal)

-o uid=N

set file owner

-o gid=N

set file group

-o entry_timeout=T

cache timeout for names (1.0s)

-o negative_timeout=T

cache timeout for deleted names (0.0s)

-o attr_timeout=T

cache timeout for attributes (1.0s)

Format Strings

A format string must be specified for each pytagsfs mount. The format string determines the directory and file names in the resulting virtual filesystem. Format strings contain zero or more special character sequences, much like the date and time format strings supported by date. These character sequences always begin with a percent sign (%).

Substitutions

Substitution sequences consist of a percent sign followed by a single ASCII character, like "%a". When formatting a filename, each sequence will be replaced with a parameter parsed from the file being represented. The parameter that is substituted is determined by the character following the "%".

The following formatting characters are supported:

f name of the original file
p name of the original file's parent directory
e extension of the original file
n track number; concise (like 7)
N track number; two digits with leading zeros (like 07)
a artist
t track title
l album title
y year of release
g genre

Modifiers

Format strings can be further extended to perform string translations on parameters prior to substitution. Such translations are indicated by the inclusion of a modifier character after the percent sign. For instance, "%^a" indicates an all-caps version of the artist name.

The full list of modifier characters follows:

^ UPPERCASE
_ lowercase
! Title Case

Conditional Expressions

Normally, any file for which a parameter required by the format string cannot be determined is implicitly excluded from the resulting filesystem. Conditionals can be used to express that these files should be included, but that those portions of the format string that cannot be rendered should be omitted or replaced.

Two types of conditional expressions may be used: "if" expressions and "if-else" expressions. The contents of an "if" expression are omitted unless all parameters within that expressions can be successfully evaluated. An "if-else" expression is similar, except that, if the expression does not evaluate, an alternative will be used instead. Use the following syntax:

%?expr%?
%?expr%:alt%?

Path Filters

Path filters can be used to limit the set of files presented by the filesystem using regular expressions. Files are filtered by source path or by destination path, inclusively (limiting the set of paths to those that match the regular expression) or exclusively (limiting the set of paths to those that do not match the regular expression).

Use the mount options srcfilter and dstfilter to filter by source path and destination path, respectively. Filters are inclusive unless the filter parameter starts with an exclamation point, in which case the regular expression is assumed to be the part of the parameter following the exclamation point.

Multiple filters of any kind may be used, and are applied in the order that they are specified on the command line. See the section called “Examples” for some sample filters.

Examples

View media files in src, with original filenames in a flat directory structure:

$ pytagsfs -o format='/%f' src mnt

View media files in src by album on mnt:

$ pytagsfs -o format='/%a/%f' src mnt

A more complex album-based view:

$ pytagsfs -o format='/%a - %l/%N %a - %t [%l].%e'

This is like above, but filters the result. I use this to display my files by album, but exclude compilations (which I've tagged to include a hyphen in the album name, like "various - album"):

$ pytagsfs -o \
  format='/%a - %l/%N %a - %t [%l].%e',\
  dstfilter='!^/[^/]* - [^/]* - [^/]*/' \
  src albums

I use this to display the compilations:

$ pytagsfs -o \
  format='/%l/%N %a - %t [%l].%e',\
  dstfilter='^/[^/]* - [^/]*/' \
  src compilations

Maybe you only want to see files that start with "a" and end in ".mp3"?

$ pytagsfs -o \
  format='/%f',dstfilter='^/a',dstfilter='\.mp3$' \
  src mnt

Unmounting

To unmount the filesystem use fusermount(1):

$ fusermount -u mnt
    

Bugs

Please report bugs on launchpad at http://launchpad.net/products/pytagsfs/+bugs.

See Also

fusermount(1), mount(8), umount(8), pytagfromfilename(1)