[mythtv-users] mythtv on 2 computers and filenames

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Nov 26 12:43:11 UTC 2018


On Mon, 26 Nov 2018 11:20:52 +0000, you wrote:

>On 26/11/18 10:50, Simon Hobson wrote:
>> Klaus Becker <colonius at free.fr> wrote:
>> 
>>> It's an old laptop, sound does not work. The desktop computer is much better.
>> 
>> That doesn't matter for using the laptop as the backend - it just hosts the DB and files etc.
>> 
>>> And I want both mythtv installations - on laptop and desktop - to be independant.

You can create a batch file to switch the config.xml file for
mythfrontend between one for the local machine and one that gets
mythfrontend to run from the laptop database and mythbackend.

>> Fair enough. But if you could use both together, then I think you'd find it a lot easier - literally just power up the frontend and without any messing around you'd have all your recordings available.
>> 
>
>I don't know about Klaus's setup, but my laptops don't have storage for 
>many hours of recordings.
>
>I didn't mention mythexport.  I think it did the same sort of thing, but 
>with closer Myth integration.  Perhaps it was/is a mythbuntu-only program?

Mythexport will export the database for a recording as a .sql file and
also a copy of the recording file.  They can be moved to another
MythTV system running the same version of the database, and mythimport
can be used to import the .sql file into the local database.  I do
this from my main MythTV box to my external hard drives for my laptop,
so I can take recordings with me when I am away from home.  They
currently support MythTV versions 0.28, v29 and likely v30 (as it has
not had any database changes).

In Klaus' case, he would be wanting to move the recordings from his
laptop to his main MythTV box.  Mythexport can certainly do that. What
I would set up would be a network connection between the laptop and
the main MythTV box so that the laptop mythexport can export files to
directly to an import directory on the main box.  The import directory
should be on the same partition as a recordings storagegroup
directory.  Then when a recording has been exported, mythimport will
just read the .sql file into the local database, and move the
recording file (usually *.ts) from the import directory to the
recording directory on the same partition, so mythbackend can see the
file.

See my mythimport/mythexport web page:

http://www.jsw.gen.nz/mythtv/mythimport.html

However, please be aware that my SMTP/Web server box has just died
tonight (the fan on the video card stopped), so I am currently running
my servers as a virtual machine on my MythTV box.  As soon as my new
video card arrives, I will be moving the servers back over to their
own box.  So there will likely be random down time when my servers are
unavailable - if so, please just try again later.

Complications:

1) If you are running Debian, as I believe Klaus is, then the Ubuntu
mythexport and mythimport packages may not install, or may not install
correctly.  So the *.deb files may need to be unpacked and manually
installed in the right places.

2) Mythexport requires that Apache be installed as it uses a web page
to tell it what and how to export things.  It is written in Perl so
needs Perl installed.  Mythimport requires Python and the MythTV
Python libraries.

3) If you are running Ubuntu 18.04, there is a problem with how the
Perl path to the Mythexport *.cgi files is found.  As installed, in
Ubuntu they are in:

/usr/share/mythtv/mythexport

I found that for them to find each other in that directory, I had to
edit each *.cgi file and add a line near the top (with the other "use"
lines) that says:

use lib '.';

That tells them to look in the current directory for the other
Mythexport *.cgi files.  If you are running a distro that has had the
same change to Perl as the 16.04 to 18.04 upgrade had, you will likely
need to do this.  You can tell if you need this change by looking in
the Apache log files for errors from mythexport where it says it can
not find one of those files.

Once mythexport is working manually, it should be possible to have it
work automatically by creating a batch file that does the commands
that mythexport uses to export the .sql file and recording file.  That
batch file could be attached to the MythTV event that happens at the
end of a recording, to automatically do the export to the main
machine.  The trick would be to copy the recording file first, then do
the export to the .sql file.  That way, if you run mythimport on the
other machine as an export is happening, there would be nothing bad
that would happen.  The export of the .sql file would be a two step
operation - first do the database export, but use a different
extension from .sql (say .sql.tmp).  Then when the database export has
completed, rename the .sql.tmp file to .sql.  Renaming is normally an
atomic operation - the operating system ensures that everything is
locked while it is happening, so that you can not see the old and new
name at the same time.  It would then be possible to set up the main
machine so that it automatically created an event whenever a .sql file
appeared in the import directory, and that event would run mythimport.


More information about the mythtv-users mailing list