jakewaldron / PlexEmail

This script aggregates all new TV, movie and music releases for the past configured time then optionally writes to your web directory and sends out an email.
206 stars 32 forks source link

ValueError: substring not found #42

Closed Magikarplvl4 closed 8 years ago

Magikarplvl4 commented 8 years ago

Hi Can you help me with the following error? Can't send emails because the script is stopping on the error ValueError: substring not found

2016-08-07 17:38:44,724 - INFO:processImage: begin
2016-08-07 17:38:44,724 - INFO:processImage: imageHash = ac7198cdbd2f034d26b797adc6e8adce18b953e3 - thumb = metadata://posters/com.plexapp.agents.thetvdb_5448663fe3aaec5cbe353906f82a65fff1cd3672 - mediaType = show - seasonIndex = 0 - episodeIndex = 0
2016-08-07 17:38:44,724 - INFO:processImage: imgLocation = D:\Plex server\Plex Media Server\Metadata\TV Shows\a\c7198cdbd2f034d26b797adc6e8adce18b953e3.bundle\Contents\com.plexapp.agents.thetvdb\posters\5448663fe3aaec5cbe353906f82a65fff1cd3672
2016-08-07 17:38:44,724 - INFO:processImage: webImgFullPath = newon.plexitnow.net//images/5448663fe3aaec5cbe353906f82a65fff1cd3672_ac7198cdbd2f034d26b797adc6e8adce18b953e3.jpg
2016-08-07 17:38:44,724 - INFO:processImage: img = C:\www\html\updates\\images\5448663fe3aaec5cbe353906f82a65fff1cd3672_ac7198cdbd2f034d26b797adc6e8adce18b953e3.jpg
2016-08-07 17:38:44,724 - INFO:processImage: Hosting image on local web server
2016-08-07 17:38:44,724 - INFO:processImage: Setting image paths to local and copying image to web folder
2016-08-07 17:38:44,724 - INFO:processImage: begin
2016-08-07 17:38:44,724 - INFO:processImage: imageHash = 7ec0f9515c46da3308574f972097f5715c87cc3a - thumb = https://thetvdb.com/banners/posters/247808-1.jpg - mediaType = show - seasonIndex = 0 - episodeIndex = 0
2016-08-07 17:38:44,724 - ERROR:Logging an uncaught exception
Traceback (most recent call last):
  File "C:\PlexEmail\plexEmail.py", line 1305, in <module>
    imageInfo = processImage(hash, imageInfo['thumb'], 'show', 0, 0)
  File "C:\PlexEmail\plexEmail.py", line 380, in processImage
    imgName = thumb[thumb.index('_') + 1:len(thumb)]
ValueError: substring not found
mmaster23 commented 8 years ago

I've had the same issue. It seems some providers have switched to HTTPS for their images. The script handles this badly. I suck at GIT so I'll just post my fix here:

Find the line starting with if (thumb.find('http://') >= 0) in the def processImage and replace that line with:

if (thumb.find('http://') >= 0) or (thumb.find('https://') >= 0):

Magikarplvl4 commented 8 years ago

Thats fix it, great thanks!

jakewaldron commented 8 years ago

@mmaster23 Thank you for the fix. I have just added it and pushed the latest changes in the dev branch to the master branch.