Change deleteSongFromPlaylist and clearPlaylist

This commit is contained in:
aditya-K2
2022-09-14 19:51:06 +05:30
parent fdd390a731
commit 503701691b
2 changed files with 15 additions and 9 deletions

View File

@@ -50,22 +50,24 @@ func (p PlaylistView) Quit() {
func (p PlaylistView) FocusBuffSearchView() {}
func (p PlaylistView) DeleteSongFromPlaylist() {
func (p *PlaylistView) DeleteSongFromPlaylist() {
UI := ui.Ui
CONN := client.Conn
r, _ := UI.ExpandedView.GetSelection()
if err := CONN.Delete(r, -1); err != nil {
notify.Notify.Send("Could not Remove the Song from Playlist")
} else {
if p.Playlist, err = client.Conn.PlaylistInfo(-1, -1); err != nil {
utils.Print("RED", "Couldn't get the current Playlist.\n")
panic(err)
}
}
}
func (p PlaylistView) Update(inputTable *tview.Table) {
inputTable.Clear()
cplaylist := make([]mpd.Attrs, len(p.Playlist))
for k, v := range p.Playlist {
cplaylist[k] = v
}
for i, j := range cplaylist {
for i, j := range p.Playlist {
_, _, w, _ := inputTable.GetInnerRect()
if j["Title"] == "" || j["Artist"] == "" || j["Album"] == "" {
inputTable.SetCell(i, 0,