Some Bug Fixes and Option to add and play.
BUG FIX : 1. Artist Added Notification moved out of for loop this caused it to sustain for more than one second. FEATURE : Added Functionality to pass addAndPlay bool which defines if the title is played after adding or not. Helpful for l and a keybindings
This commit is contained in:
parent
fde7bdd1c7
commit
34c6a7a3af
18
client.go
18
client.go
@ -227,20 +227,28 @@ func AddArtist(a map[string]map[string]map[string]string, artist string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
NOTIFICATION_SERVER.Send("Could Not Add Song : " + path)
|
NOTIFICATION_SERVER.Send("Could Not Add Song : " + path)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
NOTIFICATION_SERVER.Send("Artist Added : " + artist)
|
NOTIFICATION_SERVER.Send("Artist Added : " + artist)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adds Specified Track to the Playlist
|
Adds Specified Track to the Playlist
|
||||||
*/
|
*/
|
||||||
func AddTitle(a map[string]map[string]map[string]string, artist, alb, track string) {
|
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)
|
||||||
|
if err != nil {
|
||||||
|
NOTIFICATION_SERVER.Send("Could Not Add Track : " + track)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
err := CONN.Add(a[artist][alb][track])
|
err := CONN.Add(a[artist][alb][track])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
NOTIFICATION_SERVER.Send("Could Not Add Track : " + track)
|
NOTIFICATION_SERVER.Send("Could Not Add Track : " + track)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
NOTIFICATION_SERVER.Send("Track Added : " + track)
|
NOTIFICATION_SERVER.Send("Track Added : " + track)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,12 +286,12 @@ func QueryArtistTreeForAlbums(a map[string]map[string]map[string]string, album s
|
|||||||
return AlbumMap
|
return AlbumMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddToPlaylist(a interface{}) {
|
func AddToPlaylist(a interface{}, addAndPlay bool) {
|
||||||
switch a.(type) {
|
switch a.(type) {
|
||||||
case [3]string:
|
case [3]string:
|
||||||
{
|
{
|
||||||
b := a.([3]string)
|
b := a.([3]string)
|
||||||
AddTitle(ARTIST_TREE, b[1], b[2], b[0])
|
AddTitle(ARTIST_TREE, b[1], b[2], b[0], addAndPlay)
|
||||||
}
|
}
|
||||||
case [2]string:
|
case [2]string:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user