A fuse filesystem for accessing and managing mythtv recordings
mythtvfs [-h|--help] mythtvfs [-V|--version] mythtvfs [options] -o host=BACKEND ORIGPATH MOUNT
\*(C`BACKEND\*(C' is the hostname of the MythTV backend system
\*(C`ORIGPATH\*(C' is the path to MythTV's recordings directory
\*(C`MOUNT\*(C' is a location to mount the new \s-1FUSE\s0 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
mythtvfs is a \*(L"filesystem in userspace\*(R" (\s-1FUSE\s0) interface to the MythTV Personal Video Recorder (\s-1PVR\s0) 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 \s-1UNIX\s0 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 \s-1GUI\s0 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 \s-1GUI\s0 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.
After installing the \s-1FUSE\s0 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 \s-1NFS\s0 on the backend, export the MythTV video repository (typically /var/lib/mythtv) and establish an \s-1NFS\s0 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 \s-1EXAMPLES\s0 below for more alternatives.
Filenames in the MythTVfs filesystem default to being named based on their \s-1TV\s0 Program's metadata. The elements are contained by the brace symbols (\*(L"{}\*(R") and have the original filename embedded, and then end with \*(L".mpg\*(R".
{\s-1SERIES_TITLE\s0}{\s-1AIRED\s0}{\s-1EP_TITLE\s0}{\s-1REC_DATE\s0}{\s-1CHAN\s0}{\s-1DURATION\s0}{\s-1DESC\s0}FILE.mpg
Where \*(L"\s-1REC_DATE\s0\*(R" has the format \*(L"Sat Jan 24 22:58:00 2009\*(R", and \*(L"\s-1AIRED\s0\*(R" has the format \*(L"2005-03-31\*(R". \*(L"\s-1DURATION\s0\*(R" is measured in seconds, and \*(L"\s-1CHAN\s0\*(R" is the shortened channel \*(L"callsign\*(R". \*(L"\s-1FILE\s0\*(R" is the original MythTV filename for storage (e.g. \*(L"1013_20051207210000_20051207220000.nuv\*(R"). The file ends with \*(L".mpg\*(R" 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 \*(L"format\*(R" option.
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 \*(L"GoBack\*(R" path that matches your MythTVfs mount point, and it will automatically extract all the metadata from the filename.
Prints a synopsis of program usage and exits.
Prints the program version and exits.
Enable debug output (implies -f)
Foreground operation
disable multi-threaded operation
-o host=HOST MythTV backend hostname -o port=PORT MythTV backend port number -o format=FORMAT Format to use for filenames. Defaults to \*(L"{%T}{%a}{%S}{%s}{%c}{%d}{%D}%f.mpg\*(R". 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=\*(L"{%T}{%a}{%S}{%s}{%c}{%d}%f.mpg\*(R", except for a slight change in the internal format of %s. -o logfile=FILE write verbose logging to \s-1FILE\s0 -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 \s-1FUSE\s0 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: \s-1UTF-8\s0) -o to_code=CHARSET new encoding of the file names (default: \s-1ANSI_X3\s0.4-1968)
The following format tags are undersood:
%a Airdate, e.g. \*(L"1961-11-17\*(R", defined by -o date_format
%c Station callsign, e.g. \*(L"\s-1SCIFI\s0\*(R"
%D Show description, e.g. \*(L"The Earth begins moving closer to the sun.\*(R"
%d Show duration in seconds, e.g. \*(L"1800\*(R"
%f mythtv file basename, e.g. \*(L"1029_20090201053000.mpg\*(R".
%S Show subtitle, e.g. \*(L"The Midnight Sun\*(R"
%s Start time, e.g. \*(L"05.30 \s-1AM\s0 Sun Feb 01, 2009\*(R", defined by -o datetime_format
%T Show title, e.g. \*(L"The Twilight Zone\*(R"
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 \s-1NFS\s0 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
Show a listing of all recorded titles and number of episodes for each:
# ls | cut -d} -f 1 | sed -e \*(L"s/{//\*(R" | 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 \*(L"s/{//g\*(R" | sed -e \*(L"s/}/ /g\*(R" | 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 \*(L"s/.*\}\(.*\)\.mpg$/\1/\*(R" | head -1 | xargs mplayer
http://outflux.net/software/pkgs/mythtvfs-fuse/ <http://outflux.net/software/pkgs/mythtvfs-fuse/>
Check that the mythtv system's mysql process is running. Doublecheck that the second argument to mythtvfs is a valid hostname that is network accessible. Try running `ping myhost`. 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. 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.
Please report bugs directly to the author.
mythtvfs was written initially with the motivation to connect mythtv into Galleon.
Copyright (C) 2005-2008 by Kees Cook
mythtvfs is free software; you can redistribute it and/or modify it under the terms of the \s-1GPL\s0.
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.