bstascavage / plexReport

Scripts to generate a weekly email of new additions to Plex
67 stars 17 forks source link

Error sort_by #32

Closed ghost closed 9 years ago

ghost commented 9 years ago

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

ghost commented 9 years ago

Could my problem is related to "TheTVDB API Update # 33"?

bstascavage commented 9 years ago

Potentially. I haven't had the time to investigate your issue, but #33 is currently breaking the script. If it was the same issue, you should get some errors in your plexWatch.log.

Can you post the contents of plexWatch.log for me?

bstascavage commented 9 years ago

33 is fixed, so run a 'git pull' and try again for me.

ghost commented 9 years ago

thank you very much, I'll try and tell you how it works. but I want to take this opportunity to ask if we can change from weekly to daily, thank you very much. sorry for my English

bstascavage commented 9 years ago

Please open a separate issue for that.

ghost commented 9 years ago

Ok, I have reinstalled Plex and PlexReport, so plexReport send all my libraries (and this would be very slow), when I get to change the frequency of the script # 34 I test it again to confirm that # 32 is solved.

Sorry for my English

bstascavage commented 9 years ago

Well, the script will always scan all of your libraries; this is because the 'RecentlyAdded' api call actually has a maximum return value. It will only send all of your libraries if your libraries were added in the last week.

Even if it takes a while, please test with the weekly frequency. It might be a few days before I get to #34

ghost commented 9 years ago

I understand it, each library were added two days ago, is a very large library, I'll have to wait a week to run the script.

ghost commented 9 years ago

No, the script does'n work, show this error:

