Changeset 3953172


Ignore:
Timestamp:
2007-08-21T21:37:43Z (17 years ago)
Author:
VMiklos <vmiklos@…>
Branches:
master
Children:
64f8b8ea
Parents:
0ac1b3e0
Message:

skyped: automatically reconnect if skype is restarted
well, not 100% perfect because we detect the error when we send something. but
far better than writing to devnull forever ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.py

    r0ac1b3e0 r3953172  
    8686
    8787                reply = self.send('PROTOCOL 5')
    88                 dbus.service.Object.__init__(self, bus, "/com/Skype/Client", bus_name='com.Skype.API')
     88                try:
     89                        dbus.service.Object.__init__(self, bus, "/com/Skype/Client", bus_name='com.Skype.API')
     90                except KeyError:
     91                        sys.exit()
    8992
    9093        # skype -> client (async)
     
    105108                except dbus.exceptions.DBusException, s:
    106109                        reply = str(s)
     110                        if(reply.startswith("org.freedesktop.DBus.Error.ServiceUnknown")):
     111                                self.remove_from_connection(dbus.SessionBus(), "/com/Skype/Client")
     112                                mainloop.quit()
    107113                dprint('<< ' + reply)
    108114                return reply
     
    110116if __name__=='__main__':
    111117        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    112         skype = SkypeApi()
    113118        signal.signal(signal.SIGINT, sig_handler)
    114119        mainloop = gobject.MainLoop()
    115120        server('localhost', 2727)
    116         mainloop.run()
     121        while True:
     122                skype = SkypeApi()
     123                mainloop.run()
Note: See TracChangeset for help on using the changeset viewer.