added GetPlaylist()
This commit is contained in:
		
							
								
								
									
										8
									
								
								playlist_entry.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								playlist_entry.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package mpvipc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type PlaylistEntry struct {
 | 
				
			||||||
 | 
						Filename string `json:"filename"`
 | 
				
			||||||
 | 
						Current  bool   `json:"current"`
 | 
				
			||||||
 | 
						Playing  bool   `json:"playing"`
 | 
				
			||||||
 | 
						ID       int    `json:"id"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -49,6 +49,10 @@ func GetFileFormat(socket string) (string, error) {
 | 
				
			|||||||
	return GetProperty[string](socket, "file-format")
 | 
						return GetProperty[string](socket, "file-format")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func GetPlaylist(socket string) ([]PlaylistEntry, error) {
 | 
				
			||||||
 | 
						return GetProperty[[]PlaylistEntry](socket, "playlist")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func GetDuration(socket string) (time.Duration, error) {
 | 
					func GetDuration(socket string) (time.Duration, error) {
 | 
				
			||||||
	durationInSeconds, err := GetProperty[float64](socket, "duration")
 | 
						durationInSeconds, err := GetProperty[float64](socket, "duration")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user