Permalink
Browse files

xmbc plugin

  • Loading branch information...
1 parent 0701d23 commit 5501cbb6d1d36f33af39dc62c9a2cd93fc1729d2 @awentz awentz committed Apr 8, 2013
Showing with 3,839 additions and 0 deletions.
  1. +201 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Channel.py
  2. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Channel.pyc
  3. +151 −0 src/xmbc/plugin.video.interactivelighting/Lumos/ControllerUnit.py
  4. BIN src/xmbc/plugin.video.interactivelighting/Lumos/ControllerUnit.pyc
  5. +63 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/Controllers.py
  6. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/Controllers.pyc
  7. +151 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/FireGodControllerUnit.py
  8. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/FireGodControllerUnit.pyc
  9. +225 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/FirecrackerX10ControllerUnit.py
  10. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/FirecrackerX10ControllerUnit.pyc
  11. +146 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/LumosControllerUnit.py
  12. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/LumosControllerUnit.pyc
  13. +308 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/LynX10ControllerUnit.py
  14. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/LynX10ControllerUnit.pyc
  15. +143 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/Olsen595ControllerUnit.py
  16. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/Olsen595ControllerUnit.pyc
  17. +177 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/RenardControllerUnit.py
  18. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/RenardControllerUnit.pyc
  19. +60 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/X10ControllerUnit.py
  20. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/X10ControllerUnit.pyc
  21. 0 src/xmbc/plugin.video.interactivelighting/Lumos/Device/__init__.py
  22. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Device/__init__.pyc
  23. +63 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Event.py
  24. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Event.pyc
  25. +171 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Extras/VixenSequence.py
  26. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Extras/VixenSequence.pyc
  27. 0 src/xmbc/plugin.video.interactivelighting/Lumos/Extras/__init__.py
  28. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Extras/__init__.pyc
  29. +82 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/Network.py
  30. +62 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/Networks.py
  31. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Network/Networks.pyc
  32. +105 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/ParallelBitNetwork.py
  33. +98 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/ParallelNetwork.py
  34. +94 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/SerialBitNetwork.py
  35. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Network/SerialBitNetwork.pyc
  36. +140 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/SerialNetwork.py
  37. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Network/SerialNetwork.pyc
  38. +68 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Network/__init__.py
  39. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Network/__init__.pyc
  40. +86 −0 src/xmbc/plugin.video.interactivelighting/Lumos/PowerSource.py
  41. BIN src/xmbc/plugin.video.interactivelighting/Lumos/PowerSource.pyc
  42. +368 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Sequence.py
  43. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Sequence.pyc
  44. +587 −0 src/xmbc/plugin.video.interactivelighting/Lumos/Show.py
  45. BIN src/xmbc/plugin.video.interactivelighting/Lumos/Show.pyc
  46. +69 −0 src/xmbc/plugin.video.interactivelighting/Lumos/TimeRange.py
  47. BIN src/xmbc/plugin.video.interactivelighting/Lumos/TimeRange.pyc
  48. 0 src/xmbc/plugin.video.interactivelighting/Lumos/__init__.py
  49. BIN src/xmbc/plugin.video.interactivelighting/Lumos/__init__.pyc
  50. +109 −0 src/xmbc/plugin.video.interactivelighting/addon.py
  51. +18 −0 src/xmbc/plugin.video.interactivelighting/addon.xml
  52. 0 src/xmbc/plugin.video.interactivelighting/resources/__init__.py
  53. +5 −0 src/xmbc/plugin.video.interactivelighting/resources/language/English/strings.xml
  54. 0 src/xmbc/plugin.video.interactivelighting/resources/lib/__init__.py
  55. +75 −0 src/xmbc/plugin.video.interactivelighting/resources/lib/utils.py
  56. +14 −0 src/xmbc/plugin.video.interactivelighting/resources/settings.xml
