Page 1 of 1

[ANSWERED] DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 3:11 pm
by ckeyes888
This script had been working fine til I had to swap out my DirecTV box.

Code: Select all
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-

import simplejson
import urllib2

DTVIP = "192.168.1.53"
url = "http://%s:8080/tv/getTuned?" % DTVIP
f = urllib2.urlopen(url)
simplejson_string = f.read()
f.close()
parsed_simplejson = simplejson.loads(simplejson_string)

try:
   programTitle = parsed_simplejson['title']
   indigo.variable.updateValue(1708209973, programTitle)
except:
   indigo.variable.updateValue(1708209973, " ")
try:
   majorCh = str(parsed_simplejson['major'])
   indigo.variable.updateValue(564695813, majorCh)
except:
   indigo.variable.updateValue(564695813, " ")


It's showing this error in the log.

Code: Select all
 Action Group                    DTV State Value Script All
   Script Error                    embedded script: HTTP Error 403: Forbidden.
   Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 9, at top level
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default
HTTPError: HTTP Error 403: Forbidden.


All the other commands using the plugin are working fine.

Any help greatly appreciated.

Thanks,

Carl

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 3:27 pm
by FlyingDiver
Did the IP address of the box change?

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 5:42 pm
by ckeyes888
It did, but I changed it back to the one I had setup in Indigo.
As I mentioned, all the other commands using the plugin work just fine.

Maybe the port changed? Thing is I don't see anywhere in the DTV setup to set a port number.

Thanks,

Carl

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 6:12 pm
by FlyingDiver
I'm confused. You're talking about the DirecTV plugin, but this script is talking to the DTV box directly, not using any plugin.

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 6:19 pm
by ckeyes888
That makes two of us. I believe it was a few years ago that Matt or Jay helped write that bit of code for me.
Hoping they might recall how it worked.

Thanks,

Carl

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 6:23 pm
by FlyingDiver
You said you changed out the receiver? Same or different model? Maybe the "getTuned" command isn't available on the new box.

Open a browser window and try this url: "http:/192.168.1.53:8080/tv/getTuned?" What do you get back?

Re: DirecTV Script Issue

PostPosted: Fri Sep 22, 2017 6:29 pm
by ckeyes888
Doh. Got it working by setting the "current channel" setting to "allow" an external connection.

Carl

Re: DirecTV Script Issue

PostPosted: Sat Sep 23, 2017 7:48 am
by jay (support)
Technically, this thread shouldn't be under this plugin's forum since it's not about the plugin, but since they're related I'll leave it here. I don't recall anything about this script, but I also don't recall much about this plugin. I haven't had DIRECTV in quite a long time so I don't have occasion to deal with it (which is why we open sourced it).

When things break after replacing hardware, it's usually a good idea to look closely at the replacement hardware as the most likely source of the issue.