tiktok-dl/workflows/downloadBatchFile.go

30 lines
622 B
Go
Raw Normal View History

package workflows
import (
res "../resources"
utils "../utils"
2020-03-22 00:10:24 +00:00
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 !utils.CheckIfExists(batchFilePath) {
2020-03-22 00:10:24 +00:00
log.LogFatal(res.ErrorPathNotFound, batchFilePath)
}
utils.ReadFileLineByLine(batchFilePath, downloadItem)
}
func downloadItem(batchItem string) {
if batchItem[0] == '#' {
return
}
StartWorkflowByParameter(batchItem)
}