home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
WebService and Mobile Access
Popular Plugins
MPExtended
json/getschedules startime and endtime
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="rasmu" data-source="post: 1110187" data-attributes="member: 150544"><p>Hello,</p><p></p><p>I'm making a python script to power on my HTPC from my raspberry in the case there is a recording to start.</p><p></p><p>I succeeded to get back the schedules :</p><p>[code]</p><p>import urllib2, base64, traceback, sys, json</p><p>from wakeonlan import wol</p><p>from datetime import datetime, date, time</p><p></p><p>username = ''</p><p>password = ''</p><p>result = ''</p><p>power = False</p><p></p><p>datenow = datetime.now()</p><p></p><p>try:</p><p> request = urllib2.Request("http://192.168.0.32:4322/MPExtended/TVAccessService/json/GetSchedules")</p><p> base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')</p><p> request.add_header("Authorization", "Basic %s" % base64string)</p><p> result = urllib2.urlopen(request)</p><p> records = json.loads(result.read())</p><p> print records</p><p></p><p> for record in records:</p><p> #/json/GetScheduleById</p><p> print record['Title']</p><p> print record['StartTime']</p><p> print record['EndTime']</p><p></p><p> print "\n"</p><p></p><p> power = False</p><p></p><p> if power == True:</p><p> wol.send_magic_packet('ec.a8.6b.ff.1b.33')</p><p> print 'powerup'</p><p> </p><p>except Exception, e:</p><p> print e</p><p> sys.exit(0)</p><p></p><p></p><p></p><p>raw_input()</p><p></p><p>[/code]</p><p></p><p>Here's the ouput :</p><p></p><p></p><p>I want to use get starttime and endtime fields.</p><p>How can I convert starttime and endtime in python date ?</p><p></p><p>edit : ok, I saw from MediaPortal.bundle that he just strip the string with [6:-7].</p><p></p><p>Thanks in advance.</p></blockquote><p></p>
[QUOTE="rasmu, post: 1110187, member: 150544"] Hello, I'm making a python script to power on my HTPC from my raspberry in the case there is a recording to start. I succeeded to get back the schedules : [code] import urllib2, base64, traceback, sys, json from wakeonlan import wol from datetime import datetime, date, time username = '' password = '' result = '' power = False datenow = datetime.now() try: request = urllib2.Request("http://192.168.0.32:4322/MPExtended/TVAccessService/json/GetSchedules") base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') request.add_header("Authorization", "Basic %s" % base64string) result = urllib2.urlopen(request) records = json.loads(result.read()) print records for record in records: #/json/GetScheduleById print record['Title'] print record['StartTime'] print record['EndTime'] print "\n" power = False if power == True: wol.send_magic_packet('ec.a8.6b.ff.1b.33') print 'powerup' except Exception, e: print e sys.exit(0) raw_input() [/code] Here's the ouput : I want to use get starttime and endtime fields. How can I convert starttime and endtime in python date ? edit : ok, I saw from MediaPortal.bundle that he just strip the string with [6:-7]. Thanks in advance. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
WebService and Mobile Access
Popular Plugins
MPExtended
json/getschedules startime and endtime
Contact us
RSS
Top
Bottom