Exemple #1
0
 def album_update(self):
     a_id = input("enter album's id: ")
     if Check.check_album(a_id):
         name = input("enter album's name: ")
         presentation_date = self.get_date()
         songs_number = input("enter number of songs in album: ")
         band_id = input("enter id of band which created album: ")
         while not Check.check_band(band_id):
             string = input(
                 "There is no such band\nYou can add it\n(y/n): ")
             for case in Switch(string):
                 if case('y'):
                     band = self.band_input()
                     band_id = band.id
                     db.insert_band(band)
                     break
                 if case('n'):
                     print("can't insert album")
                     return
                 else:
                     print("wrong input, try again!")
         album = Album(a_id, name, presentation_date, songs_number, band_id)
         return album
     else:
         print("No such album in db")
         return None
Exemple #2
0
 def band_update(self):
     b_id = input("enter band's id: ")
     if Check.check_band(b_id):
         name = input("enter band's name: ")
         genre = input("enter band's ganre: ")
         album_number = input("enter number of band's album: ")
         reward_existence = input(
             "enter band's reward existence (True/False): ")
         while reward_existence != "True" and reward_existence != "False":
             reward_existence = input("Wrong input!\nTry again: ")
         reward_existence = bool(reward_existence)
         country = input("enter band's native country: ")
         band = Band(b_id, name, genre, album_number, reward_existence,
                     country)
         return band
     else:
         print("No such band in db")
         return None
Exemple #3
0
def delete_entity(name):
    if name == "band":
        band_id = ui.get_id()
        if Check.check_band(band_id):
            db.delete_band(band_id)
        else:
            print("There is no such band in db\n")

    elif name == "album":
        album_id = ui.get_id()
        if Check.check_album(album_id):
            db.delete_album(album_id)
        else:
            print("There is no such album in db\n")

    elif name == "song":
        song_id = ui.get_id()
        if Check.check_song(song_id):
            db.delete_song(song_id)
        else:
            print("There is no such song in db\n")