Update README.md
This commit is contained in:
parent
ca2ff36131
commit
542e59f9ea
17
README.md
17
README.md
@ -47,20 +47,18 @@ After installing all of the required libraries, you can import and use this libr
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jeffreydwalter/arlo-golang"
|
"github.com/jeffreydwalter/arlo-golang"
|
||||||
)
|
)
|
||||||
|
|
||||||
const oneDay = 24 * time.Hour
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
USERNAME = 'user@example.com'
|
USERNAME = "user@example.com"
|
||||||
PASSWORD = 'supersecretpassword'
|
PASSWORD = "supersecretpassword"
|
||||||
|
|
||||||
|
oneDay = 24 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -75,7 +73,7 @@ func main() {
|
|||||||
// At this point you're logged into Arlo.
|
// At this point you're logged into Arlo.
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
start := now.Sub(7 * oneDay)
|
start := now.Add(-7 * oneDay)
|
||||||
|
|
||||||
// Get all of the recordings for a date range.
|
// Get all of the recordings for a date range.
|
||||||
library, err := arlo.GetLibrary(start, now)
|
library, err := arlo.GetLibrary(start, now)
|
||||||
@ -85,6 +83,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, recording := range *library {
|
for _, recording := range *library {
|
||||||
|
|
||||||
|
// The go func() here makes this script download the files concurrently.
|
||||||
|
// If you want to download them serially for some reason, just remove the go func() call.
|
||||||
|
go func() {
|
||||||
filename := fmt.Sprintf("%s %s.mp4", time.Unix(0, recording.UtcCreatedDate*int64(time.Millisecond)).Format(("2006-01-02 15:04:05")), recording.UniqueId)
|
filename := fmt.Sprintf("%s %s.mp4", time.Unix(0, recording.UtcCreatedDate*int64(time.Millisecond)).Format(("2006-01-02 15:04:05")), recording.UniqueId)
|
||||||
|
|
||||||
// The videos produced by Arlo are pretty small, even in their longest, best quality settings,
|
// The videos produced by Arlo are pretty small, even in their longest, best quality settings,
|
||||||
@ -96,6 +98,7 @@ func main() {
|
|||||||
} else {
|
} else {
|
||||||
log.Printf("Downloaded video %s from %s", recording.CreatedDate)
|
log.Printf("Downloaded video %s from %s", recording.CreatedDate)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all of the videos you just downloaded from the Arlo library.
|
// Delete all of the videos you just downloaded from the Arlo library.
|
||||||
|
Loading…
Reference in New Issue
Block a user