2020-01-24 19:02:50 +02:00
|
|
|
package workflows
|
|
|
|
|
|
|
|
import (
|
2020-04-12 03:22:00 +03:00
|
|
|
res "github.com/pikami/tiktok-dl/resources"
|
|
|
|
fileio "github.com/pikami/tiktok-dl/utils/fileio"
|
|
|
|
log "github.com/pikami/tiktok-dl/utils/log"
|
2020-01-24 19:02:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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) {
|
2020-03-22 00:22:08 +02:00
|
|
|
if !fileio.CheckIfExists(batchFilePath) {
|
2020-03-22 02:10:24 +02:00
|
|
|
log.LogFatal(res.ErrorPathNotFound, batchFilePath)
|
2020-01-24 19:02:50 +02:00
|
|
|
}
|
|
|
|
|
2020-03-22 00:22:08 +02:00
|
|
|
fileio.ReadFileLineByLine(batchFilePath, downloadItem)
|
2020-01-24 19:02:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func downloadItem(batchItem string) {
|
|
|
|
if batchItem[0] == '#' {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-01-26 19:44:25 +02:00
|
|
|
StartWorkflowByParameter(batchItem)
|
2020-01-24 19:02:50 +02:00
|
|
|
}
|