[mythtv-commits] Ticket #8634: tmdb.py metadata image download fails

MythTV mythtv at cvs.mythtv.org
Fri Jul 16 06:12:18 UTC 2010


#8634: tmdb.py metadata image download fails
------------------------------------+---------------------------------------
 Reporter:  mcosta1quake@…          |        Owner:  robertm       
     Type:  defect                  |       Status:  infoneeded_new
 Priority:  minor                   |    Milestone:  unknown       
Component:  Plugin - MythVideo      |      Version:  0.23-fixes    
 Severity:  medium                  |   Resolution:                
  Mlocked:  0                       |  
------------------------------------+---------------------------------------

Comment(by Tianon Gravi <admwiggin@…>):

 For release-0-23-fixes, The patches made for the 301 redirect were
 important, but they weren't a complete fix.  The code as it is only
 handles redirects from one host within itself (which resulted in a lot of
 400 Bad Request responses, since it was asking the wrong server for the
 file).  I went ahead and applied the following changes to fix that.  Now
 it should handle any redirect (up to the limit of 8 times) and should also
 handle alternate port numbers.
 {{{
 #!diff
 diff --git mythplugins/mythvideo/mythvideo/videodlg.cpp
 mythplugins/mythvideo/mythvideo/videodlg.cpp
 index 6a9be5f..fa56906 100644
 --- mythplugins/mythvideo/mythvideo/videodlg.cpp
 +++ mythplugins/mythvideo/mythvideo/videodlg.cpp
 @@ -120,7 +120,14 @@ namespace
        public:
          void StartCopy()
          {
 -            m_id = m_http.get(m_url.toEncoded(), &m_data_buffer);
 +            m_http.setHost(m_url.host(), m_url.port(80));
 +            QByteArray path = m_url.encodedPath();
 +            if (m_url.hasQuery())
 +            {
 +                path.append("?");
 +                path.append(m_url.encodedQuery());
 +            }
 +            m_id = m_http.get(path, &m_data_buffer);

 m_timer.start(gContext->GetNumSetting("PosterDownloadTimeout", 60)
                            * 1000);
 @@ -168,7 +175,7 @@ namespace
              connect(&m_timer, SIGNAL(timeout()),
 SLOT(OnDownloadTimeout()));

              m_timer.setSingleShot(true);
 -            m_http.setHost(m_url.host());
 +            m_http.setHost(m_url.host(), m_url.port(80));
          }

          ~ImageDownloadProxy() {}
 }}}

 This on top of the changes made earlier in the repository have
 successfully fixed the image downloading issues for me.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/8634#comment:22>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list