/home/tolo/plex/plexReport/bin/plexReport.rb:189:in `sort_by': comparison of String with nil failed (ArgumentError)
    from /home/tolo/plex/plexReport/bin/plexReport.rb:189:in `sort_by!'
    from /home/tolo/plex/plexReport/bin/plexReport.rb:189:in `getTVEpisodes'
    from /home/tolo/plex/plexReport/bin/plexReport.rb:322:in `main'
    from /home/tolo/plex/plexReport/bin/plexReport.rb:340:in `<main>'

The logfile:

I, [2015-01-14T15:08:27.476432 #4003]  INFO -- : Starting up PlexReport
I, [2015-01-14T15:09:37.647322 #4003]  INFO -- : Reporting Movie: Betibú
I, [2015-01-14T15:10:01.890639 #4003]  INFO -- : Reporting Movie: A Walk Among the Tombstones
I, [2015-01-14T15:10:06.210107 #4003]  INFO -- : Reporting Movie: When Animals Dream
I, [2015-01-14T15:10:26.602529 #4003]  INFO -- : Reporting Movie: Get Married if You Can
I, [2015-01-14T15:10:30.221220 #4003]  INFO -- : Reporting Movie: School of Rock
I, [2015-01-14T15:10:55.668797 #4003]  INFO -- : Reporting Movie: The Grand Seduction
I, [2015-01-14T15:11:17.951752 #4003]  INFO -- : Reporting Movie: Joe
I, [2015-01-14T15:11:52.223387 #4003]  INFO -- : Reporting Movie: Mea Culpa
I, [2015-01-14T15:11:55.036576 #4003]  INFO -- : Reporting Movie: The Nut Job
I, [2015-01-14T15:12:10.365370 #4003]  INFO -- : Reporting Movie: Snow Bride
E, [2015-01-14T15:12:14.611102 #4003] ERROR -- : Something failed.  If you are seeing this, please turn on debugging and open an issue.
I, [2015-01-14T15:12:23.463397 #4003]  INFO -- : Reporting American Horror Story Season 4 Episode 11
I, [2015-01-14T15:12:36.585075 #4003]  INFO -- : Reporting Forever (2014) Season 1 Episode 13
I, [2015-01-14T15:12:38.086970 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087186 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087252 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087311 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087366 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087423 #4003]  INFO -- : Reporting  Season 1 Episode 17
I, [2015-01-14T15:12:38.087478 #4003]  INFO -- : Reporting  Season 1 Episode 17
E, [2015-01-14T15:13:22.551647 #4003] ERROR -- : Connection to thetvdb.com failed while retrieving info for Las Aventuras del Capitán Alatriste
I, [2015-01-14T15:13:23.797554 #4003]  INFO -- : Reporting The Librarians (2014) Season 1 Episode 8
I, [2015-01-14T15:13:33.305890 #4003]  INFO -- : Reporting The Mentalist Season 7 Episode 6
I, [2015-01-14T15:13:52.614539 #4003]  INFO -- : Reporting Person of Interest Season 4 Episode 12
ghost commented 9 years ago

How I can update the script correctly? After updating again shows me this error:

/usr/lib/ruby/1.9.1/openssl/ssl-internal.rb:129:in `post_connection_check': hostname does not match the server certificate (OpenSSL::SSL::SSLError)
    from /usr/lib/ruby/1.9.1/net/smtp.rb:585:in `tlsconnect'
    from /usr/lib/ruby/1.9.1/net/smtp.rb:560:in `do_start'
    from /usr/lib/ruby/1.9.1/net/smtp.rb:519:in `start'
    from /var/lib/gems/1.9.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
    from /var/lib/gems/1.9.1/gems/mail-2.6.3/lib/mail/message.rb:252:in `deliver!'
    from /home/tolo/plex/plexReport/bin/mailReport.rb:89:in `block in sendMail'
    from /home/tolo/plex/plexReport/bin/mailReport.rb:80:in `each'
    from /home/tolo/plex/plexReport/bin/mailReport.rb:80:in `sendMail'
    from /home/tolo/plex/plexReport/bin/plexReport.rb:336:in `main'
    from /home/tolo/plex/plexReport/bin/plexReport.rb:340:in `<main>'
ghost commented 9 years ago

Please, tell me what I can do to fix it. To uninstall completely? I need to know what steps to follow

bstascavage commented 9 years ago

You can update the script by running "git pull".

Right now your error is an issue with sending the email. ' hostname does not match the server certificate' That means that whatever you put as your SMTP server doesn't match the server's cert. What SMTP server are you using?

ghost commented 9 years ago

Already is up-to-date. I changed from my domain mail settings to gmail account. Now the error is:

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

The logfile:

I, [2015-01-17T09:50:12.126251 #19108]  INFO -- : Starting up PlexReport
I, [2015-01-17T09:50:32.290555 #19108]  INFO -- : Reporting Movie: Betibú
I, [2015-01-17T09:50:34.116318 #19108]  INFO -- : Reporting Movie: Colt 45
I, [2015-01-17T09:50:36.153763 #19108]  INFO -- : Reporting Movie: When Animals Dream
I, [2015-01-17T09:50:45.089490 #19108]  INFO -- : Reporting Movie: Get Married if You Can
I, [2015-01-17T09:50:46.860803 #19108]  INFO -- : Reporting Movie: School of Rock
I, [2015-01-17T09:50:48.729641 #19108]  INFO -- : Reporting Movie: Frontera
I, [2015-01-17T09:50:59.985095 #19108]  INFO -- : Reporting Movie: The Grand Seduction
I, [2015-01-17T09:51:11.648477 #19108]  INFO -- : Reporting Movie: A Most Wanted Man
I, [2015-01-17T09:51:13.435138 #19108]  INFO -- : Reporting Movie: Marshland
I, [2015-01-17T09:51:23.374271 #19108]  INFO -- : Reporting Movie: Joe
I, [2015-01-17T09:51:32.477953 #19108]  INFO -- : Reporting Movie: Gutshot Straight
I, [2015-01-17T09:51:34.264607 #19108]  INFO -- : Reporting Movie: Khumba
I, [2015-01-17T09:51:43.389211 #19108]  INFO -- : Reporting Movie: Mea Culpa
I, [2015-01-17T09:51:45.240156 #19108]  INFO -- : Reporting Movie: The Nut Job
I, [2015-01-17T09:51:47.029716 #19108]  INFO -- : Reporting Movie: X
E, [2015-01-17T09:51:49.398708 #19108] ERROR -- : Something failed.  If you are seeing this, please turn on debugging and open an issue.
I, [2015-01-17T09:52:00.677822 #19108]  INFO -- : Reporting  Season 1 Episode 18
I, [2015-01-17T09:52:11.659209 #19108]  INFO -- : Reporting Helix Season ["1"]
I, [2015-01-17T09:52:15.556105 #19108]  INFO -- : Reporting Houdini Season ["1"]
I, [2015-01-17T09:52:22.503625 #19108]  INFO -- : Reporting The Adventures of Captain Alatriste Season 1 Episode 2
I, [2015-01-17T09:52:22.518432 #19108]  INFO -- : Reporting The Adventures of Captain Alatriste Season ["1"]
I, [2015-01-17T09:52:23.460526 #19108]  INFO -- : Reporting The Librarians (2014) Season 1 Episode 8
I, [2015-01-17T09:52:23.500916 #19108]  INFO -- : Reporting The Librarians (2014) Season 1 Episode 7

How i can turn on debugging?

bstascavage commented 9 years ago

-v

ghost commented 9 years ago

I just try: I deleted the plexReport directory. I have done "purge" a ruby and ruby-dev. I reboot the server I did "apt-get update", "apt-get upgrade", "apt-get autoclean", "autoremove" .. I reboot the server I installed ruby and ruby-dev I installed following the instructions plexWeeklyReport I run the script Shows the same error :(

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

I do not know what else I can try to do, any suggestions?

Using Ubuntu Server 14.04.1 LTS (GNU/Linux 3.13.0-44-generic x86_64) Using PlexMediaServer 0.9.11.7 Using json 1.8.1 Using multi_xml 0.5.5 Using httparty 0.13.1 Using logger 1.2.8 Using mime-types 2.4.3 Using mail 2.6.3 Using bundler 1.7.12

The logfile:

I, [2015-01-21T17:05:19.503455 #3129]  INFO -- : Starting up PlexReport
I, [2015-01-21T17:05:42.956017 #3129]  INFO -- : Reporting Movie: Love Is the Perfect Crime
I, [2015-01-21T17:05:45.311759 #3129]  INFO -- : Reporting Movie: Colt 45
I, [2015-01-21T17:05:47.263550 #3129]  INFO -- : Reporting Movie: The Football Factory
I, [2015-01-21T17:06:01.587769 #3129]  INFO -- : Reporting Movie: Dracula Untold
I, [2015-01-21T17:06:03.728867 #3129]  INFO -- : Reporting Movie: Frontera
I, [2015-01-21T17:06:15.399497 #3129]  INFO -- : Reporting Movie: A Most Wanted Man
I, [2015-01-21T17:06:17.224734 #3129]  INFO -- : Reporting Movie: Marshland
I, [2015-01-21T17:06:26.589309 #3129]  INFO -- : Reporting Movie: Gutshot Straight
I, [2015-01-21T17:06:28.500009 #3129]  INFO -- : Reporting Movie: Khumba
I, [2015-01-21T17:06:55.048403 #3129]  INFO -- : Reporting Movie: Gone Girl
I, [2015-01-21T17:07:06.962882 #3129]  INFO -- : Reporting Movie: When the Game Stands Tall
I, [2015-01-21T17:07:08.809729 #3129]  INFO -- : Reporting Movie: X
I, [2015-01-21T17:07:10.661877 #3129]  INFO -- : Reporting  Season 1 Episode 2
I, [2015-01-21T17:07:28.557646 #3129]  INFO -- : Reporting Bob's Burgers Season ["1"]
I, [2015-01-21T17:07:28.557866 #3129]  INFO -- : Reporting Bob's Burgers Season ["2"]
I, [2015-01-21T17:07:28.557940 #3129]  INFO -- : Reporting Bob's Burgers Season ["3"]
I, [2015-01-21T17:07:28.558007 #3129]  INFO -- : Reporting Bob's Burgers Season ["4"]
I, [2015-01-21T17:07:46.030873 #3129]  INFO -- : Reporting Gomorrah Season ["1"]
I, [2015-01-21T17:07:47.261878 #3129]  INFO -- : Reporting  Season 1 Episode 23
I, [2015-01-21T17:07:47.338352 #3129]  INFO -- : Reporting  Season 1 Episode 22
I, [2015-01-21T17:07:47.507602 #3129]  INFO -- : Reporting  Season 1 Episode 21
I, [2015-01-21T17:07:47.593878 #3129]  INFO -- : Reporting  Season 1 Episode 20
I, [2015-01-21T17:07:58.777885 #3129]  INFO -- : Reporting Helix Season 2 Episode 1
I, [2015-01-21T17:08:07.126018 #3129]  INFO -- : Reporting The Adventures of Captain Alatriste Season 1 Episode 2

sorry for my English

ghost commented 9 years ago

I tried again, same error. The Logfile:

I, [2015-01-26T17:25:08.854341 #6706]  INFO -- : Starting up PlexReport
I, [2015-01-26T17:26:17.214555 #6706]  INFO -- : Reporting Movie: Love Is the Perfect Crime
I, [2015-01-26T17:26:53.367499 #6706]  INFO -- : Reporting Movie: Dracula Untold
I, [2015-01-26T17:27:35.547450 #6706]  INFO -- : Reporting Movie: The Boxtrolls
I, [2015-01-26T17:28:09.746096 #6706]  INFO -- : Reporting Movie: How I Live Now
I, [2015-01-26T17:28:12.333442 #6706]  INFO -- : Reporting Movie: Gone Girl
I, [2015-01-26T17:28:17.817126 #6706]  INFO -- : Reporting Movie: We Are What We Are
I, [2015-01-26T17:28:24.873742 #6706]  INFO -- : Reporting Movie: Dead Snow 2: Red vs. Dead
I, [2015-01-26T17:28:27.233424 #6706]  INFO -- : Reporting  Season 1 Episode 3
I, [2015-01-26T17:28:40.487365 #6706]  INFO -- : Reporting Bob's Burgers Season ["1"]
I, [2015-01-26T17:28:40.487647 #6706]  INFO -- : Reporting Bob's Burgers Season ["2"]
I, [2015-01-26T17:28:40.487748 #6706]  INFO -- : Reporting Bob's Burgers Season ["3"]
I, [2015-01-26T17:28:40.487812 #6706]  INFO -- : Reporting Bob's Burgers Season ["4"]
I, [2015-01-26T17:29:09.491874 #6706]  INFO -- : Reporting Gomorrah Season ["1"]
I, [2015-01-26T17:29:12.606090 #6706]  INFO -- : Reporting  Season 1 Episode 25
I, [2015-01-26T17:29:12.767499 #6706]  INFO -- : Reporting  Season 1 Episode 24
I, [2015-01-26T17:29:12.898503 #6706]  INFO -- : Reporting  Season 1 Episode 23
I, [2015-01-26T17:29:25.206866 #6706]  INFO -- : Reporting Helix Season 2 Episode 2
E, [2015-01-26T17:29:35.964904 #6706] ERROR -- : Something failed.  If you are seeing this, please turn on debugging and open an issue.
ghost commented 9 years ago

Is possible that this error is related to that I have the thetvdb.org and themoviedb agents are configured in Spanish?

Thanks and sorry for my insistence, but I have really wanted to run this script.

bstascavage commented 9 years ago

It shouldn't be; I added a wildcard for language a while back.

  1. Delete your log file
  2. Run it again on verbose
  3. Send me your log file
ghost commented 9 years ago

Thank you for your attention and patience I updated the script (git pull), I deleted the log file, I run it on verbose and this is the log file: https://mega.co.nz/#!XhkGSZTC!EAySNkkqt1KT-fKG_AjI0P_D0Z4N-_juuq2OqazKUXU

bstascavage commented 9 years ago

And did it give you an error printed to the screen?

ghost commented 9 years ago

Hello, 2 days ago the error was the same:

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

but today, the script was completed without errors in test mode (-t), without test mode show this error:

/usr/lib/ruby/1.9.1/net/smtp.rb:948:in `check_response': 555 5.5.2 Syntax error. gm10sm14894089wib.19 - gsmtp (Net::SMTPFatalError)
        from /usr/lib/ruby/1.9.1/net/smtp.rb:917:in `getok'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:860:in `rcptto'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:841:in `block in rcptto_list'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:839:in `each'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:839:in `rcptto_list'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:660:in `send_message'
        from /var/lib/gems/1.9.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:113:in `block in deliver!'
        from /usr/lib/ruby/1.9.1/net/smtp.rb:520:in `start'
        from /var/lib/gems/1.9.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
        from /var/lib/gems/1.9.1/gems/mail-2.6.3/lib/mail/message.rb:252:in `deliver!'
        from /home/tolo/plex/plexReport/bin/mailReport.rb:89:in `block in sendMail'
        from /home/tolo/plex/plexReport/bin/mailReport.rb:80:in `each'
        from /home/tolo/plex/plexReport/bin/mailReport.rb:80:in `sendMail'
        from /home/tolo/plex/plexReport/bin/plexReport.rb:336:in `main'
        from /home/tolo/plex/plexReport/bin/plexReport.rb:340:in `<main>'
ersw1187 commented 9 years ago

@ToloRiera I was running into similar problems. When using Gmail, do not forget to change the following setting "www.google.com/settings/security/lesssecureapps" as mentioned by rsava in a previous post on the PlexForum. Also use port 587 (TLS) and not 465 (SSL). when is set it up in this way it sent out the e-mail without any problems

ghost commented 9 years ago

WOW!! now is working!! but the title and description is in english, I would like to see it in Spanish, Is this possible? the problem is in the translation?

ersw1187 commented 9 years ago

Kobali asked the question on the PlexForum. Smart thing to do add it as a feature request right here. Then at least Brian (@bstascavage) and everyone else has a clear least of things to do

bstascavage commented 9 years ago

I am closing this troubleshooting ticket. If you want multiple language support, please open a ticket for it.