initial commit of bin scripts into git
This commit is contained in:
50
create_nfo_for_one_recording
Executable file
50
create_nfo_for_one_recording
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/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 "<movie>" >> $nfo
|
||||
|
||||
# think Emby doesnt process &'s, so switch them over
|
||||
title=${title//&/and}
|
||||
outline=${outline//&/and}
|
||||
plot=${plot//&/and}
|
||||
|
||||
if [ x"$outline" != "x" ]; then
|
||||
echo "<title>$title: $outline</title>" >> $nfo
|
||||
else
|
||||
echo "<title>$title</title>" >> $nfo
|
||||
fi
|
||||
|
||||
echo "<plot>$plot</plot>" >> $nfo
|
||||
echo "<date>$date</date>" >> $nfo
|
||||
echo "</movie>" >> $nfo
|
||||
sudo chown mythtv:mythtv $nfo
|
||||
echo "completed" >> $LOG
|
||||
exit 0
|
||||
Reference in New Issue
Block a user