Change deleteSongFromPlaylist and clearPlaylist
This commit is contained in:
parent
fdd390a731
commit
503701691b
10
main.go
10
main.go
@ -118,7 +118,7 @@ func main() {
|
|||||||
// This Function Is Responsible for Changing the Focus it uses the Focus Map and Based on it Chooses
|
// This Function Is Responsible for Changing the Focus it uses the Focus Map and Based on it Chooses
|
||||||
// the Draw Function
|
// the Draw Function
|
||||||
views.PView.StartWatcher()
|
views.PView.StartWatcher()
|
||||||
views.SetCurrentView(views.PView)
|
views.SetCurrentView(&views.PView)
|
||||||
ui.Ui.ExpandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
ui.Ui.ExpandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
||||||
views.GetCurrentView().Update(ui.Ui.ExpandedView)
|
views.GetCurrentView().Update(ui.Ui.ExpandedView)
|
||||||
return ui.Ui.ExpandedView.GetInnerRect()
|
return ui.Ui.ExpandedView.GetInnerRect()
|
||||||
@ -148,7 +148,11 @@ func main() {
|
|||||||
if err := Conn.Clear(); err != nil {
|
if err := Conn.Clear(); err != nil {
|
||||||
notify.Notify.Send("Could not Clear the Playlist")
|
notify.Notify.Send("Could not Clear the Playlist")
|
||||||
} else {
|
} else {
|
||||||
notify.Notify.Send("Playlist Cleared")
|
if views.PView.Playlist, err = client.Conn.PlaylistInfo(-1, -1); err != nil {
|
||||||
|
utils.Print("RED", "Couldn't get the current Playlist.\n")
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
notify.Notify.Send("Playlist Cleared!")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"previousSong": func() {
|
"previousSong": func() {
|
||||||
@ -195,7 +199,7 @@ func main() {
|
|||||||
views.FView.Update(ui.Ui.ExpandedView)
|
views.FView.Update(ui.Ui.ExpandedView)
|
||||||
},
|
},
|
||||||
"navigateToPlaylist": func() {
|
"navigateToPlaylist": func() {
|
||||||
views.SetCurrentView(views.PView)
|
views.SetCurrentView(&views.PView)
|
||||||
ui.Ui.Navbar.Select(0, 0)
|
ui.Ui.Navbar.Select(0, 0)
|
||||||
views.PView.Update(ui.Ui.ExpandedView)
|
views.PView.Update(ui.Ui.ExpandedView)
|
||||||
},
|
},
|
||||||
|
@ -50,22 +50,24 @@ func (p PlaylistView) Quit() {
|
|||||||
|
|
||||||
func (p PlaylistView) FocusBuffSearchView() {}
|
func (p PlaylistView) FocusBuffSearchView() {}
|
||||||
|
|
||||||
func (p PlaylistView) DeleteSongFromPlaylist() {
|
func (p *PlaylistView) DeleteSongFromPlaylist() {
|
||||||
UI := ui.Ui
|
UI := ui.Ui
|
||||||
CONN := client.Conn
|
CONN := client.Conn
|
||||||
r, _ := UI.ExpandedView.GetSelection()
|
r, _ := UI.ExpandedView.GetSelection()
|
||||||
if err := CONN.Delete(r, -1); err != nil {
|
if err := CONN.Delete(r, -1); err != nil {
|
||||||
notify.Notify.Send("Could not Remove the Song from Playlist")
|
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) {
|
func (p PlaylistView) Update(inputTable *tview.Table) {
|
||||||
inputTable.Clear()
|
inputTable.Clear()
|
||||||
cplaylist := make([]mpd.Attrs, len(p.Playlist))
|
for i, j := range p.Playlist {
|
||||||
for k, v := range p.Playlist {
|
|
||||||
cplaylist[k] = v
|
|
||||||
}
|
|
||||||
for i, j := range cplaylist {
|
|
||||||
_, _, w, _ := inputTable.GetInnerRect()
|
_, _, w, _ := inputTable.GetInnerRect()
|
||||||
if j["Title"] == "" || j["Artist"] == "" || j["Album"] == "" {
|
if j["Title"] == "" || j["Artist"] == "" || j["Album"] == "" {
|
||||||
inputTable.SetCell(i, 0,
|
inputTable.SetCell(i, 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user