[HOW TO] Install & configure PlexEmail

DLNA, AirPlay, Chromecast, PS3, XBOX, iTunes, & other media players
Post Reply
User avatar
nickiman
Know my way around
Posts: 217
Joined: Thu Nov 13, 2014 11:15 pm
Location: Madrid, Spain

[HOW TO] Install & configure PlexEmail

Post by nickiman »

Hi all,
EDIT: 15/05/2017 [Added detailed steps to follow the procedure from the begining running QTS 4.3.3 and an important note for users that followed this HOW TO in QTS 4.2 and have upgraded to QTS 4.3.3]

I would like to share with you what I´ve made in my NAS TS-453Pro in order to run the script PlexEmail (actually in version 0.8.7) creating the Web page and sending the e-mails to the rest of my Plex server users. You can take a look to the official PlexEmail thread in the plex forums here:
https://forums.plex.tv/discussion/15161 ... d-media/p1

And also in your GitHub page here:
https://github.com/jakewaldron/PlexEmail
IMPORTANT NOTE: TO ALL USERS THAT FOLLOWED THIS HOW-TO IN QTS 4.2 OR EARLIER AND PERFORMED THE UPGRADE TO QTS 4.3.3:
It´s important to know that the package Qpython2 have changed from the firmware QTS 4.3.3 so, if you installed it previously in QTS 4.2 or earlier version, and you did the upgrade to QTS 4.3.3 you have to uninstall it first and install it again. If you upgraded the package Qpython2 directly from the repo or overwriting it with a new version from the forum will not work. This is because the paths has changed. This is advised in the first post where you have the download of the new QPython2 for the x64 version.
x64 Version : http://www.positiv-it.fr/QNAP/APP/QPyth ... 4.qpkg.zip [ FW 4.3 ] [ Previous Version need to be removed as prior ]
Pre-Requisites [Until QTS 4.2.5]
  1. You must install:
    [QPython2 ] [ 2.7.11.0.1 ] Python 2 + modules from the QNAP forum: viewtopic.php?f=217&t=109899 or from the repo: http://store.qnapclub.eu/
  • In addition it´s recommended install (if you didn´t installed previously) Git 2.1.0 Optware Free from the QNAP´s forum also: viewtopic.php?f=301&t=97220 otherwise you can avoid using git also if you download from github page the files with the option "clone or download" and transferring the files in the paths/folders indicated below.
Pre-Requisites [From QTS 4.3.3]
  1. You must install:
    [QPython2 ] [ 2.7.13.0 ] Python 2 + modules from the QNAP forum: viewtopic.php?f=217&t=109899 or from the repo: http://store.qnapclub.eu/
  • In addition it´s recommended install (if you didn´t installed previously):
    [ QGit ] [ 2.10.0 ] Git SCM (Full) from the QNAP´s forum or from therepo.
    [CACert ] [ 1.00 ] Certificate Authority Certificates from the QNAP´s forum or from therepo. Needed to avoid certificate verify problems this also needs QPerl package as dependency
    [ QPerl ] [ 5.20.2.1 ] Perl / CPAN from the QNAP´s forum or from therepo.

    Due that we have 2 packages more to use Qgit I´ve added a new way to download the files directly from the command line without need to install these packages. Just only QPython must be installed.
If you want to avoid to install QGit, CACert and QPerl you can simple download the master branch in this way (SSH in the NAS):

Code: Select all

wget https://github.com/jakewaldron/PlexEmail/archive/master.zip
unzip master.zip
And you will get a new folder named "PlexEmail-master" with all the files needed.

Installation [Until QTS 4.2.5]

SSH to the NAS

Code: Select all

cd /share/CACHEDEV1_DATA/.qpkg
git clone https://github.com/jakewaldron/PlexEmail.git
mkdir /share/CACHEDEV1_DATA/Web/plexemail
cp -R /share/CACHEDEV1_DATA/.qpkg/PlexEmail/web/* /share/CACHEDEV1_DATA/Web/plexemail/
Installation [From QTS 4.3.3]

SSH to the NAS

Code: Select all

wget https://github.com/jakewaldron/PlexEmail/archive/master.zip
unzip master.zip
mkdir /share/CACHEDEV1_DATA/.qpkg/PlexEmail/
cp -R /root/PlexEmail-master/* /share/CACHEDEV1_DATA/.qpkg/PlexEmail/
mkdir /share/CACHEDEV1_DATA/Web/plexemail
cp -R /root/PlexEmail-master/web/* /share/CACHEDEV1_DATA/Web/plexemail/
Editing the config file with the relevant settings as details here:

Code: Select all

vi /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/config.conf
If you have doubts about the paths of Plex data folder & web folder:
plex_data_folder = '/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/'
web_folder = '/share/Web/'
Running the script [Until QTS 4.2.5]

Code: Select all

/opt/QPython2/bin/python2 /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py
Running the script [From QTS 4.3.3]

Code: Select all

/share/CACHEDEV1_DATA/.qpkg/QPython2/bin/python /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py
This is the normal output that you should get:

Code: Select all

Web page created successfully
Successfully sent 1 email(s)
Editing Cron in QNAP to create a job and run the script weekly [Until QTS 4.2.5]

This an example of an entry that will create a new job in crontab to execute the script at 16:00H. every friday.

Code: Select all

echo "0 16 * * 5 /opt/QPython2/bin/python2 /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py" >> /etc/config/crontab
crontab /etc/config/crontab
Editing Cron in QNAP to create a job and run the script weekly [From QTS 4.3.3]

This an example of an entry that will create a new job in crontab to execute the script at 16:00H. every friday.

Code: Select all

echo "0 16 * * 5 /share/CACHEDEV1_DATA/.qpkg/QPython2/bin/python /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py" >> /etc/config/crontab
crontab /etc/config/crontab
After that you can check if the entry has been added typing: crontab -l and locate that the entry has been added corectly.

And that´s all!
Hope this how to can be useful.
Best regards.
Last edited by nickiman on Mon May 15, 2017 9:49 am, edited 1 time in total.
TS-453 Pro - FW: QTS 5.1.4.2596
6Tb WD Red WD6002FFWX (x4) with RAID 5
deejayexe
Starting out
Posts: 30
Joined: Tue Apr 29, 2014 10:19 pm

Re: [HOW TO] Install & configure PlexEmail

Post by deejayexe »

Muchas Gracias/thanks! nickiman

Lo he probado y funciona de lujo, incluso es mejor que con plexply, porque cataloga por fechas y la parte del servidor web es un lujo ;) En mi caso aproveche e instale la app de QNAP_Stephane QGit para la clonacion de git.
Aprovecho la ocasion y si necesitas algo avisame, saludos

Thank you / thanks! nickiman

I tried it and it works luxury is even better than plexply because cataloged by date and part of the web server is a luxury ;) In my case take and install the app QNAP_Stephane qgit for cloning git .
I take this opportunity and if you need anything let me know , greetings
level42
Getting the hang of things
Posts: 61
Joined: Tue May 06, 2014 3:52 am
Location: 127.0.0.1
Contact:

Re: [HOW TO] Install & configure PlexEmail

Post by level42 »

First off, Thank you for this!

I followed all of your instructions, and it worked perfectly.

After my first sent test email, I made some addition changes to the configuration, that I wanted to test. However, whenever I run:

"/opt/QPython2/bin/python2 /share/MD0_DATA/.qpkg/PlexEmail/scripts/plexEmail.py"

Nothing happens, I do not get the output:

"Web page created successfully
Successfully sent 1 email(s)"

Any ideas what might be going on?
NAS: TS-870-Pro | F/W: 4.3.4.0435
NAS: TS-859-Pro+ | F/W: 4.2.6
User avatar
nickiman
Know my way around
Posts: 217
Joined: Thu Nov 13, 2014 11:15 pm
Location: Madrid, Spain

Re: RE: Re: [HOW TO] Install & configure PlexEmail

Post by nickiman »

level42 wrote:First off, Thank you for this!

I followed all of your instructions, and it worked perfectly.

After my first sent test email, I made some addition changes to the configuration, that I wanted to test. However, whenever I run:

"/opt/QPython2/bin/python2 /share/MD0_DATA/.qpkg/PlexEmail/scripts/plexEmail.py"

Nothing happens, I do not get the output:

"Web page created successfully
Successfully sent 1 email(s)"

Any ideas what might be going on?
Hi
It you have modified the script maybe it's the cause of you are not getting message with the Web page created and sent emails.

Try to start again with the script by default and modifie it step by step.

If in the first change doesn't work. My advice is to write in the plexemail thread in plex forum to get more support.

Regards
TS-453 Pro - FW: QTS 5.1.4.2596
6Tb WD Red WD6002FFWX (x4) with RAID 5
ccolotti
Starting out
Posts: 46
Joined: Fri Nov 04, 2016 5:26 am

Re: [HOW TO] Install & configure PlexEmail

Post by ccolotti »

All I get is this so something is missing in the instructions or on the NAS it seems.

Traceback (most recent call last):
File "plexEmail.py", line 9, in <module>
import requests
ImportError: No module named requests
User avatar
nickiman
Know my way around
Posts: 217
Joined: Thu Nov 13, 2014 11:15 pm
Location: Madrid, Spain

Re: [HOW TO] Install & configure PlexEmail

Post by nickiman »

ccolotti wrote:All I get is this so something is missing in the instructions or on the NAS it seems.

Traceback (most recent call last):
File "plexEmail.py", line 9, in <module>
import requests
ImportError: No module named requests
Not sure which version of QTS are you running but, it seems like you are not running the correct python. Please read carefully my first post as I´ve updated the instructions for the new users that are following this HOW TO in QTS 4.3.3.

If you have any question or doubt just ask me.

Best regards.
TS-453 Pro - FW: QTS 5.1.4.2596
6Tb WD Red WD6002FFWX (x4) with RAID 5
ccolotti
Starting out
Posts: 46
Joined: Fri Nov 04, 2016 5:26 am

Re: [HOW TO] Install & configure PlexEmail

Post by ccolotti »

seems to be all working except HTTPS on the cloudinary option. it is throwing SSL: CERTIFICATE_VERIFY_FAILED even though the CACert and QPerl are installed.
User avatar
nickiman
Know my way around
Posts: 217
Joined: Thu Nov 13, 2014 11:15 pm
Location: Madrid, Spain

Re: [HOW TO] Install & configure PlexEmail

Post by nickiman »

ccolotti wrote:seems to be all working except HTTPS on the cloudinary option. it is throwing SSL: CERTIFICATE_VERIFY_FAILED even though the CACert and QPerl are installed.
Ok happy to see that you get run the script at the end... about your issue with cloudinary... I recommend you write in the thread of PlexEmail in the Plex forum to get support regarding that questions.

By the way, which version of the script are you using?
TS-453 Pro - FW: QTS 5.1.4.2596
6Tb WD Red WD6002FFWX (x4) with RAID 5
ccolotti
Starting out
Posts: 46
Joined: Fri Nov 04, 2016 5:26 am

Re: [HOW TO] Install & configure PlexEmail

Post by ccolotti »

I pulled the latest version from GIT when I installed it the other day

Script Version: v0.9.3
ccolotti
Starting out
Posts: 46
Joined: Fri Nov 04, 2016 5:26 am

Re: [HOW TO] Install & configure PlexEmail

Post by ccolotti »

I am just curious if anyone has gotten HTTPS to work with Cloudinary? It's a cert verification issue on thew QNAP I can't seem to figure out. it's not a script issue it's an SSL chain issue

Code: Select all

2018-02-17 09:32:27,670 - INFO:uploadToCloudinary: start upload to cloudinary
2018-02-17 09:32:27,798 - ERROR:Logging an uncaught exception
Traceback (most recent call last):
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py", line 1101, in <module>
    imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py", line 435, in processImage
    cloudinaryURL = uploadToCloudinary(imgLocation)
  File "/share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py", line 493, 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 "/share/CACHEDEV1_DATA/.qpkg/QPython2/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/share/CACHEDEV1_DATA/.qpkg/QPython2/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/share/CACHEDEV1_DATA/.qpkg/QPython2/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/share/CACHEDEV1_DATA/.qpkg/QPython2/lib/python2.7/urllib2.py", line 407, 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 "/share/CACHEDEV1_DATA/.qpkg/QPython2/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)>
Post Reply

Return to “Media Streaming”