Skip to content

Commit

Permalink
IPTV/HLS/M3U Remove check on m3u substring in url
Browse files Browse the repository at this point in the history
Remove the check on the presence of m3u or m3u8 at the end of the url
to determine if a file is a HLS file or not.
This check prevents some IPTV channels to be played with MythTV.
There is already a check on the content of the file pointed to by
the url so the check on the url can safely be removed.

Refs #936
  • Loading branch information
kmdewaal committed Nov 25, 2024
1 parent 3f6a654 commit 3f6def5
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions mythtv/libs/libmythtv/iptvtuningdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,29 +237,13 @@ class MTV_PUBLIC IPTVTuningData
return false;
}

MythSingleDownload downloader;
QString url = m_dataUrl.toString();
auto path = m_dataUrl.path();

// check url is valid for a playlist before downloading (see trac ticket #12856)
if(path.endsWith(".m3u8", Qt::CaseInsensitive) ||
path.endsWith(".m3u", Qt::CaseInsensitive))
{
LOG(VB_RECORD, LOG_INFO, QString("IsHLSPlaylist url ends with either .m3u8 or .m3u %1").arg(url));
}
else
{
// not a valid playlist so just return false
LOG(VB_RECORD, LOG_INFO, QString("IsHLSPlaylist url does not end with either .m3u8 or .m3u %1").arg(url));
return false;
}

QByteArray buffer;

MythSingleDownload downloader;
downloader.DownloadURL(url, &buffer, 5s, 0, 10000);
if (buffer.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, QString("IsHLSPlaylist - Open Failed: %1\n\t\t\t%2")
LOG(VB_GENERAL, LOG_ERR, QString("IsHLSPlaylist - Open Failed:%1 url:%2")
.arg(downloader.ErrorString(), url));
return false;
}
Expand Down

0 comments on commit 3f6def5

Please sign in to comment.