summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeine_Ahnung <no@mail.com>2013-02-01 16:21:12 +0100
committerKeine_Ahnung <no@mail.com>2013-02-01 16:21:12 +0100
commit7605ff2092460c8c4bfc4cd606bcbd1aeb97b578 (patch)
tree1b98ac6c9425bade98a3f0afc9c9b6a489820302
parentf1472cb713f1f6d0e2200f7840effcf3fef88392 (diff)
downloadvdr-plugin-uactivity-7605ff2092460c8c4bfc4cd606bcbd1aeb97b578.tar.gz
vdr-plugin-uactivity-7605ff2092460c8c4bfc4cd606bcbd1aeb97b578.tar.bz2
addet started orgin
-rw-r--r--run.c1
-rw-r--r--run.h2
-rw-r--r--script/uactivity/activity/-10-syslog_demo9
-rw-r--r--script/uactivity/activity/-20-switch_tv23
-rw-r--r--uactivity.c10
5 files changed, 41 insertions, 4 deletions
diff --git a/run.c b/run.c
index 3a34d31..c8bcead 100644
--- a/run.c
+++ b/run.c
@@ -15,6 +15,7 @@ const char *cRun::OrginToString(eOrgin Orgin)
{
const char *OrginStr = "";
if (Orgin == oStartUp) OrginStr = "startup";
+ else if (Orgin == oStarted) OrginStr = "started";
else if (Orgin == oShutDown) OrginStr = "shutdown";
else if (Orgin == oRunning) OrginStr = "running";
diff --git a/run.h b/run.h
index 410ef6a..ecdd462 100644
--- a/run.h
+++ b/run.h
@@ -3,7 +3,7 @@
#include <vdr/keys.h>
-enum eOrgin {oStartUp, oShutDown, oRunning};
+enum eOrgin {oStartUp, oStarted, oShutDown, oRunning};
class cRun {
private:
diff --git a/script/uactivity/activity/-10-syslog_demo b/script/uactivity/activity/-10-syslog_demo
index 8c16823..c1d98ec 100644
--- a/script/uactivity/activity/-10-syslog_demo
+++ b/script/uactivity/activity/-10-syslog_demo
@@ -10,6 +10,15 @@ case "${1}" in
logger -t "uactivity [activity/$(basename ${0})]" "CacheDirectory: ${4}"
logger -t "uactivity [activity/$(basename ${0})]" "ResourceDirectory: ${5}"
;;
+ started)
+ logger -t "uactivity [activity/$(basename ${0})]" "activity started"
+ [ "${2}" = "true" ] \
+ && logger -t "uactivity [activity/$(basename ${0})]" "status \"user active\"" \
+ || logger -t "uactivity [activity/$(basename ${0})]" "status \"user inactive\""
+ logger -t "uactivity [activity/$(basename ${0})]" "ConfigDirectory: ${3}"
+ logger -t "uactivity [activity/$(basename ${0})]" "CacheDirectory: ${4}"
+ logger -t "uactivity [activity/$(basename ${0})]" "ResourceDirectory: ${5}"
+ ;;
shutdown)
logger -t "uactivity [activity/$(basename ${0})]" "activity shutting down"
[ "${2}" = "true" ] \
diff --git a/script/uactivity/activity/-20-switch_tv b/script/uactivity/activity/-20-switch_tv
index f014e6f..7059e1f 100644
--- a/script/uactivity/activity/-20-switch_tv
+++ b/script/uactivity/activity/-20-switch_tv
@@ -1,7 +1,24 @@
#!/bin/sh
-([ "${2}" = "true" ] && [ "${1}" != "shutdown" ]) \
- && irsend -d /var/run/lirc/ya_usbir SEND_ONCE TP av \
- || irsend -d /var/run/lirc/ya_usbir SEND_ONCE TP off
+switch_tv(){
+ [ "${1}" = "on" ] && irsend -d /var/run/lirc/ya_usbir SEND_ONCE TV_REMOTE on
+ [ "${1}" = "off" ] && irsend -d /var/run/lirc/ya_usbir SEND_ONCE TV_REMOTE off
+}
+
+
+case "${1}" in
+ startup)
+ true
+ ;;
+ started)
+ [ "${2}" = "true" ] && switch_tv on
+ ;;
+ shutdown)
+ switch_tv off
+ ;;
+ running)
+ [ "${2}" = "true" ] && switch_tv on || switch_tv off
+ ;;
+esac
exit 0
diff --git a/uactivity.c b/uactivity.c
index d209d69..d1481b8 100644
--- a/uactivity.c
+++ b/uactivity.c
@@ -23,6 +23,7 @@ static const char *DESCRIPTION = trNOOP("running shellscipts based upton user
class cPluginUactivity : public cPlugin {
private:
// Add any member variables or functions you may need here.
+ bool FirstMainThreadHook;
bool LastActivity;
int WatchdogTimer;
time_t LastTime;
@@ -70,6 +71,7 @@ cPluginUactivity::cPluginUactivity(void)
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
WatchdogTimer = WATCHDOG;
+ FirstMainThreadHook = true;
}
const char *cPluginUactivity::CommandLineHelp(void)
@@ -142,6 +144,14 @@ void cPluginUactivity::MainThreadHook(void)
// Perform actions in the context of the main program thread.
// WARNING: Use with great care - see PLUGINS.html!
bool ActivityStatus = !ShutdownHandler.IsUserInactive();
+
+ if (FirstMainThreadHook) {
+ Run.CallKey(oStarted, k_Setup);
+ Run.CallActivity(oStarted, ActivityStatus);
+ Run.CallWatchdog(oStarted, ActivityStatus);
+ FirstMainThreadHook = false;
+ }
+
if (ActivityStatus != LastActivity) {
LastActivity = ActivityStatus;
Run.CallActivity(oRunning, ActivityStatus);