bstascavage / plexReport

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

undefined method '[]' for nil:NilClass #28

Closed stephenjamieson closed 9 years ago

stephenjamieson commented 9 years ago

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>'
shottothedome commented 9 years ago

This happened to me when I had the wrong api key in the config.yaml file.

Go here: https://plex.tv/devices.xml then find your server name in the device list. The API Key you want is the Token listed there. Just remove the quotes around it and directly paste it into the config file.

stephenjamieson commented 9 years ago

Still doesn't work for me, though I did not have that token before.

shottothedome commented 9 years ago

What are you using for server in the config? It was kind of finicky for me. I have plexreport running on the same machine as plex server so I got it working with

server: 127.0.0.1

in the config. It did not like a local ip or localhost for whatever reason

stephenjamieson commented 9 years ago

I tried both 127.0.0.1, localhost, internal, and external ip

shottothedome commented 9 years ago

Ok well i've got nothing then. That is how I fixed it. If it's a different agent like freebase, the script just skips it for me so I'm not sure what the problem is. Guess we will have to wait for Dev/Op to chime in

stephenjamieson commented 9 years ago

it looks like authentication with the token is working too.

 DEBUG - We found auth token (tokenhere), enabling token-based authentication.
 DEBUG - Came in with the master token, authorization succeeded.
bstascavage commented 9 years ago

Please paste the results of plexWatch.log

stephenjamieson commented 9 years ago

plexWatch.log?

bstascavage commented 9 years ago

When the script is run, a file is generated in the same directory called plexWatch.log

stephenjamieson commented 9 years ago

I see plexReport.log, but it's only a bunch of entries with

I, [2014-12-18T13:46:52.165229 #22275]  INFO -- : Starting up PlexReport
bstascavage commented 9 years ago

And post your etc/config.yaml

stephenjamieson commented 9 years ago
---
email:
   title: 'Whats on plex'
plex:
   server: 127.0.0.1
   api_key: obfuscated
mail:
   address: 127.0.0.1
   port: 25
   username: na
   password: na
   from: plex
   subject: 'Whats new on plex'
   recipients_email: ['myemail@gmail.com']
   recipients: ['PLEX_USER']
bstascavage commented 9 years ago
  1. You don't need to specify a server if it is localhost. It will default to that.
  2. Even though it is not getting that far, unless you have an SMTP relay setup on your server, this won't send the email properly with that config.

Try removing the server from the config and trying again.

stephenjamieson commented 9 years ago

I do have a smarthost relay. Specifying no server didn't change anything.

bstascavage commented 9 years ago

Go to here: 'http:///library/section' and put your results here.

stephenjamieson commented 9 years ago

Unfortunately I'm getting a 401 Unauthorized. Maybe this has to do with Plex Home features?

When I go to https://plex.tv/library/sections, I only see

<MediaContainer size="0" identifier="com.plexapp.plugins.library" title1="Plex Library"></MediaContainer>
bstascavage commented 9 years ago

Plex Home? And yes, it sounds like you cannot access your own server.

I updated the code with some debug messages. Run this again with the -v flag and post your log here.

stephenjamieson commented 9 years ago

FYI I "left" plex home and it worked. Plex home is a new feature for plex pass users, you can have multiple accounts internally.

bstascavage commented 9 years ago

I will close this and open a ticket for Plex Home support. Thanks for brining attention to this!