forked from wildeyedskies/stmp
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add getprop for bool, use type-safe variants everywhere
- Loading branch information
spezifisch
committed
Nov 4, 2023
1 parent
f8e4ec4
commit 50a0ac4
Showing
3 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package mpvplayer | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/spezifisch/go-mpv" | ||
) | ||
|
||
func (p *Player) getPropertyInt64(name string) (int64, error) { | ||
value, err := p.instance.GetProperty(name, mpv.FORMAT_INT64) | ||
if err != nil { | ||
return 0, err | ||
} else if value == nil { | ||
return 0, errors.New("nil value") | ||
} | ||
return value.(int64), err | ||
} | ||
|
||
func (p *Player) getPropertyBool(name string) (bool, error) { | ||
value, err := p.instance.GetProperty(name, mpv.FORMAT_FLAG) | ||
if err != nil { | ||
return false, err | ||
} else if value == nil { | ||
return false, errors.New("nil value") | ||
} | ||
return value.(bool), err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters