def _connected(self, id, database, media): """ Callback to pass the database information to the client. """ # read only version of the database self._db = Database(database) # connect to server notifications self.id = id new_media = [] self._db.medialist.connect(self) for id, prop in media: # in the client medialist.add has to lock the db # and needs the db_lock rpc which will always result # in returning an InProgress object. m = yield self._db.medialist.add(id, prop) new_media.append(m) # reconnect query monitors for query in self._queries[:]: if query == None: self._queries.remove(query) continue if query._beacon_monitoring: query._beacon_monitoring = False query.monitor() for m in new_media: if not m.mountpoint == '/': self.signals['media.add'].emit(m) # FIXME: if this fails we will never notice yield thumbnail.connect() # OK, we are done self.status = CONNECTED self.signals['connect'].emit()
def _connected(self, id, database, media): """ Callback to pass the database information to the client. """ # read only version of the database self._db = Database(database) # connect to server notifications self.id = id new_media = [] self._db.medialist.connect(self) for id, prop in media: # in the client medialist.add has to lock the db # and needs the db_lock rpc which will always result # in returning an InProgress object. m = yield self._db.medialist.add(id, prop) new_media.append(m) # reconnect query monitors for query in self._queries.values(): if query.monitoring: # We dip our fingers into an internal method of Query to bypass # the test of whether or not monitoring is already True. We # know it is, but we want to resubmit the query now that we're # connected to the server. query._monitor(True) for m in new_media: if not m.mountpoint == '/': self.signals['media.add'].emit(m) # FIXME: if this fails we will never notice yield thumbnail.connect() # OK, we are done self.status = CONNECTED self.signals['connect'].emit()