Our forum migration to Discourse will be going on starting late today June 19 to 21. During the migration, the forums will be read-only, except for a single temporary forum (which will not be getting transferred). Read our announcement post here for more information https://forums.plex.tv/discussion/319354/well-be-moving-the-forums-to-discourse-heres-the-scoop/
Hey folks, there is a new Podcast category for forums https://forums.plex.tv/categories/podcasts
If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

PlexEmail - Email Recently Added Media

1246747

Comments

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    edited March 2015

    Looking for some input on design here.  If there are no new items in any of the categories for the specified time period, should it:

    1. Send out an email/create a web page that is empty
    2. Send out an email/create a web page that has text stating that there are no new releases in this time frame
    3. Exit out without sending an email/creating a new web page

    I'm trying to decide between 2 and 3 right now.  Thanks!

    EDIT: Or a 4th option of having it configurable between 2 and 3 (which I think is best and I will probably do since I like leaving it up to the user to decide)

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass

    v0.3.2 Released

     

    New Feature and Bug Fix

     
    • Added an option to skip sending emails if there is no new content
    • Added an option to skip creating a web page if there is no new content
    • Fixed a bug where we were using date instead of datetime which caused issues for daily reports
  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    edited March 2015

    v0.4.0 Released

     

    Added command line parameters.

    • Added the option to pass in an alternative config file.

    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

    I am running out of ideas to improve this script, so please let me know if there are any feature requests!

  • mesconmescon Posts: 24Members, Plex Pass Plex Pass
    Hey!

    I have the following problem!
    Hoping you can figure it out, because I am very keen on using your software!

    C:\HTPC\PlexEmail>python plexEmail.py
    Traceback (most recent call last):
      File "plexEmail.py", line 586, in <module>
        imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
      File "plexEmail.py", line 122, in processImage
        imgName = thumb[thumb.index('_') + 1:len(thumb)]
    ValueError: substring not found
  • Fabio_BrassFabio_Brass Posts: 251Members, Plex Pass Plex Pass

    Is it possible to use this script if PMS is on another machine? 

    I mean remotely?

  • drzoidberg33drzoidberg33 Posts: 2,566Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    eadwyn wrote on March 8 2015, 10:34 PM: »

    drzoidberg33: Could you try the following:

    Install virtualenv if you don't have it:

    sudo pip install virtualenv
    

    Then download and altinstall python 2.7.9:

    cd ~/downloads
    wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
    tar -xvf Python-2.7.9.tgz
    cd Python-2.7.9
    ./configure
    make
    sudo make altinstall
    

    Then make a new virtualenv:

    cd ~/plexemail/scripts (or wherever your scripts folder is for plexemail)
    sudo virtualenv --python=/usr/local/bin/python2.7 pevenv
    

    Lastly try running the script again:

    pevenv/bin/python ./plexEmail.py
    

    Thanks,

    Still no go though. Had to compile Python2.7.9 using these instructions (otherwise it compiles without zlib): http://stackoverflow.com/a/27132584

    sqlite3 still not the correct version though:

    [root@vulcan scripts]# pevenv/bin/python
    Python 2.7.9 (default, Mar 13 2015, 15:13:24) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    >>> sqlite3.version
    '2.6.0'
    >>> sqlite3.sqlite_version
    '3.6.20'

    What happens when I try to execute the script:

    [root@vulcan scripts]# pevenv/bin/python ./plexEmail.py 
    /usr/local/lib/python2.7/sqlite3/__init__.pyc
    Traceback (most recent call last):
      File "./plexEmail.py", line 145, in <module>
        cur.execute("SELECT id, parent_id, metadata_type, title, title_sort, original_title, rating, tagline, summary, content_rating, duration, user_thumb_url, tags_genre, tags_director, tags_star, year, hash, [index], studio FROM metadata_items WHERE added_at >= date('now', '-" + str(config['days_back_to_search']) + " days') AND metadata_type >= 1 AND metadata_type <= 4 ORDER BY title_sort;")
    sqlite3.DatabaseError: file is encrypted or is not a database
  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    mescon wrote on March 13 2015, 10:46 AM: »
    Hey!

    I have the following problem!
    Hoping you can figure it out, because I am very keen on using your software!

    C:\HTPC\PlexEmail>python plexEmail.py
    Traceback (most recent call last):
      File "plexEmail.py", line 586, in <module>
        imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
      File "plexEmail.py", line 122, in processImage
        imgName = thumb[thumb.index('_') + 1:len(thumb)]
    ValueError: substring not found

    I have an idea what is breaking it.  Could you please try this script: [attachment=46167:plexEmail.zip]

    Let me know if it's working now or if it breaks again please provide the last line it prints before the error.

    Thanks!

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    edited March 2015
    fbrassin wrote on March 13 2015, 11:22 AM: »

    Is it possible to use this script if PMS is on another machine?
    I mean remotely?


    This will only work if you have access to the PMS data folder since it reads the database and uses the image assets and metadata from your own data. If you have access to it through a network share or something similar you should be able to do it.

    Zoidberg: Darn! When I get to my computer I will zip up the sqlite folder in my python install for you to try using.
  • mesconmescon Posts: 24Members, Plex Pass Plex Pass
    eadwyn wrote on March 13 2015, 1:45 PM: »

    I have an idea what is breaking it.  Could you please try this script: attachicon.gifplexEmail.zip

    Let me know if it's working now or if it breaks again please provide the last line it prints before the error.

    Thanks!

    I tried your script and now it does the following (btw, thanks for your interest in my problem!):

    C:\HTPC\PlexEmail>python plexEmail.py
    metadata://posters/com.plexapp.agents.themoviedb_3213376bac3ae37278fecc924365a50
    8881de6ef
    metadata://posters/com.plexapp.agents.localmedia_003f4ddd3b8814583a3d8051bc9e9e4
    d5cb3edbc
    upload://posters/20c32eb69df82fed08679e949f058689dee8b652
    Traceback (most recent call last):
      File "plexEmail.py", line 587, in <module>
        imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
      File "plexEmail.py", line 123, in processImage
        imgName = thumb[thumb.index('_') + 1:len(thumb)]
    ValueError: substring not found

    This is line 585, 586 and 587.

    imageInfo = {}
          imageInfo['thumb'] = movies[movie]['user_thumb_url']
          imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)

    This is line 121, 122 and 123:

          thumb = thumb[11:len(thumb)]
          category = thumb[0:thumb.index('/')]
          imgName = thumb[thumb.index('_') + 1:len(thumb)]

     

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    mescon wrote on March 13 2015, 2:58 PM: »

    I tried your script and now it does the following (btw, thanks for your interest in my problem!):

    C:\HTPC\PlexEmail>python plexEmail.py
    metadata://posters/com.plexapp.agents.themoviedb_3213376bac3ae37278fecc924365a50
    8881de6ef
    metadata://posters/com.plexapp.agents.localmedia_003f4ddd3b8814583a3d8051bc9e9e4
    d5cb3edbc
    upload://posters/20c32eb69df82fed08679e949f058689dee8b652
    Traceback (most recent call last):
      File "plexEmail.py", line 587, in <module>
        imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
      File "plexEmail.py", line 123, in processImage
        imgName = thumb[thumb.index('_') + 1:len(thumb)]
    ValueError: substring not found
    This is line 585, 586 and 587.

    imageInfo = {}
          imageInfo['thumb'] = movies[movie]['user_thumb_url']
          imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0)
    This is line 121, 122 and 123:

          thumb = thumb[11:len(thumb)]
          category = thumb[0:thumb.index('/')]
          imgName = thumb[thumb.index('_') + 1:len(thumb)]

    Thanks! First time I've run into upload://

    I'll try uploading a poster to see if I can reproduce it and handle it properly. If I can't, I'll probably need some assistance on the folder structure.
  • Fabio_BrassFabio_Brass Posts: 251Members, Plex Pass Plex Pass
    eadwyn wrote on March 13 2015, 2:19 PM: »

    This will only work if you have access to the PMS data folder since it reads the database and uses the image assets and metadata from your own data. If you have access to it through a network share or something similar you should be able to do it.

    Zoidberg: Darn! When I get to my computer I will zip up the sqlite folder in my python install for you to try using.

    I managed to make it work mounting remote dir with sshfs.

    I know plexwatch work also remotely, i thought also plexmail could....

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass

    Mescon, give this a shot: [attachment=46171:plexEmail.zip]

  • mesconmescon Posts: 24Members, Plex Pass Plex Pass

    Seems to work better, but still this:
     

    metadata://posters/com.plexapp.agents.themoviedb_3213376bac3ae37278fecc924365a508881de6ef
    metadata://posters/com.plexapp.agents.localmedia_003f4ddd3b8814583a3d8051bc9e9e4d5cb3edbc
    upload://posters/20c32eb69df82fed08679e949f058689dee8b652
    metadata://posters/com.plexapp.agents.localmedia_cb8e65e9807c52f3fc79cd65ea307cba18d62407
    metadata://posters/com.plexapp.agents.localmedia_8b98cb2e3c6461b24692ac9344843725034966c4
    metadata://posters/com.plexapp.agents.localmedia_e4b7b8b72eadb2a5d8adbcb72f51080e3e5e08d4
    metadata://posters/com.plexapp.agents.localmedia_cac6ef354dc529fb1752a1e9fbb1db97b3eb0b29
    metadata://posters/com.plexapp.agents.localmedia_6d875ae632ec28c3240424aa6d05417c322d886f
    metadata://posters/com.plexapp.agents.localmedia_a69c30629e0cb985a236a5035714f66ae2b4fd11
    upload://posters/ac604642901656d271d2a0b6d049b3b3837cf57e
    metadata://posters/com.plexapp.agents.localmedia_3e25ec8baac89a47efc535acc636251a611aea0b
    metadata://posters/com.plexapp.agents.localmedia_4d84b07f7df30b9ef424a99cda81a67db38a261b
    metadata://posters/com.plexapp.agents.rottentomatoes_27113dbfbaf0708b24ffb383a57269fa90fbce6b
    upload://posters/92768d5f9ce283b0a6d91a2eeb7f793e397fff42
    metadata://posters/com.plexapp.agents.localmedia_e3f328fce9d674a1a0fbf85395fbf75dfa1643bb
    upload://posters/7064b697b8eceacde3da288c62da57e16a4f75d4
    metadata://posters/com.plexapp.agents.localmedia_27239adbbbfe2771da8d4b4614add09f376fdbf7
    metadata://posters/com.plexapp.agents.localmedia_a3668368ba37f5aa501250001752eb3e0939ee2b
    upload://posters/cdbb344a5abb5e638ef6d3526724a99cad827dd1
    metadata://posters/com.plexapp.agents.rottentomatoes_6a69c2e2970ea57f50a57ad1284c870163048dbb
    metadata://posters/com.plexapp.agents.localmedia_c08ae9a14ea844c2897580663457eeba4882651f
    upload://posters/7394b883eef5bed4ad3e1f54e094e5282bfc917d
    upload://posters/9736c4de4dd4724c1a9f69c6eb3cdbf24e6ea628
    upload://posters/ce10044ecac33eb2047eccf384b74a394db19db5
    upload://posters/bb22172c4e7960ae4646ce1e6ac8a8b0ee1db045
    upload://posters/925dfdc867707c38c6f32ce9589ad62aef86fc08
    metadata://posters/com.plexapp.agents.localmedia_0783d486ae334a0edca72561198ab21eaf70da60
    metadata://posters/com.plexapp.agents.localmedia_f524ab418b474719f84079de786c1f7e03fc9bad
    metadata://posters/com.plexapp.agents.rottentomatoes_66de9485a1c86dfe3fe0a986a90f997b9ee392e2
    upload://posters/95309afe85498f01d5a6e93dc7aee2b1ff93b095
    metadata://posters/com.plexapp.agents.rottentomatoes_9b801a115325a0b76e7fd02832051a227b5b1c9a
    upload://posters/e3d1bddcb0b01e731e6f001f96ae26058fe5888c
    upload://posters/a6a60a2cd1ac42f7ea5e7d84daf85e45ab9c7503
    upload://posters/11010edae50675c87251197db9134fdd3b4d026a
    upload://posters/d13042103e4292ef670efc3e8e282b52b649705d
    upload://posters/8a74137ce9dc553750e215c01fb19856c1000489
    upload://posters/690472d3b501ded4c8b73a05cb7e804c11fd1aba
    upload://posters/a38a9cb5f8f533ca33e16a82c18121c41e9586d0
    metadata://posters/com.plexapp.agents.localmedia_9d6348099e0f0f7b88a1fa40d1f91cf680331615
    metadata://posters/com.plexapp.agents.themoviedb_3cf4fa5ffc0ecf6d5fc63e93ce0ae2a6dbd57b8f
    upload://posters/4619a7efb950e02c2cec60e2626f9621f971e35b
    upload://posters/8a641787754421b4264a843d89de4241aae1ebbe
    upload://posters/aa9b64db124eb531215a777fa23d175e7e24b962
    upload://posters/f375524e890d85e39da3c6cdc33626ca8b0ea929
    upload://posters/7187d44cf798961d7b6cbe3d6f0567a733ec2fa9
    metadata://posters/com.plexapp.agents.rottentomatoes_5e4e44cd89a99d8055a8e1bdc1b942c6d456998a
    upload://posters/79b4f24cb1c4943e925ec7dff4389a8299e9d15a
    metadata://posters/com.plexapp.agents.localmedia_b05906efe73d9bc1603e1d4de4fd067ae97c84b4
    upload://posters/5b06dcd77e2f980c8c5dc87a3f0b046757cbfd82
    upload://posters/982b05aab9d902c58758fcd56d82906871e9e3db
    metadata://posters/com.plexapp.agents.thetvdb_04a52dc77de0a9f36dcc0d1d77bb428b4979b46b
    metadata://posters/com.plexapp.agents.thetvdb_fae9a185f53fdb4f4477471b3ffa776ef66deaf7
    metadata://posters/com.plexapp.agents.thetvdb_53e14c657251a79d3a79fa5fb4cd50cf8fcedca0
    metadata://posters/com.plexapp.agents.thetvdb_eb004c08acc504734698b16eb399ec1cd52e7ca0
    metadata://posters/com.plexapp.agents.thetvdb_6d9434da716dc2f0b3890ea176f69f3ceff156d1
    metadata://posters/com.plexapp.agents.thetvdb_08975e39eece9ccd90e62eae828b7c6cd8182c8d
    metadata://posters/com.plexapp.agents.thetvdb_df31975f0255f92e81972f1517a752bb85cd1e78
    metadata://posters/com.plexapp.agents.thetvdb_c3fdb6d5ac2264c31df9382c6cdb9f517728ab94
    metadata://posters/com.plexapp.agents.thetvdb_694c9222c8cecd30d7fe483ead7ac15df270125c
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_b01014ff4de079433eb84eeb1c80d3645e774a6f
    metadata://seasons/2/posters/com.plexapp.agents.thetvdb_648415f26dc4c69c458f1b44e4c210123bcb35c9
    metadata://seasons/3/posters/com.plexapp.agents.thetvdb_8423e49d59242f6df2fe4f20db27a7a8c3094ea8
    metadata://seasons/4/posters/com.plexapp.agents.thetvdb_40de5393e07e669b83198b3e0587154e2ce33843
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_71d57641316a7f3ae21dfe3bb2a2149b7ada12d9
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_5694e2c98b343a0b437029cf44b30c80fcd2fb1d
    metadata://seasons/2/posters/com.plexapp.agents.thetvdb_ca4d4b60ffa7cc8847b55479e97e2b64d2841823
    metadata://posters/com.plexapp.agents.thetvdb_53e14c657251a79d3a79fa5fb4cd50cf8fcedca0
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_a4af1d13d94d88a58e8124a91bf54483dab1cc74
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_d7df0e228aa901a15dd789a1daea13522728706d
    metadata://seasons/2/posters/com.plexapp.agents.thetvdb_2f1bf389170cccc6e580d5f05648a83d0acb72b0
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_2b24fad3d41476e995b674a323ec1b52a428b8bc
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_908951ee4cc2602df75a5dc3341a255a64411e6e
    metadata://seasons/2/posters/com.plexapp.agents.thetvdb_09f2423600b9145f847aaa50e856b4313ecb8d73
    metadata://seasons/3/posters/com.plexapp.agents.thetvdb_822909dc4fc4b10479cc8640f6c3a8c7574df088
    metadata://seasons/4/posters/com.plexapp.agents.thetvdb_80b4172d60b4605b15132c0ba7007724184d70d3
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_23f94b01b26084b4855a902ae58f0d88cd59a048
    metadata://seasons/1/posters/com.plexapp.agents.thetvdb_287073778ba8825d9da2781a9428734069043d15
    metadata://posters/com.plexapp.agents.thetvdb_694c9222c8cecd30d7fe483ead7ac15df270125c
    metadata://posters/com.plexapp.agents.thetvdb_694c9222c8cecd30d7fe483ead7ac15df270125c
    metadata://posters/com.plexapp.agents.thetvdb_694c9222c8cecd30d7fe483ead7ac15df270125c
    metadata://seasons/2/episodes/16/thumbs/com.plexapp.agents.thetvdb_de64bda340878171303d02945605d346be73fad1
    metadata://seasons/1/episodes/8/thumbs/com.plexapp.agents.thetvdb_03bef11f86ea2bfff6b0b4680f1f70419dd1aa04
    metadata://seasons/12/episodes/9/thumbs/com.plexapp.agents.thetvdb_6417c5c34fab255bfcdb46f9646fda88322d6304
    metadata://seasons/3/episodes/7/thumbs/com.plexapp.agents.thetvdb_7a09980223c3d02d415bd45442a9cab50111fee9
    metadata://seasons/3/episodes/9/thumbs/com.plexapp.agents.thetvdb_19cf652e8a1fbc46bb5aef21f5d0b09b2e310714
    Traceback (most recent call last):
      File "plexEmail.py", line 789, in <module>
        emailTVEpisodes += '<p class="lead"><i>S' + str(tvEpisodes[episode]['season_
    index']) + ' E' + str(tvEpisodes[episode]['index']) + ': ' + title + '</i></p>'
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 40: ordinal
     not in range(128)

    Are you on Skype? If you wanted to have quicker access to my server and look at folder structure and stuff - I could share the screen. If so, PM me and we'll get in touch that way!

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    edited March 2015
    mescon wrote on March 13 2015, 5:06 PM: »

    Seems to work better, but still this:
     

    Are you on Skype? If you wanted to have quicker access to my server and look at folder structure and stuff - I could share the screen. If so, PM me and we'll get in touch that way!

    I'm actually at work, so I can't Skype (but I can work on hobby projects)  :)

    Looks like the image issue has been fixed, now it's a bug with utf-8 characters.  This should fix it: [attachment=46173:plexEmail.zip]

    Thanks for helping iron out the remaining bugs!

  • mesconmescon Posts: 24Members, Plex Pass Plex Pass

    You've been one of the most helpful developers I've talked to!
    You're actually interested in working out issues - most people who write plugins seem to only care about having their creation work for themselfs :-)
    Thanks a lot!

    C:\HTPC\PlexEmail>python plexEmail.py
    Web page created successfully
    Successfully sent 1 email(s)
    

    Woop woop!

     

  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    edited March 2015
    mescon wrote on March 13 2015, 5:19 PM: »

    You've been one of the most helpful developers I've talked to!
    You're actually interested in working out issues - most people who write plugins seem to only care about having their creation work for themselfs :-)
    Thanks a lot!

    C:\HTPC\PlexEmail>python plexEmail.py
    Web page created successfully
    Successfully sent 1 email(s)
    

    Woop woop!

    Awesome! Likewise to you as a user :)

    I'm an engineer in Professional Services, which basically means it is my job to get stuff working for customers using products given to us by R&D.

  • mesconmescon Posts: 24Members, Plex Pass Plex Pass

    Sounds like you're good at your job :-)

    You asked for feature requests - perhaps a way to read user from a separate textfile, where each line one e-mail and user?

    Like:
    elizabeth.adams@gmail.com;Elizabeth Adams
    george.powell@hotmail.com;George Powell

    Not that I really need it, just thought I should give you something to do :-)

    Otherwise, making a "frontend" to automated setups with external users would be awesome.

    • A panel for users requesting a specific movie (add request to CouchPotato automatically, but limit what profiles they can use - I don't want no stinking standard-def material)
    • A pan for users requesting a specific TV-series (add series to Sonarr)
    • plexEmail web as default page, and then the above two panels for user requests... well, now I'm just dreaming.

    If you're not feeling like doing that, then maybe some sort of plugin to mark a subtitle as bad (out of sync, wrong subtitles or whatever) and have them deleted automatically (this really should be in the default Plex Media Server in my opinion).


    If you decide you don't think it's worth your time/effort then so be it, I'm just happy to have plexEmail up and running :-)
    Thanks again!

  • WeeflixWeeflix Posts: 238Members, Plex Pass Plex Pass

    Hi i am getting this error when trying to run the script

    Traceback (most recent call last):
      File "plexEmail.py", line 3, in <module>
        import argparse
    ImportError: No module named argparse
    
    
  • eadwyneadwyn Posts: 231Members, Plex Pass Plex Pass
    Nomadore wrote on March 13 2015, 5:48 PM: »

    Hi i am getting this error when trying to run the script

    Traceback (most recent call last):  File "plexEmail.py", line 3, in     import argparseImportError: No module named argparse

    Hi there,

    What version of Python are you running?

    python -V
  • zprewittzprewitt Posts: 61Members, Plex Pass Plex Pass
    edited March 2015
    1. 32 bit DLL for SQLite version 3.8.8.3 - http://www.sqlite.or...x86-3080803.zip (Put this into the DLLs folder of the Python installation)

    I HAVE to have Python installed on my machine (I use it for Sick Beard), but for the life of me I cannot find this DLL folder. Any ideas where I can look? 

     

    Running the script at this point gets me this error:

     

    Traceback (most recent call last):
      File "plexEmail.py", line 509, in <module>
        con = sqlite3.connect(DATABASE_FILE)
    sqlite3.OperationalError: unable to open database file
Sign In or Register to comment.