Code Monkey home page Code Monkey logo

plexemail's Introduction

PayPal donate button

Plex Email

Introduction

This script aggregates all new TV and movie releases for the past x days and writes to your web directory and sends out an email.

Supported Environments

  • Windows - Tested
  • Linux - Tested
  • FreeBSD/FreeNAS - Tested
  • Mac - Tested
  • QNAP - User Tested

Supported Email Protocols

  • SMTP

Prerequisites

  1. Python 2.7 - Windows: 32 bit - https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
  2. Windows - 32 bit DLL for SQLite version 3.8.8.3 - http://www.sqlite.org/2015/sqlite-dll-win32-x86-3080803.zip (Put this into the DLLs folder of the Python installation)
  3. 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
  4. If web reports are wanted, a web server (i.e. Wamp, Apache, etc.)

Installation (Windows)

  1. Clone this repo or download the zip
  2. Copy the contents of scripts to where you want the script to run from
  3. Copy the contents of web to your web folder
  4. Update the config.conf file inside the scripts folder
  5. Schedule a weekly task to execute plexEmail.vbs from the scripts folder (make sure to set the start in folder as the folder where the vbs script resides)

Installation (Linux)

  1. Install python 2.7.9
  2. Copy the contents of scripts to where you want the script to run from
  3. Copy the contents of web to your web folder
  4. Update the config.conf file inside the scripts folder
  5. Schedule a weekly cron job to execute the plexEmail.py script

Installation (CentOS)

https://forums.plex.tv/index.php/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

Installation (QNAP)

Thanks to nickiman:

https://forum.qnap.com/viewtopic.php?f=177&t=125414

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 (send email only to sender address)

python plexEmail.py -t

Pass a special one-time notice to users

python plexEmail.py -n "This is a special notice to all users"

Output the current script version

python plexEmail.py --version

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
Logging
  • logging_debug_level - Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • logging_file_location - Leave blank to use default location - logs folder where the script file resides
  • logging_retain_previous_logs - True to append to the log file or False to overwrite the log file on every run of the script.
Plex API Authentication - This is only used for shared user emails currently
  • plex_username - Plex account username of the server
  • plex_password - Plex account password of the server
Web
  • web_enabled - Enable the creation of the web page
  • web_only_save_images - Will not create the index.html, but will still save images to the image folder.
  • 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
Image Upload - If this option is enabled, image hosting will be used for web and email

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
  • upload_cloudinary_use_https - True to use https and False to use http for both uploading url and image locations in the email/web page
Email
  • 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_use_bcc - True to send emails on using bcc instead of to (email_to settings will send to them using bcc)
  • email_to - Array of email addresses to send the email
  • email_to_send_to_shared_users - True to get list of shared user emails (plex_username and plex_password must be valid for this to be used)
  • email_unsubscribe - List of emails to exclude (emails in email_to will override emails in this)
  • 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_include_plex_web_link - True to add hyperlinks to the images and titles to go to Plex Web for the specific title
  • filter_show_movies - True to show recently added movies
  • filter_movies_include - List of movies to include (Anything that does not match perfectly will not be included)
  • filter_movies_excluse - List of movies to exclude (Only titles that match perfectly will be excluded)
  • filter_show_shows - True to show recently added TV shows
  • filter_shows_include - List of shows to include (Anything that does not match perfectly will not be included)
  • filter_shows_excluse - List of shows to exclude (Only titles that match perfectly will be excluded)
  • filter_show_seasons - True to show recently added TV seasons
  • filter_seasons_include - List of seasons to include (Anything that does not match perfectly will not be included)
  • filter_seasons_excluse - List of seasons to exclude (Only titles that match perfectly will be excluded)
  • filter_show_episodes - True to show recently added TV episodes
  • filter_episodes_include - List of episodes to include (Anything that does not match perfectly will not be included)
  • filter_episodes_excluse - List of episodes to exclude (Only titles that match perfectly will be excluded)
  • filter_show_artists - True to show recently added TV artists
  • filter_artists_include - List of artists to include (Anything that does not match perfectly will not be included)
  • filter_artists_excluse - List of artists to exclude (Only titles that match perfectly will be excluded)
  • filter_show_albums - True to show recently added albums
  • filter_albums_include - List of albums to include (Anything that does not match perfectly will not be included)
  • filter_albums_excluse - List of albums to exclude (Only titles that match perfectly will be excluded)
  • filter_show_email_images - True to show images in the email
  • filter_episode_thumbnail_type - Type of image to show for new TV Episodes - "episode", "season" or "show" (Defaults to episode)
  • filter_libraries - A list of library names to filter out - ['Home Videos', 'Private']
  • filter_sections_movies - Movie specific filters
  • filter_sections_TV - TV specific filters
  • filter_sections_Music - Music 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
    • format - Date format to be applied (Only use this for air_date)
Messages
  • msg_notice - Used for special notices to the users. This can also be done through the command line using the -n flag.
  • 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_artists_link - Header link text to go to new artists
  • msg_albums_link - Header link text to go to new albums
  • 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_new_artists_header - Section header text for new artists
  • msg_new_albums_header - Section header text for new albums
  • 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

  • artist_sort_1 - Highest priority sort

  • artist_sort_1_reverse - Reverse the default sort

  • artist_sort_2 - Second priority sort

  • artist_sort_2_reverse - Reverse the default sort

  • artist_sort_3 - Third Priority sort

  • artist_sort_3_reverse - Reverse the default sort

  • album_sort_1 - Highest priority sort

  • album_sort_1_reverse - Reverse the default sort

  • album_sort_2 - Second priority sort

  • album_sort_2_reverse - Reverse the default sort

  • album_sort_3 - Third Priority sort

  • album_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

Screenshots

Email

Top: alt tag

Movies: alt tag

TV Shows: alt tag

TV Seasons: alt tag

TV Episodes: alt tag

Web

Top: alt tag

Movies: alt tag

TV Shows: alt tag

TV Seasons: alt tag

TV Episodes: alt tag

plexemail's People

Contributors

bart274 avatar bryant1410 avatar hammyhavoc avatar jakewaldron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plexemail's Issues

[Request Features] A button to run plexEmail.py

Hello there,

Could it be possible to add a button in the html page in order to force a refresh / execution of the script to get the new data instead of waiting for the crontab to run ?

Oh and by the way, the "View this email in your browser" link doesn't seem to work under iOS, and the images won't show neither. (but they do show under the html page)

Thanks a lot,
Have a great day :)

Images

I'd like to have individual TV Show episodes show the season poster rather than the episode thumbnail.

How can I do this?

Email not being generated when several movies added

I just have updated the config and plexEmail.py files with the most recent and found a couple issues
1 - If you have a large amount of items added recently, the email is not generated. I started reducing the number of days to look for (from 7 to 5) and then voilá, email generated
Web page was not created because the option is disabled in the config file.
Successfully sent 1 email(s)
Is there any limit on how many Movies, TV, Music can be added?

2 - I also noticed that the cron job in the Freenas is no longer working. I have found some references indicating that this new files have broken cron but unable to find anything more specific.
I have PlexEmail running on a jail in my FreeNAS
FreeNAS-9.10.1-U2
Platform Intel(R) Atom(TM) CPU C2750 @ 2.40GHz
Memory 16328MB
System Time Thu Oct 27 18:49:16 CDT 2016
Does anyone knows how to fix both issues?

Link to File for Notice

I have been trying to figure out a way to link the "msg_notice" string to an external html file. That way it would be easier to quickly update the notice that goes out with the e-mail. I've tried several ways but my lack of experience has hindered me from accomplishing this. Is there an easy way to do this?

