(2017-03-19 04:48)mackie Wrote: Thank you so much for this!
I came here to learn if what I want to do is supported and if so, what the best way to go about it is. I was happy to see you mostly answered my questions in reply #55 and recently took care of one of my concerns (Make all deletions of MythTV-DB entries respect DATABASE_ACCESS). I'm grabbing the updated tarball now to use in my developing workflow.
First, my process, then a request for recommenations :
1. MythTV auto commflags episodes after recording.
2. Use the editor in mythfrontend to generate and save a proper cutlist.
3. User Job script which does a lossless transcode using mythtranscode and --honorcutlist and then uses Handbrake to transcode to x264 MKV. At this point, I'm hoping to add m2k to my User Job to finish up the automation, but might need to put it into a separate User Job to give time for sanity checks on the transcoded files before deleting recordings.
So far my tests are working, but am I doing the following in the "right" way? Should I be using --disconnect as stuartk does in post #55?
myth2kodi /path/to/handbrakeoutputfile.mkv <title> <subtitle> (title and subtitle are already available as variables in my User Job) (PROCESS_RECORDING_MODE='MOVE', SYMLINK='Disabled', CommercialMarkup='Disabled', GuideDataType='SchedulesDirect'
myth2kodi --delete /path/to/mythtv/recordings/<chanid>_<starttimeutc>.mpg (these variables also already available)
As I said, things seem to be working - the recorded show disappears from MythTV and goes to my Kodi storage, but I get paranoid.
I have never done things in the way you describe, so I'm uncertain about an aspect of MythTV's behaviour here:
Does calling Handbrake as part of a MythTV User Job result in MythTV associating "/path/to/handbrakeoutputfile.mkv
" with the recording?
For example, if you run myth2kodi --recording-info "/path/to/handbrakeoutputfile.mkv"
does it actually return data on the recording or does it issue some sort of "recording not found" error?
I assume it must be associated, otherwise when myth2kodi attempts to process "/path/to/handbrakeoutputfile.mkv
" it would fail with a database access error.
If the "/path/to/handbrakeoutputfile.mkv
" file is tracked by MythTV, then you need to be aware that if myth2kodi
was not confident about a MOVE when SYMLINK
, it tries to fall-back to SYMLINK=Enabled
, so that the processing can still be undone.
completely deletes a recording, including following symbolic links if they are present, so if you had MOVE
d with SYMLINK
then using --delete
will remove all trace of the recording. So in this case, you really do not
want to run --delete
as it will completely delete the recording.
In the case that myth2kodi is confident in its processing, then, with SYMLINK=Disabled
the recording is deleted from MythTV, making your call to myth2kodi --delete "/path/to/mythtv/recordings/<chanid>_<starttimeutc>.mpg"
redundant. If it is not confident, then myth2kodi attempts to add symbolic-link and your --delete
will most likely delete the recording entirely -- which I assume is not what you want.
There are two ways to proceed:
Continue as you are, that is MOVE
Then, for any recordings that have symlinks added because myth2kodi was not confident in its processing, you can manually check the recordings for which there has been a link created from /path/to/handbrakeoutputfile.mkv
to the moved file and, if you are happy with myth2kodi
's processing (the moved recording has the correct name), run myth2kodi --disconnect
to permanently disconnect the recording from MythTV. The --disconnect
flag is basically the same as --delete
with the key exception that it severs the link between MythTV and the recording file before calling delete, so that the myth2kodi processed file remains; or
A more conservative option, if you are concerned about myth2kodi getting things wrong, would be to run in MOVE mode with SYMLINK
and then manually check each recording processed by myth2kodi before using --disconnect
Either way, do not
unless you really want to permanently delete the recording and information associated with it.
(2017-03-19 04:48)mackie Wrote: Otherwise, I've experienced a couple of quirks with my Ubuntu 14.04.3 LTS system.
1. Since my mythtv ($Librarian) user is set to nologin, I do most m2k tasks with `sudo -u mythtv ...`. As a result, the install.sh script fails for me when it tries to sudo as the mythtv user instead of my admin user. Not really a problem to copy over and edit files manually.
2. Ubuntu really doesn't like your use of realpath at all --diagnostics didn't detect realpath, so I installed realpath as available in the regular repository and it passed --diagnostics, but complains as shown below when I run a --delete. I'm hoping the last two `rm` lines of this output are caused by the realpath error. If I can't satisfactorily find a good version of realpath, I'll try to experiment with changing myth2kodi.sh to remove the --no-symlinks. At first glance, it seemed like where realpath is used I can do that safely since I'm not using symlinks.
Thank you again for all the hard work that went into these scripts. I'm glad I don't have to reinvent a poorer quality wheel myself!
[email protected]:/home/mythtv/.myth2kodi$ sudo -u mythtv myth2kodi --delete /mnt/myth/rec2/recordings/1051_20170204020000.mpg
WARNING: Attempting to delete recording: '/mnt/myth/rec2/recordings/1051_20170204020000.mpg'
This will PERMANENTLY delete the recording, associated files
and the associated MythTV database entry.
Are you sure you want to continue?
Requested permanent deletion: 'y' to continue or 'n' to exit... y/(n):>y
WARNING: find_file_link_pairs(): Cannot find link to: '/mnt/myth/rec2/recordings/1051_20170204020000.mpg'
This probably means that the file was not successfully processed by myth2kodi.
realpath: unrecognized option '--no-symlinks'
realpath [-s|--strip] [-z|--zero] filename ...
INFO: delete_mythtv_database_entry_mysql(): REMOVING: '1051_20170204020000.mpg'; THUMBNAILS; DATABASE ENTRIES.
rm: cannot remove ‘.’: Is a directory
rm: cannot remove ‘..’: Is a directory
1. I'll look into whether there is a clean way to handle your use-case for the install script. Do I understand correctly that you are running:
sudo -u mythtv ./install.sh
and then attempting to do a system wide install (that is, install to /usr/local/bin
)? EDIT: I've had a look at this and I can't reproduce an issue when running the install script using sudo -u
from another user... Could you post the install log from when it failed for you? Or better yet, enable debugging (set LOGLEVEL=3 on line 66 of install.sh) and try again and post that log?
2. The "realpath: unrecognized option '--no-symlinks'" is an Ubuntu specific bug I was not aware of, it looks like it should be easily fixed as "--no-symlinks", at least on my system, is just another name for the same command as "-s" or "--strip". I'll include the change in an bug-fix release. And yes, hopefully the the two rm
errors are just a result of realpath having failed, but I'll look into it and revise the code to protect against this in the future.