PlexEmail - Email Recently Added Media

looks like a nice project. If you need some ideas PlexReport currently does this.

https://forums.plex.tv/topic/130354-plexreport-a-weekly-summary-of-your-plex-server/

Please try this modified script that will output some info regarding the files being uploaded.  From the error it looks like the file might not be an actual image.  Please give me the output after running the script.

attachicon.gifplexEmail.zip

Okay, this is what I get:

C:\Python27\Scripts>python plexemail.py
http://image.tmdb.org/t/p/original/pS0gLU8gGxl5mpXnGmyOMwfxp0W.jpg
metadata://posters/com.plexapp.agents.themoviedb_3770a41803af82d1e7c69255e906bd3
adaf78340
C:\PMSData\Plex Media Server\Metadata\Movies\4\73bdbf3e5bd2826b698ac43693b39b5f7
85a16f.bundle\Contents\com.plexapp.agents.themoviedb\posters\3770a41803af82d1e7c
69255e906bd3adaf78340
C:\PMSData\Plex Media Server\Metadata\Movies\4\73bdbf3e5bd2826b698ac43693b39b5f7
85a16f.bundle\Contents\com.plexapp.agents.themoviedb\posters\3770a41803af82d1e7c
69255e906bd3adaf78340
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=28012L, st_atime=1427951938L, st_mtime=1427951938L, st_ctime=14279519
38L)
http://image.tmdb.org/t/p/original/sCmwALDt2NwW2D8gkHbOnsdYHe2.jpg
http://image.tmdb.org/t/p/original/jSPtAWXKd4NFJInCiA653bxdf8L.jpg
metadata://posters/com.plexapp.agents.thetvdb_07b5c7c09e8f8a1f71575ac9b4ad18dff1
faeb6e
C:\PMSData\Plex Media Server\Metadata\TV Shows\2\54477da2a4c469f2bbee06be6c66dbd
ee0c98f0.bundle\Contents\com.plexapp.agents.thetvdb\posters\07b5c7c09e8f8a1f7157
5ac9b4ad18dff1faeb6e
C:\PMSData\Plex Media Server\Metadata\TV Shows\2\54477da2a4c469f2bbee06be6c66dbd
ee0c98f0.bundle\Contents\com.plexapp.agents.thetvdb\posters\07b5c7c09e8f8a1f7157
5ac9b4ad18dff1faeb6e
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=500329L, st_atime=1427954458L, st_mtime=1427954458L, st_ctime=1427954
458L)
metadata://posters/com.plexapp.agents.thetvdb_a7917a347ccb6af2cca2ab7c4fbb1bffc8
d03224
C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36
da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\posters\a7917a347ccb6af2cca2
ab7c4fbb1bffc8d03224
C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36
da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\posters\a7917a347ccb6af2cca2
ab7c4fbb1bffc8d03224
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=482465L, st_atime=1427867127L, st_mtime=1427867127L, st_ctime=1427867
127L)
metadata://seasons/8/posters/com.plexapp.agents.thetvdb_29ac9eceb0402bd90f9daf1b
8fcc670342fc0b7b
C:\PMSData\Plex Media Server\Metadata\TV Shows\2\54477da2a4c469f2bbee06be6c66dbd
ee0c98f0.bundle\Contents\com.plexapp.agents.thetvdb\seasons\8\posters\29ac9eceb0
402bd90f9daf1b8fcc670342fc0b7b
C:\PMSData\Plex Media Server\Metadata\TV Shows\2\54477da2a4c469f2bbee06be6c66dbd
ee0c98f0.bundle\Contents\com.plexapp.agents.thetvdb\seasons\8\posters\29ac9eceb0
402bd90f9daf1b8fcc670342fc0b7b
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=243092L, st_atime=1427954458L, st_mtime=1427954458L, st_ctime=1427954
458L)
metadata://seasons/5/posters/com.plexapp.agents.thetvdb_bef8c63e38b2293ebcbda1c6
4323e040729b1386
C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36
da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\seasons\5\posters\bef8c63e38
b2293ebcbda1c64323e040729b1386
C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36
da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\seasons\5\posters\bef8c63e38
b2293ebcbda1c64323e040729b1386
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=
0, st_size=4L, st_atime=1427867127L, st_mtime=1427867127L, st_ctime=1427867127L)

