diff options
Diffstat (limited to 'AirPlayService.py')
| -rw-r--r-- | AirPlayService.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/AirPlayService.py b/AirPlayService.py index 3c9557c..5b4e58c 100644 --- a/AirPlayService.py +++ b/AirPlayService.py | |||
| @@ -106,7 +106,7 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): | |||
| 106 | d, p = self.service.get_scrub() | 106 | d, p = self.service.get_scrub() |
| 107 | content = "duration: " + str(float(d)) | 107 | content = "duration: " + str(float(d)) |
| 108 | content += "\nposition: " + str(float(p)) | 108 | content += "\nposition: " + str(float(p)) |
| 109 | answer = self.create_request(200, content) | 109 | answer = self.create_request(200, "", content) |
| 110 | elif request.type == 'POST': | 110 | elif request.type == 'POST': |
| 111 | self.service.set_scrub(float(request.params['position'])) | 111 | self.service.set_scrub(float(request.params['position'])) |
| 112 | answer = self.create_request() | 112 | answer = self.create_request() |
| @@ -131,7 +131,7 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): | |||
| 131 | datestr = today.strftime("%a, %d %b %Y %H:%M:%S") | 131 | datestr = today.strftime("%a, %d %b %Y %H:%M:%S") |
| 132 | return datestr+" GMT" | 132 | return datestr+" GMT" |
| 133 | 133 | ||
| 134 | def create_request(self, status = 200, body = ""): | 134 | def create_request(self, status = 200, header = "", body = ""): |
| 135 | clength = len(bytes(body)) | 135 | clength = len(bytes(body)) |
| 136 | if (status == 200): | 136 | if (status == 200): |
| 137 | answer = "HTTP/1.1 200 OK" | 137 | answer = "HTTP/1.1 200 OK" |
| @@ -143,6 +143,8 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): | |||
| 143 | answer += "\nConnection: Upgrade" | 143 | answer += "\nConnection: Upgrade" |
| 144 | answer += "\nDate: " + self.getDateTime() | 144 | answer += "\nDate: " + self.getDateTime() |
| 145 | answer += "\nContent-Length: " + str(clength) | 145 | answer += "\nContent-Length: " + str(clength) |
| 146 | if (header != ""): | ||
| 147 | answer += "\n" + header | ||
| 146 | answer +="\n\n" | 148 | answer +="\n\n" |
| 147 | answer += body | 149 | answer += body |
| 148 | return answer | 150 | return answer |
