[mythtv-users] Commercial Flagging (UK, DVB-T)

Roger Siddons dizygotheca at ntlworld.com
Thu Feb 21 00:19:17 UTC 2013


On Tue, 12 Feb 2013 10:58:03 -0000, <phipps-hutton at sky.com> wrote:

> Do you (or anyone listening) know how to get the frontends to update the  
> skiplist if they are watching the same program? I have to stop playback  
> and start again to reload the skiplist.
>

I finally found time to get this working using the commflag code that  
Robert highlighted.
Here's some code fragments that should enable you to do the same...

#include <mythcorecontext.h>
#include <mythcontext.h>
#include <mythversion.h>
#include <programtypes.h>
#include <QCoreApplication>

// Player update message
QString updateMessage;
char message[200];

void UpdatePlayer(frame_t start, frame_t stop) {

     // add comma unless it's first cut
     if (!updateMessage.endsWith(' '))
         updateMessage += ',';

     updateMessage += QString("%1:%2,%3:%4")
             .arg(start).arg(MARK_COMM_START)
             .arg(stop).arg(MARK_COMM_END);

     // printf("debug at Sending %s\n", updateMessage.toLatin1().data());

     gCoreContext->SendMessage(updateMessage);
}

int main(int argc, char **argv) {

     QCoreApplication a(argc, argv);
     QCoreApplication::setApplicationName("mausc");

     MythContext* gContext = new MythContext(MYTH_BINARY_VERSION);

     if (!gContext->Init( false, /*use gui*/
                          false, /*prompt for backend*/
                          false, /*bypass auto discovery*/
                          false)) /*ignoreDB*/
     {
         // printf("err%cContext initialisation failed\n", DELIMITER);
         exit(1);
     }

     gCoreContext->ConnectToMasterServer();

-----------

     if (1 != sscanf(argv[5], "%s", message)) {
     //    report("err", ' ', "Could not parse message option into a  
string", 0, 0, 0, 0);
         usage(argv[0]);
         exit(2);
     }
     updateMessage = "COMMFLAG_UPDATE " + QString(message) + ' ';

---------

Requires a new arg from mausc-wrapper.py:

     # player update message needs prog id
     progId = str(chanid) + '_' + str(starttime)

----------

My Makefile:

INCPATH = -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork  
-I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include/mythtv
LIBPATH = -L/usr/lib -L/usr/lib/i386-linux-gnu

all: mausc catagrower

mausc: mausc.c
	g++ $(INCPATH) $(LIBPATH) mausc.c -o /usr/local/bin/mausc -lsndfile  
-lQtCore -lmythbase-0.26 -lmyth-0.26

catagrower: catagrower.c
	g++ catagrower.c -o /usr/local/bin/catagrower

--------

Good Luck!


More information about the mythtv-users mailing list