[mythtv] GetMythDownloadManager -> download returning stale data?
Robert Kulagowski
rkulagow at gmail.com
Mon Sep 10 17:45:48 UTC 2012
On Mon, Sep 10, 2012 at 10:27 AM, Chris Pinkham <cpinkham at bc2va.org> wrote:
> * On Wed Sep 05, 2012 at 09:43:15PM -0500, Robert Kulagowski wrote:
>> The files are already pre-compressed on the server, so there's no
>> delay there. I'm looking at how the themechooser does things as
>
> If this is the case, then I wonder why you're seeing a 10-second delay
> in downloading some of them.
Turns out it was on the server side, which I fixed. The downloads are
now speeding along quite nicely.
>> block, would it just be easier set up a loop that checks the download
>> directory for the correct number of files, sleep for 30 seconds if
>> they're not all downloaded, repeat? Then, if all the files aren't
>> downloaded within some reasonable time period, exit the loop, process
>> the files that we did download and just move on...
>
> You could, but that's a bit of a hack. If you use queueDownload(), a
> QMap to track queued files, and a customEvent() handler, the you could
> either process files as they are downloaded or just delete their entry
> from the QMap as they are downloaded so you know if anything was left
> or if it was safe to proceed. The ThemeChooser does the former, it
> performs actions when the finished message comes in. In the second
> method, the queue-er could wait on a QWaitCondition after queueing and
> the customEvent handler could wake up the queue-er whenever a file was
> downloaded and the QMap was updated. When the queue-er is woken up or
> times out, it checks the size of the QMap. If it is empty, then all
> downloads were completed. If the QMap has anything still in it, then
> the wait must have timed out waiting for a download and you can either
> process the files you did download or abort.
I've switched to the queueDownload method to get the files rather than
blocking (which was what actually allowed me to find the issue on the
server side)
Right now I've implemented the "hacky" way, because I'm still learning...
QDir dir;
dir = QDir(tempDLDirectory);
QStringList files;
QString searchfor = "*_sched.txt.gz";
int LoopCount = 0;
while (LoopCount < 60) // Determine the best loop count /
sleep combination to download files.
{
qDebug() << "Sleeping";
sleep(5);
LoopCount++;
files = dir.entryList(QStringList(searchfor), QDir::Files
| QDir::NoSymLinks);
if (files.size() == total_XMLID)
{
qDebug() << "Done sleeping";
LoopCount = 99; // Magic value to let routine down the
line know that we got all the files?
break;
}
qDebug() << "Downloaded " << files.size() << "of " << total_XMLID;
}
Work in progress...
More information about the mythtv-dev
mailing list