tiktok-dl/workflows/downloadBatchFile.go
2020-03-22 00:22:08 +02:00

30 lines
632 B
Go

package workflows
import (
res "../resources"
fileio "../utils/fileio"
log "../utils/log"
)
// CanUseDownloadBatchFile - Check's if DownloadBatchFile can be used
func CanUseDownloadBatchFile(batchFilePath string) bool {
return batchFilePath != ""
}
// DownloadBatchFile - Download items from batch file
func DownloadBatchFile(batchFilePath string) {
if !fileio.CheckIfExists(batchFilePath) {
log.LogFatal(res.ErrorPathNotFound, batchFilePath)
}
fileio.ReadFileLineByLine(batchFilePath, downloadItem)
}
func downloadItem(batchItem string) {
if batchItem[0] == '#' {
return
}
StartWorkflowByParameter(batchItem)
}