[libdmapsharing] Apply standard whitespace rules to test-dmap-client-python



commit 5ff26427cd4f45685d630496db45193c13303355
Author: W. Michael Petullo <mike flyn org>
Date:   Sat Nov 11 08:22:28 2017 -0500

    Apply standard whitespace rules to test-dmap-client-python
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 tests/test-dmap-client-python |  119 ++++++++++++++++++++---------------------
 1 files changed, 59 insertions(+), 60 deletions(-)
---
diff --git a/tests/test-dmap-client-python b/tests/test-dmap-client-python
index a900e2d..3a2c758 100755
--- a/tests/test-dmap-client-python
+++ b/tests/test-dmap-client-python
@@ -6,83 +6,82 @@ from gi.repository import DMAP
 from gi.repository import DAAP
 
 class PyDMAPDb(GObject.GObject, DMAP.Db):
-       db = {}
-       nextId = 0
+    db = {}
+    nextId = 0
 
-       def do_foreach(self, func, user_data=None):
-               for id in self.db:
-                       func (id, self.db[id])
+    def do_foreach(self, func, user_data=None):
+        for id in self.db:
+            func (id, self.db[id])
 
-       def do_add(self, record):
-               self.db[self.nextId] = record
-               self.nextId += 1
+    def do_add(self, record):
+        self.db[self.nextId] = record
+        self.nextId += 1
 
-       def __init__(self):
-               super(PyDMAPDb, self).__init__()
+    def __init__(self):
+        super(PyDMAPDb, self).__init__()
 
 class PyDAAPRecord(GObject.GObject, DAAP.Record, DMAP.Record):
-       location    = GObject.property(type=str,  default=None)
-       title       = GObject.property(type=str,  default=None)
-       mediakind   = GObject.property(type=int,  default=0)
-       songalbum   = GObject.property(type=str,  default=None)
-       songalbumid = GObject.property(type=int,  default=0)
-       sort_album  = GObject.property(type=str,  default=None)
-       songartist  = GObject.property(type=str,  default=None)
-       sort_artist = GObject.property(type=str,  default=None)
-       songgenre   = GObject.property(type=str,  default=None)
-       format      = GObject.property(type=str,  default=None)
-       rating      = GObject.property(type=int,  default=None)
-       filesize    = GObject.property(type=int,  default=None)
-       duration    = GObject.property(type=int,  default=0)
-       track       = GObject.property(type=int,  default=0)
-       year        = GObject.property(type=int,  default=0)
-       firstseen   = GObject.property(type=int,  default=0)
-       mtime       = GObject.property(type=int,  default=0)
-       disc        = GObject.property(type=int,  default=0)
-       bitrate     = GObject.property(type=int,  default=0)
-       has_video   = GObject.property(type=bool, default=0)
-
-       def __init__(self):
-               super(PyDAAPRecord, self).__init__()
+    location    = GObject.property(type=str,  default=None)
+    title       = GObject.property(type=str,  default=None)
+    mediakind   = GObject.property(type=int,  default=0)
+    songalbum   = GObject.property(type=str,  default=None)
+    songalbumid = GObject.property(type=int,  default=0)
+    sort_album  = GObject.property(type=str,  default=None)
+    songartist  = GObject.property(type=str,  default=None)
+    sort_artist = GObject.property(type=str,  default=None)
+    songgenre   = GObject.property(type=str,  default=None)
+    format      = GObject.property(type=str,  default=None)
+    rating      = GObject.property(type=int,  default=None)
+    filesize    = GObject.property(type=int,  default=None)
+    duration    = GObject.property(type=int,  default=0)
+    track       = GObject.property(type=int,  default=0)
+    year        = GObject.property(type=int,  default=0)
+    firstseen   = GObject.property(type=int,  default=0)
+    mtime       = GObject.property(type=int,  default=0)
+    disc        = GObject.property(type=int,  default=0)
+    bitrate     = GObject.property(type=int,  default=0)
+    has_video   = GObject.property(type=bool, default=0)
+
+    def __init__(self):
+        super(PyDAAPRecord, self).__init__()
 
 class PyDAAPRecordFactory(GObject.GObject, DMAP.RecordFactory):
-       def do_create (self, user_data=None):
-               return PyDAAPRecord()
+    def do_create (self, user_data=None):
+        return PyDAAPRecord()
 
-       def __init__(self):
-               super(PyDAAPRecordFactory, self).__init__()
+    def __init__(self):
+        super(PyDAAPRecordFactory, self).__init__()
 
 class TestDMAPClient(GObject.GObject):
+    def __init__(self):
+        super(TestDMAPClient, self).__init__()
 
-       def __init__(self):
-               super(TestDMAPClient, self).__init__()
+        self.factory = PyDAAPRecordFactory()
+        self.db = PyDMAPDb()
+        self.browser = DMAP.MdnsBrowser.new(DMAP.MdnsServiceType.DAAP)
 
-               self.factory = PyDAAPRecordFactory()
-               self.db = PyDMAPDb()
-               self.browser = DMAP.MdnsBrowser.new(DMAP.MdnsServiceType.DAAP)
+    def start(self):
+        self.browser.connect("service-added", self.service_added_cb, None)
+        self.browser.start()
 
-       def start(self):
-               self.browser.connect("service-added", self.service_added_cb, None)
-               self.browser.start()
+    def print_record(self, id, record, user_data):
+        title = record.get_property("title")
+        has_video = record.get_property("has-video")
+        artist = record.get_property("songartist")
 
-       def print_record(self, id, record, user_data):
-               title = record.get_property("title")
-               has_video = record.get_property("has-video")
-               artist = record.get_property("songartist")
+        print id, artist, title, has_video
 
-               print id, artist, title, has_video
+    def connected_cb(self, connection, result, reason, user_data):
+        self.db.foreach(self.print_record, None)
 
-       def connected_cb(self, connection, result, reason, user_data):
-               self.db.foreach(self.print_record, None)
+    def service_added_cb(self, browser, service, user_data):
+        service_name = service.get_property("service-name")
+        name         = service.get_property("name")
+        host         = service.get_property("host")
+        port         = service.get_property("port")
 
-       def service_added_cb(self, browser, service, user_data):
-               service_name = service.get_property("service-name")
-               name         = service.get_property("name")
-               host         = service.get_property("host")
-               port         = service.get_property("port")
-
-               connection = DAAP.Connection.new(service_name, host, port, self.db, self.factory)
-               connection.start(self.connected_cb, self.db)
+        connection = DAAP.Connection.new(service_name, host, port, self.db, self.factory)
+        connection.start(self.connected_cb, self.db)
 
 client = TestDMAPClient ()
 client.start ()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]