add music item from gui + option to edit music.ini with default editor

This commit is contained in:
cidoku 2025-10-09 16:56:59 -03:00
parent 9bb049f7d1
commit b3fd870981

View File

@ -1930,14 +1930,23 @@ class GUI(QtGui.QWidget):
QtGui.QApplication.clipboard().setText(self.musicItems.currentItem().text())
def onActMusicAddTriggered(self):
title, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter a title for the song.")
if title and ok:
title.replace("=", "")
url, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter an URL for the song.")
if url and ok:
title, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter a title for the song. Leave this empty to add a separator that acts as music stop.")
url = QtCore.QString("")
if ok:
ok = False
if not title:
title = QtCore.QString("--------------------------")
ok = True
if not ok:
url, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter an URL for the song.")
if ok:
title.replace("=", "-")
if ok:
if not url:
url = "~stop.mp3"
with open(AO2XPpath + "music.ini", "ab") as f:
f.write(("\n" + title + " = " + url).toUtf8())
self.onActMusicRefreshTriggered()
self.onActMusicRefreshTriggered()
def onActMusicEditTriggered(self):
pass
@ -1958,7 +1967,6 @@ class GUI(QtGui.QWidget):
if not init:
self.musicItems.clear()
self.loadAllMusic()
print self.musicListPrivate
def onActMusicSwitchTriggered(self):
self.privateMusicSelected = not self.privateMusicSelected