[mythtv] GetMythDownloadManager -> download returning stale data?

Robert Kulagowski rkulagow at gmail.com
Wed Sep 5 20:15:36 UTC 2012


I'm using mythdownloadmanager to retrieve files, but it appears that
in some circumstances something is going terribly wrong; subsequent
calls to the download function return a file which has already been
downloaded?

I may just be misunderstanding something though.

Here's the log from the point of view of the server.
204.79.172.4 - - [05/Sep/2012:19:39:34 +0000] "GET
/proc.php?command=get&p1=lineup&p2=IL57303 HTTP/1.1" 200 23112 "-"
"MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:39:34 +0000] "GET
/proc.php?command=get&p1=schedule&p2=11848&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 18015 "-" "MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:39:42 +0000] "GET
/proc.php?command=get&p1=schedule&p2=12475&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 17859 "-" "MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:39:46 +0000] "GET
/proc.php?command=get&p1=schedule&p2=14789&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 1089 "-" "MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:39:51 +0000] "GET
/proc.php?command=get&p1=schedule&p2=27549&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 10840 "-" "MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:39:55 +0000] "GET
/proc.php?command=get&p1=schedule&p2=60165&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 21392 "-" "MythTV v0.26.20120822-1 MythDownloadManager"
204.79.172.4 - - [05/Sep/2012:19:40:06 +0000] "GET
/proc.php?command=get&p1=schedule&p2=74348&rand=cff83fc70c106c4e4cfa689e2cd23e84
HTTP/1.1" 200 1143 "-" "MythTV v0.26.20120822-1 MythDownloadManager"

Here's what I'm seeing in mythfilldatabase:
2012-09-05 14:38:07.996585 I  Updated headend. New version: 6 New last
modified: 2012-09-05
2012-09-05 14:38:07.997413 I  Headend has been updated. Refreshing
channel table.
2012-09-05 14:38:08.501326 I  Downloaded file IL57303.txt
2012-09-05 14:38:08.620840 I  7 unique XMLIDs to download
2012-09-05 14:38:11.457863 I  Starting mythlogserver
destfile is  "/tmp/11848_sched.txt"
size of downloaded file is  18015
2012-09-05 14:38:16.427312 I  Downloaded file /tmp/11848_sched.txt
destfile is  "/tmp/12475_sched.txt"
size of downloaded file is  17859
2012-09-05 14:38:20.833061 I  Downloaded file /tmp/12475_sched.txt
destfile is  "/tmp/14789_sched.txt"
size of downloaded file is  1089
2012-09-05 14:38:25.236396 I  Downloaded file /tmp/14789_sched.txt
destfile is  "/tmp/27549_sched.txt"
size of downloaded file is  10840
2012-09-05 14:38:29.441170 I  Downloaded file /tmp/27549_sched.txt

This is where it starts to break down:

destfile is  "/tmp/60165_sched.txt"
size of downloaded file is  10840
2012-09-05 14:38:39.447517 I  Downloaded file /tmp/60165_sched.txt

The server logs indicate that the sent file size is 21392 bytes, but
mythdownloadmanager returned 10840 bytes.

2012-09-05 14:38:41.492280 I  Starting mythlogserver
destfile is  "/tmp/74348_sched.txt"
size of downloaded file is  10840
2012-09-05 14:38:49.454275 I  Downloaded file /tmp/74348_sched.txt
destfile is  "/tmp/76943_sched.txt"
size of downloaded file is  10840
2012-09-05 14:38:59.460241 I  Downloaded file /tmp/76943_sched.txt
2012-09-05 14:38:59.462265 I  Loading schedule files into database.

The code is:

        QByteArray dl_file;

        LOG(VB_GENERAL, LOG_INFO, QString("%1 unique XMLIDs to
download").arg(query.size()));

        while (query.next())
            // We're going to update all chanid's in the database that use this
            // particular XMLID no matter where they are.
        {
            xmltvid = query.value(0).toString();
            urlquery.bindValue(":XMLTVID", xmltvid);

            urlquery.exec();
            urlquery.next();
            url = urlquery.value(0).toString();

            url = url + "&rand=" + randhash;

            destfile = "/tmp/" + xmltvid + "_sched.txt";

            GetMythDownloadManager()->download(url, &dl_file, false);
            QFile file(destfile);
qDebug() << "url is " << url;
qDebug() << "destfile is " << destfile;
qDebug() << "size of downloaded file is " << dl_file.size();

            if (file.open(QIODevice::WriteOnly))
            {
                file.write(gUncompress(dl_file));
                file.close();
                LOG(VB_GENERAL, LOG_INFO, QString("Downloaded file
%1").arg(destfile));
            }
            else
            {
                LOG(VB_GENERAL, LOG_ERR, LOC + QString("Could not
create file %1").arg(destfile));
                return false;
            }
        }



More information about the mythtv-dev mailing list