def get_song(self, filepath): songHash = DB_Helper._hash(filepath) self.db.setNamespace(config.CHOSEN_FEATURE_TABLE) #Finds song if it exists self.db.search(C._raw(commonHash, "=", songHash)) return self.db.read(1)
def hash_to_file(self, h): self.db.setNamespace(config.CHOSEN_FEATURE_TABLE) self.db.search(C._raw(commonHash, '=', str(h))) result = self.db.read() # get filepath return result[0][commonPath]
def moods_for_filepath(self, filepath): self.db.setNamespace(moodNamespace) songHash = DB_Helper._hash(filepath) #Get moods from DB with hash self.db.search(C._raw(commonHash, "=", songHash)) rawMoods = self.db.read() moods = [rawMood[moodTitle] for rawMood in rawMoods] return moods