Update: I had limited success using the iframe tag, however that only works for the webpage and doesn't work in the e-mails. I'm still experimenting to find a way to do this and I'll give an update if I find something that works for both the webpage and the e-mail.

Update 2: Here's what worked:

msg_notice = open('/path/to/PlexEmail/scripts/notice.htm', 'r').read()

"notice.htm" is the file I put the html that I wanted to appear in the notice section of the e-mail/web page

Update 3:
This is helpful because I think it's easier to add a custom notice in a file rather than editing the notice in the config file, especially when it's a big notice with a lot of links and styles. I like to include messages regarding what's going to be removed from the server along with any other special information I might want to pass on to the plex users.

App broken with Plex Media Server 1.1.3

I've added a post to the thread on the forums, but the more I look at this, the more I think the security changes in 1.1.3 (from 1.1.0 I think) have broken this as it doesn't log into to Plex.tv

Absolutely Lost

Lost at how to get this running. I have plex.py running, plexrequests, but can not figure this install out. Not a dev, but techie enough to get in trouble. Anyone able to give me a few minutes to get it running?

[Feature Request] Mobile view

Hi! First, thank you for your amazing work. PlexEmail is very useful and I love it! Is it possible to eventually have a mobile friendly version? Works great in landscape but would be cool in portrait view too!

Thank you!

ValueError: substring not found

Hi Can you help me with the following error?
Can't send emails because the script is stopping on the error ValueError: substring not found

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

Database issue

Hi

Checked the logs and this is the error i´m getting:

2016-12-31 13:32:42,296 - INFO:Test flag found - setting script instance to test mode.
2016-12-31 13:32:42,296 - INFO:Setting Cloudinary config values
2016-12-31 13:32:42,296 - INFO:Including Plex Web Link - Getting machine identifier from the DLNA DB
2016-12-31 13:32:42,296 - INFO:DLNA_DB_FILE = C:\Users\Administrator\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.dlna.db
2016-12-31 13:32:42,312 - ERROR:Logging an uncaught exception
Traceback (most recent call last):
File "plexemail.py", line 913, in
cur.execute('SELECT machine_identifier FROM remote_servers WHERE url LIKE "http://127.0.0.1%";')
DatabaseError: file is encrypted or is not a database

Any ideas?

Sign up page?

it'd be nice to have a page where users can opt in by putting their email and it builds who it emails.

Cloudinary SSL Certificate Verify Failed

I'm receiving the following error if I set the config file to use Cloudinary:

Traceback (most recent call last):
File "C:\PlexEmail\plexEmail.py", line 961, in
imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
File "C:\PlexEmail\plexEmail.py", line 370, in processImage
cloudinaryURL = uploadToCloudinary(imgLocation)
File "C:\PlexEmail\plexEmail.py", line 415, in uploadToCloudinary
response = cloudinary.uploader.upload(imgToUpload)
File "C:\PlexEmail\cloudinary\uploader.py", line 16, in upload
return call_api("upload", params, file = file, *_options)
File "C:\PlexEmail\cloudinary\uploader.py", line 201, in call_api
response = urllib2.urlopen(request, *_kw).read()
File "C:\Python27\lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\PlexEmail\cloudinary\poster\streaminghttp.py", line 172, in https_ope
n
return self.do_open(StreamingHTTPSConnection, req)
File "C:\Python27\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve
rify failed (_ssl.c:590)>

Email always too long

Gmail always errors my email for being above length because I do add quite a bit each week.

Does the cloundinary option help with that or no?

I have tried filtering and I just can't filter enough away to make it useful yet small enough. Turning off images seems no fun as well.

images not showing in email

I have the "filter_show_email_images" set to True, but it won't show images in emails.
Although On the Web it shows perfectly fine.
Thanks!!!

Runtime for TV Shows

When I enable runtime/duration for tv shows, it works fine for new episodes but shows 0 minutes for new tv shows or seasons. Any ideas?

example

[Feature Request] - Support Music

Hello,

