diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-11-14 22:31:31 +0100 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-11-14 22:31:31 +0100 |
| commit | 103f4bf674f20b4431233ac066089e6de16ea480 (patch) | |
| tree | e8670c1cae05ae97d0a83f823a3cda024b0665a8 /lib/python/Plugins/SystemPlugins | |
| parent | 06aa9b9569bdaf23d2d73f75dd7658d7721f4574 (diff) | |
| download | enigma2-103f4bf674f20b4431233ac066089e6de16ea480.tar.gz enigma2-103f4bf674f20b4431233ac066089e6de16ea480.zip | |
callbacks that are added upon hotplug events can be added to a hotplugNotifier list now. use this to speed up Audio CD recognition in MediaPlayer
Diffstat (limited to 'lib/python/Plugins/SystemPlugins')
| -rw-r--r-- | lib/python/Plugins/SystemPlugins/Hotplug/plugin.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py index 469b1dd0..97ddf4a1 100644 --- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py @@ -8,6 +8,8 @@ DEVICEDB = \ "/devices/pci0000:00/0000:00:14.2/usb1/1-1/1-1:1.0/host0/target1:0:0/0:0:0:0": "SD Slot" } +hotplugNotifier = [ ] + class Hotplug(Protocol): def getUserfriendlyDeviceName(self, phys): return DEVICEDB.get(phys, "USB Storage") @@ -48,6 +50,12 @@ class Hotplug(Protocol): harddiskmanager.addHotplugPartition(dev, self.getUserfriendlyDeviceName(physdevpath)) elif media_state == '0': harddiskmanager.removeHotplugPartition(dev) + + for callback in hotplugNotifier: + try: + callback(dev, media_state) + except AttributeError: + hotplugNotifier.remove(callback) def autostart(reason, **kwargs): if reason == 0: |
