Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11218 closed Bug Report - General (fixed)

streaming radio does not follow redirects

Reported by: dekarl@… Owned by: cpinkham
Priority: minor Milestone: 0.27
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

radioseven.se's website links to http://www.radioseven.se/128.pls, so I added that as new Shoutcast station.

request:

GET /128.pls HTTP/1.1
User-Agent: MythTV v0.27.20120906-1 MythDownloadManager
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: de-DE,en,*
Host: www.radioseven.se

reply:

HTTP/1.1 301 Moved Permanently
Content-Length: 156
Content-Type: text/html
Location: http://play.radioseven.se/128.pls
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Fri, 02 Nov 2012 22:50:26 GMT

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://play.radioseven.se/128.pls">here</a></body>

frontend log:

2012-11-02 23:49:43.166881 I  File 128.pls has extension pls
2012-11-02 23:49:43.166941 I  Retrieving playlist from 'http://www.radioseven.se/128.pls'
2012-11-02 23:49:43.574759 E  CfgReader:: Badly formatted line 1
2012-11-02 23:50:13.168184 E  DecoderHandler:: Timed out trying to download playlist from: http://www.radioseven.se/128.pls

manually resolving the redirect appears to get me to #11214

Change History (4)

comment:1 Changed 11 years ago by paulh <mythtv@…>

Actually this is a problem with the DownloadManager? not with MythMusic.

What happens is the downloaded file ends up containing both the text from the redirect message and the text from the final redirected file like this:-

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://play.radioseven.se/128.pls">here</a></body>[playlist]

File1=http://sc1.radioseven.se:80
Title1=Radioseven - www.radioseven.se
Length1=-1

File2=http://sc1.radioseven.se:8500
Title2=Radioseven - www.radioseven.se
Length2=-1

File3=http://sc9.radioseven.se:8500
Title3=Radioseven - www.radioseven.se
Length3=-1

File4=http://sc2.radioseven.se:8500
Title4=Radioseven - www.radioseven.se
Length4=-1

File5=http://sc8.radioseven.se:8500
Title5=Radioseven - www.radioseven.se
Length5=-1

File6=http://sc3.radioseven.se:8500
Title6=Radioseven - www.radioseven.se
Length6=-1

NumberOfEntries=6
Version=2

This patch fixes the problem but there is probably a better way to do it. Hopefully it will give whoever reviews this something to work with.

diff --git a/mythtv/libs/libmythbase/mythdownloadmanager.cpp b/mythtv/libs/libmythbase/mythdownloadmanager.cpp
index cc1721b..68aa0c2 100644
--- a/mythtv/libs/libmythbase/mythdownloadmanager.cpp
+++ b/mythtv/libs/libmythbase/mythdownloadmanager.cpp
@@ -1032,6 +1032,8 @@ void MythDownloadManager::downloadFinished(MythDownloadInfo *dlInfo)
         request.setRawHeader("User-Agent",
                              "MythDownloadManager v" MYTH_BINARY_VERSION);
 
+        dlInfo->m_bytesReceived = 0;
+
         switch (dlInfo->m_requestType)
         {
             case kRequestPost :

comment:2 Changed 11 years ago by Raymond Wagner

Component: Plugin - MythMusicMythTV - General
Owner: set to cpinkham
Status: newassigned

comment:3 Changed 11 years ago by Chris Pinkham <cpinkham@…>

Resolution: fixed
Status: assignedclosed

In 0866fcb69d5288320e66313a7f88705b25c8f641/mythtv:

Reset some stats and a buffer when MythDownloadManager? gets a redirect.

Fixes #11218.

comment:4 Changed 11 years ago by paulh

Milestone: unknown0.27
Note: See TracTickets for help on using tickets.