def __init__(self): self.clear_packet_queue() self._db = musicalDatabase.request_database("MusicalPackets") self._db_collection = self._db.open_collection("packets") thread.start_new_thread(self._packet_read_loop, ())
def __init__(self): self.clear_packet_queue() self._db = musicalDatabase.request_database("MusicalPackets") self._db_collection = self._db.open_collection("packets") networkSniffer = Sniffer() networkSniffer.add_callback(self) self._thread = threading.Thread(target=networkSniffer) self._thread.daemon = True self._thread.start()
def __init__(self, col_name): self._database = musicalDatabase.request_database("MusicalPackets") self._collection = self._database.open_collection(col_name) self._cursor = self._collection.find() self._next_packet = self._cursor.next() self._current_time = self._next_packet['time']
import musicalDatabase import musicalStatistics as stats from getdata import getdata import time database = musicalDatabase.request_database("MusicalPackets") #database._database.drop_collection("MyFirstMusic") #collection = database.open_collection("MyFirstMusic") #data = getdata() #global counter #counter = 0 #for packet in data: # counter = counter + 1 # packet['time'] = time.time() + counter # collection.put(packet) result = stats.get_last_X_packets("packets") for data in result: print(data)
def _get_collection(col_name): database = musicalDatabase.request_database("MusicalPackets") return database.open_collection(col_name)