simple seeking implementation
This commit is contained in:
		
							parent
							
								
									b2c5575c8b
								
							
						
					
					
						commit
						ea3fc105a4
					
				@ -24,6 +24,7 @@ var (
 | 
				
			|||||||
		"PORT":                 "6600",
 | 
							"PORT":                 "6600",
 | 
				
			||||||
		"DEFAULT_IMAGE_PATH":   "default.jpg",
 | 
							"DEFAULT_IMAGE_PATH":   "default.jpg",
 | 
				
			||||||
		"CACHE_DIR":            utils.CheckDirectoryFmt(USER_CACHE_DIR),
 | 
							"CACHE_DIR":            utils.CheckDirectoryFmt(USER_CACHE_DIR),
 | 
				
			||||||
 | 
							"SEEK_OFFSET":          10,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -50,6 +50,8 @@ var (
 | 
				
			|||||||
		100: "deleteSongFromPlaylist",
 | 
							100: "deleteSongFromPlaylist",
 | 
				
			||||||
		63:  "FocusSearch",
 | 
							63:  "FocusSearch",
 | 
				
			||||||
		47:  "FocusBuffSearch",
 | 
							47:  "FocusBuffSearch",
 | 
				
			||||||
 | 
							98:  "SeekBackward",
 | 
				
			||||||
 | 
							101: "SeekForward",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.go
									
									
									
									
									
								
							@ -65,6 +65,7 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	var Volume int64
 | 
						var Volume int64
 | 
				
			||||||
	var Random, Repeat bool
 | 
						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")
 | 
							utils.Print("RED", "Could Not Get the MPD Status\n")
 | 
				
			||||||
@ -218,6 +219,16 @@ func main() {
 | 
				
			|||||||
		"FocusBuffSearch": func() {
 | 
							"FocusBuffSearch": func() {
 | 
				
			||||||
			views.GetCurrentView().FocusBuffSearchView()
 | 
								views.GetCurrentView().FocusBuffSearchView()
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							"SeekForward": func() {
 | 
				
			||||||
 | 
								if err := CONN.SeekCur(time.Second*time.Duration(SeekOffset), true); err != nil {
 | 
				
			||||||
 | 
									notify.Notify.Send("Could Not Seek Forward in the Song")
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"SeekBackward": func() {
 | 
				
			||||||
 | 
								if err := CONN.SeekCur(-1*time.Second*time.Duration(SeekOffset), true); err != nil {
 | 
				
			||||||
 | 
									notify.Notify.Send("Could Not Seek Backward in the Song")
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Generating the Key Map Based on the Function Map Here Basically the Values will be flipped
 | 
						// Generating the Key Map Based on the Function Map Here Basically the Values will be flipped
 | 
				
			||||||
 | 
				
			|||||||
@ -121,5 +121,8 @@ func progressFunction() (string, string, string, float64) {
 | 
				
			|||||||
		text = "   ---:---"
 | 
							text = "   ---:---"
 | 
				
			||||||
		percentage = 0
 | 
							percentage = 0
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if percentage > 100 {
 | 
				
			||||||
 | 
							percentage = 0
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return song, top, text, percentage
 | 
						return song, top, text, percentage
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user