Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 # Elisa - Home multimedia server 3 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 4 # All rights reserved. 5 # 6 # This file is available under one of two license agreements. 7 # 8 # This file is licensed under the GPL version 3. 9 # See "LICENSE.GPL" in the root of this distribution including a special 10 # exception to use Elisa with Fluendo's plugins. 11 # 12 # The GPL part of Elisa is also available under a commercial licensing 13 # agreement from Fluendo. 14 # See "LICENSE.Elisa" in the root directory of this distribution package 15 # for details on that license. 16 17 """ 18 UPnP MediaRenderer 19 """ 20 21 __maintainer__ = "Philippe Normand <philippe@fluendo.com>" 22 23 from elisa.base_components import service_provider 24 from elisa.core import common, component 25 from elisa.core.bus.bus_message import PlayerModel, ComponentsLoaded, \ 26 PBReferenceable, CoherencePlugin 27 from elisa.core import player, media_uri 28 29 from twisted.spread import pb 3032 """ 33 DOCME 34 """ 35126 127 128 """ 129 remote_play_uri = play_uri_once 130 remote_toggle_play_pause = toggle_play_pause 131 remote_seek_forward = seek_forward 132 remote_seek_backward = seek_backward 133 remote_increment_playback_speed = increment_playback_speed 134 remote_decrement_playback_speed = decrement_playback_speed 135 remote_next = next 136 remote_get_current_item = get_current_item 137 remote_get_status_informations = get_status_informations 138 """ 13937 self._player_model = None 38 common.application.bus.register(self._bus_message_received, 39 PlayerModel, ComponentsLoaded)4042 if isinstance(msg, PlayerModel): 43 self._player_model = msg.player_model 44 else: 45 # register myself to the PB service 46 msg = PBReferenceable('get_player', self) 47 common.application.bus.send_message(msg) 48 49 args = {}#'host':'internal'} 50 msg = CoherencePlugin('ElisaPlayer', args) 51 common.application.bus.send_message(msg)52 5355 if not self._player_model: 56 return 57 if uri: 58 uri = media_uri.MediaUri(uri) 59 self.debug("Playing %r", uri) 60 self._player_model.uri = uri 61 else: 62 self.warning("Not usable URI: %r", uri)6365 state = 'STOPPED' 66 if self._player_model and self._player_model.state: 67 state = str(self._player_model.state) 68 69 return state7072 volume = 0 73 if self._player_model: 74 volume = self._player_model.volume 75 volume = (volume * 100) / 10. 76 return int(volume)77 7880 if self._player_model: 81 if int(volume) in range(101): 82 volume = int(volume) 83 self.info("Setting volume to %s" % volume) 84 volume = (volume * 10) / 100. 85 if volume < 0.: 86 volume = 0. 87 elif volume > 10.: 88 volume = 10. 89 self._player_model.volume = volume9092 position, duration = 0, 0 93 if self._player_model: 94 position = self._player_model.position 95 duration = self._player_model.duration 96 return (position, duration)97 103 107 111 116 121
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:10 2008 | http://epydoc.sourceforge.net |