GithubHelp home page GithubHelp logo

plexreport's Introduction

plexWeeklyReport

Scripts to generate a weekly email of new additions to Plex.

Introduction

This script is meant to send out a summary of all new Plex entries to your server to all of your server's users.

Supported Platforms

  • Debian
  • Ubuntu 14.04 LTS
  • Mac OSX

Supported Email Clients

  • Gmail
  • Mozilla Thunderbird

Supported Plex Agents

  • themoviedb
  • Freebase
  • thetvdb.org

Prerequisites

The following are needed to run this script:

  1. Ruby installed (at least version 1.9.3) and ruby-dev.
  2. For OSX: make sure you have Ruby installed using RVM (This is needed to create a wrapper to weekly run the script through crontab) (see http://railsapps.github.io/installrubyonrails-mac.html. Follow the steps from "Prepare your computer" until "Rails installation options").
  3. themoviedb set as your Agent for your Movie section on your Plex server.
  4. thetvdb.org set as your Agent for your TV section on your Plex server.
  5. (Optional) A Gmail account to forward the email (Gmail is the only supported provider, so if you use another, YMMV).

Installation (Linux)

  1. Clone this repo on your server:

    git clone https://github.com/bstascavage/plexReport.git

  2. Change to the plexReport directory

  3. Run the initial_setup script:

    ./initial_setup.sh

  4. If you want to run your script with different commandline parameters, you'll need to edit the crontab. See here for reference: http://www.adminschoice.com/crontab-quick-reference

Installation (OS X)

Part 1: Install plexReport

  1. Clone this repo on your server:

    git clone https://github.com/bstascavage/plexReport.git

  2. Change to the plexReport directory

  3. Install the blunder gem (http://bundler.io/)

    gem install bundler

  4. Install the gem dependecies:

    bundle install

  5. Setup the config file in etc/config.yaml. See etc/config.yaml.example and below for details

  6. Run bin/plexreport to execute the script It should work correctly

Part 2: Create Ruby Wrapper

Now to have the script run once a week through crontab, you have to create an RVM alias by doing the following steps: (Note: You need an RVM alias because launchd, cron, and other process schedulers operate in discrete bash shell environments. Simply calling ruby from inside your launchd or cron script will not work; that will invoke the non-RVM ruby that OS X shipped with. Instead, you need an RVM alias, which will run your file through RVM's ruby, from inside launchd.)

  1. Determine your ruby version by entering

    which ruby this should results in: /Users/you/.rvm/rubies/ruby-2.2.0/bin/ruby ruby-2.2.0 is your ruby version

  2. Create a wrapper by entering

    rvm alias create plexReport ruby-2.2.0@plexReport Note: Replace ruby-2.2.0 with the version that you have determined in step 1

  3. Test the wrapper by entering

    $rvm_path/wrappers/plexReport/ruby <PATH_TO_REPO>/bin/plexReport.rb -t Note: Replace <PATH_TO_REPO> with the path leading to your plexReport directory

    It should run and exit properly (be patient it might take a few minutes).

  4. Next determine the absolute path to your wrapper. Just run

    echo $rvm_path it should result in something like this /users/esw1187/.rvm/

    Substitute '$rvm_path' in the wrapper call with the absolute rvm path obtaine above and run it again by entering

    /users/ersw1187/.rvm/wrappers/plexReport/ruby /path_to/plexReport/bin/plexReport.rb

  5. Create bash script to run the Rub code by doing the following:

    • Create a file on your desktop named 'plexReport.sh' and open it with TextEdit

    • Copy the following two lines in the file export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8

    • Add the wrapper call you just tested in step 4 to the file that you have just tested. E.g. /users/ersw1187/.rvm/wrappers/plexReport/ruby /path_to/plexReport/bin/plexReport

  6. Copy plexReport.sh to /user/local/bin directory

  7. Go to the /usr/local/bin directory and set the correct permissions by entering chmod u+x plexReport.sh

  8. Add the following line to your crontab (sudo crontab -e)

    `15 11 * * 5 <USERNAME> /usr/local/bin/plexReport.sh` 
    

    (This will run it every Friday at 11:15. To change the time, see crontab documentation:
    http://www.adminschoice.com/crontab-quick-reference

Upgrading

To upgrade your code, cd to your plexReport directory and run ./update.sh

Config file

By default, the config file is located in /etc/plexReport/config.yaml. If you need to change any information for the program, or to add more optional config parameters, see below for the config file format:

email

title - Banner title for the email body. Required.

language - The language of the email body. You need to use ISO 639-1 code ('fr', 'en', 'de'). If a content is not available in the specified language, the script will fall back to english. Defaults to 'en'. Optional.

plex

server - IP address of your Plex server. Defaults to 'localhost'. Optional.

api_key - Your Plex API key. Required.

sections - Array of sections to report on. If field is not set, will report on all TV and movie sections. Format is ['section1', 'section2']. Optional.

mail

address - Address of your smtp relay server. (ie smtp.gmail.com). Required.

port - Mail port to use. Default is 25. (Use 587 for gmail.com). Required

username - Email address to send the email from. Required.

password - Password for hte email set above. Required.

from - Display name of the sender. Required.

subject - Subject of the email. Note that the script will automatically add a date to the end of the subject. Required.

recipients_email - Email addresses of any additional recipients, outside of your Plex friends. Optional.

recipients - Plex usernames of any Plex friends to be notified. To be used with the -n option. Optional

Command-line Options

Once installed, you can run the script by simply running plexreport. If you need to reinstall or reconfigure the program, run plexreport-setup. All commandline options can be seen by running plexReport --help

Options:

-n, --no-plex-email - Do not send emails to Plex friends. Can be used with the recipients_email and recipients config file option to customize email recipients.

-l, --add-library-names - Adding the Library name in front of the movie/tv show. To be used with custom Libraries

-t, --test-email - Send email only to the Plex owner (ie yourself). For testing purposes

-d, --detailed-email - Send more details in the email, such as movie ratings, actors, etc

Images

New Episodes: alt tag

New Seasons: alt tag

New Movies: alt tag

New Movies (detailed view): alt tag

plexreport's People

Contributors

bstascavage avatar ersw1187 avatar evanrich avatar granbebe 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

Watchers

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

plexreport's Issues

Poster art for TV shows is too large in some email clients

The poster art used for the TV shows looks to be rendering at full size, whereas the poster art for movies seems right-sized.

I see this when using Outlook. One other user in the Plex forum reports (with screenshots) the same issue using Thunderbird.

I have not seen the issue when using Roundcube, a web-based email client. Perhaps that's because the email client is purposely resizing the images to fit on the screen better, but that is speculation.

Bundler Issues

OSX 10.10.5

Cloned the repo, then cd into repo to run gem install bundler and everything is listed as successful.

$ gem install bundler
Successfully installed bundler-1.10.6
Parsing documentation for bundler-1.10.6
Done installing documentation for bundler after 4 seconds
1 gem installed
$ bundler --version
Bundler version 1.10.6

Doing a bundle install

$ bundle install
Using highline 1.7.1
Using json 1.8.1
Using multi_xml 0.5.5
Using httparty 0.13.1
Using i18n 0.7.0
Using logger 1.2.8
Using mime-types 2.4.3
Using mail 2.6.3
Using bundler 1.10.6
Bundle complete! 6 Gemfile dependencies, 9 gems now installed.

After creating my config file, I try to run plexreport and have an issue.

$ ./bin/plexreport
Could not find json-1.8.1 in any of the sources
Run `bundle install` to install missing gems.

Any help in figuring this out would be great, thanks.

error: comparison of NilClass with String failed (ArgumentError)

Hi,

All of a sudden I am getting this error. I have already updated to see whether that may be the cause.

chunkykong:/opt/plexReport # LANG=en_US.UTF-8 /usr/local/sbin/plexreport -t
/usr/local/sbin/plexreport:223:in sort_by': comparison of NilClass with String failed (ArgumentError) from /usr/local/sbin/plexreport:223:insort_by!'
from /usr/local/sbin/plexreport:223:in getTVEpisodes' from /usr/local/sbin/plexreport:367:inmain'
from /usr/local/sbin/plexreport:385:in `

'

The last lines of the log (debug level) show it has collected data on all new episodes. The series "Zwarte Tulp" is alphabetically the last of my TV Series.

D, [2015-04-19T09:38:47.017214 #27677] DEBUG -- : #<HTTParty::Request:0x0000000520e220 @http_method=Net::HTTP::Get, @path=#<URI::Generic:0x0000000520e090 URL:/library/me
tadata/90025>, @options={:limit=>5, :assume_utf16_is_big_endian=>true, :default_params=>{}, :follow_redirects=>true, :parser=>HTTParty::Parser, :connection_adapter=>HTTP
arty::ConnectionAdapter, :base_uri=>"http://192.168.0.100:32400", :format=>:xml, :headers=>{"X-Plen-Token"=>"XXXXXXX", "X-Plex-Token"=>"XXXXXXX
"}}, @last_uri=#<URI::HTTP:0x0000000520d208 URL:http://192.168.0.100:32400/library/metadata/90025>, @raw_request=#<Net::HTTP::Get GET>, @last_response=#<Net::HTTPOK 200
OK readbody=true>>
D, [2015-04-19T09:38:47.017296 #27677] DEBUG -- : #<HTTParty::Response:0x51523b8 parsed_response={"MediaContainer"=>{"size"=>"1", "allowSync"=>"1", "identifier"=>"com.pl
exapp.plugins.library", "librarySectionID"=>"7", "librarySectionTitle"=>"TV Series", "librarySectionUUID"=>"bdfe081e-ee04-42b1-bd7f-7887258a39e2", "mediaTagPrefix"=>"/sy
stem/bundle/media/flags/", "mediaTagVersion"=>"1420821141", "Directory"=>{"ratingKey"=>"90025", "key"=>"/library/metadata/90025/children", "guid"=>"com.plexapp.agents.th
etvdb://293692?lang=nl", "type"=>"show", "title"=>"Zwarte Tulp", "summary"=>"Dramaserie waarin de ontwikkelingen tussen twee families uit de bollenstreek centraal staan.
Vanwege een mysterieus ongeluk in het verleden zijn de families erfvijanden geworden. Hun al jarenlang voortdurende vete wordt versterkt en actueel gehouden door de rac
e om de zwarte tulp. Beetje bij beetje wordt het mysterie uit het verleden ontrafeld. Niets is wat het lijkt, maar zeker is dat er belangrijke keuzes gemaakt moeten word
en over leven en dood, liefde en haat, loslaten en vasthouden, harmonie en chaos.", "index"=>"1", "rating"=>"8.0", "viewCount"=>"2", "lastViewedAt"=>"1428268393", "year"
=>"2015", "thumb"=>"/library/metadata/90025/thumb/1428182857", "art"=>"/library/metadata/90025/art/1428182857", "banner"=>"/library/metadata/90025/banner/1428182857", "d
uration"=>"2700000", "originallyAvailableAt"=>"2015-03-30", "leafCount"=>"12", "viewedLeafCount"=>"1", "childCount"=>"1", "addedAt"=>"1428100222", "updatedAt"=>"14281828
57", "Genre"=>{"id"=>"30", "tag"=>"Drama", "count"=>"139"}, "Role"=>[{"id"=>"5582", "tag"=>"Huub Stapel", "role"=>"Luuk Vonk"}, {"id"=>"2137", "tag"=>"Anna Drijver", "role"=>"Emma Vonk"}, {"id"=>"43678", "tag"=>"Linda van Dyck", "role"=>"Marieke Vonk"}], "Location"=>{"path"=>"/data/sambashare/Video/TV Series/Zwarte Tulp"}}}}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["text/xml;charset=utf-8"], "content-length"=>["1655"], "connection"=>["close"], "x-plex-protocol"=>["1.0"], "cache-control"=>["no-cache"]}>

Any idea what is causing this?

Possible Issue: New Shows recently added not showing up in report

I am not sure if this is an actual issue or by design, but I just added many new TV shows (air date today) to my plex server and none of them show up in the report. I have shows from 11/30 - 12/6 PST. If I run tomorrow, will the shows I added today show up in the report? If this is by design, is it possible to change the script to allow all new releases through current time to be in the report? Thanks!

Add timeout catching

API calls, ESPECIALLY thetvdb, sometimes fail, which breaks the script. Needs proper error checking.

Error while processing a new series (Allegiance)

A new series was added to Plex last night called Allegiance. It is not showing up in the report. It looks like this is the relevant portion of the log:

D, [2015-02-06T14:23:04.043043 #26066] DEBUG -- : #<HTTParty::Request:0x000000041aa4b0 @http_method=Net::HTTP::Get, @path=#<URI::Generic:0x000000041aa320 URL:/library/metadata/17104/allLeaves>, @options={:limit=>5, :assume_utf16_is_big_endian=>true, :default_params=>{}, :follow_redirects=>true, :parser=>HTTParty::Parser, :connection_adapter=>HTTParty::ConnectionAdapter, :base_uri=>"http://localhost:32400", :format=>:xml, :headers=>{"X-Plen-Token"=>"XXXXX", "X-Plex-Token"=>"XXXXX"}}, @last_uri=#<URI::HTTP:0x000000041a9790 URL:http://localhost:32400/library/metadata/17104/allLeaves>, @raw_request=#<Net::HTTP::Get GET>, @last_response=#<Net::HTTPOK 200 OK readbody=true>D
D, [2015-02-06T14:23:04.043116 #26066] DEBUG -- : #<HTTParty::Response:0x41e07e0 parsed_response={"MediaContainer"r>{"size"=>"1", "allowSync"=>"1", "art"=>"/library/metadata/17104/art/1423249882", "banner"=>"/library/metadata/17104/banner/1423249882", "identifier"=>"com.plexapp.plugins.library", "key"=>"17104", "librarySectionID"=>"1", "librarySectionTitle"=>"TV Shows", "librarySectionUUID"=>"b17ab790-20ba-468e-8f69-b58bc9e4369f", "mediaTagPrefix"=>"/system/bundle/media/flags/", "mediaTagVersion"=>"1421551012", "mixedParents"=>"1", "nocache"=>"1", "parentIndex"=>"1", "parentTitle"=>"Allegiance", "parentYear"=>"2015", "title1"=>"TV Shows", "title2"=>"Allegiance", "viewGroup"=>"episode", "viewMode"=>"65592", "Video"=>{"ratingKey"=>"17106", "key"=>"/library/metadata/17106", "parentRatingKey"=>"17105", "studio"=>"NBC", "type"=>"episode", "title"=>"Pilot", "parentKey"=>"/library/metadata/17105", "grandparentTitle"=>"Allegiance", "contentRating"=>"TV-14", "summary"=>"Rookie CIA analyst Alex O’Connor is assigned his first case - to examine the statements of a defecting Russian spy, who claims that rogue elements within her organization are planning a catastrophic attack that will bring America to its knees. Unbeknownst to Alex, his parents, Katya and Mark, are part of the dormant Russian sleeper cell he’s investigating, and an unwelcome friend from the past arrives on their doorstep to give them a new mission: turn their son into a spy before his investigation unmasks them. With nowhere to turn, Katya and Mark must choose – flag, or family.", "index"=>"1", "parentIndex"=>"1", "rating"=>"7.0", "year"=>"2015", "thumb"=>"/library/metadata/17106/thumb/1423249882", "parentThumb"=>"/library/metadata/17105/thumb/1423249882", "duration"=>"2662720", "originallyAvailableAt"=>"2015-02-05", "addedAt"=>"1423196443", "updatedAt"=>"1423249882", "chapterSource"=>"", "Media"=>{"videoResolution"=>"720", "id"=>"20223", "duration"=>"2662720", "bitrate"=>"2752", "width"=>"1280", "height"=>"720", "aspectRatio"=>"1.78", "audioChannels"=>"6", "audioCodec"=>"ac3", "videoCodec"=>"h264", "container"=>"mkv", "videoFrameRate"=>"24p", "Part"=>{"id"=>"22350", "key"=>"/library/parts/22350/file.mkv", "duration"=>"2662720", "file"=>"/pub/Media/Video/Television/Allegiance/Season 01/S01E01 - Pilot.mkv", "size"=>"915908753", "container"=>"mkv", "indexes"=>"sd"}}, "Writer"=>{"tag"=>"George Nolfi"}, "Director"=>{"tag"=>"George Nolfi"}}}}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["text/xml;charset=utf-8"], "content-length"=>["2159"], "connection"=>["close"], "x-plex-protocol"=>["1.0"], "cache-control"=>["no-cache"]}>
E, [2015-02-06T14:23:04.045422 #26066] ERROR -- : Something failed. If you are seeing this, please turn on debugging and open an issue.
D, [2015-02-06T14:23:04.045449 #26066] DEBUG -- : {"ratingKey"=>"17104", "key"=>"/library/metadata/17104/children", "studio"=>"NBC", "type"=>"show", "title"=>"Allegiance", "contentRating"=>"TV-14", "summary"=>"Alex O'Connor, a young idealistic CIA analyst specializing in Russian affairs, learns a shocking secret and his close-knit, affluent family is about to be split apart when it's revealed that his parents, Mark and Katya, are covert Russian spies deactivated decades ago. But today the Kremlin has re-enlisted them into service as they plan a terrorist operation inside the U.S. border that will bring America to its knees.", "index"=>"1", "rating"=>"8.0", "year"=>"2015", "thumb"=>"/library/metadata/17104/thumb/1423249882", "art"=>"/library/metadata/17104/art/1423249882", "banner"=>"/library/metadata/17104/banner/1423249882", "duration"=>"3600000", "originallyAvailableAt"=>"2015-02-05", "leafCount"=>"1", "viewedLeafCount"=>"0", "childCount"=>"1", "addedAt"=>"1423196443", "updatedAt"=>"1423249882", "Genre"=>[{"tag"=>"Crime"}, {"tag"=>"Drama"}], "Role"=>[{"tag"=>"Hope Davis"}, {"tag"=>"Scott Cohen"}, {"tag"=>"Margarita Levieva"}]}
D, [2015-02-06T14:23:04.045518 #26066] DEBUG -- : can't convert String into Integer (TypeError)
bin/plexReport.rb:249:in []' bin/plexReport.rb:249:inblock (2 levels) in getTVInfo'
bin/plexReport.rb:248:in each' bin/plexReport.rb:248:inblock in getTVInfo'
bin/plexReport.rb:236:in each' bin/plexReport.rb:236:ingetTVInfo'
bin/plexReport.rb:191:in block (2 levels) in getTVEpisodes' bin/plexReport.rb:190:ineach'
bin/plexReport.rb:190:in block in getTVEpisodes' bin/plexReport.rb:185:ineach'
bin/plexReport.rb:185:in getTVEpisodes' bin/plexReport.rb:332:inmain'
bin/plexReport.rb:350:in `

'

Error sending gmail

I cant send a gmail anymore. How can this be fixed ?

root@DD-WRT:/opt/plexReport# /usr/local/sbin/plexreport -t 
/var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/core_extensions/string.rb:26:in `=~': invalid byte sequence in US-ASCII (ArgumentError)
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/core_extensions/string.rb:26:in `!~'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/core_extensions/string.rb:26:in `blank?'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/body.rb:36:in `initialize'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:2012:in `new'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:2012:in `process_body_raw'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:1244:in `body'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:2038:in `identify_and_set_transfer_encoding'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:1792:in `ready_to_send!'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:1810:in `encoded'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/check_delivery_params.rb:12:in `check_delivery_params'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:98:in `deliver!'
    from /var/lib/gems/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:252:in `deliver!'
    from /var/lib/plexReport/mailReport.rb:93:in `block in sendMail'
    from /var/lib/plexReport/mailReport.rb:84:in `each'
    from /var/lib/plexReport/mailReport.rb:84:in `sendMail'
    from /usr/local/sbin/plexreport:381:in `main'
    from /usr/local/sbin/plexreport:385:in `<main>'

Error with latest pull

Getting an error with the latest pull (from De 12, 2014:

bin/plexreport.rb:117:in []': no implicit conversion of String into Integer (TypeError) from bin/plexreport.rb:117:ingetMovieInfo'
from bin/plexreport.rb:97:in block (2 levels) in getMovies' from bin/plexreport.rb:96:ineach'
from bin/plexreport.rb:96:in block in getMovies' from bin/plexreport.rb:92:ineach'
from bin/plexreport.rb:92:in getMovies' from bin/plexreport.rb:292:inmain'
from bin/plexreport.rb:311:in `

'

Have tried twice, exact same error.

undefined method '[]' for nil:NilClass

Saw someone else had this issue in the forums, but I don't see an issue here.

~/src/plexReport ±master » ./bin/plexReport.rb
./bin/plexReport.rb:92:in `getMovies': undefined method `[]' for nil:NilClass (NoMethodError)
        from ./bin/plexReport.rb:316:in `main'
        from ./bin/plexReport.rb:335:in `<main>'

Support for other languages

Hi, I have PMS agents configured in Spanish, I would like the text in the e-mail appears in Spanish too.

Sorry for my English

Installation error

I'm having an issue installing on Ubuntu Linux HP-Z210 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I receive this error

Creating plexreport library at /var/lib/plexReport
Creating plexreport conf directory at /etc/plexReport
Moving plexreport and plexreport-setup to /usr/local/sbin
Moving plexreport libraries to /var/lib/plexreport
Moving email_body.erb to /etc/plexreport
Creating /etc/plexreport/config.yaml
Creating /var/log/plexReport.log
Installing ruby gem dependency
./initial_setup.sh: line 27: /use/bin/gem: No such file or directory
./initial_setup.sh: line 28: /usr/local/bin/bundle: No such file or directory
Running /usr/local/sbin/plexreport-setup
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- httparty     (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require'
    from /usr/local/sbin/plexreport-setup:4:in `<main>'

Error sort_by

Hello, I love this script!
I had a permissions issue ("Log file not found Exiting ....") I've solved temporarily.
Applying changing permissions "chmod -R 775" to plexReport directory permissions. What Should I apply?
With this problem fixed, another new problem appears when I run the script:

/home/tolo/plexReport/bin/plexReport.rb:189:in `sort_by': comparison of NilClass with String failed (ArgumentError)
    from /home/tolo/plexReport/bin/plexReport.rb:189:in `sort_by!'
    from /home/tolo/plexReport/bin/plexReport.rb:189:in `getTVEpisodes'
    from /home/tolo/plexReport/bin/plexReport.rb:317:in `main'
    from /home/tolo/plexReport/bin/plexReport.rb:335:in `<main>'

I searched the line of code fails and That is: (in case you help)

# Method for getting new TV shows from the Plx server  
    def getTVEpisodes
        plex = Plex.new($config)
        tv_episodes = Hash.new
        tv_episodes[:new] = []
        tv_episodes[:seasons] = []

        library = plex.get('/library/sections')
        library['MediaContainer']['Directory'].each do | element |
            if element['type'] == 'show'
                library = plex.get("/library/sections/#{element['key']}/all")
                library['MediaContainer']['Directory'].each do | element |
                    tv_episodes = self.getTVInfo(element, tv_episodes)
                end
            end
        end

        tv_episodes[:new].sort_by! { |hsh| hsh[:series_name] }
        tv_episodes[:seasons].sort_by! { |hsh| hsh[:series_name] }
        return tv_episodes
    end

my config.yaml file with personal data blanked:

email:
        title: 'Novedades de la semana'
plex:
        server: localhost
        api_key: ******
mail:
        address: smtp.****.com
        port: 25
        username: alert@****.com
        password: ****
        from: MoviesServer
        subject: 'Novedades de la semana - '
        recipients_email: ['****@me.com']
        recipients: ['****', '****']

Sorry for my English

same as #39 but with error code 200

sorry i have the same problem with the last script (d.d. 4-2-2015 04.32 hour) as in issue #39

root@SERVER:/opt/plexReport# bin/plexReport.rb -t
bin/plexReport.rb:200:in sort_by': comparison of String with nil failed (ArgumentError) from bin/plexReport.rb:200:insort_by!'
from bin/plexReport.rb:200:in getTVEpisodes' from bin/plexReport.rb:332:inmain'
from bin/plexReport.rb:350:in `'

in the logfile i can see that the error starts at the moment that the scan starts with the series

gan you help me?
thanks and regards
Marco

REQUEST: Send General Notice to Plex Friends

In addition to sending a weekly report on the new releases for the week, it would be awesome if the script included an option to send out a general notice in a nicely formatted HTML email to users. It would come in handy to notify of downtime, etc. In addition, perhaps another option to add a notice in the header or footer of the weekly new releases email would be nice too!

Thanks again for your efforts! =)

Change the frequency of the script

Hello, I would like to change the frequency of the script. Instead of running week, I'd like that every day will run
From Weekly to every day. Is this possible?

Sorry for my English.

Feature Request: Option to email user statistics summary

I am not sure if you are familiar with plexWatch and plexWatch/Web, but they are very nice scripts that provide excellent statistics by user. I am not sure if this is easily doable, or if I should perhaps make the request with the plexWatch/Web developer, but it would be great if I had an option to easily send watched statistics, including show/movie, duration, stream info, total time on plex usage per day, week, month, all time, etc. to users. In addition to a "plexReport" on newly added TV/Movies, it would be a watched "plexReport".

screen shot 2014-12-11 at 8 46 42 am
screen shot 2014-12-11 at 8 50 10 am

Log file not found

As mentioned - keep getting Log File not found when running plexreport -t

REQUEST: Limit which Libary section to be notified per user.

Hi, Would it be possible to limit which library i want to notify my users of new items?

Also it would be great if we can specify create notification groups and add emails to those groups. If i want to notify Group1 of Movies only and Group2 of Kids Movies and Movies and Group3 of Documentaries.

Thank you. Love the script.

More than one episode of a TV Show

if more than one episode of a tv show is added within the week one of the episodes is listed twice instead of the two separate episodes.

REQUEST: Include Genre, Release Date, and Stars from IMDB

I realize the Movies have hyperlinks to IMDB, but it would be nice to include the Genre, MPAA rating, Release Date, and Stars from IMDB as well in the email body if possible.

Thanks again for the wonderful script and quickly adding the IMDB ratings!

Cannot install

The script initial_setup.sh has an issue at line 27 :
/use/bin/gem
It should be /usr/bin/gem

Also somme commands requires sudo, some not. It may be more safe to use sudo for each command requiring it instead of asking for sudo the whole script (especially as bundler do not want to be executed as root).

Also, highline seems to not be available in the required 1.7.0 version (you may want to update it to 1.7.1).

Error when using with Plex Home

Logfile created on 2015-02-12 14:22:38 -0500 by logger.rb/31641
I, [2015-02-12T14:22:38.862941 #55] INFO -- : Starting up PlexReport
D, [2015-02-12T14:22:38.866157 #55] DEBUG -- : Debug info for plexmediaserver connection
D, [2015-02-12T14:22:38.866240 #55] DEBUG -- : 401
D, [2015-02-12T14:22:38.866272 #55] DEBUG -- : #<HTTParty::Request:0x00000000e58ff8 @http_method=Net::HTTP::Get, @path=#<URI::Generic:0x00000000e58918 URL:/library/sections>, @options={:limit=>5, :assume_utf16_is_big_endian=>true, :default_params=>{}, :follow_redirects=>true, :parser=>HTTParty::Parser, :connection_adapter=>HTTParty::ConnectionAdapter, :base_uri=>"http://10.10.1.3:32400", :format=>:xml, :verify=>false}, @last_uri=#<URI::HTTP:0x00000000e5d9e0 URL:http://10.10.1.3:32400/library/sections>, @raw_request=#<Net::HTTP::Get GET>, @last_response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>>
D, [2015-02-12T14:22:38.866398 #55] DEBUG -- : #<HTTParty::Response:0x16a30c8 parsed_response={"html"=>{"head"=>{"title"=>"Unauthorized"}, "body"=>{"h1"=>"401 Unauthorized"}}}, @response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>, @headers={"content-length"=>["91"], "content-type"=>["text/html"], "x-plex-protocol"=>["1.0"], "cache-control"=>["no-cache"]}>

REQUEST - Multiple Library Functionality

I love this script! I am wondering if it's possible to prepend the title of the movie with the library in which it is contained, for example: (Kids) MovieTitle (1943) I have multiple move libraries with differing content and it would be nice for users to be able to see which library any specific new content was added under.

In this same vein, a feature to only email with content from the libraries that user has access to would be very cool (so kids can thier own emails but don't see movies they aren't allowed to watch).

REQUEST: Select Movies or TV Shows or Both in output

I have many users who only care about the movies, TVShows don't matter. I think it would be great to have an easy selection somewhere (perhaps the config.yaml) to choose what types of media to output. Specifically, I'd like to just have Movies output for folks. Alternatively, using a switch on the script might work as well so someone could run a script once a week for only themselves (include all), but also run a script once a week for friends, which outputs only movies.

Update thetvdb API

Apparently thetvdb removed a large section of their API, which broke this script (ugh).

No pictures in email

Hello,

I am receiving the email with the right information but without any pictures.
The receiving email is a gmail account with pictures enabled.
"Images from this sender are always displayed"
The message arrives in Inbox not Junk.

I have removed the title names and description from the image below.
http://s8.postimg.org/3w82iyrxx/Untitled.png

Error: /opt/plexReport/bin/plexReport.rb:183:in `block in getTVEpisodes': undefined method `each' for nil:NilClass (NoMethodError)

When running /opt/plexReport/bin/plexReport.rb -t -v I get this error:

/opt/plexReport/bin/plexReport.rb:183:in 'block in 'getTVEpisodes': undefined method 'each' for nil:NilClass (NoMethodError)
   from /opt/plexReport/bin/plexReport.rb:180:in 'each'
   from /opt/plexReport/bin/plexReport.rb:180:in 'getTVEpisodes'
   from /opt/plexReport/bin/plexReport.rb:322:in 'main'
   from /opt/plexReport/bin/plexReport.rb:340:in '`<main>'

Thanks for your help in getting this resolved. I'm really looking forward to using this.

Here are my config file. I need to figure how to upload a whole log file.

config.yaml:


---
email:
   title: 'Plex Weekly Updates'
plex:
   server: 10.1.1.20
   api_key: <api>
mail:
   address: smtp.gmail.com
   port: 587
   username: ***@gmail.com
   password: ***
   from: ***@gmail.com 
   subject: 'Plex'
   recipients_email: ['***@***.org', '***@***.org']
   recipients: ['PLEX_USER']

Ability to have a space in subject line

I would like the ability to put a space after my custom subject line before the date. It currently shows up as "New This Week:12/07/2014". I tried adding single quotes but it breaks the scripts ability to parse the config file. I also tried   figuring it would maybe read the html in the subject but no luck.

If you could change the way the subject option is parsed to allow single quotes or even just add a space on the end by default that would fix it for me.

REQUEST - Ability to customize email recipients

Would like to see the ability to use a custom list of email addresses instead of pulling from Plex to target users that may not have a separate Plex account.
Example - I have 3 users that I share with. Two of those users (User 1 and User 2) do not care about new stuff, they just use Plex with whatever is there.
One user (User 3) uses it as a cable replacement and wants to know when new shows are added.
In addition, my wife (Wife) uses Plex but just uses my account.

I would like the ability to tell Plex to email User 3 and Wife while ignoring User 1 and User 2.
Hopefully that makes sense.

No Email sending, error and config attached

As per the forum.
I'm trying to run this on OSX Yosemite.
Running
I get the following when run -

Quantum:bin pardonator$ ruby plexReport.rb
/Users/pardonator/Documents/PlexReport/plexReport/bin/mailReport.rb:54:in sendMail': undefined methodeach' for nil:NilClass (NoMethodError)
from plexReport.rb:346:in main' from plexReport.rb:350:in

'

PlexReport broken after upgrade to 15.04

I upgraded to 15.04 and now whenever I try to run the report, I get the following error:

user@hostname:/etc/plexReport$ /usr/local/sbin/plexreport -t
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- i18n (LoadError) from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/sbin/plexreport:11:in `

'

I have the gem installed, so I'm not sure what this error could mean.
user@hostname:/etc/plexReport$ gem list --local | grep i18n
i18n (0.7.0)

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.