Skip to content

Commit

Permalink
add download caption into folder
Browse files Browse the repository at this point in the history
  • Loading branch information
alantsai committed May 11, 2019
1 parent 624f92c commit 0b2871b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Download-BuildResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function DownloadSession($sessionObject, $sessionSearchCount, $directory) {
$videoFile = "$directory\$code-$title\$code.mp4";
$slideFile = "$directory\$code-$title\$code.pptx";
$dataFile = "$directory\$code-$title\$code.txt";
$vttSubtitle = "$directory\$code-$title\$code.vtt";

#Video download.
if ($sessionObject.downloadVideoLink.Length -ne 0) {
Expand Down Expand Up @@ -176,6 +177,21 @@ function DownloadSession($sessionObject, $sessionSearchCount, $directory) {
else {
Write-Host "Data file exists: $dataFile"
}

#subtitle download.
if ($sessionObject.captionFileLink.Length -ne 0) {
if (!(test-path $vttSubtitle)) {
Write-Host "Downloading subtitle for: $title ($code).";
Start-BitsTransfer -Source $sessionObject.captionFileLink -Destination $vttSubtitle;
}
else {
Write-Host "subtitle exist: $vttSubtitle"
}
}
else {
Write-Host "The session $title ($code) does not contain a subtitle."
}

Write-Host("`r`n");
return $true;
}
Expand Down

0 comments on commit 0b2871b

Please sign in to comment.