mirror of
https://github.com/pikami/tiktok-dl.git
synced 2026-04-23 23:08:48 +01:00
Fixed circular dependency issue
This commit is contained in:
@@ -2,7 +2,7 @@ package workflows
|
||||
|
||||
import (
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
fileio "../utils/fileio"
|
||||
log "../utils/log"
|
||||
)
|
||||
|
||||
@@ -13,11 +13,11 @@ func CanUseDownloadBatchFile(batchFilePath string) bool {
|
||||
|
||||
// DownloadBatchFile - Download items from batch file
|
||||
func DownloadBatchFile(batchFilePath string) {
|
||||
if !utils.CheckIfExists(batchFilePath) {
|
||||
if !fileio.CheckIfExists(batchFilePath) {
|
||||
log.LogFatal(res.ErrorPathNotFound, batchFilePath)
|
||||
}
|
||||
|
||||
utils.ReadFileLineByLine(batchFilePath, downloadItem)
|
||||
fileio.ReadFileLineByLine(batchFilePath, downloadItem)
|
||||
}
|
||||
|
||||
func downloadItem(batchItem string) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
fileio "../utils/fileio"
|
||||
log "../utils/log"
|
||||
)
|
||||
|
||||
@@ -31,7 +32,7 @@ func DownloadHashtag(url string) {
|
||||
hashtag := utils.GetHashtagFromURL(url)
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, hashtag)
|
||||
|
||||
utils.InitOutputDirectory(downloadDir)
|
||||
fileio.InitOutputDirectory(downloadDir)
|
||||
|
||||
for index, upload := range uploads {
|
||||
downloadVideo(upload, downloadDir)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
fileio "../utils/fileio"
|
||||
log "../utils/log"
|
||||
)
|
||||
|
||||
@@ -32,7 +33,7 @@ func DownloadMusic(url string) {
|
||||
username := utils.GetUsernameFromString(upload.Uploader)
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
|
||||
|
||||
utils.InitOutputDirectory(downloadDir)
|
||||
fileio.InitOutputDirectory(downloadDir)
|
||||
downloadVideo(upload, downloadDir)
|
||||
log.Logf("\r[%d/%d] Downloaded", index+1, uploadCount)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
fileio "../utils/fileio"
|
||||
log "../utils/log"
|
||||
)
|
||||
|
||||
@@ -32,7 +33,7 @@ func DownloadUser(username string) {
|
||||
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
|
||||
|
||||
utils.InitOutputDirectory(downloadDir)
|
||||
fileio.InitOutputDirectory(downloadDir)
|
||||
|
||||
for index, upload := range uploads {
|
||||
downloadVideo(upload, downloadDir)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
fileio "../utils/fileio"
|
||||
log "../utils/log"
|
||||
)
|
||||
|
||||
@@ -32,7 +33,7 @@ func DownloadSingleVideo(url string) {
|
||||
}
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
|
||||
|
||||
utils.InitOutputDirectory(downloadDir)
|
||||
fileio.InitOutputDirectory(downloadDir)
|
||||
downloadVideo(upload, downloadDir)
|
||||
log.Log("[1/1] Downloaded\n")
|
||||
}
|
||||
@@ -42,7 +43,7 @@ func downloadVideo(upload models.Upload, downloadDir string) {
|
||||
uploadID := upload.GetUploadID()
|
||||
downloadPath := fmt.Sprintf("%s/%s.mp4", downloadDir, uploadID)
|
||||
|
||||
if utils.CheckIfExists(downloadPath) {
|
||||
if fileio.CheckIfExists(downloadPath) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user