From ea604e719f16161a6d166ce36b6b952d25095e13 Mon Sep 17 00:00:00 2001 From: billy Date: Wed, 9 Apr 2025 11:10:09 -0400 Subject: [PATCH] rename playlists --- README.md | 2 +- components/PlaylistsPane.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f0f3a36..37b15f9 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,11 @@ config.ini db/ - ~~when table is focused, start typing to match against the primary sort column~~ - ~~remember last window size~~ - ~~automatically fix broken config before loading app (new config options added)~~ +- ~~allow spectrum analyzer to fall when playback stops or song is paused~~ - jump to currently playing song - how do i make this work regardless of current sort params? - playlist autoexporting - .wav, .ogg, .flac convertor - playback modes (normal, repeat playlist, repeat 1 song, shuffle) - autoplay next song in all modes -- allow spectrum analyzer to fall when playback stops or song is paused - ability to delete playlist - automatic "radio" based on artist or genre diff --git a/components/PlaylistsPane.py b/components/PlaylistsPane.py index 23c7753..eab6c6c 100644 --- a/components/PlaylistsPane.py +++ b/components/PlaylistsPane.py @@ -1,4 +1,4 @@ -from PyQt5.QtWidgets import QAction, QListWidget, QMenu, QMessageBox, QTreeWidget, QTreeWidgetItem +from PyQt5.QtWidgets import QAction, QInputDialog, QListWidget, QMenu, QMessageBox, QTreeWidget, QTreeWidgetItem from PyQt5.QtCore import pyqtSignal, Qt, QPoint import DBA from logging import debug @@ -71,8 +71,19 @@ class PlaylistsPane(QTreeWidget): window.exec_() def rename_playlist(self, *args): - # TODO: implement this - pass + """ + Asks user for input + Renames selected playlist based on user input + """ + text, ok = QInputDialog.getText(self, "Rename playlist", "New name: ") + + if len(text) > 64: + QMessageBox.warning(self, "WARNING", "Name must not exceed 64 characters") + return + if ok: + with DBA.DBAccess() as db: + db.execute('UPDATE playlist SET name = ? WHERE id = ?;', (text, self.playlist_db_id_choice)) + self.reload_playlists() def delete_playlist(self, *args): """Deletes a playlist"""