Mythfs-perl
view release on metacpan or search on metacpan
bin/mythfs.pl view on Meta::CPAN
use "-p %T/%S" instead of "--pattern=%T/%S".
If you request unmounting (using --unmount or -u), the first
non-option argument is interpreted as the mountpoint, not the backend
hostname.
=head1 MORE INFORMATION
This is a FUSE filesystem for MythTV (www.mythtv.org). It uses the
Myth 0.25 API to mount the TV recordings known to a MythTV master
backend onto a virtual filesystem on the client machine for convenient
playback with mplayer or other video tools. Because it uses the MythTV
network protocol, the recordings do not need to be on a shared
NFS-mounted disk, nor does the Myth database need to be accessible
from the client.
=head2 Usage
To mount the recordings contained on the master backend "MyHost" onto
a local filesystem named "/tmp/mythfs" use this command:
$ mkdir /tmp/mythfs
$ mythfs.pl MyHost /tmp/mythfs
The script will fork into the background and should be stopped with
fusermount. The mounted /tmp/mythfs directory will contain a series of
human-readable recordings organized by title (directory) and subtitle
(file).
To unmount:
$ fusermount -u /tmp/mythfs
or
$mythfs.pl -u /tmp/mythfs
NOTE: Do NOT try to kill the mythfs.pl process. This will only cause a
hung filesystem that needs to be unmounted with fusermount.
There are a number of options that you can pass to mythfs.pl,
including the ability to customize the filesystem layout and set the
interval that the backend is checked for new and deleted
recordings. Call mythfs.pl with the -h option for the complete help
text.
=head2 Local Recordings
The default behavior of this filesystem is to use the Myth API to
stream recordings across the network when you attempt to read from
them. This is done in an efficient way that fetches just the portion
of the file you wish to read. However, if the underlying recording
files are directly accessible (either in a regular director or via an
NFS mount), you can get better performance by passing mythfs.pl the
--mountpt option with the path to the directory in which the
recordings can be found. The filesystem will then be set up as a set
of symbolic links that point from a human readable file name to the
recording file.
The main advantage of creating symbolic links is that NFSv4 can be
noticeably faster than the backend streaming protocol -- about a 25%
improvement on my local network. The main limitation is that this mode
does not understand storage groups, so all recordings need to be
located in a single storage group in a locally-accessible
directory. However if a recording file is not found in local
directory, then mythfs.pl will fall back to the streaming protocol, so
the recording is accessible one way or another.
=head2 The Default Directory Layout
Recordings that are part of a series usually have a title (the series
name) and subtitle (the episode name). Such recordings are displayed
using a two-tier directory structure in which the top-level directory
is the series name, and the contents are a series of recorded
episodes. The corresponding pattern (as described in the next section)
is "%T/%S".
For recordings that do not have a subtitle, typically one-off movie
showings, the recording is placed at the top level.
If needed for uniqueness, the channel number and time the recorded was
started is attached to the filename, along with an extension
indicating the recording type (.mpg or .nuv). The file create and
modification times correspond to the recording start time. For
directories, the times are set to the most recent recording contained
within the directory.
Here is an example directory listing:
% ls -lR /tmp/mythfs
total 35
-r--r--r-- 1 lstein lstein 12298756208 Dec 30 00:00 A Funny Thing Happened on the Way to the Forum.mpg
-r--r--r-- 1 lstein lstein 14172577964 Dec 25 16:00 A Heartland Christmas.mpg
dr-xr-xr-x 1 lstein lstein 5 Mar 11 03:00 Alfred Hitchcock Presents
dr-xr-xr-x 1 lstein lstein 8 May 2 00:00 American Dad
...
/home/lstein/Myth/Alfred Hitchcock Presents:
total 3
-r--r--r-- 1 lstein lstein 647625408 Dec 25 15:30 Back for Christmas.mpg
-r--r--r-- 1 lstein lstein 647090360 Dec 7 00:00 Dead Weight.mpg
-r--r--r-- 1 lstein lstein 660841056 Mar 11 03:00 Rose Garden.mpg
-r--r--r-- 1 lstein lstein 647524452 Dec 25 00:00 Santa Claus and the 10th Ave. Kid.mpg
-r--r--r-- 1 lstein lstein 649819932 Dec 27 00:00 The Contest of Aaron Gold.mpg
/home/lstein/Myth/American Dad:
total 4
-r--r--r-- 1 lstein lstein 3512038152 Apr 24 00:00 Flirting With Disaster.mpg
The size of directories corresponds to the number of recordings (not
counting subdirectories) contained within it. The modification time of
directories is the start time of the most recent recording contained
within it.
Two automatically-created files are always present at the top level of
the directory. "STATUS" contains a human-readable description of what
happened the last time the script attempted to refresh the list of
recordings from the backend. It is useful in diagnosing connection
problems. ".fuse-mythfs" contains version and copyright information
for this script, and can be used to detect if the Myth filesystem is
mounted.
=head2 Customizing the Directory Listing
You may customize the directory listing by providing a pattern for
naming each recording using the -p option. For example:
( run in 1.203 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )