PlexEmail - Email Recently Added Media

I started poking around this morning, and found the authorization function for the Plex shared users is hitting ‘https://my.plexapp.com/users/sign_in.json’ which returns an error when hitting it. Not sure if PlexEmail is hitting it differently, but I’m wondering if this might be the problem?

@nickiman said:
@eadwyn one question… Will you update the github repo with the new script 0.8.4?

I ask you that because I´ve seen that in GitHub you are still using the script 0.8.3 and I´m doing a little tutorial to explain to all QNAP users like me how to get PlexEmail work so I would like to know what should write:

a) Do a git clone command to download the latest script 0.8.4 (if you are going to update the repo in GitHub)
b) Tell them to get the files from your post

Thank you so much!

When I finish my current additions to logging (hopefully in the next couple weeks), I will pull my changes from the dev branch into the master branch for a v0.9.0. In the meantime though, you can direct people to use the latest from the dev branch. Thanks for doing that as I am sure other QNAP users will appreciate it.

@The_Llama said:
I started poking around this morning, and found the authorization function for the Plex shared users is hitting ‘https://my.plexapp.com/users/sign_in.json’ which returns an error when hitting it. Not sure if PlexEmail is hitting it differently, but I’m wondering if this might be the problem?

That might be the case, we are using that url. I have just checked in changes for the start of logging in the dev branch (GitHub - jakewaldron/PlexEmail at dev). If you want to try it out and PM me the logs I can see if there is anything obvious happening in there.

@JamminR @eadwyn So this was just working for me, now I am getting this large error: see image http://imgur.com/J8pWTNn
Any help would be appreciated

ALl of a sudden I am getting this error:

plexemail.py
Traceback (most recent call last):
File “C:\plexemail\plexEmail.py”, line 1330, in
duration = row[5]/1000
TypeError: unsupported operand type(s) for /: ‘NoneType’ and ‘int’

WHy?

@whataguy56 said:
@JamminR @eadwyn So this was just working for me, now I am getting this large error: see image http://imgur.com/J8pWTNn
Any help would be appreciated

This could be an issue with Gmail potentially: Python 2: SMTPServerDisconnected: Connection unexpectedly closed - Stack Overflow

You can either follow these steps: Send email from a printer, scanner, or app - Google Workspace Admin Help

Or use ssl by setting:
email_use_ssl = True
email_smtp_port = 465

@linkjoy123 said:
ALl of a sudden I am getting this error:

plexemail.py
Traceback (most recent call last):
File “C:\plexemail\plexEmail.py”, line 1330, in
duration = row[5]/1000
TypeError: unsupported operand type(s) for /: ‘NoneType’ and ‘int’

WHy?

Looks like duration might not be set for a specific track in the database. I will need to add logic around this in the next release to check if duration is a number.

Nevermind in the DEV branch log, I am still getting that error before in the log.

The link in the emails/web browser brings it to a server which doesnt exist. Way to fix?

@linkjoy123 said:
Nevermind in the DEV branch log, I am still getting that error before in the log.

Dev branch now has this fixed in it.

@zachmal said:
The link in the emails/web browser brings it to a server which doesnt exist. Way to fix?

What browser are you using? Can you access your server from the computer you are opening the email?

Hi,
Sorry if it sounds like a stupid question… but I´ve no idea of CSS and Web Design.

Is there any way to decrease the font size of the Headers 1 and 2 in the Web page?

Which are the files to touch?
Thanks

Hi Eadwyn, thank you for your work !

i have a problem when i run the python i get this error :

raceback (most recent call last):
File “plexEmail.py”, line 1525, in
emailHTML = createEmailHTML()
File “plexEmail.py”, line 561, in createEmailHTML
emailText += emailMovies + ’
 ’
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 2352: ordinal not in range(128)

Did i do something wrong?

Thanks!

@eadwyn said:
@Team503 Sorry, assumed you were on Linux so was taking python out of it and seeing if you could directly access the db with sqlite3. With python try this:

python
import os, sys
print os.access("p:\\Plex Media Server\\Plug-in Support\\Databases\\com.plexapp.dlna.db", os.R_OK)

EDIT: I noticed that your path started with Plug-in Support. Is this the case or was it a typo? If it is the case try creating a folder named “Plex Media Server” and putting the current top level into that.

C:\Applications>net use P: \ausplex01\plexdata$
The command completed successfully.

(This path is C:\Users\Administrator\AppData\Local on the Plex server, shared with read-only access)

C:\Applications>c:\python27\python plexemail\plexEmail.py
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

C:\Applications>python
‘python’ is not recognized as an internal or external command,
operable program or batch file.

C:\Applications>c:\python27\python
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

impost os, sys
File “”, line 1
impost os, sys
^
SyntaxError: invalid syntax
import os, sys
print os.access(“P:\Plex Media Server\Plug-in Support\Databases\com.plexapp.dlna.db”, os.R_OK)
True

And that ended up being it. The share can’t be read only - for whatever reason, it needs write access.

Also, Markdown sucks and is annoying as hell to use. What’s wrong with UBB again?

Thanks for this nice solution. Recently I’ve been experiencing the following issue on the dev branch (upgraded since I had the same issues as linkjoy123 above) when images are stored locally instead of Cloudinary:

Traceback (most recent call last):
File “plexemail.py”, line 1057, in
imageInfo = processImage(hash, imageInfo[‘thumb’], ‘movie’, 0, 0)
File “plexemail.py”, line 434, in processImage
logging.warning('processImage: Failed to copy image - ’ + e)
TypeError: cannot concatenate ‘str’ and ‘exceptions.IOError’ objects

Thanks.

After updating my OS to Win10 Pro from Win7 Ultimate, I too have been getting the dreaded Python/openssl error CERTIFICATE_VERIFY_FAILED. Though I disabled https uploads in the config of the latest PlexEmail, I wanted to make sure you knew there is an issue out there. Closing the incident report with a hacky work-around just didn’t feel right when I noticed you’d done it, though I don’t know python outright so have no idea how to solve it.
Originally, tried using same version of python I had been using, (2.7.11 x64) which had openssl 1.0.2d, I updated to Python 2.7.12 x64 and it has openssl version 1.0.2h. Same error.
Again, system version specs:
Win10 Pro
Python 2.7.12 x64 (which includes openssl 1.0.2h)

awesome script. just what i was looking for.
for my personal use i’ve edited lines 955 for this:
if ('title' in movies[movie] and movies[movie]['title'] != ''): #title += movies[movie]['original_title'] + ' AKA ' title += movies[movie]['title'] else: title += movies[movie]['original_title']

Thanks thanks thanks!!

I’ve just recently started seeing the following error when trying to run the script:

Traceback (most recent call last): File "plexEmail.py", line 1037, 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
Any help would be appreciated. Keep up the good work!

@eadwyn: I’m a bit late to the party, but wanted to say thank you for such a cool product! I’m hoping for a little sanity check here:

Running the latest git pull on FreeNAS 9.10 STABLE, in it’s own generic jail (separate IP, with storage linked to the Plexdata folder in the Plex jail).

I’m having no issues getting the email, and have successfully set a working cronjob.

For the life of me, I can’t seem to access the webpage I thought it would setup!

I followed the instructions here pretty much to the letter: https://forums.freenas.org/index.php?threads/guide-for-installing-plexemail.40748/

web_folder = /usr/local/www/apache24/data/
web_enabled = true
web_only_save_images = false
web_domain = (I’ve tried every combo I can think of, including leaving it blank, entering the PlexEmail jail IP, localhost, 0.0.0.0 and my external DDNS ip. I’ve tried port 80 when using internal IP info, and my forwarded port when using my external DDNS ip)
web_path = ‘plexemail’

when I run the python script, everything looks good, I get the notices that the Web page created successfully, and that the email has been sent. The email looks great! When I go to click on the link in the email, or attempt to browse to the server IP directly, no dice- i get “This site can’t be reached” in a number of browsers, both on my internal network , and when attempting to connect via external browsers.

Thanks for such a great product! Even if I can’t figure out my web issue, I’ll be happy to use this for weekly updates!

@nickiman said:
Hi,
Sorry if it sounds like a stupid question… but I´ve no idea of CSS and Web Design.

Is there any way to decrease the font size of the Headers 1 and 2 in the Web page?

Which are the files to touch?
Thanks

In web/css/one-page-wonder.css you can modify the following font-size portions:

.headline h1
.headline h2

@bastox said:
Hi Eadwyn, thank you for your work !

i have a problem when i run the python i get this error :

raceback (most recent call last):
File “plexEmail.py”, line 1525, in
emailHTML = createEmailHTML()
File “plexEmail.py”, line 561, in createEmailHTML
emailText += emailMovies + '
 ’
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 2352: ordinal not in range(128)

Did i do something wrong?

Thanks!

I’ll need to investigate this more.

@DallasHQ said:
Thanks for this nice solution. Recently I’ve been experiencing the following issue on the dev branch (upgraded since I had the same issues as linkjoy123 above) when images are stored locally instead of Cloudinary:

Traceback (most recent call last):
File “plexemail.py”, line 1057, in
imageInfo = processImage(hash, imageInfo[‘thumb’], ‘movie’, 0, 0)
File “plexemail.py”, line 434, in processImage
logging.warning('processImage: Failed to copy image - ’ + e)
TypeError: cannot concatenate ‘str’ and ‘exceptions.IOError’ objects

Thanks.

This error should be fixed in the dev branch. Note, that the image will still fail to copy, but now it will print the reason and continue with the script without stopping.

@JamminR said:
After updating my OS to Win10 Pro from Win7 Ultimate, I too have been getting the dreaded Python/openssl error CERTIFICATE_VERIFY_FAILED. Though I disabled https uploads in the config of the latest PlexEmail, I wanted to make sure you knew there is an issue out there. Closing the incident report with a hacky work-around just didn’t feel right when I noticed you’d done it, though I don’t know python outright so have no idea how to solve it.
Originally, tried using same version of python I had been using, (2.7.11 x64) which had openssl 1.0.2d, I updated to Python 2.7.12 x64 and it has openssl version 1.0.2h. Same error.
Again, system version specs:
Win10 Pro
Python 2.7.12 x64 (which includes openssl 1.0.2h)

So this isn’t so much as a code issue, as an issue with the system running the script not having the certificate in the cacert.pem file. For those who want to do that and use https, you can give this solution a shot: python - urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error - Stack Overflow

@MikeFalcor said:
I’ve just recently started seeing the following error when trying to run the script:

Traceback (most recent call last): File "plexEmail.py", line 1037, 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
Any help would be appreciated. Keep up the good work!

Can you please take the latest dev build and PM me the logs? It should have more info on what might be happening.

@ahughes03 said:
@eadwyn: I’m a bit late to the party, but wanted to say thank you for such a cool product! I’m hoping for a little sanity check here:

Running the latest git pull on FreeNAS 9.10 STABLE, in it’s own generic jail (separate IP, with storage linked to the Plexdata folder in the Plex jail).

I’m having no issues getting the email, and have successfully set a working cronjob.

For the life of me, I can’t seem to access the webpage I thought it would setup!

I followed the instructions here pretty much to the letter: Guide for installing PlexEmail? | TrueNAS Community

web_folder = /usr/local/www/apache24/data/
web_enabled = true
web_only_save_images = false
web_domain = (I’ve tried every combo I can think of, including leaving it blank, entering the PlexEmail jail IP, localhost, 0.0.0.0 and my external DDNS ip. I’ve tried port 80 when using internal IP info, and my forwarded port when using my external DDNS ip)
web_path = ‘plexemail’

when I run the python script, everything looks good, I get the notices that the Web page created successfully, and that the email has been sent. The email looks great! When I go to click on the link in the email, or attempt to browse to the server IP directly, no dice- i get “This site can’t be reached” in a number of browsers, both on my internal network , and when attempting to connect via external browsers.

Thanks for such a great product! Even if I can’t figure out my web issue, I’ll be happy to use this for weekly updates!

I have not tried getting apache working in a jail. A couple things:

  1. Have you verified that the web page that is created is in the proper location in your web directory (/usr/local/www/apache24/data/plexemail)?
  2. Have you tried accessing it on your local network: http:///plexemail

@eadwyn said:
I have not tried getting apache working in a jail. A couple things:

  1. Have you verified that the web page that is created is in the proper location in your web directory (/usr/local/www/apache24/data/plexemail)?
  2. Have you tried accessing it on your local network: http:///plexemail

thanks for the tips. yes, the web-page index file is in the correct location, and I’ve tried navigating to the /plexemail page a number of different ways, with no positive results.

All that being said, the email is still really helpful, so thanks for all your hard work!

~~I had an issue when my PC updated to Win10 AU. Borked it bad enough that I had to do a clean install of the OS.
I have got PlexEmail running again for my weekly/test script (.bat), but am having an issue with my daily script.
My script reads:
plexEmail.py -c PlexDailyUpdate

I am getting this back at the CLI~~
C:\PlexEmail\scripts>plexemail.py -c usage: plexEmail.py [-h] [-c CONFIGFILE] [-t] [-n NOTICE] plexEmail.py: error: argument -c/--configfile: expected one argument

~~The scripts and batch files are located at C:\PlexEmail\scripts.
And , like I mentioned, the regular weekly/test (-t) script works fine.

Before the borking of my PC, that batch script ran fine.

edit:
This is the same PlexEmail folder I had previously. I was able to copy it to Drive.~~

EDIT2:
Fixed

Have still issues with the script. Got this error:
2016-08-13 13:26:08,036 - INFO:processImage: begin 2016-08-13 13:26:08,036 - INFO:processImage: imageHash = ac7198cdbd2f034d26b797adc6e8adce18b953e3 - thumb = metadata://posters/com.plexapp.agents.thetvdb_5448663fe3aaec5cbe353906f82a65fff1cd3672 - mediaType = show - seasonIndex = 0 - episodeIndex = 0 2016-08-13 13:26:08,036 - INFO:processImage: imgLocation = D:\Plex server\Plex Media Server\Metadata\TV Shows\a\c7198cdbd2f034d26b797adc6e8adce18b953e3.bundle\Contents\com.plexapp.agents.thetvdb\posters\5448663fe3aaec5cbe353906f82a65fff1cd3672 2016-08-13 13:26:08,036 - INFO:processImage: webImgFullPath = newon.plexitnow.net//images/5448663fe3aaec5cbe353906f82a65fff1cd3672_ac7198cdbd2f034d26b797adc6e8adce18b953e3.jpg 2016-08-13 13:26:08,036 - INFO:processImage: img = C:\www\html\updates\\images\5448663fe3aaec5cbe353906f82a65fff1cd3672_ac7198cdbd2f034d26b797adc6e8adce18b953e3.jpg 2016-08-13 13:26:08,036 - INFO:processImage: Hosting image on local web server 2016-08-13 13:26:08,036 - INFO:processImage: Setting image paths to local and copying image to web folder 2016-08-13 13:26:08,036 - INFO:processImage: begin 2016-08-13 13:26:08,036 - INFO:processImage: imageHash = 7ec0f9515c46da3308574f972097f5715c87cc3a - thumb = https://thetvdb.com/banners/posters/247808-1.jpg - mediaType = show - seasonIndex = 0 - episodeIndex = 0 2016-08-13 13:26:08,036 - 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