Mythfs-perl

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

If you get messages about missing dependencies, run:

<pre>
 $ <b>./Build installdeps</b>
</pre>

and then "sudo ./Build install". See Fuse Notes if you get
Fuse-related errors when attempting to install dependencies.

For best performance, Perl must have been compiled with support for
IThreads. In addition, you will need at Fuse version 0.15 to run
correctly under Perl version >= 5.14.  Threading will be automatically
disabled if not available. See Fuse Notes for additional information.

Usage
=====

To mount the recordings contained on the master backend "MyHost" onto
a local filesystem named "/tmp/mythfs" use this command:

<pre>
 $ <b>mkdir /tmp/mythfs</b>
 $ <b>mythfs.pl MyHost /tmp/mythfs</b>
</pre>

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:

<pre>
 $ <b>fusermount -u /tmp/mythfs</b>
</pre>

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.

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.

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:

<pre>
 % <b>ls -lR  /tmp/mythfs</b>
 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
</pre>

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.

Customizing the Directory Listing
=================================

You may customize the directory listing by providing a pattern for
naming each recording using the -p option. For example:

 $ mythfs.pl -p '%C/%T:%S (%od-%ob-%oY)' mythbackend ~/Myth

This will create filenames that look like this:



( run in 1.324 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )