Package flumotion :: Package component :: Package consumers :: Package shout2 :: Module wizard_gtk
[hide private]

Source Code for Module flumotion.component.consumers.shout2.wizard_gtk

  1  # -*- Mode: Python -*- 
  2  # vi:si:et:sw=4:sts=4:ts=4 
  3   
  4  # Flumotion - a streaming media server 
  5  # Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L. 
  6  # Copyright (C) 2010,2011 Flumotion Services, S.A. 
  7  # All rights reserved. 
  8  # 
  9  # This file may be distributed and/or modified under the terms of 
 10  # the GNU Lesser General Public License version 2.1 as published by 
 11  # the Free Software Foundation. 
 12  # This file is distributed without any warranty; without even the implied 
 13  # warranty of merchantability or fitness for a particular purpose. 
 14  # See "LICENSE.LGPL" in the source distribution for more information. 
 15  # 
 16  # Headers in this file shall remain intact. 
 17   
 18  import gettext 
 19  import os 
 20  from zope.interface import implements 
 21   
 22  from flumotion.admin.assistant.interfaces import IConsumerPlugin 
 23  from flumotion.admin.assistant.models import Consumer 
 24  from flumotion.admin.gtk.basesteps import ConsumerStep 
 25   
 26  __version__ = "$Rev$" 
 27  _ = gettext.gettext 
 28   
 29   
30 -class Shout2Consumer(Consumer):
31 componentType = 'shout2-consumer' 32 prefix = 'shout2' 33
34 - def __init__(self):
35 super(Shout2Consumer, self).__init__() 36 self.properties.ip = '127.0.0.1' 37 self.properties.mount_point = '/' 38 self.properties.description = '' 39 self.properties.short_name = '' 40 self.properties.url = 'http://localhost/' 41 self.properties.password = ''
42 43
44 -class Shout2Step(ConsumerStep):
45 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 46 'wizard.glade') 47
48 - def __init__(self, wizard):
49 self.model = Shout2Consumer() 50 ConsumerStep.__init__(self, wizard)
51 52 # ConsumerStep 53
54 - def getConsumerModel(self):
55 return self.model
56 57 # WizardStep 58
59 - def setup(self):
60 self.ip.data_type = str 61 self.port.data_type = int 62 self.mount_point.data_type = str 63 self.password.data_type = str 64 self.short_name.data_type = str 65 self.description.data_type = str 66 self.url.data_type = str 67 68 self.add_proxy(self.model.properties, 69 ['ip', 70 'port', 71 'mount_point', 72 'short_name', 73 'password', 74 'description', 75 'url'])
76
77 - def workerChanged(self, worker):
78 self.model.worker = worker 79 self.wizard.checkElements(worker, 'shout2send')
80 81
82 -class Shout2BothStep(Shout2Step):
83 name = 'Icecast streamer (audio & video)' 84 title = _('Icecast Streamer (Audio and Video)') 85 sidebarName = _('Icecast audio/video') 86 docSection = 'help-configuration-assistant-icecast-streaming-both' 87 docAnchor = '' 88 docVersion = 'local' 89 90 # ConsumerStep 91
92 - def getConsumerType(self):
93 return 'audio-video'
94 95
96 -class Shout2AudioStep(Shout2Step):
97 name = 'Icecast streamer (audio only)' 98 title = _('Icecast Streamer (Audio Only)') 99 sidebarName = _('Icecast Audio') 100 docSection = 'help-configuration-assistant-icecast-streaming-audio-only' 101 docAnchor = '' 102 docVersion = 'local' 103 104 # ConsumerStep 105
106 - def getConsumerType(self):
107 return 'audio'
108 109
110 -class Shout2VideoStep(Shout2Step):
111 name = 'Icecast streamer (video only)' 112 title = _('Icecast Streamer (Video Only)') 113 sidebarName = _('Icecast Video') 114 docSection = 'help-configuration-assistant-icecast-streaming-video-only' 115 docAnchor = '' 116 docVersion = 'local' 117 118 # ConsumerStep 119
120 - def getConsumerType(self):
121 return 'video'
122 123
124 -class Shout2ConsumerWizardPlugin(object):
125 implements(IConsumerPlugin) 126
127 - def __init__(self, wizard):
128 self.wizard = wizard
129
130 - def getConsumptionStep(self, type):
131 if type == 'video': 132 return Shout2VideoStep(self.wizard) 133 elif type == 'audio': 134 return Shout2AudioStep(self.wizard) 135 elif type == 'audio-video': 136 return Shout2BothStep(self.wizard)
137