yoyostile / Plexpy-Ubersicht-Widget

A simple widget to display current streams from your Plex Server via PlexPy.
13 stars 2 forks source link

Syntax Error #4

Closed DCPDad closed 7 years ago

DCPDad commented 7 years ago

Hello- I am looking forward to trying this out. Thanks for creating it.

I am getting an error: SyntaxError: JSON Parse error: Unexpected identifier "undefined"

Thx! Dan

yoyostile commented 7 years ago

Hey Dan,

I get this error when my PlexPy isn't available for some reason. I should catch this, yep. However: Is PlexPy available? Is your API-Key correct? Is your protocol http or https? Can you access PlexPy through http(s)://YOURHOST/api/v2?apikey=YOUR_API_KEY&cmd=get_activity?

-- Johannes

DCPDad commented 7 years ago

Thanks for getting back to me so quickly!

  1. My PlexPy is up and running
  2. The API-Key is correct
  3. I am using http
  4. I can access ( bunch of text shows up) when I key in: http(s)://xxx.xxx.xxx.xxx:yyyy/api/v2?apikey=xxx&cmd=get_activity
  5. And this is the options section of my index.coffee (the 2 comments in the () are NOT in the actual .coffee file):

options =   widgetEnable: true   avatarEnable: true   apiKey: ‘xxx’ (has real numbers for the xxx)   plexpyHost: 'http://192.xxx.x.xxx:yyyy’  (has real numbers for the x’s & y’s)   protocol: 'http’

-- Dan Pennington site: about.me/danpennington Pennington FamilyOffice Tel: 949.500.0975 Fax: 949.417.1795 Dan@PenningtonFamily.org

On Apr 24, 2017, 12:18 PM -0700, Johannes Heck notifications@github.com, wrote:

Hey Dan, I get this error when my PlexPy isn't available for some reason. I should catch this, yep. However: Is PlexPy available? Is your API-Key correct? Is your protocol http or https? Can you access PlexPy through http(s)://YOURHOST/api/v2?apikey=YOUR_API_KEY&cmd=get_activity?

Johannes — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yoyostile commented 7 years ago

Try this:

options =
  widgetEnable: true
  avatarEnable: true
  apiKey: ‘xxx’
  plexpyHost: '192.xxx.x.xxx:yyyy’
  protocol: 'http’

Just remove the protocol from the plexpyHost attribute. :)

DCPDad commented 7 years ago

Really appreciate your help with this. I know get this in the Debug Console:

/Users/danpennington/Library/Application Support/Übersicht/widgets/Plexpy.widget/index.coffee: Error: Line 34: Unexpected token ILLEGAL while parsing file: /Users/danpennington/Library/Application Support/Übersicht/widgets/Plexpy.widget/index.coffee

-- Dan Pennington site: about.me/danpennington Pennington FamilyOffice Tel: 949.500.0975 Fax: 949.417.1795 Dan@PenningtonFamily.org

On Apr 24, 2017, 12:36 PM -0700, Johannes Heck notifications@github.com, wrote:

Try this:

options = widgetEnable: true avatarEnable: true apiKey: ‘xxx’ plexpyHost: '192.xxx.x.xxx:yyyy’ protocol: 'http’```

Just remove the protocol from the plexpyHost attribute. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yoyostile commented 7 years ago

There must be some kind of syntax error. Could you post your options again? Did you copy & paste them from here? It seems like there are mixed apostrophes and single quotes in the code above. I guess this causes the syntax error you got.

DCPDad commented 7 years ago

Yea, probably something simple:

options =   widgetEnable: true   avatarEnable: true   apiKey: ‘xxx'   plexpyHost: ‘xxx.xxx.xxx.xxx:yyyy'   protocol: ‘http'

The above is a straight paste from the .coffee file. I just replaced the numbers. It does look like some of the apostrophes are mismatched….

If this doesn’t work I might try installing from scratch again….

F

-- Dan Pennington site: about.me/danpennington Pennington FamilyOffice Tel: 949.500.0975 Fax: 949.417.1795 Dan@PenningtonFamily.org

On Apr 24, 2017, 12:52 PM -0700, Johannes Heck notifications@github.com, wrote:

There must be some kind of syntax error. Could you post your options again? Did you copy & paste them from here? It seems like there are mixed apostrophes and single quotes in the code above. I guess this is the syntax error you got here. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yoyostile commented 7 years ago
options =
  widgetEnable: true
  avatarEnable: true
  apiKey: 'xxx'
  plexpyHost: 'xxx.xxx.xxx.xxx:yyyy'
  protocol: 'http'

You must use simple single quotes. :) Also, edit your file with a proper editor like Sublime Text, Atom or the simple OS X TextEdit , in case your editor tries to "fix" these single quotes in something else.

DCPDad commented 7 years ago

Thx - I started from scratch. I had been using Osx TextEditor, but was possibly a bit more careful this time. Seems to be working! Yay!

TYVM :)

-- Dan Pennington site: about.me/danpennington Pennington FamilyOffice Tel: 949.500.0975 Fax: 949.417.1795 Dan@PenningtonFamily.org

On Apr 24, 2017, 1:01 PM -0700, Johannes Heck notifications@github.com, wrote:

options = widgetEnable: true avatarEnable: true apiKey: 'xxx' plexpyHost: 'xxx.xxx.xxx.xxx:yyyy' protocol: 'http'

You must use simple single quotes. :) Also, edit your file with a proper editor like Sublime Text, Atom or the simple OS X TextEdit , in case your editor tries to "fix" these single quotes in something else. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yoyostile commented 7 years ago

Nice :)