Beispiel #1
0
 def startListen(self):
    log.info("UPNP Service startListen...")
    config = {'logmode':'none', 'interface': self.core.configGet('upnp', 'ethdev')}
    try:
       c = Coherence(config)
       c.connect(self.check_device, 'Coherence.UPnP.Device.detection_completed')
    except:
       log.error("UPNP ERROR")
       #traceback.print_exc(file=open("/tmp/traceback", "w"))
    self.coherence = c
    log.info("UPNP Service started")
          'control':control,
        }
    if control:
        devices.append(d)
    else:
        unknown_devices.append(d)

def remove_device(*args, **kwargs):
    ''' Remove device '''
#    print "remove_device:", args, kwargs

def create_device(infos=None, device_type=None, *args, **kwargs):
    ''' Create device '''
#    print "create_device:", infos, device_type, args, kwargs

coherence.connect( create_device, 'Coherence.UPnP.SSDP.new_device')
coherence.connect( add_device, 'Coherence.UPnP.RootDevice.detection_completed')
coherence.connect( remove_device, 'Coherence.UPnP.SSDP.removed_device')

class CoherenceMenu(basic.LineReceiver):
    from os import linesep as delimiter
    queue = []
    device = None
    NavigatorId = None
    handlers = {}
    menu = []
    lastSelection = None
    currentStation = None

    def __init__(self, *args, **kwargs):
        self.handlers = {
Beispiel #3
0

def remove_device(*args, **kwargs):
    ''' Remove device '''


#    print "remove_device:", args, kwargs


def create_device(infos=None, device_type=None, *args, **kwargs):
    ''' Create device '''


#    print "create_device:", infos, device_type, args, kwargs

coherence.connect(create_device, 'Coherence.UPnP.SSDP.new_device')
coherence.connect(add_device, 'Coherence.UPnP.RootDevice.detection_completed')
coherence.connect(remove_device, 'Coherence.UPnP.SSDP.removed_device')


class CoherenceMenu(basic.LineReceiver):
    from os import linesep as delimiter
    queue = []
    device = None
    NavigatorId = None
    handlers = {}
    menu = []
    lastSelection = None
    currentStation = None

    def __init__(self, *args, **kwargs):
def start():
    config = {'logmode':'warning'}
    c = Coherence(config)
    c.connect(found_device_cb, 'Coherence.UPnP.Device.detection_completed')
Beispiel #5
0
def start():
    config = {'logmode': 'warning'}
    c = Coherence(config)
    c.connect(check_device, 'Coherence.UPnP.Device.detection_completed')
    c.connect(completed, 'Coherence.UPnP.DeviceClient.detection_completed')
    c.connect(remove_client, 'Coherence.UPnP.Device.remove_client')
    window.set_title('%s' % device['friendly_name'])
    hbox = gtk.HBox(homogeneous=False, spacing=2)
    
    for action in ('Play','Stop', 'Pause', 'Previous','Next'):
        if device.has_key(action):            
            button = gtk.Button(action)
            function, params = device[action]
            button.connect('clicked',execute_action, function ,params)
            hbox.pack_start(button)
            
    window.add(hbox)
    window.show_all()

window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect("delete_event", lambda x,y: reactor.stop())
window.set_default_size(100,33)
window.set_title('DLNA Remote control')
button = gtk.Button('Quit remote control')
button.connect("clicked", lambda x: reactor.stop())
hbox = gtk.HBox(homogeneous=False, spacing=10)
hbox.pack_start(button,False,False,2)
hbox.pack_end(button,False,False,20)
window.add(hbox)
window.show_all()

coherence.connect(device_found, 'Coherence.UPnP.RootDevice.detection_completed')
coherence.connect(device_removed, 'Coherence.UPnP.RootDevice.removed')

reactor.run()