[mythtv-users] mythtv on 2 computers and filenames

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Nov 26 17:27:01 UTC 2018


On Mon, 26 Nov 2018 17:45:19 +0100, you wrote:

>
>
>Le 26/11/2018 à 13:43, Stephen Worthington a écrit :
>> 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.
>
>
>Hi Stephen,
>
>thanks for all these explanations.
>
>I had another idea:
>
>laptop and desktop are quite near in the same room and of course, there 
>is network between them.
>
>Is it possible to tell mythtv on both machines to record episodes on the 
>same external usb-disk  and to acceed films from the desktop machine 
>even if the laptop is down ?
>
>This would perhaps the best and most simple solution.
>
>bye
>
>Klaus

You can set up one of the PCs with an external drive, and then get
that PC to record directly to the external drive.  And you can set up
a network connection from the other PC and get it to record over that
connection to the external drive.  The two PCs would have to record to
different directories, or the mythbackends could become very confused
about the filenames.  However, if the drive was on a USB 2 connection,
that would make it too slow to record very well.  A USB 3 drive would
be fine.  You would have to make sure that not too many recordings
were made at the same time to the drive - two recordings from each PC
would likely be too much.  And you would have to be careful that you
did not use too much network bandwidth for other things while
recordings were happening over the network.  If you copied a large
file at the same time as a network recording was happening, you could
prevent the recording from writing to disk properly.  By setting up a
separate storage group for the external drive, you could tell
mythbackend which recording rules should record to that drive and
which should record to the usual internal drive(s).

You would be able to make the directory the files are in part of the
videos storage group, so the files could be seen from Watch Videos.
But I do not see how that would help you.  All the recordings would
still have only the usual <chanid>_<starttime>00.ts type filenames, so
you would still have to use the database of the box they were recorded
from to tell you what the files are.  So you would still need to get
mythlink or a similar program working to create usable names for the
files.  At least the files would then be on the machine you want to
watch them on, so that is a little better than before.


More information about the mythtv-users mailing list