add video-only mode
This commit is contained in:
@@ -212,7 +212,7 @@ func DownloadVideo(httpClient *http.Client, accessToken, courseID, modDir, input
|
||||
}
|
||||
}
|
||||
|
||||
func DownloadMainRecordings(httpClient *http.Client, accessToken, courseID, root string) {
|
||||
func DownloadMainRecordings(httpClient *http.Client, accessToken, courseID, root string, videosOnly bool) {
|
||||
fmt.Println("\n[*] Checking for main Panopto recordings...")
|
||||
|
||||
jar, _ := cookiejar.New(nil)
|
||||
@@ -300,8 +300,18 @@ func DownloadMainRecordings(httpClient *http.Client, accessToken, courseID, root
|
||||
}
|
||||
os.WriteFile(cookieFile, []byte(cData), 0o644)
|
||||
|
||||
recordingsDir := filepath.Join(root, "Recordings")
|
||||
os.MkdirAll(recordingsDir, 0o755)
|
||||
var downloadDir string
|
||||
var outputTemplate string
|
||||
|
||||
if videosOnly {
|
||||
// Flat: all videos go directly into course root
|
||||
downloadDir = root
|
||||
outputTemplate = "%(title)s.%(ext)s"
|
||||
} else {
|
||||
downloadDir = filepath.Join(root, "Recordings")
|
||||
os.MkdirAll(downloadDir, 0o755)
|
||||
outputTemplate = "%(playlist_title)s/%(title)s.%(ext)s"
|
||||
}
|
||||
|
||||
fmt.Println("[*] Starting yt-dlp download for main recordings...")
|
||||
|
||||
@@ -310,8 +320,8 @@ func DownloadMainRecordings(httpClient *http.Client, accessToken, courseID, root
|
||||
cmd := exec.Command(ytCmd,
|
||||
"--cookies", cookieFile,
|
||||
"--referer", config.BaseURL+"/",
|
||||
"-P", recordingsDir,
|
||||
"-o", "%(playlist_title)s/%(title)s.%(ext)s",
|
||||
"-P", downloadDir,
|
||||
"-o", outputTemplate,
|
||||
decodedURL,
|
||||
)
|
||||
cmd.Stdout = os.Stdout
|
||||
|
||||
Reference in New Issue
Block a user