Skip to content
    music.app@daniellahorvath
    addSongs.py
    connect.py
    createSQLiteTbls.py
    deleteSongs.py
    deleteSongsV2.py
    GLAW4C21.db
    main.py
    menu.py
    menu1.py
    menu2.py
    readSongs.py
    reports.py
    reportsMenu.txt
    songsMenuMain.txt
    updateSongs.py
    updateSongsV2.py
    Config files
    .replit
    #import all modules/component
    import readSongs, addSongs, updateSongs, deleteSongsV2, reports

    #function tpo read from respective txt files (Songs and reports)


    def menuFiles():
    #open and read from the songsMenuMain.txt
    with open(r"songsMenuMain.txt") as mainMenu:
    userMainMenu = mainMenu.read()

    #open and read from the reportsMenu.txt
    with open(r"reportsMenu.txt") as subMenu:
    userSubMenu = subMenu.read()

    # return the value or what is held in the userMainMenuand userSubmenu
    return userMainMenu, userSubMenu # return as tuple[str, str] (index based)


    userChoices = menuFiles()

    #print(userChoices[0]) #userMainMenu
    #print("Sub Menu\n")
    #print(userChoices[1]) #userSubMenu


    #function for the main songs menu
    def songsMenu():
    options = 0 #created an option var and initialise it with an integer value 0
    #created a list of string items/elements
    optionsList = ["1", "2", "3", "4", "5", "6"]

    # call/invoke our menu files function
    userChoices = menuFiles()

    # while loop to check if options(intiger value) is present in the optionaList (string value)
    while options not in optionsList:
    # repeatedly do something or execute the code below

    #Display the options in the songsMenuMain.txt
    print(userChoices[0])

    # re-assign the value of the option var (input has a string data type by default)
    options = input("Enter an option from the songs main menu above: ")

    # check to see the reassigned options var value inputted is not present in the optionList
    if options not in optionsList:
    print(f"{options} is not a valid option in the songs menu!")
    return options


    # function for the report sub menu
    def reportSubMenu():
    options = 0
    optionsList = ["1", "2", "3"]
    reportChoices = menuFiles()

    while options not in optionsList:
    print(userChoices[1]) #userSubMenu

    options = input("Enter an option from the reports sub menu above: ")

    if options not in optionsList:
    print(f"{options} is not valid coice in the reports sub menu! ")
    return options


    print(reportSubMenu)

    #Main program: call the songs menu function and the report sub menu functions
    "Create a boolean variable"
    mainProgram = True

    while mainProgram: #while True
    # assing the songsmanu() function to mainMenu variable
    mainMenu = songsMenu(
    ) # returns and display the menu choices and input from the user

    # check/compare if the value from mainMenu variable above is the same as the value in the string
    # "1" == "1"
    if mainMenu == "1": # if this comparison is true
    # call/invoke the function in the respective python file
    readSongs.readData()

    elif mainMenu == "2":
    addSongs.insertData()

    elif mainMenu == "3":
    updateSongs.updateData()

    elif mainMenu == "4":
    deleteSongsV2.deleteRecord()

    elif mainMenu == "5":
    # reports.getrecords()
    reportProgram = True #create a boolean variable
    while reportProgram: #same as while True
    # return and display the menu reportSubMenu and input from the user ......0/1/2/3.....from the reportSubMenu function
    reportMenu = reportSubMenu() #

    # check/compare if the value from the reportMenu variable above is the same as the value of the string
    # "1/2/3" == "1"
    if reportMenu == "1":
    reports.getReports()

    elif reportMenu == "2":
    reports.searchReport()

    else:
    # re-assign the value of the reportProgram variable to False
    reportProgram = False
    input("Press enter to return to the Songs Menu")

    else:
    # re-assign the value of the mainProgram variable to False
    mainProgram = False #break
    input("Press enter to Quit the Songs App")

    #print(songsMenu())
    #print("This is a reports sub menu")