First of all, awesome code, truely !
However never thought of adding a third part to the relases : Music ?
It's the only thing missing at this stage even though I know that most people (myself included) use Plex for TV & Movies mostly.

In any case, thanks for the contribution and sharing your code with us all !!

Sincerely,

Mawuena

Feature Request

Have the ability to add an unsubsribe button that way users are added in the configuration to no be emailed. May not be possible other than having a link that emails me telling me

Script Error(s)

Any Idea what I'm doing wrong here?

Traceback (most recent call last):
File "plexEmail.py", line 1076, in
imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
File "plexEmail.py", line 426, in processImage
cloudinaryURL = uploadToCloudinary(imgLocation)
File "plexEmail.py", line 484, in uploadToCloudinary
response = cloudinary.uploader.upload(imgToUpload)
File "/opt/PlexEmail/scripts/cloudinary/uploader.py", line 16, in upload
return call_api("upload", params, file = file, **options)
File "/opt/PlexEmail/scripts/cloudinary/uploader.py", line 201, in call_api
response = urllib2.urlopen(request, **kw).read()
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/opt/PlexEmail/scripts/cloudinary/poster/streaminghttp.py", line 144, in http_open
return self.do_open(StreamingHTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1202, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib64/python2.7/httplib.py", line 1136, in getresponse
response.begin()
File "/usr/lib64/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python2.7/httplib.py", line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib64/python2.7/socket.py", line 480, in readline
cloudinaryURL = uploadToCloudinary(imgLocation)
File "plexEmail.py", line 484, in uploadToCloudinary
response = cloudinary.uploader.upload(imgToUpload)
File "/opt/PlexEmail/scripts/cloudinary/uploader.py", line 16, in upload
return call_api("upload", params, file = file, **options)
File "/opt/PlexEmail/scripts/cloudinary/uploader.py", line 201, in call_api
response = urllib2.urlopen(request, **kw).read()
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/opt/PlexEmail/scripts/cloudinary/poster/streaminghttp.py", line 144, in http_open
return self.do_open(StreamingHTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1202, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib64/python2.7/httplib.py", line 1136, in getresponse
response.begin()
File "/usr/lib64/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python2.7/httplib.py", line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib64/python2.7/socket.py", line 480, in readline
data = self._sock.recv(self._rbufsize)

QPython2

Hi there, perhaps you can point me in the right direction, when i install this on my QNAP, i get the below issue:

Command:
/opt/QPython2/bin/python2 /share/CACHEDEV1_DATA/.qpkg/PlexEmail/scripts/plexEmail.py

Error:
/opt/QPython2/bin/python2: error while loading shared libraries: libdl.so.2: wrong ELF class: ELFCLASS32

Am i missing some dependancies, both QPython and Git.

Your assistance would be appreciated

Multiple emails

When calling the email script

python /app/plexemail/scripts/plexEmail.py -c /config/config.conf

users including myself are getting 6 copies of said email. Attached my config for reference. Issue does not happen when i disable shared users and set to just myself.

`# This Python file uses the following encoding: utf-8

Folder Paths

plex_data_folder = '/plex'
web_folder = '/app/plexemail/web/'

General

date_format = '%m/%d/%y'
date_days_back_to_search = 0
date_hours_back_to_search = 24
date_minutes_back_to_search = 0

Plex API Authentication (only used for shared user Emails right now)

plex_username = '_'
plex_password = '_
'

Image Upload - If this option is enabled, image hosting will be used for web and email

Cloudinary - Sign up for a free account at: http://cloudinary.com/

upload_use_cloudinary = True
upload_cloudinary_cloud_name = '_'
upload_cloudinary_api_key = '_
_'
upload_cloudinary_api_secret = '_
**********************'

Web

web_enabled = True

This will not create the index.html file, but will still save the images to the images folder. (Useful for when you only want to send an email)

web_only_save_images = False
web_domain = '****_.__._:8585'
web_path = ''
web_delete_previous_images = True
web_skip_if_no_additions = False

Email

email_enabled = True
email_individually = True
email_use_bcc = False

['[email protected]', '[email protected]']

email_to = ['']

This requires plex_username and plex_password to be filled to get emails of shared users.

email_to_send_to_shared_users = True
email_from = '[email protected]'
email_from_name = 'Plass Plex Server'
email_smtp_address = '_.__.__'
email_smtp_port = _*
email_use_ssl = False #Port must be an SSL port i.e. 465
email_username = '***_'
email_password = '
_*******'

Only valid if web_enabled = True and upload_use_cloudinary = False

email_use_web_images = False
email_skip_if_no_additions = False

Filtering

filter_include_plex_web_link = True
filter_show_movies = True
filter_show_shows = False
filter_show_seasons = False
filter_show_episodes = True
filter_show_email_images = True

Name of libraries to filter out - ['Home Videos', 'Private']

filter_libraries = []

The sections to include and ordering - tagline, summary, content_rating, duration, year, rating, studio, tags_genre, tags_director, tags_star

filter_sections_movies = {
'tagline':{
'order':1,
'show': True,
'preText':'',
'postText':'
',
'include':[],
'exclude':[]
},
'summary':{
'order':2,
'show': True,
'preText':'',
'postText':'',
'include':[],
'exclude':[]
},
'tags_genre':{
'order':3,
'show': True,
'preText':'Genre(s): ',
'postText':'',
'include':[],
'exclude':[]
},
'tags_director':{
'order':4,
'show': False,
'preText':'Director: ',
'postText':'',
'include':[],
'exclude':[]
},
'tags_star':{
'order':5,
'show': True,
'preText':'Star(s): ',
'postText':'',
'include':[],
'exclude':[]
},
'content_rating':{
'order':6,
'show': False,
'preText':'Content Rating: ',
'postText':'',
'include':[],
'exclude':[]
},
'duration':{
'order':7,
'show': True,
'preText':'Runtime: ',
'postText':' minutes',
'include':[],
'exclude':[]
},
'year':{
'order':8,
'show': True,
'preText':'Year: ',
'postText':'',
'include':[],
'exclude':[]
},
'studio':{
'order':9,
'show': False,
'preText':'Studio: ',
'postText':'',
'include':[],
'exclude':[]
},
'rating':{
'order':10,
'show': True,
'preText':'Rating: ',
'postText':'%',
'include':[],
'exclude':[]
}
}
filter_sections_TV = {
'tagline':{
'order':1,
'show': True,
'preText':'',
'postText':'
',
'include':[],
'exclude':[]
},
'summary':{
'order':2,
'show': True,
'preText':'',
'postText':'',
'include':[],
'exclude':[]
},
'tags_genre':{
'order':3,
'show': False,
'preText':'Genre(s): ',
'postText':'',
'include':[],
'exclude':[]
},
'tags_director':{
'order':4,
'show': False,
'preText':'Director: ',
'postText':'',
'include':[],
'exclude':[]
},
'tags_star':{
'order':5,
'show': False,
'preText':'Star(s): ',
'postText':'',
'include':[],
'exclude':[]
},
'content_rating':{
'order':6,
'show': False,
'preText':'Content Rating: ',
'postText':'',
'include':[],
'exclude':[]
},
'duration':{
'order':7,
'show': True,
'preText':'Runtime: ',
'postText':' minutes',
'include':[],
'exclude':[]
},
'year':{
'order':8,
'show': False,
'preText':'Year: ',
'postText':'',
'include':[],
'exclude':[]
},
'studio':{
'order':9,
'show': True,
'preText':'Network: ',
'postText':'',
'include':[],
'exclude':[]
},
'rating':{
'order':10,
'show': False,
'preText':'Rating: ',
'postText':'%',
'include':[],
'exclude':[]
}
}

Messages

msg_notice = ''
msg_email_teaser = 'Check out this week's releases from Plex: {website} - {past_day} - {current_day}'
msg_web_title = 'Plass New Plex Releases'
msg_email_subject = 'Plass New Plex Releases - {past_day} - {current_day}'
msg_header1 = 'Plass New Plex Releases'
msg_header2 = '{past_day} - {current_day}'
msg_header3 = 'View as Website'
msg_top_link = 'What's New in Plex'
msg_movies_link = 'Movies'
msg_shows_link = 'TV Shows'
msg_seasons_link = 'TV Seasons'
msg_episodes_link = 'TV Episodes'
msg_new_movies_header = 'New Movies'
msg_new_shows_header = 'New TV Shows'
msg_new_seasons_header = 'New TV Seasons'
msg_new_episodes_header = 'New TV Episodes'
msg_footer = ''
msg_no_new_content = 'There have been no new additions to Plex from {past_day} through {current_day}.'

Sorting

Possible values = id, title, title_sort, original_title, rating, tagline,

summary, content_rating, duration, tags_genre, tags_director, tags_star, year,

hash, index, studio

movie_sort_1 = 'rating'
movie_sort_1_reverse = True
movie_sort_2 = 'title_sort'
movie_sort_2_reverse = False
movie_sort_3 = ''
movie_sort_3_reverse = False

Possible values = id, title, title_sort, original_title, rating, tagline,

summary, content_rating, duration, tags_genre, tags_director, tags_star, year,

hash, index, studio

show_sort_1 = 'title_sort'
show_sort_1_reverse = False
show_sort_2 = ''
show_sort_2_reverse = False
show_sort_3 = ''
show_sort_3_reverse = False

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_sort_1 = 'title_sort'
season_sort_1_reverse = False
season_sort_2 = 'index'
season_sort_2_reverse = False
season_sort_3 = ''
season_sort_3_reverse = False

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`

Permission Denied on image

I dont know when it started but everytime i run plexEmail.py, it fails with this message

Traceback (most recent call last):
  File "/opt/plexEmail/scripts/plexEmail.py", line 782, in <module>
    imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
  File "/opt/plexEmail/scripts/plexEmail.py", line 271, in processImage
    shutil.copy(imgLocation, img)
  File "/usr/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/var/www/html/plexEmail/images/07dff822e4d99b8ae4c5bb693e06ed7adffeb00d_c7f62e627843f4e17e59168370e56fae60e46b65.jpg'

The problem is that 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d_c7f62e627843f4e17e59168370e56fae60e46b65.jpg does not exist in the image folder. Also when i check my Plex metadata folder(plex is on windows) and search for 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d, it referes to a UFC poster. The weird thing is that everytime i get a new UFC poster, 07dff822e4d99b8ae4c5bb693e06ed7adffeb00d points to that new poster and not the previous one. How can i fix this?

[Feature Request] Email/Web templates

First ill say this script is awesome, absolutely what im looking for since im sharing my server with a friend or two. The only thing id like to see is an easier method of changing the email design, preferably some kind of template system. I poked around and realize that would take a lot of restructuring as the template is tied heavily into the code base. So im not expecting it and will use this as a jumping off point for learning python to help contribute, but a feature request all the same :)

Freenas Install Errors

I followed the instructions you posted to install this on a freenas system, however when I try to run the application I get back:

Traceback (most recent call last): File "/PlexEmail/scripts/plexEmail.py", line 784, in <module> execfile(configFile,config) File "/PlexEmail/scripts/config.conf", line 372 msg_notice = '' ^

I'm not sure what my error is.

Help with setup

Hi Jake,

First off, THANKS! This looks amazing and im very greatful you developed a windows version!

I am having problems with setup... this is what I've done so far:

  1. I've installed py 2.7
  2. Downladed: Windows - SQLite version 3.8.8.3 and put it in "C:\Python27\DLLs"
  3. Downloaded the module for Python. pip install requests, extracted the .tz.gz file and put that folder in "C:\Python27\Lib" (not sure if i should have extracted or just put the .tar.gz file in Libs)
  4. Downloaded the code and put it in "F:\PleX\PlexEmail-master"
  5. changed the variables in the config file in "F:\PleX\PlexEmail-master\scripts" and set the following parameters:
- plex_data_folder = 'F:\\PleX\\'
- web_folder = '' (I left this blank because i dont have a web-folder (I assume this has something to do with cloud storage)
- plex_web_server_guid = 'a0c8b1ddcXXXXXXXXXXXXXXXXX6b5d4afdc7b99'
- logging_file_location = 'F:\\PleX\\' 
- plex_username = 'XXX' (hidden)
- plex_password = 'XXX' (hidden)
- email_to = ['[email protected]']
- email_username = '[email protected]''
- email_password = '!@!@!@!@!@!'

All other parameters i left the same....

NOW: I restarted the computer, and when I run 'plexEmail.vbs' (double click) NOTHING HAPPENS!!! (No email to '[email protected]')

It does not even create a log-file in the "logging_file_location" directory.

Any help is greatly appreciated.

[Feature Request] Change section order

Hi!

I'd love to be able to change the order of the various sections around, so I can show TV Series / Episodes before Movies in de HTML and mail. Now, the order of sections is pretty hardcoded..

[Feature Request] - External HTML template

Hi, I was wondering if it would be possible to load an external HTML template instead of the hard-coded layout. This would make it much easier to add e-mail layout themes for example.

[BUG] Line 353: TypeError: Could not guess image MIME subtype

File "C:\PlexEmail\scripts\plexEmail.py", line 353, in sendMail
msgImage = MIMEImage(fp.read())
File "C:\Python27\lib\email\mime\image.py", line 43, in init
raise TypeError('Could not guess image MIME subtype')
TypeError: Could not guess image MIME subtype

I have in the script made a temporary workaround:

Earlier: msgImage = MIMEImage(fp.read())
Now: msgImage = MIMEImage(fp.read(),_subtype="png")

The issue could be due to some UTF-8 stuff. I may have the danish letters æ,ø,å in some of the naming of objects.

"...com.plexapp.plugins.library.db does not exist." Using database files over network?

I am hosting PlexRequests, PlexEmail and a landing page on my raspberry pi running Lubuntu. The issue I've run into is configuring my Plex library location. I host the library on my Mac, on the same network. I've tried to type the Mac's ip address and the file location as the "plex_data_folder" value and got the below error:

192.168.1.101:/Users/justinerwin/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db does not exist. Please make sure the plex_data_folder value is correct.

Can I do what I'm trying to do? Thanks.

Request - Help with Cloudinary/JPEGmini Image Compression

Hello, great piece of software works very well. I was hoping for a bit of assistance using JPEGmini to adjust the quality of the files so they load a bit more quickly in emails accessed via mobile. I read this article here:

http://cloudinary.com/blog/optimize_your_jpeg_images_without_compromising_quality_with_jpegmini_and_cloudinary

It looks like "/q_90/" added to the upload URL will reduce the quality and help a bit. I am not sure where to even begin in adding this to the plexemail.py script. Could you provide me with a bit of direction when you have a moment?
Thanks again for a great script!

running the script gives the following error

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 March 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

Error with line 669

Hi
Could you please help me with the following error
c:\Plexemail\scripts>python plexemail.py
Traceback (most recent call last):
File "plexemail.py", line 669, 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

I have python 32bit installed and placed the sqlite file in your instructions in the correct folder.

[Feature Request] TV Episode - Aired Date

Air date for TV episodes. I have tried to figure out from Plex Web app the required tag but thinking I may need to delve into the xml, as such thought I would ask in the interim if you already new details for it?

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

New problem. Running a clean master branch with modified HTML. Added pull #29 to fix an error and now I am getting a new error.

Traceback (most recent call last): File "plexEmail.py", line 978, in <module> title += movies[movie]['original_title'] + ' AKA ' TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Line 978 for me, but it is actually line 955. Not sure why this started popping up all of a sudden. Either way, I can;t be the only one experiencing this issue. Thought I would bring it to your attention.

Thanks for the help thus far! Looking to get the emails rolling again with some assistance.

Multiple Seasons Adding Compiling Issue

Hello,

Anyone is having trouble running PlexEmail since their latest PMS update ?
I'm running it through a Fedroa 24 Server btw and here is the output of my terminal

Traceback (most recent call last):
File "plexEmail.py", line 1097, in
imageInfo = processImage(hash, imageInfo['thumb'], 'season', tvSeasons[season]['index'], 0)
File "plexEmail.py", line 341, in processImage
imgName = thumb[thumb.index('
') + 1:len(thumb)]
ValueError: substring not found_

Tried to tinker with it a little bit with no help
If anyone has an idea, I'd take it

Thanks guys

Updated to latest version...

So I recently updated PlexEmail to the latest version and now I am getting errors when I try to run it:

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

I was able to modify previous errors away, but this one I cannot get my head around. Any idea what could be causing this?

Cloudinary SSL?

Would it be possible to have a flag to make the webpage/email generated by the script use https instead of http for the Cloudinary stuff? I tried the images it included and it looks like both http and https are usable.

Thanks!

[Feature Request] - BCC field

Though I know the Plex release discussion has requested this several times, I'm making an official request - Add BCC to capabilities.
Though I know PlexEmail already includes ways to prevent each emailed person from seeing another, I wish to only send one email, and not use cloud hosting.
BCC would allow me to do this (send one email, attaching the images myself)

error on get friend list

Checking the app logs I see the next error:

2016-09-05 19:38:05,116 - INFO:getSharedUserEmails: url = https://plex.tv/pms/friends/all
2016-09-05 19:38:05,122 - INFO:Starting new HTTPS connection (1): plex.tv
2016-09-05 19:38:06,374 - INFO:getSharedUserEmails: response = <Response [200]>
2016-09-05 19:38:06,375 - ERROR:Logging an uncaught exception
Traceback (most recent call last):
File "/app/plexemail/scripts/plexEmail.py", line 1659, in
sharedEmails = getSharedUserEmails()
File "/app/plexemail/scripts/plexEmail.py", line 332, in getSharedUserEmails
logging.info('getSharedUserEmails: response = ' + str(response.text))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 12682: ordinal not in range(128)

Corrupted Plex DB

i tested your PlexEmail and initially everything looked great but then i started to get problems that my Plex library DB got corrupted.

any idea what exactly is causing that. as soon as i disabled PlexEmail the DB is stable

Matt

Special Apostrophes from Mac OS X servers break code

When someone has a server called "John's iMac" after setting up Plex on an OS X Machine, that special apostrophe for the default name is breaking the XML import for getting users emails.

The apostrophe is unicode character \u2019.

Is there anyway to add some removal tool before importing and parsing the XML? The only workaround I have had right now is removing those user's servers from my list....or asking them to change the name of their server.

Plex Web Links

I had to merge my changes to the new version and compared files everything seems fine. However the VBS wont run with scheduled task anymore but will if use CMD and run the script. The second issue is the webpage weblinks are not working? If I click a poster it says media server not available?

Error: unsupported operand type(s)

I'm getting an error when sending emails:
Traceback (most recent call last):
File "plexEmail.py", line 1330, in
duration = row[5]/1000
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

I believe it has something to do with my music library. Strange this is, it has worked fine the last few days.

Help with installation

Can someone help me with the installation process? Every time I try to run plexEmail.py, the cmd prompt pops up, spits out an error, and closes too quickly for me to read and see what's the issue. Very new to this so please excuse my ignorance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.