Release myth2kodi -- generate Kodi friendly file-names from MythTV recordings.
#67
I'm just throwing this up here in case someone will get some use from it. Since we had our discussion a few pages back about using handbrake with the files moved by myth2kodi I threw a real quick and dirty script together to compress my recordings and then disconnect them from mythtv. It does a great job and Kodi still skips the commercials perfectly. I don't use the cutlist to actually modify the video itself due to the occasional false positive. I want the ability to back up if part of the show gets cut off.

By default the script will place the converted file into the same directory it found the original in. It will not delete the original unless you remove the # from the proper line.

I have it names convert.sh. Make sure to chmod +x so the script has permission to be executed.
Code:
#!/bin/bash

fullfile=$1
fbname=${fullfile%.*}
echo "$fbname"

HandBrakeCLI -v -i "$1" -o "$fbname".mp4 --preset "Very Fast 720p30" ;

echo y|myth2kodi --disconnect  "$1"
#uncomment next line to delete original
#rm "$1"

It can be run on any file from the terminal using the following command (note: the script must be run by your myth librarian, in my case mythtv. There is no error checking built in so remember to run it as the proper user or myth2kodi won't do the disconnect)
Code:
./convert.sh "/path/to/recorded/file.ts"
All my recordings from mythtv are in the .ts container so I call the script with a find command when I want to run it on my whole recordings directory (in my case /media/Storage/Videos)
Code:
find "/media/Storage/Videos"  -name "*.ts" -exec /media/Storage/convert.sh {} \;

I have it set up as a cron job to run weekly on my entire recordings folder, but you could easily adapt the script to work as a mythtv user job or any other type of automation. As long as it fits the format of script "path/file" it should run properly.

Hope this helps someone else. I can't offer much in the way of support because I couldn't code my way out of a paper bag.
Reply


Messages In This Thread
RE: myth2kodi -- generate Kodi friendly file-names from MythTV recordings. - by jctennis - 2017-03-22, 19:42
Logout Mark Read Team Forum Stats Members Help
myth2kodi -- generate Kodi friendly file-names from MythTV recordings.2