PlexEmail - Email Recently Added Media

@Semperfratres said:
Are there any release notes so that one may see what has changed from v. 0.8.1 to v. 0.8.3?

It’s technical, but, it shows notes for each commit between .8.1 and master (.8.3 as of this post), and actual file changes.

@JamminR said:

@Semperfratres said:
Are there any release notes so that one may see what has changed from v. 0.8.1 to v. 0.8.3?

Comparing v0.8.1...master · jakewaldron/PlexEmail · GitHub
It’s technical, but, it shows notes for each commit between .8.1 and master (.8.3 as of this post), and actual file changes.

Thanks for the info.

Receiving this error:

C:\Python27\Scripts>python C:\plexemail\scripts\plexemail.py
Traceback (most recent call last):
File “C:\plexemail\scripts\plexemail.py”, line 812, in
cur.execute(‘SELECT machine_identifier FROM remote_servers WHERE url LIKE “h
ttp://127.0.0.1%”;’)
sqlite3.DatabaseError: file is encrypted or is not a database

Does anyone know what Plex server file gets updated when new items are added to the library?
Perhaps it’s a metadata file or something?

I am attempting to run an auto-update of my web page each time something new is scanned and added to my library. Using FreeFileSync to watch a file, then running a .bat to run PlexEmail when that file changes, and then FreeFileSync again to sync the new web page with my web server.

Also, I know that plexEmail.py -t will send only the server owner an email, but is there a way to run plexEmail.py and only updating the webpage? No emails to owner.

I have a Task set to send emails to my users only on Fridays, but I don’t need to get the email every time my library changes and plexEmail runs based on a library change.

Thanks in advance.

@Pope Viper said:
Receiving this error:

C:\Python27\Scripts>python C:\plexemail\scripts\plexemail.py
Traceback (most recent call last):
File “C:\plexemail\scripts\plexemail.py”, line 812, in
cur.execute(‘SELECT machine_identifier FROM remote_servers WHERE url LIKE “h
ttp://127.0.0.1%”;’)
sqlite3.DatabaseError: file is encrypted or is not a database

Did you follow prerequisite #2?

@Semperfratres said:
Does anyone know what Plex server file gets updated when new items are added to the library?
Perhaps it’s a metadata file or something?

I am attempting to run an auto-update of my web page each time something new is scanned and added to my library. Using FreeFileSync to watch a file, then running a .bat to run PlexEmail when that file changes, and then FreeFileSync again to sync the new web page with my web server.

Also, I know that plexEmail.py -t will send only the server owner an email, but is there a way to run plexEmail.py and only updating the webpage? No emails to owner.

I have a Task set to send emails to my users only on Fridays, but I don’t need to get the email every time my library changes and plexEmail runs based on a library change.

Thanks in advance.

Have you tried creating another config file that disables email? You can pass another config file with the -c option.

@Semperfratres said:
Does anyone know what Plex server file gets updated when new items are added to the library?

I don’t know of any single file, I’m betting there are MANY.
That being said, besides what eadwyn suggests, I’d recommend looking into running PlexPy in conjunction with PlexEmail.
PlexPy’s statistics presentations are wonderful, and in addition, it has a robust frequent almost real time notification system for many social sites.
In addition to social sites, it has a custom script setup and variable framework that can be passed to the custom script. It should fit your idea “server updated, run script (that runs PlexEmail -c yourwebpageupdate_noemail.config”) idea well.

Has anyone using Cloudinary as image hosting, sending emails to multiple users, experienced missing/broken images in the emails that go out?
It seems my weekly updates are missing 1 in 4 or 1 in 5 statistically.

@JamminR Yup. Every week, like clockwork.

@eadwyn and @JamminR
Thanks for your replies. I will look into both ideas. Sounds like together, they will do what I want to accomplish.

@JamminR , I get that every once in a while. Most of the time, if I go into my library and take a look at the file in question, it is missing the poster. I have noticed that Freebase is not catching everything, so I then re-scan it with MovieDB. I saw somewhere last week that Freebase was going away, so I don’t know what is going on with it.

Any help someone can give with the below would be much apreciated.

@harroguk said:
Not sure what has changed but trying to run the script gives the following error. Last email was successfully sent on 25 Apr 2015 (Emails are normally sent weekly on Mondays).

26th April was a Plex Update, I can see no updates to PlexEmail since 4th Ma 2016

C:\InstalledPrograms\PlexEmail\scripts>python plexEmail.py Traceback (most recent call last): File "plexEmail.py", line 1175, in <module> tvEpisodes = OrderedDict(sorted(tvEpisodes.iteritems(), key=lambda t: t[1][config['episode_sort_2']], reverse=config['episode_sort_2_reverse'])) File "plexEmail.py", line 1175, in <lambda> tvEpisodes = OrderedDict(sorted(tvEpisodes.iteritems(), key=lambda t: t[1][config['episode_sort_2']], reverse=config['episode_sort_2_reverse'])) KeyError: 'season_index'

Line 1175 seems to refer to “episode_sort_2” in the config.conf so here are the relevant lines refering to it in my config.conf

# Possible values = id, title, title_sort, original_title, rating, tagline,
#                   summary, content_rating, duration, tags_genre, tags_director, tags_star, year,
#                   hash, index, studio, season_index, show_title, show_title_sort, show_original_title
episode_sort_1 = 'show_title_sort'
episode_sort_1_reverse = False
episode_sort_2 = 'season_index'
episode_sort_2_reverse = False
episode_sort_3 = 'index'
episode_sort_3_reverse = False

@harroguk said:
Any help someone can give with the below would be much apreciated.

Hmm, that looks like default config and code, so I’m not sure what is happening. Only thing I can think of is that there is a show without seasons? But that doesn’t make sense, since I’m pretty sure all TV episodes in Plex have to belong to a season. I’ve been super slammed with work the past couple weeks and still am. I’ll try to give you some debug code when things slow down for me.

@infideler - thanks for info
@Semperfratres - No, I’ve checked. Except for once, it’s always available on my PMS server. I can even link back to my server and working poster from the email links. Just the image pointing to Cloudinary is broken as though Cloudinary never got it.

@eadwyn - As I find no easy way to tell from the many images stored on Cloudinary (due to hex file names, and difficulty ‘seeing’ the thumbnails), is there a way to determine, from logs or such, why infideler and I (and the email lists we send to) are seeing broken/missing images.
Does PlexEmail wait for Cloudinary to “accept” the file before moving on to the next (one or batch, I don’t know), or does PlexEmail just blindly upload images, then move on to next task of sending the emails with image links that might not actually work?

@eadwyn said:
Have you tried creating another config file that disables email? You can pass another config file with the -c option.

@JamminR said:
I don’t know of any single file, I’m betting there are MANY.
That being said, besides what eadwyn suggests, I’d recommend looking into running PlexPy in conjunction with PlexEmail.
PlexPy’s statistics presentations are wonderful, and in addition, it has a robust frequent almost real time notification system for many social sites.
In addition to social sites, it has a custom script setup and variable framework that can be passed to the custom script. It should fit your idea “server updated, run script (that runs PlexEmail -c yourwebpageupdate_noemail.config”) idea well._

Thanks a lot for these suggestions. Using PlexPy (setup as a service with AlwaysUp), the -c option for PlexEmail, and FreeFileSync(ReatimeSync), my webpage stays updated any time new content is added to my server.

One question though. Is there any way to order the content in the email/webpage alphabetically? It seems to come in randomly, not even by what was added last.

Thanks again for your insight to my webpage update.

@eadwyn said:

@Pope Viper said:
Receiving this error:

C:\Python27\Scripts>python C:\plexemail\scripts\plexemail.py
Traceback (most recent call last):
File “C:\plexemail\scripts\plexemail.py”, line 812, in
cur.execute(‘SELECT machine_identifier FROM remote_servers WHERE url LIKE “h
ttp://127.0.0.1%”;’)
sqlite3.DatabaseError: file is encrypted or is not a database

Did you follow prerequisite #2?

I double checked, and did find a different version of the DLL, I replaced it, and am now getting this:

C:\PlexEmail\scripts>python plexemail.py
Traceback (most recent call last):
File “plexemail.py”, line 1, in
import sqlite3
File “C:\Python27\lib\sqlite3_init_.py”, line 24, in
from dbapi2 import *
File “C:\Python27\lib\sqlite3\dbapi2.py”, line 27, in
from _sqlite3 import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

@JamminR said:
@eadwyn - As I find no easy way to tell from the many images stored on Cloudinary (due to hex file names, and difficulty ‘seeing’ the thumbnails), is there a way to determine, from logs or such, why infideler and I (and the email lists we send to) are seeing broken/missing images.
Does PlexEmail wait for Cloudinary to “accept” the file before moving on to the next (one or batch, I don’t know), or does PlexEmail just blindly upload images, then move on to next task of sending the emails with image links that might not actually work?

Right now, it takes the image and makes the call to upload to Cloudinary. It then waits for the response, which includes the URL of the image. You should be able to copy the image location in your email or web page to get the Cloudinary URL.

At some point when I get a bunch more free time, I plan on adding logging throughout the script to help troubleshoot these issues, but as of now there is no logging.

@Semperfratres said:
Thanks a lot for these suggestions. Using PlexPy (setup as a service with AlwaysUp), the -c option for PlexEmail, and FreeFileSync(ReatimeSync), my webpage stays updated any time new content is added to my server.

One question though. Is there any way to order the content in the email/webpage alphabetically? It seems to come in randomly, not even by what was added last.

Thanks again for your insight to my webpage update.

Take a look at the sort options at the bottom of the config file. Default for movies is rating then title_sort. You can change this to whichever you prefer (the comments in those sections list out the possible choices).

@Pope Viper said:
I double checked, and did find a different version of the DLL, I replaced it, and am now getting this:

C:\PlexEmail\scripts>python plexemail.py
Traceback (most recent call last):
File “plexemail.py”, line 1, in
import sqlite3
File “C:\Python27\lib\sqlite3_init_.py”, line 24, in
from dbapi2 import *
File “C:\Python27\lib\sqlite3\dbapi2.py”, line 27, in
from _sqlite3 import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

Did you grab the correct DLL (32/64) for your python installation?

Yea, I had just thought of that after I typed it, grabbed the 64-bit DLL, and now it’s up and running, thanks sir

@eadwyn said:
Right now, it takes the image and makes the call to upload to Cloudinary. It then waits for the response, which includes the URL of the image. You should be able to copy the image location in your email or web page to get the Cloudinary URL.

At some point when I get a bunch more free time, I plan on adding logging throughout the script to help troubleshoot these issues, but as of now there is no logging.

Ok. I’ve just been doing some troubleshooting.
I thought it might be Gmail breaking in it’s odd proxy of linked images.
I determined some images aren’t getting uploaded or are getting errors (and not being uploaded) before PlexEmail moves on to other images.
I just ran a test, 14 day history, no email, only web index.html and using Cloudinary to host.
30 images should be in my index.html notification.
6 are missing.
The src tag in the html is blank, and the image isn’t on Cloudinary.
One example
<img class="featurette-image img-responsive pull-left" src="" height="218px" width="154px">
The image is on my PMS server, for all missing images.

@eadwyn said:

@harroguk said:
Any help someone can give with the below would be much apreciated.

Hmm, that looks like default config and code, so I’m not sure what is happening. Only thing I can think of is that there is a show without seasons? But that doesn’t make sense, since I’m pretty sure all TV episodes in Plex have to belong to a season. I’ve been super slammed with work the past couple weeks and still am. I’ll try to give you some debug code when things slow down for me.

Tried running it again today and we have a different error message (well, same error, different line numbers)…

C:\InstalledPrograms\PlexEmail\scripts>python plexEmail.py
Traceback (most recent call last):
File “plexEmail.py”, line 1087, in
tvSeasons = OrderedDict(sorted(tvSeasons.iteritems(), key=lambda t: t[1][config[‘season_sort_2’]], reverse=config[‘season_sort_2_reverse’]))
File “plexEmail.py”, line 1087, in
tvSeasons = OrderedDict(sorted(tvSeasons.iteritems(), key=lambda t: t[1][config[‘season_sort_2’]], reverse=config[‘season_sort_2_reverse’]))
KeyError: ‘Index’

So, a small amount of investigation shows that if I add any of the following 3 shows to my library in Plex then I get the error above…

All directories contain files in .avi, .mkv and .srt format

C:\InstalledPrograms\PlexEmail\scripts>Tree I:\Temp /F Folder PATH listing for volume DrivePool Volume serial number is 0016-710E I:\TEMP ├───Jane the Virgin │ ├───Season 01 │ └───Season 02 │ ├───Made in Chelsea │ └───Season 11 │ └───No Such Thing as the News └───Season 01

Remove the offending shows and the script runs with no issues.