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

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' #41

Closed MikeFalcor closed 7 years ago

MikeFalcor commented 8 years ago

New problem. Running a clean master branch with modified HTML. Added pull #29 to fix an error and now I am getting a new error.

Traceback (most recent call last): File "plexEmail.py", line 978, in <module> title += movies[movie]['original_title'] + ' AKA ' TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Line 978 for me, but it is actually line 955. Not sure why this started popping up all of a sudden. Either way, I can;t be the only one experiencing this issue. Thought I would bring it to your attention.

Thanks for the help thus far! Looking to get the emails rolling again with some assistance.

MikeFalcor commented 8 years ago

News: I removed the if statement for the movies section as I am a naming Nazi when it comes to my Movies. This fixed this error.

Old Code: for movie in movies: movies[movie] = convertToHumanReadable(movies[movie]) title = '' if ('original_title' in movies[movie] and movies[movie]['original_title'] != ''): title += movies[movie]['original_title'] + ' AKA ' title += movies[movie]['title'] hash = str(movies[movie]['hash']) imageInfo = {} imageInfo['thumb'] = movies[movie]['user_thumb_url'] imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)

New code: for movie in movies: movies[movie] = convertToHumanReadable(movies[movie]) title = '' title += movies[movie]['title'] hash = str(movies[movie]['hash']) imageInfo = {} imageInfo['thumb'] = movies[movie]['user_thumb_url'] imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)

This results in an error in the TV Episode processing section: Traceback (most recent call last): File "plexEmail.py", line 1043, in <module> imageInfo = processImage(hash, imageInfo['thumb'], 'show', 0, 0) File "plexEmail.py", line 343, in processImage imgName = thumb[thumb.index('_') + 1:len(thumb)] ValueError: substring not found

Grr. :) And now I am right back to pretty much where I started...

jakewaldron commented 8 years ago

@MikeFalcor Hi, could you give the latest code a try? It has a fix for the error in your latest post.

MikeFalcor commented 8 years ago

Tried it. While the email does go out and the web page is created without issue, it also skips a couple images. Perhaps it has to do with the TV show it seems to fail on time and time again. Does anyone happen to have "Mr. Robot" in their collection?

Not sure what the problem is or how to SHOW you the problem.

Please advise.

MikeFalcor commented 8 years ago

If I am understanding the log files correctly, the moment it starts processing the TV episodes, I get this:

2016-08-21 18:32:30,004 - INFO:uploadToCloudinary: begin 2016-08-21 18:32:30,004 - INFO:uploadToCloudinary: file not located

I have no idea what this means nor how to address it.

MikeFalcor commented 8 years ago

I can confirm, now, that the issue appears to be the handling of a period (.) in a title's name. The emails are sent perfectly fine up until the script gets to "Mr. Robot", at which point the title image is not present and any subsequent image fails as well.

I would say it would be a good idea to address this issue in all categories. There are some movies out there as well that have periods in their names. I wouldn't doubt the existence of the period in music either.

Think you can fix it? :)

jakewaldron commented 8 years ago

Hmm, I also have Mr. Robot and am not seeing a similar issue. Would you mind sharing more info from the logs for the the images that are missing (include the line that looks like "INFO:processImage: imgLocation =". Could you also verify that the image actually exists at that location?

MikeFalcor commented 8 years ago

See attached log, which has been sanitized. I am not too sure how to read the logging, so I figure best for you to tell me. Plus, weeding through a couple hundred images via hash would suck. :) plexEmail.log.txt

I will sift through the log while I have time to do so and compare what is on my server as well.

Thanks!

MikeFalcor commented 8 years ago

OK - So plexEmail is apparently referencing images that do not exist...how is this even possible?

Currently re-downloading all the metadata for all of my TV episodes/shows. We'll see if that fixes the issue... Sure doesn't help that theTVDB has been spotty at best for the past couple months...

MikeFalcor commented 7 years ago

Yup! Sure enough, unmatching and re-matching my TV shows forced a metadata redownload and fixed the issue. Emails and webpage are A-OK now.

Thanks!

jakewaldron commented 7 years ago

FYI, there was an issue with posters that I found and fixed today. Feel free to take the latest code from the master branch and let me know if you have any other issues.