2021-07-03, 10:39
I tried two ways, but the log always gives errorcode should be different instead of import requests?
example 1.
example 2.
-----------------
save.txt
smb://192.168.1.10/@.mkv
-----------------
this is always in the error log but it plays the movie anyway
log
I usually invoke the py file via the main menu and button
<end>RunScript("c:\kodi\load.py")</end>
homescreen command
RunScript("c:\kodi\load.py")
Thanks in advance for any help!
example 1.
Code:
import requests
file = open("c:\\kodi\\save.txt")
lines2 = file.readlines()
url = lines2[0].split('\n')[0]
headers = {
'Content-Type': 'application/json',
}
data = {"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file": url}}}
requests.post('http://kodi:[email protected]:8080/jsonrpc?Base', headers = headers, json = data)
example 2.
Code:
import requests
file = open("c:\\kodi\\save.txt")
lines = file.readlines()
link = lines[0].split('\n')[0]
url = "http://kodi:[email protected]:8080/jsonrpc?Base"
data = {"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":link}}}
resp = requests.post(url, json = data)
-----------------
save.txt
smb://192.168.1.10/@.mkv
-----------------
this is always in the error log but it plays the movie anyway
log
I usually invoke the py file via the main menu and button
<end>RunScript("c:\kodi\load.py")</end>
homescreen command
RunScript("c:\kodi\load.py")
Thanks in advance for any help!