freedom-legacy/freedom.go

69 lines
1.6 KiB
Go
Raw Permalink Normal View History

2018-12-28 02:27:34 +00:00
package main
import (
"fmt"
)
func DownloadTrack() {
fmt.Print("Please provide a spotify track id: ")
// track_id
var track_id string
_, _ = fmt.Scanln(&track_id)
// folder
var folder = root_track_folder
var userFolder string
if check_if_track_is_valid(track_id) {
fmt.Print("Please provide a folder name: "+root_track_folder)
_, _ = fmt.Scanln(&userFolder)
} else {
fmt.Println("Not a valid spotify track id.\nPlease provide a correct one.\n")
waitForInput()
main()
}
lens := len(userFolder)
var newVal string
if lens > 0 {
newVal = userFolder[lens-1:]
} else {
newVal = folder[len(folder)-1:]
}
if string(newVal) != "/" {
userFolder = userFolder + "/"
}
folder = folder + userFolder
fmt.Println(folder)
download_track_to_folder(track_id,folder)
waitForInput()
}
func DownloadPlaylist() {
fmt.Print("Please provide a spotify playlist id: ")
// playlist_id
var playlist_id string
_, _ = fmt.Scanln(&playlist_id)
fmt.Print("Please provide the user id of the playlists owner: ")
// owner_id
var owner_id string
_, _ = fmt.Scanln(&owner_id)
download_playlist_to_folder(playlist_id,owner_id,root_playlists_folder)
waitForInput()
}
func DownloadAllPlaylistsOfUser() {
// fmt.Print("Please provide a spotify user id: ")
// user_id
var user_id = ""
// _, _ = fmt.Scanln(&user_id)
download_all_playlist_of_user(user_id,root_user_folder+user_id+"/")
waitForInput()
}