Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parseResponse(self, response):
- oPchStatus = PchStatus()
- try:
- Debug(response)
- try:
- oXml = ElementTree.fromstring(response)
- except:
- #If oXml fails do this
- Debug("doing except")
- response = '<?xml version="1.0" encoding="Latin-1" ?>' + response
- oXml = ElementTree.XML(response)
- Debug(response)
- Debug("This should equal theDavidBox = " + oXml.tag)
- if oXml.tag == "theDavidBox": # theDavidBox should be the root
- This will show in the logs as
- 2013-02-20 11:20:20,644 INFO Pchtrakt START version = "0.4.23"
- 2013-02-20 11:20:20,904 INFO <theDavidBox><request><arg0>get_current_vod_info</arg0><module>playback</module></request><response><currentStatus>play</currentStatus><currentTime>873</currentTime><downloadSpeed>0</downloadSpeed><fullPath>/opt/sybhttpd/localhost.drives/HARD_DISK/Storage/NAS/Videos/Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</fullPath><lastPacketTime>0</lastPacketTime><mediatype>OTHERS</mediatype><seekEnable>true</seekEnable><title>Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</title><totalTime>6100</totalTime></response><returnValue>0</returnValue></theDavidBox>
- 2013-02-20 11:20:20,943 INFO doing except
- 2013-02-20 11:20:20,985 INFO <?xml version="1.0" encoding="Latin-1" ?><theDavidBox><request><arg0>get_current_vod_info</arg0><module>playback</module></request><response><currentStatus>play</currentStatus><currentTime>873</currentTime><downloadSpeed>0</downloadSpeed><fullPath>/opt/sybhttpd/localhost.drives/HARD_DISK/Storage/NAS/Videos/Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</fullPath><lastPacketTime>0</lastPacketTime><mediatype>OTHERS</mediatype><seekEnable>true</seekEnable><title>Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</title><totalTime>6100</totalTime></response><returnValue>0</returnValue></theDavidBox>
- 2013-02-20 11:20:20,987 INFO This should equal theDavidBox = theDavidBox
- 2013-02-20 11:20:21,034 INFO /opt/sybhttpd/localhost.drives/HARD_DISK/Storage/NAS/Videos/Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi
- 2013-02-20 11:20:21,044 INFO File: Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi
- 2013-02-20 11:20:21,094 INFO Trying search 1: http://www.imdbapi.com/?t=Le+Fabuleux+Destin+d%27Amelie+Poulain&y=2001
- 2013-02-20 11:20:22,073 INFO Trying search 2: http://www.deanclatworthy.com/imdb/?q=Le+Fabuleux+Destin+d%27Amelie+Poulain&year=2001
- 2013-02-20 11:20:22,989 INFO Trying search 3: http://www.google.com/search?q=www.imdb.com:site+Le+Fabuleux+Destin+d%27Amelie+Poulain&num=1&start=0
- 2013-02-20 11:20:23,421 INFO Search address = http://www.google.com/search?q=www.imdb.com:site+Le+Fabuleux+Destin+d%27Amelie+Poulain&num=1&start=0 ID = tt0211915
- 2013-02-20 11:20:23,425 INFO Movie : Le Fabuleux Destin d'Amelie Poulain - Year : 2001 - 15% - IMDB: tt0211915
- 2013-02-20 11:20:23,591 INFO trakt json url: /movie/watching/def6943c09e19dccb4df715bd4c9c6c74bc3b6d7
- 2013-02-20 11:20:23,593 INFO json: {"username": "USERNAME", "media_center_version": 0, "plugin_version": 0, "title": "Le Fabuleux Destin d'Amelie Poulain", "imdb_id": "tt0211915", "year": "2001", "duration": "6100", "progress": "15", "media_center_date": "10/01/2012", "password": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "media_center": "popcorn hour"}
- 2013-02-20 11:20:23,829 INFO {u'status': u'success', u'movie': {u'year': u'2001', u'tmdb_id': u'194', u'imdb_id': u'tt0211915', u'title': u'Am\xe9lie'}, u'twitter': False, u'tumblr': False, u'facebook': False, u'message': u'watching Am\xe9lie (2001)'}
- 2013-02-20 11:20:23,832 INFO Video playing: success - watching Amélie (2001)
- So that side of this work, if i use
- def parseResponse(self, response):
- oPchStatus = PchStatus()
- try:
- Debug(response)
- oXml = ElementTree.fromstring(response)
- Debug(response)
- Debug("This should equal theDavidBox = " + oXml.tag)
- if oXml.tag == "theDavidBox": # theDavidBox should be the root
- It does not work and i get this in the logs
- 2013-02-20 12:01:25,943 INFO Pchtrakt START version = "0.4.23"
- 2013-02-20 12:01:26,137 INFO <theDavidBox><request><arg0>get_current_vod_info</arg0><module>playback</module></request><response><currentStatus>play</currentStatus><currentTime>89</currentTime><downloadSpeed>0</downloadSpeed><fullPath>/opt/sybhttpd/localhost.drives/HARD_DISK/Storage/NAS/Videos/Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</fullPath><lastPacketTime>0</lastPacketTime><mediatype>OTHERS</mediatype><seekEnable>true</seekEnable><title>Le.Fabuleux.Destin.d'Amélie.Poulain.(2001).avi</title><totalTime>6100</totalTime></response><returnValue>0</returnValue></theDavidBox>
- 2013-02-20 12:01:26,173 INFO doing except
- 2013-02-20 12:01:27,724 INFO PCH status = unknown
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement