🚧 App package to hold app state
This commit is contained in:
parent
433f49e9e0
commit
d91fc4b9ec
2 changed files with 29 additions and 3 deletions
27
app/choose.go
Normal file
27
app/choose.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"codeberg.org/danjones000/strip-beats/files"
|
||||
"codeberg.org/danjones000/strip-beats/media"
|
||||
)
|
||||
|
||||
var file *media.Probe
|
||||
|
||||
func PickNewFile() media.Probe {
|
||||
path := files.PickRandomFile()
|
||||
f := media.ProbeFile(path)
|
||||
file = &f
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func GetFile() media.Probe {
|
||||
if file == nil {
|
||||
return PickNewFile()
|
||||
}
|
||||
return *file
|
||||
}
|
||||
|
||||
func ForgetFile() {
|
||||
file = nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue