Using `fhs/gompd/v2`

This commit is contained in:
aditya-K2 2022-09-09 00:46:38 +05:30
parent 7f4e1460b8
commit b2c5575c8b
8 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@ import (
"github.com/aditya-K2/fuzzy"
"github.com/aditya-K2/gomp/notify"
"github.com/fhs/gompd/mpd"
"github.com/fhs/gompd/v2/mpd"
"strings"
)
@ -138,8 +138,8 @@ func AddArtist(a map[string]map[string]map[string]string, artist string) {
// Adds Specified Track to the Playlist
func AddTitle(a map[string]map[string]map[string]string, artist, alb, track string, addAndPlay bool) {
if addAndPlay {
id, err := Conn.AddId(a[artist][alb][track], -1)
Conn.PlayId(id)
id, err := Conn.AddID(a[artist][alb][track], -1)
Conn.PlayID(id)
if err != nil {
notify.Notify.Send("Could Not Add Track : " + track)
}

View File

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/fhs/gompd/mpd"
"github.com/fhs/gompd/v2/mpd"
)
type FileNode struct {

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/aditya-K2/fuzzy v0.1.1-0.20211128173834-d0023b66cdd4
github.com/aditya-K2/tview v0.0.0-20211115161300-6b99c2c2658c
github.com/bogem/id3v2 v1.2.0
github.com/fhs/gompd v1.0.1
github.com/fhs/gompd/v2 v2.2.0
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1
github.com/mewkiz/flac v1.0.7
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646

4
go.sum
View File

@ -90,8 +90,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fhs/gompd v1.0.1 h1:kBcAhjnAPJQAylZXR0TeH+d2vpjawXlTtKYguqNlF4A=
github.com/fhs/gompd v1.0.1/go.mod h1:b219/mNa9PvRqvkUip51b23hGL3iX4d4q3gNXdtrD04=
github.com/fhs/gompd/v2 v2.2.0 h1:zdSYAAOzQ5cCCgYa5CoXkL0Vr0Cqb/b5JmTobirLc90=
github.com/fhs/gompd/v2 v2.2.0/go.mod h1:nNdZtcpD5VpmzZbRl5rV6RhxeMmAWTxEsSIMBkmMIy4=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=

View File

@ -14,7 +14,7 @@ import (
"github.com/aditya-K2/gomp/views"
"github.com/aditya-K2/fuzzy"
"github.com/fhs/gompd/mpd"
"github.com/fhs/gompd/v2/mpd"
"github.com/gdamore/tcell/v2"
"github.com/spf13/viper"
)

View File

@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"github.com/fhs/gompd/mpd"
"github.com/fhs/gompd/v2/mpd"
"github.com/gdamore/tcell/v2"
"github.com/aditya-K2/gomp/utils"

View File

@ -24,11 +24,11 @@ func (s BuffSearchView) ShowChildrenContent() {
r, _ := UI.ExpandedView.GetSelection()
SetCurrentView(FView)
if len(client.DirTree.Children[r].Children) == 0 {
if id, err := CONN.AddId(client.DirTree.Children[client.Matches[r].Index].AbsolutePath, -1); err != nil {
if id, err := CONN.AddID(client.DirTree.Children[client.Matches[r].Index].AbsolutePath, -1); err != nil {
notify.Notify.Send(fmt.Sprintf("Could Not add the Song %s to the Playlist",
client.DirTree.Children[client.Matches[r].Index].AbsolutePath))
} else {
if err := CONN.PlayId(id); err != nil {
if err := CONN.PlayID(id); err != nil {
notify.Notify.Send("Could not Play the Song")
}
}

View File

@ -24,11 +24,11 @@ func (f FileView) ShowChildrenContent() {
r, _ := UI.ExpandedView.GetSelection()
SetCurrentView(FView)
if len(client.DirTree.Children[r].Children) == 0 {
if id, err := CONN.AddId(client.DirTree.Children[r].AbsolutePath, -1); err != nil {
if id, err := CONN.AddID(client.DirTree.Children[r].AbsolutePath, -1); err != nil {
notify.Notify.Send(fmt.Sprintf("Could not Add Song %s",
client.DirTree.Children[r].Path))
} else {
if err := CONN.PlayId(id); err != nil {
if err := CONN.PlayID(id); err != nil {
notify.Notify.Send(fmt.Sprintf("Could Not Play Song %s",
client.DirTree.Children[r].Path))
}