2020-01-26 17:44:25 +00:00
|
|
|
package workflows
|
|
|
|
|
|
|
|
import (
|
|
|
|
models "../models"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// StartWorkflowByParameter - Start needed workflow by given parameter
|
|
|
|
func StartWorkflowByParameter(url string) {
|
|
|
|
|
|
|
|
// Music
|
|
|
|
if CanUseDownloadMusic(url) {
|
|
|
|
DownloadMusic(url)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Single video
|
|
|
|
if CanUseDownloadSingleVideo(url) {
|
|
|
|
DownloadSingleVideo(url)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tiktok user
|
|
|
|
if CanUseDownloadUser(url) {
|
2020-01-27 18:46:10 +00:00
|
|
|
DownloadUser(models.GetUsernameFromString(url))
|
2020-01-26 17:44:25 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
panic(fmt.Sprintf("Could not recognise URL format of string %s", url))
|
|
|
|
}
|