SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations > Batch Metadata Tools
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

Batch Metadata Tools This forums is for discussing the user-created Batch Metadata Tools for SageTV.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-27-2017, 03:02 PM
jvl711's Avatar
jvl711 jvl711 is offline
Sage Fanatic
 
Join Date: Jan 2004
Posts: 825
BMT Issue downloading images for TVDB

Hi,

I noticed over the last few days the BMT was having issues downloading images for new shows. After a few hours of banging my head I decided to look into the code to try and debug the issue. It looks like TVDB is forcing HTTPS connections, and BMT is trying to pull images using HTTP connections. The java HttpURLConnection does not support following redirects from HTTP to HTTPS. I am not sure if there is an easier way to fix that issue, but I made the following code change after googling the issue for a while.

Hopefully I will save someone the same agrevation I just went through looking into this issue. Of course I assumed I broke something!


sagex.phoenix.util.url.UrlUtil
Code:
public static URLConnection openUrlConnection(URL url, String userAgent, String referrer, int timeout, boolean followRedirects)
            throws IOException, SocketTimeoutException 
    {
        UrlConfiguration cfg = GroupProxy.get(UrlConfiguration.class);
        URLConnection conn = url.openConnection();
        
        if (conn instanceof HttpURLConnection) 
        {
            
            if (userAgent == null) 
            {
                userAgent = cfg.getHttpUserAgent();
            }
            if (userAgent != null) 
            {
                conn.setRequestProperty("User-Agent", userAgent);
            }
            if (referrer != null) 
            {
                conn.setRequestProperty("REFERER", referrer);
            }
            
            //((HttpURLConnection) conn).setInstanceFollowRedirects(followRedirects);
            
            if(((HttpURLConnection)conn).getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP || ((HttpURLConnection)conn).getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM )
            {
                
                URL resourceUrl, base, next;
                String location;
  
                location = conn.getHeaderField("Location");
                
                location = URLDecoder.decode(location, "UTF-8");
                
                
                base = new URL(url.toExternalForm());
                next = new URL(base, location); 
                
                
                return openUrlConnection(next,userAgent, referrer, timeout, followRedirects);
                
            }
        }

        if (timeout <= 0) 
        {
            timeout = cfg.getReadTimeoutMS();
        }

        if (timeout > 0) 
        {
            conn.setReadTimeout(timeout);
            conn.setConnectTimeout(timeout);
        }

        return conn;
        
    }
Reply With Quote
  #2  
Old 09-27-2017, 03:22 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
That is the fix. It was also talked here, as well.

Now I just need to find the time to update Phoenix (you could send a pull request)
Reply With Quote
  #3  
Old 09-27-2017, 04:31 PM
jvl711's Avatar
jvl711 jvl711 is offline
Sage Fanatic
 
Join Date: Jan 2004
Posts: 825
Quote:
Originally Posted by stuckless View Post
That is the fix. It was also talked here, as well.

Now I just need to find the time to update Phoenix (you could send a pull request)
I submitted a pull request. I think I did it correctly. I used the website editor to make the changes.

Thanks,
Josh
Reply With Quote
  #4  
Old 09-27-2017, 06:37 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by jvl711 View Post
I submitted a pull request. I think I did it correctly. I used the website editor to make the changes.

Thanks,
Josh
Awesome... I will push out a new phoenix before the end of the weekend... promise
Reply With Quote
  #5  
Old 09-27-2017, 06:40 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by stuckless View Post
Awesome... I will push out a new phoenix before the end of the weekend... promise
EXCELLENT NEWS!!!!
__________________
If you wish to see what I am up to and support my efforts visit my Patreon page
Reply With Quote
  #6  
Old 09-27-2017, 07:26 PM
nateziemann nateziemann is offline
Sage User
 
Join Date: Jun 2010
Location: MN
Posts: 70
Quote:
Originally Posted by stuckless View Post
Awesome... I will push out a new phoenix before the end of the weekend... promise
new update worked for me. Had to upgrade from sage 9.1.5 to newer version due to new gemstone prereq. but all worked well. Thank you !!

Last edited by nateziemann; 10-01-2017 at 04:08 PM. Reason: Added result
Reply With Quote
  #7  
Old 09-30-2017, 07:50 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by stuckless View Post
Awesome... I will push out a new phoenix before the end of the weekend... promise
New version resolved for me.

Thanks all.
__________________
If you wish to see what I am up to and support my efforts visit my Patreon page
Reply With Quote
  #8  
Old 10-04-2017, 04:21 AM
Polypro Polypro is offline
Sage Icon
 
Join Date: Jun 2005
Posts: 1,804
Another perfect fix, thanks team! This reminds me of the "old days" - you guys are as good, if not better () than the OEM Sage crew!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to Get Metadata -- tvdb instafails aedgington Batch Metadata Tools 2 08-20-2012 10:05 AM
Is BMT striking out with TVDB more often? Spectrum Batch Metadata Tools 2 04-02-2011 06:57 PM
tvdb and Camelot jusjoken Batch Metadata Tools 2 04-02-2011 12:02 PM
BMT fails to fetch tvdb metadata scanner95 Batch Metadata Tools 1 02-15-2011 08:35 AM
Issue Downloading Netflix Plugin cgreenle SageTV Customizations 1 04-13-2008 06:23 PM


All times are GMT -6. The time now is 01:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.