PlexEmail - Email Recently Added Media

I would like to place this in my HTML page (under the dates at header h3 … /h3 to indicate when the last time the page uploaded. Where would I place it?

`<script language="Javascript">
document.write("This page was last modified on: " + document.lastModified +"");
</SCRIPT>`

Not sure where to post this, but having some issues. plexEmail was running fine for weeks and now all of a sudden it is not. Nothing (to my knowledge has changed) but I receive the following error when running manually.

C:\Python27>C:\Automation\PlexEmail\plexEmailLogging.py
Traceback (most recent call last):
File “C:\Automation\PlexEmail\plexEmail-responses.py”, line 1058, in
emailText += ‘


KeyError: ‘emailImgPath’

Using a standard Config file and as stated earlier, it was working fine for weeks (runs weekly) now this week it has stopped working.

Any advice greatly appreciated…

Edit

This weeks email has worked. I guess it got stuck on a TV series it didnt like last week…?

@Semperfratres said:
I would like to place this in my HTML page (under the dates at header h3 … /h3 to indicate when the last time the page uploaded. Where would I place it?

`<script language="Javascript">
document.writeln("This page was last modified on: " + document.lastModified +"");
</SCRIPT>`

Any chance someone knows where this will go? The index gets overwritten, so it can’t go in there. I don’t see anything in the CSS, and don’t know where to look in the bootstraps.
Thanks.

@Semperfratres - Try @~line 498 in plexEmail.py, in the div tag footer where eadwyn adds his copyright notice.
Var name is emailText, but, I’m pretty sure it’s some of the same text pushed to index.html.

Hi all,
I’ve found the way to run PlexEmail in my QNAP but I would like a little support to try to understand the errors that I’m getting. This is the output:

Traceback (most recent call last):                                                                                                                  
  File "plexEmail.py", line 961, in <module>                                                                                                        
    imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)                                                                               
  File "plexEmail.py", line 370, in processImage                                                                                                    
    cloudinaryURL = uploadToCloudinary(imgLocation)                                                                                                 
  File "plexEmail.py", line 415, in uploadToCloudinary                                                                                              
    response = cloudinary.uploader.upload(imgToUpload)                                                                                              
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/cloudinary/uploader.py", line 16, in upload                                                   
    return call_api("upload", params, file = file, **options)                                                                                       
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/cloudinary/uploader.py", line 201, in call_api                                                
    response = urllib2.urlopen(request, **kw).read()                                                                                                
  File "/opt/QPython2/lib/python2.7/urllib2.py", line 154, in urlopen                                                                               
    return opener.open(url, data, timeout)                                                                                                          
  File "/opt/QPython2/lib/python2.7/urllib2.py", line 431, in open                                                                                  
    response = self._open(req, data)                                                                                                                
  File "/opt/QPython2/lib/python2.7/urllib2.py", line 449, in _open                                                                                 
    '_open', req)                                                                                                                                   
  File "/opt/QPython2/lib/python2.7/urllib2.py", line 409, in _call_chain                                                                           
    result = func(*args)                                                                                                                            
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/cloudinary/poster/streaminghttp.py", line 172, in https_open                                  
    return self.do_open(StreamingHTTPSConnection, req)                                                                                              
  File "/opt/QPython2/lib/python2.7/urllib2.py", line 1197, in do_open                                                                              
    raise URLError(err)                                                                                                                             
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>                                           

This is the output of the first time run. I’ve configured the config file config.conf with all the parameters that I think important to run it but I don’t know if I’m doing it well or wrong.

Thank you very much for your help!

@nickiman said:
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

This is the output of the first time run.

FYI - I only give educated GUESSES - I do not know python, but my general IT kung-fu is moderately strong

