Hallo Gurus,
ich versuche über schleifen und variablen ein Musiktitel abzuspielen, sobald ich den größten teil in variablen stelle führt mir das terminal es nicht mehr aus. Aufbau des Scipt:
1 2 3 4 5 6 7 8 | test@Kodi:~/.kodIO$ PLAYER="curl -u $BENUTZER:$PASSWORT -g --data-binary '{\"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \"params\": {\"item\": {\"" test@Kodi:~/.kodIO$ #definiere Url test@Kodi:~/.kodIO$ URL="} }, \"id\": \"1\"}' --header 'content-type: application/json;' $IP:$PORT/jsonrpc" test@Kodi:~/.kodIO$ test@Kodi:~/.kodIO$ test@Kodi:~/.kodIO$ $PLAYER songid":8 $URL > > |
Einzel abfrage und dann Händig zusammen gesetzt:
1 2 3 4 5 6 7 8 9 | test@Kodi:~/.kodIO$ echo $PLAYER curl -u test:Passwort -g --data-binary '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {" test@Kodi:~/.kodIO$ songid":8 > ^C test@Kodi:~/.kodIO$ echo $URL } }, "id": "1"}' --header 'content-type: application/json;' http://192.168.178.31:8080/jsonrpc test@Kodi:~/.kodIO$ test@Kodi:~/.kodIO$ curl -u test:Passwort -g --data-binary '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"songid":8} }, "id": "1"}' --header 'content-type: application/json;' http://192.168.178.31:8080/jsonrpc {"id":"1","jsonrpc":"2.0","result":"OK"}test@Kodi:~/.kodIO$ |
Ich vermute das irgend ein Hochkomma als reguläre Ausdruck genommen werden muss. versuch es songid\":8 so oder so 'songid":8' auszuführen kommt dann eine Fehlermeldung.
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 | test@Kodi:~/.kodIO$ $PLAYER songid\":8 $URL curl: (6) Could not resolve host: "2.0", curl: (6) Could not resolve host: "method" curl: (6) Could not resolve host: "Player.Open", curl: (6) Could not resolve host: "params" curl: (6) Could not resolve host: {"item" curl: (6) Could not resolve host: {" curl: (6) Could not resolve host: songid" curl: (6) Could not resolve host: } curl: (6) Could not resolve host: }, curl: (6) Could not resolve host: "id" curl: (6) Could not resolve host: "1"}' curl: (6) Could not resolve host: application test@Kodi:~/.kodIO$ $PLAYER 'songid":8’ $URL > > ^C test@Kodi:~/.kodIO$ $PLAYER 'songid\":8’ $URL > ^C test@Kodi:~/.kodIO$ $PLAYER "songid\":8" $URL curl: (6) Could not resolve host: "2.0", curl: (6) Could not resolve host: "method" curl: (6) Could not resolve host: "Player.Open", curl: (6) Could not resolve host: "params" curl: (6) Could not resolve host: {"item" curl: (6) Could not resolve host: {" curl: (6) Could not resolve host: songid" curl: (6) Could not resolve host: } curl: (6) Could not resolve host: }, curl: (6) Could not resolve host: "id" curl: (6) Could not resolve host: "1"}' curl: (6) Could not resolve host: application test@Kodi:~/.kodIO$ |
vielleicht könnt ihr mir helfen oder es reicht schon wenn die $PLAYER verkürzt wird und dafür an den songid":8 vorne anhänge.
Gruß Phanom