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