#!/bin/bash LOG=/tmp/c.log echo "create_nfo_for_one_recording called for '$1'" >> $LOG DIR=/export/myth/tv if [ $# != 1 ] then echo "Usage: $0 basename" >> $LOG echo " where basename is similar too: 1076_20191120075800.ts" >> $LOG exit 1 fi basename=`basename $1` base="${basename%.*}" echo "Need to create a nfo for $base" >> $LOG title=$(echo -n "select title from recorded where basename='$basename'" | mysql --host=mara.ddp.net --user=mythtv --password=mythtv mythconverg 2>&1 | grep -v 'Using a password' | tail -n1) outline=$(echo -n "select subtitle from recorded where basename='$basename'" | mysql --host=mara.ddp.net --user=mythtv --password=mythtv mythconverg 2>&1 | grep -v 'Using a password' | tail -n1) plot=$(echo -n "select description from recorded where basename='$basename'" | mysql --host=mara.ddp.net --user=mythtv --password=mythtv mythconverg 2>&1 | grep -v 'Using a password' | tail -n1) date=$(echo -n "select starttime from recorded where basename='$basename'" | mysql --host=mara.ddp.net --user=mythtv --password=mythtv mythconverg 2>&1 | grep -v 'Using a password' | tail -n1) echo "t=$title, o=$outline, p=$plot, d=$date" >> $LOG nfo="$DIR/$base.nfo" # in case we have not run this before, use -f sudo rm -f $nfo echo "" >> $nfo # think Emby doesnt process &'s, so switch them over title=${title//&/and} title=${title//\'/} outline=${outline//&/and} outline=${outline//\'/} plot=${plot//&/and} plot=${plot//\'/} if [ x"$outline" != "x" ]; then echo "$title: $outline" >> $nfo else echo "$title" >> $nfo fi echo "" >> $nfo echo "$date" >> $nfo echo "" >> $nfo sudo chown mythtv:mythtv $nfo echo "completed" >> $LOG exit 0