Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
195b00abf2 | |||
cb478e8b4d | |||
0e93c0cafb | |||
ddb1e3af17 |
8
go.mod
8
go.mod
@ -1,5 +1,7 @@
|
||||
module git.milar.in/milarin/mpvipc
|
||||
module git.tordarus.net/tordarus/mpvipc
|
||||
|
||||
go 1.21.5
|
||||
go 1.23
|
||||
|
||||
require git.milar.in/milarin/channel v0.1.1
|
||||
toolchain go1.24.4
|
||||
|
||||
require git.tordarus.net/tordarus/channel v0.1.19
|
||||
|
4
go.sum
4
go.sum
@ -1,2 +1,2 @@
|
||||
git.milar.in/milarin/channel v0.1.1 h1:s8+BdiOMmuRUDmChQ2i4G5GWsDCK9tKNHt1knLJx9zM=
|
||||
git.milar.in/milarin/channel v0.1.1/go.mod h1:We83LTI8S7u7II3pD+A2ChCDWJfCkcBUCUqii9HjTtM=
|
||||
git.tordarus.net/tordarus/channel v0.1.19 h1:d9xnSwFyvBh4B1/82mt0A7Gpm2nIZJTc+9ceJMIOu5Q=
|
||||
git.tordarus.net/tordarus/channel v0.1.19/go.mod h1:8/dWFTdGO7g4AeSZ7cF6GerkGbe9c4dBVMVDBxOd9m4=
|
||||
|
13
props_get.go
13
props_get.go
@ -17,6 +17,10 @@ func IsPaused(socket string) (bool, error) {
|
||||
return GetProperty[bool](socket, "pause")
|
||||
}
|
||||
|
||||
func GetVolume(socket string) (float64, error) {
|
||||
return GetProperty[float64](socket, "volume")
|
||||
}
|
||||
|
||||
func GetFilename(socket string) (string, error) {
|
||||
return GetProperty[string](socket, "filename")
|
||||
}
|
||||
@ -54,6 +58,15 @@ func GetDuration(socket string) (time.Duration, error) {
|
||||
return time.Duration(durationInSeconds * float64(time.Second)), nil
|
||||
}
|
||||
|
||||
func GetDemuxerCacheTime(socket string) (time.Duration, error) {
|
||||
cacheInSeconds, err := GetProperty[float64](socket, "demuxer-cache-time")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return time.Duration(cacheInSeconds * float64(time.Second)), nil
|
||||
}
|
||||
|
||||
func GetPercentPos(socket string) (float64, error) {
|
||||
return GetProperty[float64](socket, "percent-pos")
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.milar.in/milarin/channel"
|
||||
"git.tordarus.net/tordarus/channel"
|
||||
)
|
||||
|
||||
func ObserveEndOfFile(ctx context.Context, socket string) (<-chan string, error) {
|
||||
|
@ -17,3 +17,7 @@ func SetTimePos(socket string, timePos time.Duration) error {
|
||||
func SetPercentPos(socket string, percentPos float64) error {
|
||||
return SetProperty[float64](socket, "percent-pos", percentPos)
|
||||
}
|
||||
|
||||
func SetVolume(socket string, volume float64) error {
|
||||
return SetProperty[float64](socket, "volume", volume)
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"errors"
|
||||
"net"
|
||||
|
||||
"git.milar.in/milarin/channel"
|
||||
"git.tordarus.net/tordarus/channel"
|
||||
)
|
||||
|
||||
type Command struct {
|
||||
|
Reference in New Issue
Block a user