Plex Email
Update 2/26/2016: This script has been updated to now handle music along with TV and movies.
Hey everyone. The other day I saw someone looking for an application that could send out a newsletter email with recently added TV and movies from the previous week. The only options that I could find were PlexWatch, which sends out emails for every new addition and PlexReport which does not support Windows.
So I decided to create my own script that can work on all OSes (that can execute a python script) which would send out an email once a week to a configured list of recipients. While I was doing this, I decided to have it also create a web page that can be viewed outside email (this requires a web server).
The script has already expanded to be fairly configurable, so please look at the Readme to see all the options.
Github Repo: https://github.com/jakewaldron/PlexEmail
Latest Release: https://github.com/jakewaldron/PlexEmail/releases/latest
Readme: https://github.com/jakewaldron/PlexEmail/blob/master/README.md (screenshots included here)
Donations: I've recently been asked about donations. If you would like to donate to this project, you can do so here: Paypal Donation
Introduction
This script aggregates all new TV and movie releases for the past x days then writes to your web directory and sends out an email.
Supported Environments
- Windows - Tested
- Linux - Tested
- FreeBSD/FreeNAS - Tested
- Mac - Not Tested
Supported Email Protocols
- SMTP
Prerequisites
- Python 2.7 - Windows: 32 bit - https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
- 32 bit DLL for SQLite version 3.8.8.3
- Windows - http://www.sqlite.org/2015/sqlite-dll-win32-x86-3080803.zip (Put this into the DLLs folder of the Python installation)
- Windows 64 bit: If you need 64 bit python, this was just found and works: http://synopse.info/files/SQLite3-64.7z
- Mac (Most likely already installed) - http://www.sqlite.org/2015/sqlite-shell-osx-x86-3080803.zip (Put this into the /usr/lib/python2.7 directory - default location)
- Requests module for Python. pip install requests or download it here and put it in the LIb folder of your Python installation: https://pypi.python.org/packages/source/r/requests/requests-2.5.3.tar.gz#md5=23bf4fcc89ea8d353eb5353bb4a475b1
- If web reports are wanted, a web server (apache, nginx, XAMPP, WampServer, EasyPHP, lighttpd, MAMP, etc)
Installation (Windows)
- Clone this repo or download the zip
- Copy the contents of scripts to where you want the script to run from
- Copy the contents of web to your web folder
- Update the config.conf file inside the scripts folder
- Schedule a weekly task to execute plexEmail.vbs (on windows) or plexEmail.py (on linux/mac) from the scripts folder (make sure to set the start in folder as the folder where the vbs script resides)
Installation (Linux)
- Install python 2.7.9
- pip install requests
- Copy the contents of scripts to where you want the script to run from
- Copy the contents of web to your web folder
- Update the config.conf file inside the scripts folder
- Schedule a weekly cron job to execute the plexEmail.py script
Installation (CentOS)
https://forums.plex.tv/topic/151619-plexemail-in-development/page-7#entry879778
Installation (FreeNAS)
Thanks to adrianwi:
https://forums.freenas.org/index.php?threads/guide-for-installing-plexemail.40748/#post-257799
Usage
Normal Usage
python plexEmail.py
Alternate Usage
Pass in an alternate config file. For example the default config file sends out a daily email (using Cloudinary), while an alternate config file is set up for a weekly web page.
python plexEmail.py -c C:\files\plexEmailWeekly.conf
Run in test mode. This will only send the email to the sender.
python plexEmail.py -t
Config File
The config file is in the scripts folder. Before first run of the script, please update this file with your information.
Field Explanations:
Folder Paths
- plex_data_folder - Location where the Plex Media Server folder is located - i.e. E:\\Library\\Plex\\
- web_folder - Location of web/www/public_html folder is located - i.e. C:\\wamp\\www\\
General
- date_format - Format to use for the date
- date_days_back_to_search - Number of days to search backwards
- date_hours_back_to_search - Number of hours to search backwards
- date_minutes_back_to_search - Number of minutes to search backwards
Image Hosting
Cloudinary - Sign up for a free account at: http://cloudinary.com/
- upload_use_cloudinary - Use Cloudinary image hosting
- upload_cloudinary_cloud_name - Cloudinary cloud name
- upload_cloudinary_api_key - Cloudinary api key
- upload_cloudinary_api_secret - Cloudinary api secret
Web
- web_enabled - Enable the creation of the web page
- web_domain - Domain name of the web page
- web_path - Path on the domain to the web page
- web_delete_previous_images - True to delete all .jpg images in the web image folder prior to copying over current images
- web_skip_if_no_additions - True to skip creating a web page if there are no new additions
- email_enabled - Enable the creation and sending of an email
- email_individually - True to send out emails individually to each address in the email_to setting
- email_to - Array of email addresses to send the email
- email_from - Email address to send the email from
- email_from_name - Friendly name of sender
- email_smtp_address - SMTP address of the email service
- email_smtp_port - SMTP port of the email service
- email_use_ssl - Use SSL - Note that the port must be an SSL port for this to work i.e. 465
- email_username - SMTP authentication username
- email_password - SMTP authentication password
- email_use_web_images - Use images from the web server instead of attaching them directly to the email
- email_skip_if_no_additions - True to skip sending emails if there are no new additions
Filtering
- filter_show_movies - True to show recently added movies
- filter_show_shows - True to show recently added TV shows
- filter_show_seasons - True to show recently added TV seasons
- filter_show_episodes - True to show recently added TV episodes
- filter_libraries - A list of library names to filter out -
- filter_sections_movies - Movie specific filters
- filter_sections_TV - TV specific filters
- Possible fields: tagline, summary, content_rating, duration, year, rating, studio, tags_genre, tags_director, tags_star
- order - The order this field should appear for each title
- show - Whether or not this field should be shown for each title
- preText - The text that should be added before this field for each title
- postText - The text that should be added after this field for each title
- include - A list of values that are each title must match at least one to be shown
- exclude - A list of values that if the title matches any of, will not be shown
Messages
- msg_email_teaser - Teaser text on the email
- msg_web_title - Title of the webpage
- msg_email_subject Subject of email
- msg_header1 - First header text
- msg_header2 - Second header text
- msg_header3 - Third header text. Only used in the email
- msg_top_link - Header link text to go to top of the page
- msg_movies_link - Header link text to go to new movies
- msg_shows_link - Header link text to go to new shows
- msg_seasons_link - Header link text to go to new seasons
- msg_episodes_link - Header link text to go to new episodes
- msg_new_movies_header - Section header text for new movies
- msg_new_shows_header - Section header text for new shows
- msg_new_seasons_header - Section header text for new seasons
- msg_new_episodes_header - Section header text for new episodes
- msg_footer - Footer text at the bottom of the page
- msg_no_new_content - Message to be displayed if no new content has been added
Sorting
- movie_sort_1 - Highest priority sort
- movie_sort_1_reverse - Reverse the default sort
- movie_sort_2 - Second priority sort
- movie_sort_2_reverse - Reverse the default sort
- movie_sort_3 - Third Priority sort
-
movie_sort_3_reverse - Reverse the default sort
-
show_sort_1 - Highest priority sort
- show_sort_1_reverse - Reverse the default sort
- show_sort_2 - Second priority sort
- show_sort_2_reverse - Reverse the default sort
- show_sort_3 - Third Priority sort
-
show_sort_3_reverse - Reverse the default sort
-
season_sort_1 - Highest priority sort
- season_sort_1_reverse - Reverse the default sort
- season_sort_2 - Second priority sort
- season_sort_2_reverse - Reverse the default sort
- season_sort_3 - Third Priority sort
-
season_sort_3_reverse - Reverse the default sort
-
episode_sort_1 - Highest priority sort
- episode_sort_1_reverse - Reverse the default sort
- episode_sort_2 - Second priority sort
- episode_sort_2_reverse - Reverse the default sort
- episode_sort_3 - Third Priority sort
- episode_sort_3_reverse - Reverse the default sort