Skip to content

Commit

Permalink
IPTVChannelFetcher: remove the need for the depreciated HttpComms
Browse files Browse the repository at this point in the history
This uses the MythDownloadManager to download the playlist. I've no way to test
this but should just be a drop in replacement.

Should also fix the IPTVChannelFetcher on Qt5.
  • Loading branch information
Paul Harrison committed Jun 16, 2013
1 parent d52d294 commit 1c8e30b
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp
Expand Up @@ -15,10 +15,7 @@
#include "iptvchannelfetcher.h"
#include "scanmonitor.h"
#include "mythlogging.h"

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include "httpcomms.h"
#endif
#include "mythdownloadmanager.h"

#define LOC QString("IPTVChanFetch: ")

Expand Down Expand Up @@ -230,25 +227,18 @@ QString IPTVChannelFetcher::DownloadPlaylist(const QString &url,
return ret;
}

// Use Myth HttpComms for http URLs
QString redirected_url = url;

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QString tmp = HttpComms::getHttp(
redirected_url,
10000 /* ms */, 3 /* retries */,
3 /* redirects */, true /* allow gzip */,
NULL /* login */, inQtThread);
#else
#warning IPTVChannelFetcher::DownloadPlaylist not yet ported to Qt5.
QString tmp("");
#endif

if (redirected_url != url)
// Use MythDownloadManager for http URLs
QByteArray data;
QString tmp;

if (!GetMythDownloadManager()->download(url, &data))
{
LOG(VB_CHANNEL, LOG_INFO, QString("Channel URL redirected to %1")
.arg(redirected_url));
LOG(VB_GENERAL, LOG_INFO,
QString("IPTVChannelFetcher::DownloadPlaylist failed to "
"download from %1").arg(url));
}
else
tmp = QString(data);

return QString::fromUtf8(tmp.toLatin1().constData());
}
Expand Down

0 comments on commit 1c8e30b

Please sign in to comment.