NAME
mythtvfs - a FUSE filesystem for accessing and managing MythTV
recordings
SYNOPSIS
mythtvfs [-h|--help]
mythtvfs [-V|--version]
mythtvfs [options] -o host=BACKEND ORIGPATH MOUNT
"BACKEND" is the hostname of the MythTV backend system
"ORIGPATH" is the path to MythTV’s recordings directory
"MOUNT" is a location to mount the new FUSE filesystem mythtvfs will
establish.
Options:
-h, --help prints a help message and exits
-V, --version prints the version and exits
-d, -o debug enable debug output (implies -f)
-f foreground operation
-s disable multi-threaded operation
-o host=HOST MythTV backend hostname
-o port=PORT MythTV backend port number
-o format=FORMAT format to use for filename
-o date_format=FORMAT format to use for date fields (i.e. airdate)
-o datetime_format=S format to use for date+time fields (i.e. start)
-o short-display shorter filename display format
-o logfile=FILE write verbose logging to FILE
-o backend-version=N force a specific backend version
-o program-width=N force a specific backend program width
-o invalid-chars=STR list of characters not allowed in filenames
-o replacement-char=C character to replace invalid characters with
-o <option[=value]> passes FUSE-specific options to the FUSE system
DESCRIPTION
mythtvfs is a "filesystem in userspace" (FUSE) interface to the MythTV
Personal Video Recorder (PVR) software, that allows you to interact
with mythtv as if it were a file system. It creates an overlay
filesystem that encodes recording metadata (title, episode,
description, etc.) into a filename so that systems that do not natively
talk to MythTV can still get information about a given show. This
allows use of standard UNIX programs (ls, grep, cut, sort) to search
and select programs, and permits running video software like mplayer
directly from the command line rather than via the normal MythTV GUI
frontend.
The value of this is that it enables scripting of MythTV interactions
using any scripting language, through standard file system type
operations. Examples could include: a bash script for grepping through
the listings to find a show and play it with mplayer; a Perl script to
encode and copy episodes of your favorite television shows onto a video
iPod; a Python script that downsamples/compresses recordings of a given
tv series more than a month old to save disk space; a Ruby program to
generate an alternate GUI interface to list available recordings and
allow playing them via mplayer.
This may also be useful for users wishing to access mythtv and play
recordings from systems that cannot run mythtv (such as if they’re
running different Linux distros).
A design goal is to provide compatibility with the in-filename metadata
extraction capabilities in Galleon. See Filename Structure below.
Usage
After installing the FUSE libraries and kernel modules, mythtvfs can be
built using the standard ‘./configure && make‘.
Unless your MythTV backend is running locally, you will also need to
enable NFS on the backend, export the MythTV video repository
(typically /var/lib/mythtv) and establish an NFS mount locally (at,
say, /srv/myth).
MythTVfs can then be started from the command line as root:
mythtvfs -o host=mythtv.my.network /srv/myth/recordings /media/mythtvfs
or you can mount mythtvfs via fstab, for example:
mythtvfs#/media/mythtvfs /srv/myth/recordings fuse noauto,host=mythtv.my.network 0 0
See EXAMPLES below for more alternatives.
Filename Structure
Filenames in the MythTVfs filesystem default to being named based on
their TV Program’s metadata. The elements are contained by the brace
symbols ("{}") and have the original filename embedded, and then end
with ".mpg".
{SERIES_TITLE}{AIR_DATE}{EPISODE_TITLE}{RECORD_DATE}{CHANNEL}{DURATION}{DESCRIPTION}FILE.mpg
Where "RECORD_DATE" has the format "Sat Jan 24 22:58:00 2009", and
"AIR_DATE" has the format "2005-03-31". "DURATION" is measured in
seconds, and "CHANNEL" is the shortened channel "callsign". "FILE" is
the original MythTV filename for storage (e.g.
"1013_20051207210000_20051207220000.nuv"). The file ends with ".mpg"
because Galleon will only recognize file extensions that it expects the
TiVo to be able to play.
If you dislike the default filename format, you can change it using the
"format" option.
Hooking to Galleon
You’ll need a version of Galleon that understands this file format
layout. A patch against 2.1.0 is available on the MythTVfs homepage.
Just add a "GoBack" path that matches your MythTVfs mount point, and it
will automatically extract all the metadata from the filename.
OPTIONS
-h, --help
Prints a synopsis of program usage and exits.
-V, --version
Prints the program version and exits.
-d, -o debug
Enable debug output (implies -f)
-f Foreground operation
-s disable multi-threaded operation
-o option[=value]
-o host=HOST MythTV backend hostname
-o port=PORT MythTV backend port number
-o format=FORMAT Format to use for filenames. Defaults
to "{%T}{%a}{%S}{%s}{%c}{%d}{%D}%f.mpg". See below for what
the various tags mean.
-o date_format=S Format to use within date fields, i.e.
airdate. These tags follow strftime(1) rules.
-o datetime_format=S Format to use within date+time fields,
i.e. start. These tags follow strftime(1) rules.
-o short-display shorter filename display format.
Equivalent to setting format="{%T}{%a}{%S}{%s}{%c}{%d}%f.mpg",
except for a slight change in the internal format of %s.
-o logfile=FILE write verbose logging to FILE
-o backend-version=N force a specific backend version
-o program-width=N force a specific backend program width
-o invalid-chars=STR list of characters not allowed in
filenames
-o replacement-char=C character to replace invalid characters
with
Other options passed directly to the FUSE system:
-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 subtype=NAME set filesystem type
-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 [no]auto_cache enable caching based on modification
times
-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)
-o ac_attr_timeout=T auto cache timeout for attributes
(attr_timeout)
-o intr allow requests to be interrupted
-o intr_signal=NUM signal to send on interrupt (10)
-o modules=M1[:M2...] names of modules to push onto filesystem
stack
-o max_write=N set maximum size of write requests
-o max_readahead=N set maximum readahead
-o async_read perform reads asynchronously (default)
-o sync_read perform reads synchronously
-o subdir=DIR prepend this directory to all paths
-o [no]rellinks transform absolute symlinks to relative
-o from_code=CHARSET original encoding of file names
(default: UTF-8)
-o to_code=CHARSET new encoding of the file names (default:
ANSI_X3.4-1968)
Format tags
The following format tags are undersood:
%a Airdate, e.g. "1961-11-17", defined by -o
date_format
%c Station callsign, e.g. "SCIFI"
%D Show description, e.g. "The Earth begins moving
closer to the sun."
%d Show duration in seconds, e.g. "1800"
%f mythtv file basename, e.g.
"1029_20090201053000.mpg".
%S Show subtitle, e.g. "The Midnight Sun"
%s Start time, e.g. "05.30 AM Sun Feb 01, 2009",
defined by -o datetime_format
%T Show title, e.g. "The Twilight Zone"
EXAMPLES
Filesystem Mount Examples
To create a /media/mythtvfs on a local MythTV system (both backend and
frontend are on the same system)
mythtvfs -o host=localhost /var/lib/mythtv/recordings /media/mythtvfs
For mounting against a remote host named ’sparky’, with its mythtv dir
NFS mounted locally at /myth, you might do:
mythtvfs -o allow_other,host=sparky /myth/recordings /media/mythtvfs
If you prefer a different file name format:
mythtvfs -o host=localhost,format="%T - %S - %s.mpg" /myth /mythtvfs
Command Line Use
Show a listing of all recorded titles and number of episodes for each:
# ls | cut -d} -f 1 | sed -e "s/{//" | uniq -c
23 Dark Angel
7 Nature
4 Survivorman
26 The Colbert Report
42 The Daily Show With Jon Stewart
Listing Nature programs sorted by original air date with newest first:
# ls {Nature}* | cut -d} -f 2,3 | sed -e "s/{//g" | sed -e "s/}/ /g" |
sort -r
2007-11-11 The Cheetah Orphans
2007-11-04 In the Valley of the Wolves
2007-10-28 Silence of the Bees
2007-02-11 Supersize Crocs
2005-02-13 From Orphan to King
2005-01-09 Violent Hawaii
2004-02-08 Diamonds
Play the oldest episode of Dark Angel by original air date:
# ls {Dark\ Angel}* | cut -d} -f 2,8 | sort -r | \
sed -e "s/.*\}\(.*\)\.mpg$/\1/" | head -1 | xargs mplayer
SEE ALSO
<http://outflux.net/software/pkgs/mythtvfs-fuse/>
ERRORS
No listings in /media/mythtvfs, but files present in /myth/recordings
Check that the mythtv system’s mysql process is running.
"myhost: Connection timed out"
Doublecheck that the second argument to mythtvfs is a valid hostname
that is network accessible. Try running ‘ping myhost‘.
"fuse: bad mount point ‘/media/mythtvfs’: Transport endpoint is not
connected"
Something appears to have killed the mythtvfs process or mythtvfs has
otherwise died (perhaps due to a bug you should report?) rendering its
mount point unavailable. Try umount’ing the mount point, killing the
mythtvfs process (if it’s hung), and re-establishing the mythtvfs
process. In the worst case, it may be required to reboot the system to
get things back to normal.
"umount: /media/mythtvfs: device is busy"
A process is still accessing the mythtvfs file system, preventing it
from being unmounted. Try running ‘lsof | grep mythtvfs‘ to find
processes that may have open file handles in the file system.
BUGS
Please report bugs directly to the author.
HISTORY
mythtvfs was written initially with the motivation to connect mythtv
into Galleon.
COPYRIGHT AND LICENSE
Copyright (C) 2005-2008 by Kees Cook
mythtvfs is free software; you can redistribute it and/or modify it
under the terms of the GPL.
Manpage Copyright (C) 2007 by Bryce Harrington (licensed under the same
terms as mythtvfs itself).
Format support based on work by Morty Abzug, and licensed under the
same terms as mythtvfs itself.