Page 2 of 2

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 8:55 pm
by ckeyes888
Here's one I tried:

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

import simplejson
import urllib2

DTVIP = "192.168.1.28"
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 = parsed_simplejson['major']
   indigo.variable.updateValue(564695813, majorCh)
except:
   indigo.variable.updateValue(564695813, " ")


The return is always blank, or whatever I may type into the "except".
callsign and a few others will work but not major.

What's odd is that they all log just fine using your original script.

Thanks,

Carl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 9:30 pm
by DaveL17
Hi Carl - try wrapping it in a string method:

Code: Select all
majorCh = str(parsed_simplejson['major'])

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 10:41 pm
by ckeyes888
Nailed it, works great.

Thanks again!

Carl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Tue Dec 23, 2014 3:44 am
by DaveL17
ckeyes888 wrote:
Nailed it, works great.

Thanks again!

Carl

Good deal. Glad it worked.

Enjoy!
Dave