// Package package main // Libraries import ( backend "SongPuller/src" "fmt" ) // Variables var pages = [2]backend.CLI{} var page int = 0 // Functions func initPages() { // Holders var cPage backend.CLI // Main Menu /// Creating variable cPage.Init("Main Menu", func() { fmt.Println("1) Download a Song") fmt.Println("2) Exit") fmt.Print("Select option [1-2]: ") // The scan variable var usrInput string // Scanning what the user wants fmt.Scanln(&usrInput) // Based on this, what do we do? if usrInput == "1" { page = 1 } }) /// Append page pages[0] = cPage // Song Info /// Creating variable cPage.Init("Song Information", func() { // The scan variable var usrInput string var songURL string // Introduction fmt.Println("Before we proceed, Some basic info") fmt.Println("This program is designed to download songs from:") fmt.Print(string(backend.CliYellow)) fmt.Println(" - Soundcloud") fmt.Print(string(backend.CliWhite)) fmt.Println() fmt.Println("We just need you to give us some very basic information.") fmt.Println() // The URL of the site fmt.Println("First, what's the Share URL of your song?") fmt.Print("URL [https://www.soundcloud.com/---]: ") // Scanning what the user wants fmt.Scanln(&songURL) fmt.Println() // Running the puller var meta backend.SongMetadata meta.Init("soundcloud", songURL) // Asking if the song name is correct fmt.Println("Is your song's name: " + string(backend.CliGreen) + meta.Title + string(backend.CliWhite) + "?") fmt.Print("Select option [y/n]: ") // Scanning if the user likes what is shown fmt.Scanln(&usrInput) fmt.Println() // If it's not the song they want, then appologize! if usrInput != "y" && usrInput != "Y" { fmt.Println() fmt.Println("Sorry about that! If you could please try that again.") fmt.Println() } // Switch back to main menu page = 0 }) /// Append page pages[1] = cPage } // Entry Point func main() { // Initilizing pages initPages() // Run Loop for backend.Running { // Doing page stuff pages[page].Run() } }