source: trunk/plugins/output.tcl @ 1144

Revision 984, 2.6 KB checked in by james, 3 years ago (diff)

Support onload enable/disable of plugins as per settings file

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1## bMotion plugins loader: output
2#
3# $Id$
4#
5
6###############################################################################
7# This is a bMotion plugin
8# Copyright (C) James Michael Seward 2000-2002
9#
10# This program is covered by the GPL, please refer the to LICENCE file in the
11# distribution; further information can be found in the headers of the scripts
12# in the modules directory.
13###############################################################################
14
15set languages [split $bMotionSettings(languages) ","]
16foreach bMotion_language $languages {
17  bMotion_putloglev 2 * "bMotion: loading output plugins language = $bMotion_language"
18  set files [glob -nocomplain "$bMotionPlugins/$bMotion_language/output_*.tcl"]
19  foreach f $files {
20                set count [llength [array names bMotion_plugins_output]]
21    bMotion_putloglev 1 * "bMotion: loading ($bMotion_language) output plugin file $f"
22                set bMotion_noplugins 0
23    catch {
24      source $f
25    } err
26                set newcount [llength [array names bMotion_plugins_output]]
27                if {($bMotion_testing == 0) && ($newcount == $count) && ($bMotion_noplugins == 0)} {
28                        putlog "bMotion: ALERT! output plugin file $f added no plugins"
29                        putlog "Possible error: $err"
30                }
31  }
32}
33
34# enable or disable plugins as per the settings file
35# setting format:
36# pluginname1:1,pluginname2=#channel,pluginname3:0
37# enables pluginname1 globally, pluginname2 on #channel, and disables pluginname3
38
39set output_preenables [split [bMotion_setting_get "output_preenables"] ","]
40
41foreach output_preenable $output_preenables {
42        if {[string range $output_preenable end-1 end] == ":1"} {
43                set plugin [string range $output_preenable 0 [expr [string last ":1" $output_preenable] - 1]]
44                bMotion_putloglev d * "Globally enabling output plugin $plugin from settings file"
45                bMotion_plugin_set_output $plugin 1
46                continue
47        }
48
49        if {[string range $output_preenable end-1 end] == ":0"} {
50                set plugin [string range $output_preenable 0 [expr [string last ":1" $output_preenable] - 1]]
51                bMotion_putloglev d * "Globally disabling output plugin $plugin from settings file"
52                bMotion_plugin_set_output $plugin 0
53                continue
54        }
55
56        if [string match "*=*" $output_preenable] {
57                set plugin [string range $output_preenable 0 [expr [string last "=" $output_preenable] - 1]]
58                set chan [string range $output_preenable [expr [string last "=" $output_preenable] + 1] end]
59                bMotion_putloglev d * "Enabling output plugin $plugin on channel $chan from settings file"
60                bMotion_plugin_set_output_channel $plugin $chan 1
61                continue
62        }
63
64        putlog "bMotion: ERROR parsing output_preenables: not sure what to do with $output_preenable"
65}
66
Note: See TracBrowser for help on using the repository browser.