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 mmslist Component Class 19 """ 20 21 22 __maintainer__ = 'Benjamin Kampmann <benjamin@fluendo.com>' 23 24 from elisa.base_components.media_provider import MediaProvider 25 from elisa.core.media_uri import MediaUri 26 from elisa.core import common 27 28 from elisa.extern.translation import gettexter, N_ 29 T_ = gettexter('elisa-base') 30 31 from elisa.core.bus import bus_message 32 33 from twisted.internet import defer, threads 34 35 _IBN = 'mms://a150.l2584248272.c25842.g.lm.akamaistream.net/D/150/25842/v0001/reflector:48272' 3638 """ 39 This media provider simply ships a list of mms-channels 40 """ 41 42 default_config = {'streams' : [_IBN,], 43 _IBN: {'label': 'ibn'} 44 } 4512347 uri = "mmslist:///" 48 action_type = bus_message.MediaLocation.ActionType.LOCATION_ADDED 49 msg = bus_message.InternetLocation(action_type, 50 T_(N_("MMS channels")), 51 'mms', 52 uri, 53 media_types=['video',]) 54 common.application.bus.send_message(msg) 55 self._init_streams()5658 self._streams = {} 59 for stream_uri in self.config.get('streams',[]): 60 uri = MediaUri(stream_uri) 61 stream_opts = self.config.get(str(uri), {'label': uri.label}) 62 label = stream_opts['label'] 63 self._streams[label] = uri64 67 7072 if self._blocking_is_directory(uri): 73 return {'file_type' : 'directory', 74 'mime_type' : 'mime_type'} 75 76 return {'file_type' : 'video', 'mime_type' : 'mms'}77 85 90 9193 d = threads.deferToThread(self._blocking_has_children_with_types, 94 uri, media_types) 95 return d9698 if self._blocking_is_directory(uri): 99 if 'video' in media_types: 100 return True 101 return False102104 105 if self._blocking_is_directory(uri): 106 for key in self._streams.keys(): 107 chi_uri = MediaUri(self._streams[key]) 108 chi_uri.label = key 109 chi_uri.scheme = 'mmslist' 110 dict = {'file_type' : 'video', 111 'mime_type' : 'mms'} 112 list_of_children.append( (chi_uri, dict) ) 113 return list_of_children114 118
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:10 2008 | http://epydoc.sourceforge.net |