Merge branch 'refactor' into seek
This commit is contained in:
		
						commit
						d2e625a4a4
					
				
							
								
								
									
										32
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								main.go
									
									
									
									
									
								
							| @ -37,10 +37,10 @@ func main() { | ||||
| 		utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n") | ||||
| 		panic(mpdConnectionError) | ||||
| 	} | ||||
| 	CONN := client.Conn | ||||
| 	defer CONN.Close() | ||||
| 	Conn := client.Conn | ||||
| 	defer Conn.Close() | ||||
| 
 | ||||
| 	ui.SetConnection(CONN) | ||||
| 	ui.SetConnection(Conn) | ||||
| 
 | ||||
| 	cache.SetCacheDir(viper.GetString("CACHE_DIR")) | ||||
| 
 | ||||
| @ -50,7 +50,7 @@ func main() { | ||||
| 
 | ||||
| 	ui.Ui = ui.NewApplication() | ||||
| 
 | ||||
| 	fileMap, err := CONN.ListAllInfo("/") | ||||
| 	fileMap, err := Conn.ListAllInfo("/") | ||||
| 	if err != nil { | ||||
| 		utils.Print("RED", "Could Not Generate the File Map\n") | ||||
| 		utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n") | ||||
| @ -67,7 +67,7 @@ func main() { | ||||
| 	var Random, Repeat bool | ||||
| 	var SeekOffset = viper.GetInt("SEEK_OFFSET") | ||||
| 
 | ||||
| 	if _v, err := CONN.Status(); err != nil { | ||||
| 	if _v, err := Conn.Status(); err != nil { | ||||
| 		utils.Print("RED", "Could Not Get the MPD Status\n") | ||||
| 		panic(err) | ||||
| 	} else { | ||||
| @ -90,7 +90,7 @@ func main() { | ||||
| 	notify.Notify = notify.NewNotificationServer() | ||||
| 	notify.Notify.Start() | ||||
| 
 | ||||
| 	if c, err := CONN.CurrentSong(); err != nil { | ||||
| 	if c, err := Conn.CurrentSong(); err != nil { | ||||
| 		utils.Print("RED", "Could Not Retrieve the Current Song\n") | ||||
| 		panic(err) | ||||
| 	} else { | ||||
| @ -125,19 +125,19 @@ func main() { | ||||
| 			views.GetCurrentView().ShowParentContent() | ||||
| 		}, | ||||
| 		"nextSong": func() { | ||||
| 			if err := CONN.Next(); err != nil { | ||||
| 			if err := Conn.Next(); err != nil { | ||||
| 				notify.Notify.Send("Could not Select the Next Song") | ||||
| 			} | ||||
| 		}, | ||||
| 		"clearPlaylist": func() { | ||||
| 			if err := CONN.Clear(); err != nil { | ||||
| 			if err := Conn.Clear(); err != nil { | ||||
| 				notify.Notify.Send("Could not Clear the Playlist") | ||||
| 			} else { | ||||
| 				notify.Notify.Send("Playlist Cleared") | ||||
| 			} | ||||
| 		}, | ||||
| 		"previousSong": func() { | ||||
| 			if err := CONN.Previous(); err != nil { | ||||
| 			if err := Conn.Previous(); err != nil { | ||||
| 				notify.Notify.Send("Could Not Select the Previous Song") | ||||
| 			} | ||||
| 		}, | ||||
| @ -145,12 +145,12 @@ func main() { | ||||
| 			views.GetCurrentView().AddToPlaylist() | ||||
| 		}, | ||||
| 		"toggleRandom": func() { | ||||
| 			if err := CONN.Random(!Random); err == nil { | ||||
| 			if err := Conn.Random(!Random); err == nil { | ||||
| 				Random = !Random | ||||
| 			} | ||||
| 		}, | ||||
| 		"toggleRepeat": func() { | ||||
| 			if err := CONN.Repeat(!Repeat); err == nil { | ||||
| 			if err := Conn.Repeat(!Repeat); err == nil { | ||||
| 				Repeat = !Repeat | ||||
| 			} | ||||
| 		}, | ||||
| @ -160,7 +160,7 @@ func main() { | ||||
| 			} else { | ||||
| 				Volume -= 10 | ||||
| 			} | ||||
| 			if err := CONN.SetVolume(int(Volume)); err != nil { | ||||
| 			if err := Conn.SetVolume(int(Volume)); err != nil { | ||||
| 				notify.Notify.Send("Could Not Decrease the Volume") | ||||
| 			} | ||||
| 		}, | ||||
| @ -170,7 +170,7 @@ func main() { | ||||
| 			} else { | ||||
| 				Volume += 10 | ||||
| 			} | ||||
| 			if err := CONN.SetVolume(int(Volume)); err != nil { | ||||
| 			if err := Conn.SetVolume(int(Volume)); err != nil { | ||||
| 				notify.Notify.Send("Could Not Increase the Volume") | ||||
| 			} | ||||
| 		}, | ||||
| @ -196,14 +196,14 @@ func main() { | ||||
| 			views.GetCurrentView().Quit() | ||||
| 		}, | ||||
| 		"stop": func() { | ||||
| 			if err := CONN.Stop(); err != nil { | ||||
| 			if err := Conn.Stop(); err != nil { | ||||
| 				notify.Notify.Send("Could not Stop the Playback") | ||||
| 			} else { | ||||
| 				notify.Notify.Send("Playback Stopped") | ||||
| 			} | ||||
| 		}, | ||||
| 		"updateDB": func() { | ||||
| 			_, err = CONN.Update("") | ||||
| 			_, err = Conn.Update("") | ||||
| 			if err != nil { | ||||
| 				notify.Notify.Send("Could Not Update the Database") | ||||
| 			} else { | ||||
| @ -265,7 +265,7 @@ func main() { | ||||
| 		} else { | ||||
| 			if views.GetCurrentView().GetViewName() == "PlaylistView" { | ||||
| 				if e.Rune() == 'j' || e.Rune() == 'k' { | ||||
| 					if p, err := CONN.PlaylistInfo(-1, -1); err != nil { | ||||
| 					if p, err := Conn.PlaylistInfo(-1, -1); err != nil { | ||||
| 						notify.Notify.Send("Error Getting PlaylistInfo") | ||||
| 					} else { | ||||
| 						if len(p) == 0 { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user