Add files only mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -12,6 +13,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
filesOnly := flag.Bool("fo", false, "Files only mode - download all files to a single directory without module structure")
|
||||
flag.Parse()
|
||||
|
||||
httpClient := &http.Client{}
|
||||
|
||||
authenticator := auth.NewAuthenticator(httpClient)
|
||||
@@ -25,7 +29,7 @@ func main() {
|
||||
fmt.Print("Enter Course ID: ")
|
||||
fmt.Scanln(&courseID)
|
||||
|
||||
canvasClient := canvas.NewClient(httpClient, accessToken, courseID)
|
||||
canvasClient := canvas.NewClient(httpClient, accessToken, courseID, *filesOnly)
|
||||
|
||||
if err := canvasClient.GetCourseInfo(); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
@@ -40,5 +44,7 @@ func main() {
|
||||
|
||||
canvasClient.DownloadModules(courseRoot)
|
||||
|
||||
panopto.DownloadMainRecordings(httpClient, accessToken, courseID, courseRoot)
|
||||
if !*filesOnly {
|
||||
panopto.DownloadMainRecordings(httpClient, accessToken, courseID, courseRoot)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user