Everend Posted October 14, 2015 Posted October 14, 2015 I'm using Sparkleyballs MythTV docker template to record TV onto my cache drive. Some of the recordings I would like to keep after watching so after recording I use his Handbreak docker to reencode them and transfer to another disk with the rest of my TV Shows playable through Kodi. MythTV saves recordings with a date code for a name. Mythlink.pl is a script that harvests the show and episode information from MythTV db and creates a symbolic link file. Now instead of referencing cryptic file names to the list of recordings in MythTV I can queue up shows for reencoding in handbreak by their show-episode file name. I can also see them sorted nicely in a unRAID user share; \\TOWER\mythtv\recordings\pretty The first challenge was to get mythlink.pl into the docker. As far as I could tell, it was not included in the docker template. For someone who actually knows any linux please suggest a better way of doing this. I found the source code for the script on the mythtv.org site (google search). opened a putty terminal into the unraid server as root then got into the docker container with this command docker exec -it MythTv bash navigated to the directory the script is supposed to be "/usr/share/doc/mythtv-backend/contrib/user_jobs/" (I suspect the script can be located somewhere else, but this is where my searching said it was supposed to be.) I created the file here by pasting it into a vi window. - There's got to be a better way of doing this. Once created, I had to modify the script because mythtv is inside a docker and the script is being run inside where the file mappings are different. Ultimately I use this command to execute the script. perl /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link /home/mythtv/recordings/pretty --format '%T/%T%-%S%-%y%m%d%H%i' If you run the script right away before modifying it the symbolic links point to 'var/lib/mythtv/recordings/' but outside of the docker that path doesn't work so none of the links work. I made the following changes to the script, using the vi editor while still inside the docker container bash. LINE 29 - added a new variable '$newmap' LINE 413 - I commented this line out and made my own version. $newmap = $show->{'local_path'}; $newmap =~ s/var\/lib/mnt\/user/; # symlink $show->{'local_path'}, "$dest/$name" # With mythtv running inside docker the paths are not mapped right. symlink $newmap, "$dest/$name" or die "Can't create symlink $dest/$name: $!\n"; vprint("$dest/$name"); } Next step is to run this script as a System Event so new links are created as shows are recorded.
Everend Posted October 18, 2015 Author Posted October 18, 2015 So setting it up as a system event is easier than I expected. RDP into the mythtv docker. Look to the mythtv support thread for info on how to do that. One note was that for a time RDP stopped working/connecting. To fix it I followed bungee91 & trurl advise http://lime-technology.com/forum/index.php?topic=43322.msg413871#msg413871 So once you've RDP into the docker, then start the backend setup. The last section is for 8. System Events. Scroll down through the list of system events until you get to "Recording Started Writing" and paste the perl code from the original post. Restart the backend and that's it. I tested it by starting a recording right away and it updated the list of pretty file names. The mythlink.pl documentation recommends specifying a chanel ID and start time in the mythlink.pl command so that it creates the link for only that new recording. I didn't do this because I like the idea of generating the whole folder of links each time, clearing out any old links. I suppose if I had hundreds of recordings it may take some time to do this each time but for only a few dozen recordings it regenerates the whole list of symlinks before I can hit refresh on the Windows Explorer window.
bah1976 Posted December 17, 2015 Posted December 17, 2015 FWIW I did this differently - I made a system job called MythLink with this command /var/lib/mythtv/migration/mythlink.pl --link "/var/lib/mythtv/recordings/parsed" --format "%T -S%qs2#%qe2 - %S" --filename "%FILE%" --separator "#" All my recording rules are set to run the MythLink job when the recording completes. That parsed folder gets all the links that plex TV Episode library then monitors - although I rarely watch recorded TV with anything but the myth frontend. Notice that my mythlink.pl is NOT in the /usr/share folder that you have it in - when your docker restarts that will disappear because it's part of the docker image. I put the .pl script in the path that is mapped out to my array so it'll stay there, and the job (and your system event) are defined in the DB that would also be on the array from the volume mapping.
Everend Posted December 22, 2015 Author Posted December 22, 2015 I moved mythlink.pl to my recordings folder. For some reason it fails to pick up all the files in the recordings folder when it runs as a user job (not sure why but it picks a date and only creates links for recordings after that date). However when I log into the docker and run it this way, it picks up everything. perl /home/mythtv/recordings/mythlink.pl --link /home/mythtv/recordings/pretty --format '%T/%T%-%S%-%y%m%d%H%i'
Recommended Posts
Archived
This topic is now archived and is closed to further replies.