Traceback (most recent call last):
File “plexemail.py”, line 850, in
imageInfo = processImage(hash, imageInfo[‘thumb’], ‘season’, tvSeasons[seaso
n][‘index’], 0)
File “plexemail.py”, line 216, in processImage
cloudinaryURL = uploadToCloudinary(imgLocation)
File “plexemail.py”, line 263, in uploadToCloudinary
response = cloudinary.uploader.upload(imgToUpload)
File “C:\Python27\Scripts\cloudinary\uploader.py”, line 16, in upload
return call_api(“upload”, params, file = file, **options)
File “C:\Python27\Scripts\cloudinary\uploader.py”, line 223, in call_api
raise Error(result[“error”][“message”])
cloudinary.api.Error: Invalid image file

The image size is really small.  Could you verify that this file is an image: C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\seasons\5\posters\bef8c63e38b2293ebcbda1c64323e040729b1386

If it is, can you try to upload it manually to Cloudinary?

The image size is really small.  Could you verify that this file is an image: C:\PMSData\Plex Media Server\Metadata\TV Shows\b\b089929eda22602abd85ace4d5a0a36da5ccdd9.bundle\Contents\com.plexapp.agents.thetvdb\seasons\5\posters\bef8c63e38b2293ebcbda1c64323e040729b1386

If it is, can you try to upload it manually to Cloudinary?

It's a 1KB file, so I doubt it's a valid image. What would cause something like this? Is this a result of a function that PMS performed incorrectly?

It's a 1KB file, so I doubt it's a valid image. What would cause something like this? Is this a result of a function that PMS performed incorrectly?

I'm not sure what would cause that and there's nothing I can do from my side to make sure the database is pointing at a valid image.  The best I can do is to check that the file actually is an image when uploading it and if it isn't, skip it.

Try this script and let me know if it's at least working now: plexEmail.zip (9.9 KB)

I'm not sure what would cause that and there's nothing I can do from my side to make sure the database is pointing at a valid image.  The best I can do is to check that the file actually is an image when uploading it and if it isn't, skip it.

Try this script and let me know if it's at least working now: attachicon.gifplexEmail.zip

Got it. Latest results:

C:\Python27\Scripts>python plexemail.py
jpeg
jpeg
jpeg
jpeg
None
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
jpeg
Web page created successfully
Successfully sent 13 email(s)

C:\Python27\Scripts>

The offending "image" is for a television episode of a series I don't "collect" - once I watch the latest episode, I delete the file from my server, and purge it from Plex on the next library refresh. The file and PMS entry is still there, and has series poster, season poster, and episode thumbnail, so I don't know where this error is occuring.

EDIT: The resulting email had the entry for the episode in question, along with the correct thumbnail.

Also, quick follow-up:

Since I share my server with a bunch of people, they often make requests. However, since I've got a toddler and a baby, my brain don't work so gudd these days. So I made a form on Google Docs that's a simple one-question request form, which then dumps that into a spreadsheet on my Google Drive. Best part is I inserted a link into the email that PlexEmail creates to take people to that form. Now, when they get their "New Release" email every week, they also have an easy way to make requests. Thought I'd share that.

Also, quick follow-up:

Since I share my server with a bunch of people, they often make requests. However, since I've got a toddler and a baby, my brain don't work so gudd these days. So I made a form on Google Docs that's a simple one-question request form, which then dumps that into a spreadsheet on my Google Drive. Best part is I inserted a link into the email that PlexEmail creates to take people to that form. Now, when they get their "New Release" email every week, they also have an easy way to make requests. Thought I'd share that.

Interesting, you might also have an interest in this as well. It current form only supports movie requests, but it is growing rapidly and should soon support TV show requests.

https://forums.plex.tv/topic/151899-plex-movie-requests/

Hi, I just started using PlexEmail and everything works great. But I’m wondering; is there some way to customize the sent email so that it’s viewable on a phone? I have basic HTML-knowledge at the most but I’m willing to try if someone can point me in the right direction!

Also, quick follow-up:

