-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathIFTTTactions.php
More file actions
39 lines (29 loc) · 825 Bytes
/
IFTTTactions.php
File metadata and controls
39 lines (29 loc) · 825 Bytes
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
39
<?php
/*
endpoint for actions (IFTTT or others...)
call:
http://www.mydomain.com/path/to/action.php?IP=somedyndns:port&action=autoPlay
*/
require($_SERVER['DOCUMENT_ROOT']."/path/to/phpKodi-api.php");
$IP = 'defaultIP'; //if you got several kodi...
if(isset($_GET['IP'])) $IP = $_GET['IP'];
if(isset($_GET['action']))
{
$action = $_GET['action'];
$_Kodi = new Kodi($IP);
if (isset($_Kodi->error)) die($_Kodi->error);
call_user_func($action); //use same name in url and your function
}
//actions:
function autoPlay()
{
global $_Kodi;
$_Kodi->clearPlayList();
$pl = 'special://profile/playlists/mymusic.xsp';
$_Kodi->loadPlaylist($pl);
$_Kodi->play();
$_Kodi->setVolume(45);
$_Kodi->setShuffle(true);
$_Kodi->setRepeat('all');
}
?>