X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-utils%2Favahi-publish-service.in;h=41cc5d49bc224b6c968a62053879b373210ce798;hb=5a685a0f05389e671a32b01ef729dbb39cb39020;hp=3000ea988279ec5cccb98bf0d536b4dfb6bfc5dc;hpb=280e0fa69dc03706a24bf7128422443cb37d08ab;p=catta diff --git a/avahi-utils/avahi-publish-service.in b/avahi-utils/avahi-publish-service.in index 3000ea9..41cc5d4 100755 --- a/avahi-utils/avahi-publish-service.in +++ b/avahi-utils/avahi-publish-service.in @@ -40,7 +40,7 @@ def usage(retval = 0): sys.exit(retval) try: - opts, args = getopt.getopt(sys.argv[1:], "d:H:", ["help", "domain=", "host="]) + opts, args = getopt.getopt(sys.argv[1:], "hd:H:", ["help", "domain=", "host="]) except getopt.GetoptError: usage(2) @@ -83,16 +83,19 @@ def add_service(): if group is None: group = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP) - + group.connect_to_signal('StateChanged', entry_group_state_changed) + assert group.IsEmpty() print "Adding service '%s' of type '%s' ..." % (name, stype) - group.connect_to_signal('StateChanged', entry_group_state_changed) - group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, name, stype, domain, host, dbus.UInt16(port), txt) + + group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, name, stype, domain, host, dbus.UInt16(port), avahi.string_array_to_txt_array(txt)) group.Commit() def entry_group_state_changed(state): global name, server, n_rename + +# print "state change: %i" % state if state == avahi.ENTRY_GROUP_ESTABLISHED: print "Service established."