summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-03-17 23:33:19 +0100
committerTheTroll <trolldev@gmail.com>2010-03-17 23:33:19 +0100
commit228e192f64c073afe8e3cd1523d0a975dcf26557 (patch)
treef4fd5c9d5372c2783f17a50d37d49bc93e5ff02b /bin
parentd0640763e648d441510afeb5939106eb8d48731c (diff)
downloadistreamdev-228e192f64c073afe8e3cd1523d0a975dcf26557.tar.gz
istreamdev-228e192f64c073afe8e3cd1523d0a975dcf26557.tar.bz2
Added timers edition/deletion
Diffstat (limited to 'bin')
-rwxr-xr-xbin/backend.php6
-rwxr-xr-xbin/jsonapi.php5
-rwxr-xr-xbin/vdr.php41
3 files changed, 40 insertions, 12 deletions
diff --git a/bin/backend.php b/bin/backend.php
index 8619c89..9be4b28 100755
--- a/bin/backend.php
+++ b/bin/backend.php
@@ -96,11 +96,7 @@ switch ($action)
break;
case ("editTimer"):
- $id = $_REQUEST['id'];
- if (id)
- $tree = file_get_contents("textfiles/editTimer.txt");
- else
- $tree = file_get_contents("textfiles/addTimer.txt");
+ $tree = editTimer($_REQUEST['id'], $_REQUEST['name'], $_REQUEST['active'], $_REQUEST['channumber'], $_REQUEST['date'], $_REQUEST['starttime'], $_REQUEST['endtime']);
print $tree;
break;
diff --git a/bin/jsonapi.php b/bin/jsonapi.php
index 8f144d9..d4f96ac 100755
--- a/bin/jsonapi.php
+++ b/bin/jsonapi.php
@@ -142,7 +142,12 @@ function delTimer($id)
return json_encode($ret);
}
+function editTimer($id, $name, $active, $channumber, $date, $starttime, $endtime)
+{
+ $ret = vdrsettimer($id, $channumber, $date, $starttime, $endtime, $name, $active);
+ return json_encode($ret);
+}
function getRunningSessions()
{
diff --git a/bin/vdr.php b/bin/vdr.php
index d0df102..4253856 100755
--- a/bin/vdr.php
+++ b/bin/vdr.php
@@ -371,26 +371,53 @@ function vdrdeltimer($timer)
{
$ret = array();
- $ret['status'] = "ok";
- $ret['message'] = vdrsendcommand("DELT " .$timer);
+ $message = vdrsendcommand("DELT " .$timer);
+
+ if ($message == 'Timer "' .$timer .'" deleted')
+ {
+ $ret['status'] = "Ok";
+ $ret['message'] = "Timer successfully deleted";
+ }
+ else
+ {
+ $ret['status'] = "Error";
+ $ret['message'] = $message;
+ }
return $ret;
}
-function vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active)
+function vdrsettimer($prevtimer, $channum, $date, $stime, $etime, $desc, $active)
{
- $channum = vdrgetchannum($channame);
- if ($active)
+ $ret = array();
+
+ if ($active == 'on')
$type = "1";
else
$type = "0";
- if ($prevtimer == -1)
+ if ($prevtimer == "")
$command = "NEWT " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc;
else
$command = "MODT " .$prevtimer ." " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc;
- return vdrsendcommand($command);
+ $message = vdrsendcommand($command);
+
+ if (is_numeric(substr($message, 0, 1)))
+ {
+ $ret['status'] = "Ok";
+ if ($prevtimer == "")
+ $ret['message'] = "Timer created successfully";
+ else
+ $ret['message'] = "Timer edited successfully";
+ }
+ else
+ {
+ $ret['status'] = "Error";
+ $ret['message'] = $message;
+ }
+
+ return $ret;
}
?>