Audio
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package mic
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
|
||||
const recordingLayout = "2006-01-02-150405"
|
||||
|
||||
var recordingPattern = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}-\d{6}\.wav$`)
|
||||
|
||||
func RecordingFilename(t time.Time) string {
|
||||
return t.Local().Format(recordingLayout) + ".wav"
|
||||
}
|
||||
|
||||
func ValidRecordingFilename(name string) bool {
|
||||
return recordingPattern.MatchString(filepath.Base(name))
|
||||
}
|
||||
Reference in New Issue
Block a user