[ { "id": "6c0230df.62aff8", "type": "tab", "label": "Kodi", "disabled": false, "info": "" }, { "id": "ca0e80d.d92ef8", "type": "ping", "z": "6c0230df.62aff8", "mode": "timed", "name": "Server Pingen", "host": "192.168.123.101", "timer": "5", "inputs": 0, "x": 90, "y": 40, "wires": [ [ "45cd1134.ca532" ] ] }, { "id": "3d9709e.5434cf6", "type": "ui_switch", "z": "6c0230df.62aff8", "name": "Schalter zeigt ob MC an", "label": "Mediencenter läuft", "tooltip": "", "group": "6fc15530.2c7c3c", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "x": 570, "y": 40, "wires": [ [ "8e0fae5e.32cb3" ] ] }, { "id": "45cd1134.ca532", "type": "function", "z": "6c0230df.62aff8", "name": "Ping umwandeln in an/aus", "func": "if(msg.payload==false){\n msg.payload=false;\n}\nelse msg.payload=true;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 300, "y": 40, "wires": [ [ "3d9709e.5434cf6" ] ] }, { "id": "3a5c02bf.4f63ae", "type": "http request", "z": "6c0230df.62aff8", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"season\", \"episode\", \"duration\", \"showtitle\", \"tvshowid\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 1 }, \"id\": \"VideoGetItem\"}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 1470, "y": 320, "wires": [ [ "bcf67c78.2d31e8" ] ] }, { "id": "9acd940e.345f88", "type": "ui_text", "z": "6c0230df.62aff8", "group": "6fc15530.2c7c3c", "order": 3, "width": "8", "height": "4", "name": "Ausgabe", "label": "", "format": "{{msg.payload}}", "layout": "row-center", "x": 620, "y": 780, "wires": [] }, { "id": "bcf67c78.2d31e8", "type": "function", "z": "6c0230df.62aff8", "name": "Video Typ Ermittlung und Laufzeit", "func": "if(msg.payload.result.item.label!=false){\n if(msg.payload.result.item.type==\"channel\"){\n msg.payload=\"
Fernsehen/PVR
Sender: \"+msg.payload.result.item.label+\"
Es läuft: \"+msg.payload.result.item.title+\"
\"; \n }\n else if(msg.payload.result.item.type==\"movie\")\n {\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\n msg.payload=\"Filmtitel: \"+msg.payload.result.item.title+\"
Filmlänge: \"+hour+\":\"+minute+\":\"+second+\"
Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"
Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"
\";\n }\n else if(msg.payload.result.item.type==\"episode\")\n {\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\n msg.payload=\"Serientitel: \"+msg.payload.result.item.showtitle+\"
Episode: \"+msg.payload.result.item.title+\"
Episodenlänge: \"+hour+\":\"+minute+\":\"+second+\"
Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"
Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"
\";\n }\n else if(msg.payload.result.item.type==\"unknown\"){\n hour=Math.floor(msg.payload.result.item.streamdetails.video[0].duration/3600);\n minute=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%3600/60);\n second=Math.floor(msg.payload.result.item.streamdetails.video[0].duration%60);\n if(hour < 10){\n hour = \"0\"+hour;\n }\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n } \n msg.payload=\"Videodatei
\"+msg.payload.result.item.label+\"
Format: \"+msg.payload.result.item.streamdetails.video[0].width+\"x\"+msg.payload.result.item.streamdetails.video[0].height+\"
Codec: \"+msg.payload.result.item.streamdetails.video[0].codec+\"
\";\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 320, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "8179f813.b9e4d8", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei Typ Video", "func": "if (msg.payload==true){\nmsg.payload = '{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"season\", \"episode\", \"duration\", \"showtitle\", \"tvshowid\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 1 }, \"id\": \"VideoGetItem\"}';\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1170, "y": 320, "wires": [ [ "3a5c02bf.4f63ae" ] ] }, { "id": "8e0fae5e.32cb3", "type": "switch", "z": "6c0230df.62aff8", "name": "PC ist an/aus", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 800, "y": 40, "wires": [ [ "41b336ad.aadbb" ], [ "ec2ef628.71b658" ] ], "outputLabels": [ "An", "Aus" ] }, { "id": "f10df51a.0f3388", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei PC aus", "func": "if(msg.payload==false){\nmsg.payload=\"Mediacenter läuft nicht.\";\nreturn msg;\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 640, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "7710b7b6.d715c8", "type": "catch", "z": "6c0230df.62aff8", "name": "Fehler abfangen", "scope": [ "3a5c02bf.4f63ae", "55ed1a78.848a94", "8cc7f348.d7e4a8" ], "uncaught": false, "x": 140, "y": 920, "wires": [ [] ] }, { "id": "dfc43c35.900018", "type": "comment", "z": "6c0230df.62aff8", "name": "Falls PC erreichbar/Kodi aus gibt es dann doch Fehler", "info": "", "x": 260, "y": 860, "wires": [] }, { "id": "ac44ebef.f822c", "type": "function", "z": "6c0230df.62aff8", "name": "Ausgabe bei Bildern", "func": "if(msg.payload==false){\nmsg.payload=\"Es wird ein Bild angezeigt.\";\nreturn msg;\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 1740, "y": 420, "wires": [ [ "3ccceed0.5a744a" ] ] }, { "id": "55ed1a78.848a94", "type": "http request", "z": "6c0230df.62aff8", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://192.168.123.101/jsonrpc?request={\"jsonrpc\": \"2.0\", \"method\": \"Player.GetItem\", \"params\": { \"properties\": [\"title\", \"album\", \"artist\", \"duration\", \"thumbnail\", \"file\", \"fanart\", \"streamdetails\"], \"playerid\": 0 }, \"id\": \"AudioGetItem\"}", "tls": "", "persist": false, "proxy": "", "authType": "basic", "x": 1470, "y": 220, "wires": [ [ "99e31030.44d448" ] ] }, { "id": "99e31030.44d448", "type": "function", "z": "6c0230df.62aff8", "name": "Audio Ausgabe generieren", "func": "if(msg.payload.result.item.label!=false){\n var url=decodeURIComponent(msg.payload.result.item.fanart);\n var newurl=url.replace(\"image://\",\"\");\n var newurl2=newurl.substring(0,newurl.length-1);\n minute=Math.floor(msg.payload.result.item.duration%3600/60);\n second=Math.floor(msg.payload.result.item.duration%60);\n if(minute < 10){\n minute = \"0\"+minute;\n }\n if(second < 10){\n second = \"0\"+second;\n }\nmsg.payload = \"Spielt Musik