Searching Google for “python urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]” brings up many discussions. Many of the first page links refer to having an old version (2.7.9 and less) of python.
Others refer to having older OpenSSL libraries (which I think are a dependency of the “requests” module prerequisite required as part of PlexEmail.
So I’ll ask (and a true dev can come in and correct me/give you exact answer at anytime)
What version of python is on your qnap?
Did you install the requests module as listed in instructions? (using pip)

I happen to have a qnap. (Though I don’t use it for any of my web services)
I just shelled to it and did this -
[~] # python --version Python 2.7.5
by default, it’s an old version of python 2.7.
I’d start with researching how to get python to latest 2.7.11 if your QNAP hasn’t had python updated.

@nickiman I just pushed an update to the dev branch that allows you to configure whether to use https or http for cloudinary. Either try updating your python to get ssl working on your server or give this updated script a shot by turning off https.

@eadwyn
I tried doing this myself in some of the files, but was not successful.
I have a weekly and a daily web page. The weekly goes out in email, while the daily does not. I have a link in my weekly to let people know they can check the daily to see what is new over the past 24 hrs. I have a script run every 5 mins to see if the local webpage has been updated, and if so, to upload it to my server for public view.
Under the dates in the <h2> </h2>header, I would like to add a <H3> </h3> header listing the time the page was last updated using document.lastModified (or any other means you have).
Would this be something that could be easily integrated in to PlexEmail?

Hi,
Hoping to get some help with a couple of issues, I really like the application.
Firstly,
I am able to send emails to myself with -t. That works no problem. When I put in the Plex API info I get a traceback error:

F:\PlexEmail\scripts>python plexEmail.py
Web page was not created because the option is disabled in the config file.
Traceback (most recent call last):
File “plexEmail.py”, line 1540, in
sharedEmails = getSharedUserEmails()
File “plexEmail.py”, line 294, in getSharedUserEmails
token = json.loads(response.text)[‘user’][‘authentication_token’];
KeyError: 'user’

This seems to occur when anything is in the plex_username and plex_password fields. I put the correct info in, I get the error. I put the wrong info in, I still get the error. I don’t know Python at all but it looks like it’s having trouble getting a user token from Plex?

Secondly, and less important, I have ‘The Late Show with Stephen Colbert’ in the filter_shows_exclude field, but the episodes are still being included in the email. I copied and pasted the show title text directly from my Plex server, making sure it had all the correct capitalization.

@The_Llama You need to add the filter to all the sections where you want it filtered. If you want it filtered at the episode level you need it like this:

filter_episodes_exclude = [‘The Late Show with Stephen Colbert’]

Not sure what is happening with the authentication. My next release is going to add more helpful logging throughout and that might help pinpoint the issue.

@Semperfratres You can’t do it through the config file right now, but if you wanted it now you could add a line after 708 in the script file:

<h3>Last Modified: """ + time.strftime("%Y-%m-%d %H:%M:%S") + """</h3>

h3 doesn’t have any css applied to it, so you would need to add that as well or use another h2.

@eadwyn Awesome, that fixed the Colbert issue, much appreciated. Looking forward to some insight with the Plex auth issue

@The_Llama - If you’re using a Mac and it’s default text editor, make sure you disable something called smartquotes. Some discussions several pages ago were breaking various config entries because the Mac text editor was actually changing quotes to something python didn’t understand or used differently.

@JamminR No, I dislike OSX/Apple. Notepad++ on Server 2008R2. I did see that tip earlier in the thread, thanks much for the reply.

@eadwyn said:

@Semperfratres You can’t do it through the config file right now, but if you wanted it now you could add a line after 708 in the script file:

<h3>Last Modified: """ + time.strftime("%Y-%m-%d %H:%M:%S") + """</h3>

h3 doesn’t have any css applied to it, so you would need to add that as well or use another h2.

Thanks for the info @eadwyn. Added the CSS for H3 and it looks good.

@JamminR said:

@nickiman said:
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

This is the output of the first time run.

FYI - I only give educated GUESSES - I do not know python, but my general IT kung-fu is moderately strong

Searching Google for “python urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]” brings up many discussions. Many of the first page links refer to having an old version (2.7.9 and less) of python.
Others refer to having older OpenSSL libraries (which I think are a dependency of the “requests” module prerequisite required as part of PlexEmail.
So I’ll ask (and a true dev can come in and correct me/give you exact answer at anytime)
What version of python is on your qnap?
Did you install the requests module as listed in instructions? (using pip)

I happen to have a qnap. (Though I don’t use it for any of my web services)
I just shelled to it and did this -
[~] # python --version Python 2.7.5
by default, it’s an old version of python 2.7.
I’d start with researching how to get python to latest 2.7.11 if your QNAP hasn’t had python updated.

@JamminR I have installed QPython2 from the QNAP forum: [QPython2 ] [ 2.7.11.0.1 ] Python 2 + modules there you can see all the modules that contains listed.
If I run on the CLI in my Qnap:
[~] # python --version
Python 2.7.10
But if I run:
[~] # /opt/QPython2/bin/python2 --version
Python 2.7.11

@eadwyn said:
@nickiman I just pushed an update to the dev branch that allows you to configure whether to use https or http for cloudinary. Either try updating your python to get ssl working on your server or give this updated script a shot by turning off https.

@eadwyn Could you tell me how to do that? My knowledge with python it´s very limited :frowning: I´ve been reviewing the file “”/opt/QPython2/lib/python2.7/urllib2.py"" but I can´t see anything.
Thanks and best regards.

@nickiman I meant that I pushed an update for you to use http instead of https with Cloudinary in the dev branch: https://github.com/jakewaldron/PlexEmail/archive/dev.zip

Grab the new script file and merge your config file with the new one.

@eadwyn said:
@nickiman I meant that I pushed an update for you to use http instead of https with Cloudinary in the dev branch: https://github.com/jakewaldron/PlexEmail/archive/dev.zip

Grab the new script file and merge your config file with the new one.

Ah! OK thank you very much @eadwyn will try it tonight… I´ll let you know ASAP.
Regards

Is there a way to run this remotely? I’d prefer to have the script run from my application server and not my Plex server. They’re local to each other, and I’ve managed to work around Python not liking UNC paths by using a batch file that mounts the LOCAL folder as a drive, then runs PlexEmail, then dismounts the drive.

However, I get this error:

Traceback (most recent call last):
File “plexemail\plexEmail.py”, line 698, in
cur.execute(‘SELECT machine_identifier FROM remote_servers WHERE url LIKE “http://127.0.0.1%”;’)
sqlite3.OperationalError: disk I/O error

The user only has read-only access. Does the script need to write to anything, and how can I work around this? I wouldn’t mind hard-coding things in the script…

@Team503 i ran into the same thing, you need the latest sqlite3 library for Python.

Both sqllite3.def and .dll are in the DLLs folder. PlexPy runs fine, as does HeadPhones. This is related to the fact that the server it’s running on isn’t the Plex server itself - it’s another server.

Plex01: Plex Media Server
App01: Server on which various 3rd party applications run.

If I’m running PlexEmail on App01, does Plex01 have to have Python installed on it?