Add files only mode

This commit is contained in:
2026-03-11 17:37:18 +01:00
parent c9fa079893
commit 352315b041
2 changed files with 36 additions and 7 deletions

View File

@@ -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)
}
}