-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxbmc.py
38 lines (25 loc) · 812 Bytes
/
xbmc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /usr/bin/python
# -*- coding: utf-8 -*-
import requests
import json
import optparse
def main():
p = optparse.OptionParser()
p.add_option('--message', '-m', default="Bonjour")
options, arguments = p.parse_args()
url = "http://miku.larez.fr:8080/jsonrpc"
headers = {'Content-Type': 'application/json'}
xbmc = {
"method": "GUI.ShowNotification",
"params": {'title':'voctroll','message':options.message,'image':'Troll.png'},
"jsonrpc": '2.0',
"id": 0,
}
response = requests.post(
url, data=json.dumps(xbmc), headers=headers, auth=('xbmc','xbmc')).json()
#assert response["result"] == "echome!"
assert response["jsonrpc"] == '2.0'
assert response["id"] == 0
print (response)
if __name__ == "__main__":
main()