Hey guys, working on another plugin. Having some dramas with my image urls returning 302 redirects when trying to use them as thumbs for TV Show Objects. If I open the url in a browser tab, I get the image fine. However, when using the same url as a thumb, its reverting to my fallback image. Any idea why? I have used the same code for a different site recently with no dramas. Could this be some kind of hotlink protection? Thanks in advance.
Example URL:
http://aniverse.tv/wp-content/uploads/2013/08/Asu-No-Yoichi.png
Relevant Code:
@route("/video/aniverse/showcategory")
def ShowCategory(title, category):
oc = ObjectContainer(title1 = title)
page_data = HTML.ElementFromURL(BASE_URL + str(category))
count = 0
for each in page_data.xpath("//div[@id='anime']/a"):
show_url = each.xpath("./@href")[0]
show_title = each.xpath("./div[@class='tooltip']/span[@class='tip']/h1/text()")[0]
show_thumb = each.xpath("./div[@class='tooltip']/img/@src")[0]
show_summary = each.xpath("./div[@class='tooltip']/span[@class='tip']/p[1]/text()")[0].strip()
show_genres = each.xpath("./div[@class='tooltip']/span[@class='tip']/h2/text()")[0].split(", ")
oc.add(TVShowObject(
key = Callback(PageEpisodes, show_title = show_title, show_url = show_url),
rating_key = show_title,
title = show_title,
thumb = Resource.ContentsOfURLWithFallback(url = show_thumb, fallback='icon-cover.png'),
summary = show_summary,
genres = show_genres
)
)
count = count + 1
if count == 30:
break
return oc
Relevant Plugin Log:
2013-11-05 15:50:17,559 (-4f877490) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FArea-no-Kishi.png 2013-11-05 15:50:17,561 (-4f877490) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback 2013-11-05 15:50:17,562 (-4f877490) : DEBUG (networking:233) - Fetching HTTP headers for 'http://aniverse.tv/wp-content/uploads/2013/08/Area-no-Kishi.png' 2013-11-05 15:50:18,357 (-4f877490) : DEBUG (networking:172) - Requesting 'http://aniverse.tv/wp-content/uploads/2013/08/Area-no-Kishi.png' 2013-11-05 15:50:24,156 (-4f877490) : ERROR (networking:219) - Error opening URL 'http://aniverse.tv/wp-content/uploads/2013/08/Area-no-Kishi.png' 2013-11-05 15:50:24,158 (-4f877490) : DEBUG (runtime:914) - Response: [302] Redirect, 0 bytes 2013-11-05 15:50:24,161 (-4f877490) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.plugins.aniverse/resources/icon-cover.png?t=1383235969 2013-11-05 15:50:24,163 (-4f877490) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.plugins.aniverse/resources/icon-cover.png 2013-11-05 15:50:24,166 (-4f877490) : DEBUG (runtime:914) - Response: [200] DataObject, 65338 bytes
Relevant PMS Log:
Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - Request: HEAD /photo/:/transcode?height=720&url=http%3a%2f%2f127.0.0.1%3a32400%2f%3a%2fplugins%2fcom.plexapp.plugins.aniverse%2fresources%2fcontentWithFallback%3ffallback%3dicon-cover.png%26urls%3dhttp%25253A%252F%252Faniverse.tv%252Fwp-content%252Fuploads%252F2013%252F08%252FAsu-No-Yoichi.png&width=720 [192.168.1.101:53764] (9 live) Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - * height => 720 Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - * url => http://127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - * width => 720 Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - Photo transcoder: Request for url [127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png] (is local: 1 upscaled: 0) Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - * fallback => icon-cover.png Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - * urls => http%3A//aniverse.tv/wp-content/uploads/2013/08/Asu-No-Yoichi.png Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - Plug-in com.plexapp.plugins.aniverse has been used 220 times. Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - [com.plexapp.plugins.aniverse] Sending command over HTTP (GET): /:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png Nov 05, 2013 15:49:16 [0xa3fffb70] DEBUG - HTTP requesting to: http://127.0.0.1:35181/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - [com.plexapp.plugins.aniverse] HTTP reply status 302, with 0 bytes of content. Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - Calling back into ourselves for photo to transcode, optimizing the process (status: 302) Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - HTTP requesting to: http://127.0.0.1:35181/:/plugins/com.plexapp.plugins.aniverse/resources/icon-cover.png?t=1383235969 Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - Photo cache obtained 65338 bytes from http://127.0.0.1:35181/:/plugins/com.plexapp.plugins.aniverse/resources/icon-cover.png?t=1383235969 Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - Saving original media file to /mnt/cache/apps/Plex/Application Support/Plex Media Server/Cache/PhotoTranscoder/80/80ba59f8fd587190bf08674fab58408515b034f1.jpg Nov 05, 2013 15:49:18 [0xa3fffb70] DEBUG - Created thumbnail of size 512x512, has pixels: 1 Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - Request: HEAD /photo/:/transcode?height=720&url=http%3a%2f%2f127.0.0.1%3a32400%2f%3a%2fplugins%2fcom.plexapp.plugins.aniverse%2fresources%2fcontentWithFallback%3ffallback%3dicon-cover.png%26urls%3dhttp%25253A%252F%252Faniverse.tv%252Fwp-content%252Fuploads%252F2013%252F08%252FAsu-No-Yoichi.png&width=720 [192.168.1.101:53766] (9 live) Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - * height => 720 Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - * url => http://127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - * width => 720 Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - Photo transcoder: Request for url [127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png] (is local: 1 upscaled: 0) Nov 05, 2013 15:49:18 [0xa4cffb70] DEBUG - Content-Length of /mnt/cache/apps/Plex/Application Support/Plex Media Server/Cache/PhotoTranscoder/01/0178d259fa75c78719783308361a77476b081746.jpg is 65714. Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - Request: GET /photo/:/transcode?height=720&url=http%3a%2f%2f127.0.0.1%3a32400%2f%3a%2fplugins%2fcom.plexapp.plugins.aniverse%2fresources%2fcontentWithFallback%3ffallback%3dicon-cover.png%26urls%3dhttp%25253A%252F%252Faniverse.tv%252Fwp-content%252Fuploads%252F2013%252F08%252FAsu-No-Yoichi.png&width=720 [192.168.1.101:53767] (8 live) Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - * height => 720 Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - * url => http://127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - * width => 720 Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - Request range: 0 to 0 Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - Photo transcoder: Request for url [127.0.0.1:32400/:/plugins/com.plexapp.plugins.aniverse/resources/contentWithFallback?fallback=icon-cover.png&urls=http%253A%2F%2Faniverse.tv%2Fwp-content%2Fuploads%2F2013%2F08%2FAsu-No-Yoichi.png] (is local: 1 upscaled: 0) Nov 05, 2013 15:49:18 [0xac6ffb70] DEBUG - Content-Length of /mnt/cache/apps/Plex/Application Support/Plex Media Server/Cache/PhotoTranscoder/01/0178d259fa75c78719783308361a77476b081746.jpg is 65714.