[mythtvnz] Blank characters at start of titles in EPG

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Oct 17 07:43:40 BST 2016


On Mon, 17 Oct 2016 17:44:04 +1300, you wrote:

>Hi,
>
>These all have "All New " in front for me (using tv_grab_nz-py),
>except possibly repeats which have the normal titles. I don't do any
>post processing. Something isn't removing "All New" and not removing
>the trailing space on your end?
>
>All New Dr. Ken
>All New Mike & Molly
>All New The Big Bang Theory
>All New 2 Broke Girls
>All New The Middle
>
>Duke has "New: " just to be different. And of course "New Girl" is valid.

Where are you getting your EPG from?  The downloaded EPG does have
processing to remove the "All New " bit, but I think it does not
handle "All New: " and definitely does not handle "New: ".  What I
have done is to do postprocessing on my database after
mythfilldatabase has been run.  This is what I currently have in my
epg_fixes.sh script:

#!/bin/bash

##############################################################################
# epg_fixes.sh
#
# Fix EPG problems by editing the mythconverg.program table.
#
# Author: J S Worthington
# Version: 0.1 2016-08-30
#
##############################################################################

which xmlstarlet >/dev/null
if [ $? != 0 ] ; then
    echo 'Error: xmlstarlet is not installed.'
    echo 'On Ubuntu, you can use the command "sudo apt-get install
xmlstarlet" to install it.'
    exit 1
fi

configxml=/etc/mythtv/config.xml

DBUserName=`xmlstarlet sel -t -v
Configuration/UPnP/MythFrontend/DefaultBackend/DBUserName $configxml`
if [ "$DBUserName" == "" ]; then
    # Either config.xml does not exist, or it is in MythTV 0.26 or
greater
    # format.  Try 0.26+ format.

    DBUserName=`xmlstarlet sel -t -v Configuration/Database/UserName
$configxml`
    if [ "$DBUserName" == "" ]; then
        echo "Error: Either $configxml does not exist or it is in an
unknown format."
        exit 1
    fi

    DBPassword=`xmlstarlet sel -t -v Configuration/Database/Password
$configxml`
    DBHostName=`xmlstarlet sel -t -v Configuration/Database/Host
$configxml`
    DBName=`xmlstarlet sel -t -v Configuration/Database/DatabaseName
$configxml`
else
    # The config.xml file is in 0.25 and before format.

    DBPassword=`xmlstarlet sel -t -v
Configuration/UPnP/MythFrontend/DefaultBackend/DBPassword $configxml`
    DBHostName=`xmlstarlet sel -t -v
Configuration/UPnP/MythFrontend/DefaultBackend/DBHostName $configxml`
    DBName=`xmlstarlet sel -t -v
Configuration/UPnP/MythFrontend/DefaultBackend/DBName $configxml`
fi

mysql -vvv --show-warnings --local-infile -u $DBUserName -p$DBPassword
-h $DBHostName $DBName << EOF
select chanid,starttime,title,subtitle,programid from program where
title like 'All New %';
update program set title=substr(title,8) where title like 'All New %';
select chanid,starttime,title,substr(title,6) as
title6,subtitle,programid from program where title like 'New: %';
update program set title=substr(title,6) where title like 'New: %';
select chanid,starttime,title,subtitle,programid from program where
title like 'Cleverman %';
update program set title='Cleverman' where title like 'Cleverman %';
select
chanid,starttime,title,subtitle,left(description,20),season,episode,category,seriesid,programid
from program where title like '%trans-si%';
update program set programid='' where title="Joanna Lumley's
Trans-Siberian";
select
chanid,starttime,title,subtitle,left(description,20),season,episode,category,seriesid,programid
from program where left(title,1)=' ';
update program set title=substr(title,2) where left(title,1)=' ';
EOF

mythutil --resched

If anyone wants a copy, I have it on my web server at:

  http://www.jsw.gen.nz/mythtv/epg_fixes.sh

Most of the fixes are obvious, but the Joanna Lumley one is for a bad
programid value that tells MythTV that all the episodes are the same
episode, when in fact there is a new episode weekly.  Without that
fix, the duplicate detection was using the programid and saying they
all matched, when the description was changing each week.



More information about the mythtvnz mailing list