Since I share my server with a bunch of people, they often make requests. However, since I've got a toddler and a baby, my brain don't work so gudd these days. So I made a form on Google Docs that's a simple one-question request form, which then dumps that into a spreadsheet on my Google Drive. Best part is I inserted a link into the email that PlexEmail creates to take people to that form. Now, when they get their "New Release" email every week, they also have an easy way to make requests. Thought I'd share that.

Glad to hear you're putting it to good use :)

Hi, I just started using PlexEmail and everything works great. But I'm wondering; is there some way to customize the sent email so that it's viewable on a phone? I have basic HTML-knowledge at the most but I'm willing to try if someone can point me in the right direction!

It's not necessarily the prettiest on mobile (due to the image), but it works just fine on my phone.  Is it an issue with it not showing up at all on your phone or the look?

Glad to hear you're putting it to good use :)

It's not necessarily the prettiest on mobile (due to the image), but it works just fine on my phone.  Is it an issue with it not showing up at all on your phone or the look?

I bet what he is referring to is the way a large body of text can get squashed into a thin column that then makes a fairly long email a very long one. Maybe if there was a way that we can choose to show those details are not might help. Such as only show the title of the movie or show and not the full description of it.

I bet what he is referring to is the way a large body of text can get squashed into a thin column that then makes a fairly long email a very long one. Maybe if there was a way that we can choose to show those details are not might help. Such as only show the title of the movie or show and not the full description of it.

If that's the case, then it can already be done by changing filter_sections_movies and filter_sections_TV.

If that's the case, then it can already be done by changing filter_sections_movies and filter_sections_TV.

Cool, it never really bother me as I think I was the only person that tested on mobile. But I will keep that in mind if my users tell me otherwise. -Thanks eadwyn.

If that's the case, then it can already be done by changing filter_sections_movies and filter_sections_TV

First of all; Thank you for your help! I tried that and the email still doesnt look right. Is there some way I could disable most of the functionality with pictures etc and just get an email with new movies/episodes: 

"New TV:

Game of thrones season 1 Episode 5

New Movies:

Mortal kombat" 

Something like that? 

First of all; Thank you for your help! I tried that and the email still doesnt look right. Is there some way I could disable most of the functionality with pictures etc and just get an email with new movies/episodes: 

"New TV:

Game of thrones season 1 Episode 5

New Movies:

Mortal kombat" 

Something like that? 

I'll take a look at what I can do later this week when my job slows down a bit.

Are you looking for just plain text basically (i.e. no styling)?

I'll take a look at what I can do later this week when my job slows down a bit.

Are you looking for just plain text basically (i.e. no styling)?

Oh, wow! Thank you! Yeah, sure plain text should work. I'm pretty much looking for anything that would make it readable on a mobile phone. I love the script in the original state but my plan is to share my content and send daily updates with whats new to 4 - 5 friends and they barely use a computer so they're just complaining about "weird emails" on their phones.

I'll take a look at what I can do later this week when my job slows down a bit.

Are you looking for just plain text basically (i.e. no styling)?

I know what he's talking about - the formatting on a phone doesn't work well because it's using 2 "columns". One for the thumbnail, and one for the text; the email is placing them side-by-side, and so you end up with a long, skinny email that has a lot of white space on the left, and a column on text on the right with three to four words per line.

Maybe reconfigure the column structure for the email? Or change it to thumbnail on top, with text underneath? I dunno...

I know what he's talking about - the formatting on a phone doesn't work well because it's using 2 "columns". One for the thumbnail, and one for the text; the email is placing them side-by-side, and so you end up with a long, skinny email that has a lot of white space on the left, and a column on text on the right with three to four words per line.

Maybe reconfigure the column structure for the email? Or change it to thumbnail on top, with text underneath? I dunno...

Yeah that sounds about right! Would love to be able to use it on both mobile and PC but I tried reading a bit about optimizing CSS for phones and I can honestly say that my webdesign-skills arent even close.

@eadwyn, maybe I missed that option but would you be willing to consider adding the ability to automatically collect/add email addresses of friends with whom you are sharing content?

https://plex.tv/api/users?auth_token=<plextoken here>

Hello, first of all great script! Using it every week now foor all my users!

A thing I'd like to see: BCC, currently all my users can see each others address in the mail at the TO line. If there was a BCC option or if it would sent out all mail seperatly it would be great!

Or am I just blind and is there already such an option?

EDIT: OK, I am very, very blind!