def set_played(self): rating_key = self.get_rating_key() if rating_key is None: log.error("No 'ratingKey' could be found in XML from URL '%s'" % (self.parent.path.geturl())) return False url = urlparse.urljoin(self.parent.server_url, '/:/scrobble') data = { "key": rating_key, "identifier": "com.plexapp.plugins.library" } self.played = safe_urlopen(url, data) return self.played
def update_position(self, ms): """ Sets the state of the media as "playing" with a progress of ``ms`` milliseconds. """ rating_key = self.get_rating_key() if rating_key is None: log.error("No 'ratingKey' could be found in XML from URL '%s'" % (self.parent.path.geturl())) return False url = urlparse.urljoin(self.parent.server_url, '/:/progress') data = { "key": rating_key, "time": int(ms), "identifier": "com.plexapp.plugins.library", "state": "playing" } return safe_urlopen(url, data)