Beispiel #1
0
    def __init__(self, cover_dir, net_type='lan'):

        self.connected = False
        self.net_type = net_type
        self.proto = MpdProtocol()
        self.proto._event = self.dispatch_event
        self.status = {'state': 'stop'}
        self.playlist = Playlist(self)
        self.waiting = False
        self.calls = []
        self.cover_dir = cover_dir
        self._sources = [
            OrderedDict(
                sorted({
                    'Name': '_'.join((self.name, n)),
                    'Type': n,
                    'Visible': True
                }.items(),
                       key=lambda t: t[0])) for n in self.sources
        ]
        self.sourcexml = dict2xml(
            {'SourceList': [{
                'Source': n
            } for n in self._sources]})
        self.protocolinfo = self.mtlist = 'http-get:*:' + ''\
            .join([':*,http-get:*:'.join(self.mimetypes)]) + ':*'
Beispiel #2
0
 def add_source(self, source):
     self.sources.append(OrderedDict(
         sorted({'Name': self.productroom + source.type + '0',
                 'Type': source.type,
                 'Visible': True}. items(), key=lambda t: t[0])))
     self.oh_product_event('sources', self.sources)
     self.sourcexml = dict2xml(
         {'SourceList': [{'Source': n} for n in self.sources]})
     self.oh_product_event('sourcexml', self.sourcexml)
Beispiel #3
0
    def __init__(self,
                 name,
                 clients,
                 datadir,
                 room,
                 sources=[],
                 active_source=''):
        super(Source, self).__init__(self)
        self.productroom = room
        self.datadir = datadir
        self.client = clients[0]
        self.friendlyName = name
        self.version = (
            1,
            0,
        )
        self.uuid = str(
            uuid.uuid5(uuid.NAMESPACE_DNS,
                       socket.gethostname() + name))
        self.playlist = Playlist(datadir + 'xml/playlist.xml', self)
        self.product = Product(datadir + 'xml/product.xml', 'Salon',
                               [self.playlist], 0, self)
        self.info = Info(datadir + 'xml/info.xml', self.player)
        self.time = Time(datadir + 'xml/time.xml', self)
        self.volume = Volume(datadir + 'xml/volume.xml', self)
        self.services = [
            self.product, self.playlist, self.time, self.info, self.volume
        ]
        for service in self.services:
            service.parent = self
        for source in sources:
            self.sources.append(
                OrderedDict(
                    sorted({
                        'Name': room + source.type + '0',
                        'Type': source.type,
                        'Visible': True
                    }.items(),
                           key=lambda t: t[0])))
#         self.sources = [OrderedDict(
#                         sorted(
#                             {'Name': room + active_source.type + '0',
#                              'Type': active_source.type,
#                              'Visible': True}. items(), key=lambda t: t[0])),
#                         OrderedDict(
#                         sorted(
#                             {'Name': room + self.parent.type + '0',
#                              'Type': self.parent.type,
#                              'Visible': True}. items(), key=lambda t: t[0]))]
        self.sourcexml = dict2xml(
            {'SourceList': [{
                'Source': n
            } for n in self.sources]})
Beispiel #4
0
 def add_source(self, source):
     self.sources.append(
         OrderedDict(
             sorted({
                 'Name': self.productroom + source.type + '0',
                 'Type': source.type,
                 'Visible': True
             }.items(),
                    key=lambda t: t[0])))
     self.oh_product_event('sources', self.sources)
     self.sourcexml = dict2xml(
         {'SourceList': [{
             'Source': n
         } for n in self.sources]})
     self.oh_product_event('sourcexml', self.sourcexml)
Beispiel #5
0
    def __init__(self, cover_dir, net_type='lan'):

        self.connected = False
        self.net_type = net_type
        self.proto = MpdProtocol()
        self.proto._event = self.dispatch_event
        self.status = {'state': 'stop'}
        self.playlist = Playlist(self)
        self.waiting = False
        self.calls = []
        self.cover_dir = cover_dir
        self._sources = [OrderedDict(sorted(
            {'Name': '_'.join((self.name, n)),
             'Type': n,
             'Visible': True}.
            items(), key=lambda t: t[0])) for n in self.sources]
        self.sourcexml = dict2xml(
            {'SourceList': [{'Source': n} for n in self._sources]})
        self.protocolinfo = self.mtlist = 'http-get:*:' + ''\
            .join([':*,http-get:*:'.join(self.mimetypes)]) + ':*'
Beispiel #6
0
    def __init__(
            self, name, clients, datadir, room, sources=[], active_source=''):
        super(Source, self).__init__(self)
        self.productroom = room
        self.datadir = datadir
        self.client = clients[0]
        self.friendlyName = name
        self.version = (1, 0,)
        self.uuid = str(
            uuid.uuid5(uuid.NAMESPACE_DNS, socket.gethostname()+name))
        self.playlist = Playlist(datadir + 'xml/playlist.xml', self)
        self.product = Product(
            datadir + 'xml/product.xml', 'Salon', [self.playlist], 0, self)
        self.info = Info(datadir + 'xml/info.xml', self.player)
        self.time = Time(datadir + 'xml/time.xml', self)
        self.volume = Volume(datadir + 'xml/volume.xml', self)
        self.services = [
            self.product,
            self.playlist,
            self.time,
            self.info,
            self.volume]
        for service in self.services:
            service.parent = self
        for source in sources:
            self.sources.append(OrderedDict(
                sorted({'Name': room + source.type + '0',
                        'Type': source.type,
                        'Visible': True}. items(), key=lambda t: t[0])))
#         self.sources = [OrderedDict(
#                         sorted(
#                             {'Name': room + active_source.type + '0',
#                              'Type': active_source.type,
#                              'Visible': True}. items(), key=lambda t: t[0])),
#                         OrderedDict(
#                         sorted(
#                             {'Name': room + self.parent.type + '0',
#                              'Type': self.parent.type,
#                              'Visible': True}. items(), key=lambda t: t[0]))]
        self.sourcexml = dict2xml(
            {'SourceList': [{'Source': n} for n in self.sources]})
Beispiel #7
0
 def source_xml(self, ignored):
     log.err('SourceXml from Product')
     return dict2xml({'SourceList': [{'Source': n} for n in self.sources]})
Beispiel #8
0
 def source_xml(self, ignored):
     log.err('SourceXml from Product')
     return dict2xml({'SourceList': [{'Source': n} for n in self.sources]})