]> git.meshlink.io Git - catta/blobdiff - avahi-python/avahi/ServiceTypeDatabase.py.in
work around a limitation in Gentoo's DBUS build (which is compiled with --disable...
[catta] / avahi-python / avahi / ServiceTypeDatabase.py.in
index 9caeebd91cd74ca9cdd17743a6c306baa862c8a0..25807f36c7e6e22ab5737d2e8fe6e0f626c82ed3 100644 (file)
@@ -21,6 +21,7 @@
 
 import gdbm
 import locale
+import re
 
 locale.setlocale(locale.LC_ALL, '')
 
@@ -65,6 +66,17 @@ class ServiceTypeDatabase:
 
         raise KeyError()
 
+    def items(self):
+
+        items = []
+        key = self.db.firstkey()
+        while key is not None:
+            if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
+                localized_service_name = self[key]
+                items.append((key, localized_service_name))
+            key = self.db.nextkey(key)
+        return items
+
     def has_key(self, key):
 
         for suffix in self.suffixes:
@@ -88,6 +100,7 @@ class ServiceTypeDatabase:
 if __name__ == "__main__":
     
     b = ServiceTypeDatabase()
+    print b.items()
 
     print b["_http._tcp"]
     print b["_ftp._tcp"]