@@ -0,0 +1,201 @@
+# vi:set ai sm nu ts=4 sw=4 expandtab:
+#
+# LUMOS CHANNEL CLASS
+# $Header: /tmp/cvsroot/lumos/lib/Lumos/Channel.py,v 1.4 2008-12-31 00:25:19 steve Exp $
+#
+# Lumos Light Orchestration System
+# Copyright (c) 2005, 2006, 2007, 2008 by Steven L. Willoughby, Aloha,
+# Oregon, USA. All Rights Reserved. Licensed under the Open Software
+# License version 3.0.
+#
+# This product is provided for educational, experimental or personal
+# interest use, in accordance with the terms and conditions of the
+# aforementioned license agreement, ON AN "AS IS" BASIS AND WITHOUT
+# WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
+# THE WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
+# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
+# WORK IS WITH YOU. (See the license agreement for full details,
+# including disclaimer of warranty and limitation of liability.)
+#
+# Under no curcumstances is this product intended to be used where the
+# safety of any person, animal, or property depends upon, or is at
+# risk of any kind from, the correct operation of this software or
+# the hardware devices which it controls.
+#
+# USE THIS PRODUCT AT YOUR OWN RISK.
+#
+
+class DimmerError (Exception):
+ "Exception thrown for improper usage of dimmer settings."
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return str(self.value)
+
+class Channel (object):
+ """
+ Class for power output channels.
+
+ This just describes some behavior and attributes common to all kinds
+ of channels.
+ """
+
+ def __init__(self, id, name=None, load=None, dimmer=True, warm=None, resolution=100, power=None):
+ """
+ Constructor for Channel objects:
+
+ Channel(id, [name], load, [dimmer], [warm], [resolution], power)
+
+ id: unique (within a given controller) ID
+ for this channel.
+ name: descriptive name for channel (optional).
+ load: amperage of load assigned to this channel.
+ dimmer: (bool) is channel capable of dimming?
+ warm: minimum dimmer level to maintain for this
+ channel, as an integer percentage of full
+ brightness. If you set this to None, no
+ minimum is set, and turning the channel off
+ will turn it completely off. Alternatively,
+ if you set it to 0, then turning the channel
+ off will dim it to 0%, which is an important
+ distinction on some devices (e.g., X10).
+ [default=None]
+ resolution: number of discrete dimmer steps supported.
+ [default=100]
+ power: PowerSource object supplying power to this channel
+ """
+
+ if name is None:
+ self.name = 'Channel %s' % id
+ else:
+ self.name = name
+ if load is None:
+ raise ValueError("Channel %s load parameter is required" % id)
+ if power is None:
+ raise ValueError("Channel %s power parameter is required" % id)
+
+
+ self.load = float(load)
+ self.dimmer = bool(dimmer)
+ self.resolution = int(resolution)
+ self.level = None
+ self.power_source = power
+ if warm is not None:
+ self.warm = self.raw_dimmer_value(warm)
+ if not 0 <= self.warm < self.resolution:
+ self.warm = None
+ raise ValueError, "Channel %s warm percentage out of range (%d)" % (id, warm)
+
+ if not self.dimmer:
+ self.warm = None
+ raise DimmerError, "Channel %s specifies warm value but is not dimmable." % id
+ else:
+ self.warm = None
+
+ def raw_dimmer_value(self, n):
+ '''Translate brightness percentage to device-specific "raw"
+ dimmer level value.
+
+ Note that this is for determining *dimmer* values; if you
+ give it a value of None (which normally indicates the "off"
+ state), this function returns 0 (zero).'''
+
+ if n is None: return 0
+ return int(((self.resolution-1)/100.0) * n)
+
+ def pct_dimmer_value(self, n):
+ '''Translate device-specific "raw" dimmer value to percentage.
+
+ The None value (i.e., "off") is returned as 0% as well.'''
+
+ if n is None: return 0
+ return int((100.0/(self.resolution-1)) * n)
+
+ def normalized_value(self, n, override_warm=False):
+ '''Normalize percentage brightness level to percentage
+ which matches dimmer resolution steps. Takes into account
+ the "warm" attribute unless told to override that.
+
+ An input value of None is considered to be a dimmer level
+ of 0 for this function.'''
+
+ n = self.raw_dimmer_value(n)
+ if self.warm is not None and not override_warm and n < self.warm:
+ n = self.warm
+ return self.pct_dimmer_value(n)
+
+ def set_level(self, level, override_warm=False):
+ '''
+ Set channel to a raw (device-specific) dimmer level.
+
+ For convenience, you can set the level to None, which
+ will turn the device off completely. This is different
+ than dimming it to 0%. (More importantly different with
+ some controllers than others.)
+
+ Returns a tuple of raw (device-specific) level values for the
+ channel. The first is the original value before the change,
+ and the second is the new value being set. Either value could
+ be None to indicate a completely "off" condition.
+ '''
+ previous = self.level
+ #
+ # if we are not capable of dimming, we make any level
+ # less than 50% "off" and anything greater "on".
+ #
+ if not self.dimmer:
+ self.level = None if level < self.resolution / 2.0 else self.resolution-1
+ return (previous, self.level)
+ #
+ # otherwise, figure out proper dimmer handling.
+ #
+ if level is None:
+ if override_warm or self.warm is None:
+ self.level = None
+ return (previous, None)
+ else:
+ level = 0
+
+ level = int(level)
+ if not override_warm and self.warm is not None:
+ if level < self.warm:
+ level = self.warm
+ elif level < 0:
+ level = 0
+
+ if level >= self.resolution:
+ level = self.resolution-1
+
+ self.level = level
+ return (previous, self.level)
+
+ def set_on(self):
+ '''Turn channel fully on (full brightness).
+ Returns same values as setLevel()'''
+ return self.set_level(self.resolution-1)
+
+ def set_off(self):
+ 'Turn channel fully off. Returns same values as setLevel()'
+ return self.set_level(self.warm)
+
+ def kill(self):
+ '''Turn channel COMPLETELY off, disregarding "warm" setting.
+ Returns same values as setLevel()'''
+ return self.set_level(None, override_warm=True)
+
+ def current_drain(self):
+ "Report current load in amps based on output level right now -> (amps, PowerSource)"
+ if self.level is None:
+ return (0, self.power_source)
+
+ return ((float(self.level) / (self.resolution-1)) * self.load, self.power_source)
+
+ def current_load(self):
+ "Report the load assigned to this channel as a tuple (amps, PowerSource)"
+ return (self.load, self.power_source)
+#
+# $Log: not supported by cvs2svn $
+# Revision 1.3 2008/12/30 22:58:02 steve
+# General cleanup and updating before 0.3 alpha release.
+#
+#
Binary file not shown.
@@ -0,0 +1,151 @@
+# vi:set ai sm nu ts=4 sw=4 expandtab:
+#
+# LUMOS CONTROLLER UNIT BASE CLASS
+# $Header: /tmp/cvsroot/lumos/lib/Lumos/ControllerUnit.py,v 1.6 2008-12-31 00:25:19 steve Exp $
+#
+# Lumos Light Orchestration System
+# Copyright (c) 2005, 2006, 2007, 2008 by Steven L. Willoughby, Aloha,
+# Oregon, USA. All Rights Reserved. Licensed under the Open Software
+# License version 3.0.
+#
+# This product is provided for educational, experimental or personal
+# interest use, in accordance with the terms and conditions of the
+# aforementioned license agreement, ON AN "AS IS" BASIS AND WITHOUT
+# WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
+# THE WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
+# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
+# WORK IS WITH YOU. (See the license agreement for full details,
+# including disclaimer of warranty and limitation of liability.)
+#
+# Under no curcumstances is this product intended to be used where the
+# safety of any person, animal, or property depends upon, or is at
+# risk of any kind from, the correct operation of this software or
+# the hardware devices which it controls.
+#
+# USE THIS PRODUCT AT YOUR OWN RISK.
+#
+from Lumos.Channel import Channel
+
+class ControllerUnit (object):
+ """
+ Generic controller unit virtual class. Don't create these directly;
+ derive a subclass describing some real type of hardware device.
+ This class describes attributes and behaviors common to all controller
+ unit types.
+ """
+ def __init__(self, id, power, network, resolution=100):
+ """
+ Constructor for basic controller units.
+ id: the ID tag this unit instance is known by.
+ power: a PowerSource instance describing the power
+ feed for this unit This will be the default
+ source for all channels unless a channel
+ explicitly overrides this.
+ network: a Network instance describing the communications
+ network and protocol connected to this unit.
+ resolution: default dimmer resolution for channels of this
+ device. [def=100]
+ """
+ self.id = id
+ self.power_source = power
+ self.channels = {}
+ self.resolution = resolution
+ self.network = network
+
+ def channel_id_from_string(self, channel):
+ '''Given a string with a channel name, return the proper channel
+ ID this device wants to see. This may be, for example, an
+ integer value instead of a character string with digits in it.'''
+
+ raise NotImplementedError("Subclasses of ControllerUnit must define a channel_id_from_string() method.")
+
+ def add_channel(self, id, name=None, load=None, dimmer=True, warm=None, resolution=None, power=None):
+ """
+ Add an active channel for this controller.
+ add_channel(id, [name], [load], [dimmer], [warm], [resolution], [power])
+
+ This constructs a channel object of the appropriate type and
+ adds it to this controller unit. This may be of the the base
+ Channel class, or it may be something derived from that if the
+ controller has special channel features. The parameters are
+ the same as for the Channel object constructor.
+
+ The resolution parameter will default to the value specified to
+ the ControllerUnit constructor.
+ """
+
+ if resolution is None: resolution = self.resolution
+ if power is None: power = self.power_source
+ self.channels[id] = Channel(id, name, load, dimmer, warm, resolution, power)
+
+ def set_channel(self, id, level, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own set_channel method.")
+
+ def set_channel_on(self, id, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own set_channel_on method.")
+
+ def set_channel_off(self, id, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own set_channel_off method.")
+
+ def kill_channel(self, id, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own kill_channel method.")
+
+ def kill_all_channels(self, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own kill_all_channels method.")
+
+ def all_channels_off(self, force=False):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own all_channels_off method.")
+
+ def initialize_device(self):
+ raise NotImplementedError("Subclasses of ControllerUnit must define their own initialize_device method.")
+
+ def flush(self, force=False):
+ """
+ Flush any pending device changes to the hardware. The default action
+ is to do nothing, which is appropriate for devices which will transmit
+ their commands immediately. Other devices may need to track commands
+ internally and then send a controller-wide all-channel update sequence
+ when flush() is called.
+ """
+ pass
+
+ def iter_channels(self):
+ "Iterate over the list of channel IDs, not necessarily in any order."
+ return iter(self.channels)
+
+ def _iter_non_null_channel_list(self):
+ '''For units where the channel list is a linear list of objects,
+ this method implements an generator function which will return the
+ channel IDs which are actually initialized. So, for example, if
+ a unit had 48 physical channels but only 13 were set up in a show
+ profile, only those 13 would be returned.'''
+
+ for i in range(len(self.channels)):
+ if self.channels[i] is not None:
+ yield i
+
+ def current_drain(self):
+ '''Report on the current load drawn by this controller at this point in
+ time, based on chanel output levels. (This assumes any pending flush
+ has happened and channels are already doing what they were last commanded
+ to do.) The return value is a dictionary mapping channel ID to a tuple
+ of (amps, PowerSource) for each channel in this controller.'''
+ return dict([
+ (k,self.channels[k].current_drain())
+ for k in self.iter_channels()
+ ])
+
+ def current_loads(self):
+ '''Report on the loads assigned to this controller during the show.
+ The return value is a dictionary mapping channel ID to a tuple of
+ (amps, PowerSource) for each channel in this controller.'''
+ return dict([
+ (k,self.channels[k].current_load())
+ for k in self.iter_channels()
+ ])
+#
+# $Log: not supported by cvs2svn $
+# Revision 1.5 2008/12/30 22:58:02 steve
+# General cleanup and updating before 0.3 alpha release.
+#
+#
Oops, something went wrong.

0 comments on commit 5501cbb

Please sign in to comment.