def runTest(self): song = self.sqlaSession.query(libmgr.Song).all()[0] song.addTag(libmgr.getTag("GENRE", "Rock"), write=True) song.addTag(libmgr.getTag("ARTIST", "Testing"), write=True) songInfo = song.getMetadata() assert libmgr.getTag("GENRE", "Rock") in song assert libmgr.getTag("ARTIST", "Testing") in song
def renameTags(self): dialog = mainwindow.renameTagsDialog() if not dialog.exec_(): return newValue = dialog.ui.tagValueInput.text() tag = libmgr.getTag(self.mainFilter.tagName, newValue) print self.getCurrentSelection() [tag.merge(oldTag) for oldTag in self.getCurrentSelection()]
def setData(self, index, value, role): if index.isValid() and role == QtCore.Qt.EditRole: song = self.songs.keyAt(index.row()) tagName = self.columnNames[index.column()].upper() if tagName == "TITLE": song.setTitle(value) return True if tagName == "LOCATION": return False else: song.addTags([libmgr.getTag(tagName, value)], write=True) self.refreshCacheByObjects([song]) return True return False