Ejemplo n.º 1
0
def display_raport(album_list):
    os.system("clear")
    print("""'\033[1;32m
  _____            _____   ____  _____ _______ 
 |  __ \     /\   |  __ \ / __ \|  __ \__   __|
 | |__) |   /  \  | |__) | |  | | |__) | | |   
 |  _  /   / /\ \ |  ___/| |  | |  _  /  | |   
 | | \ \  / ____ \| |    | |__| | | \ \  | |   
 |_|  \_\/_/    \_\_|     \____/|_|  \_\ |_|   
                                               
  \033[1;m                                             
""")
    print("Number of artists: {}".format(count_artists(album_list)))
    print("Number of albums:  {}".format(count_albums(album_list)))
    print("Number of genres:  {}".format(count_genres(album_list)))
    print("\nThe longest album: ")
    inputs.show_shortest_longest_album(album_list, 'longest')
    print("\nThe shortest album: ")
    inputs.show_shortest_longest_album(album_list, 'shortest')
    #print("\n\tThe oldest album: ")
    #print("\n\tThe newest album: ")

    print("\nAll imported albums: ")
    display.display_table_header()
    for album in album_list:
        display.display_album_to_print(album)
Ejemplo n.º 2
0
def menu():
    album_list = []
    loop_handling = True
    while loop_handling:
        #os.system("clear")
        print("\n\t\t************MENU MUSIC**************\n")

        choice = input("""
                        A: Import Albums
                        B: Display Albums
                        C: Album Search
                        D: Report
                        Q: Quit

                        Please enter your choice: """)

        if choice == "A" or choice == "a":
            os.system("clear")
            display.logo_print()
            album_list = file_handler.import_albums("text_albums_data.txt")
        elif choice == "B" or choice == "b":
            os.system("clear")
            display.logo_print()
            display.display_table_header()
            for album in album_list:
                display.display_album_to_print(album)
        elif choice == "C" or choice == "c":
            os.system("clear")
            display.logo_print()
            search_menu(album_list)
        elif choice == "D" or choice == "d":
            os.system("clear")
            display.logo_print()
            music_reports.display_raport(album_list)
        elif choice == "Q" or choice == "q":
            os.system("clear")
            print("""\033[1;31m
            
           )               (         (     
   (    ( /(               )\ )      )\ )  
 ( )\   )\()) (        (  (()/( (   (()/(  
 )((_) ((_)\  )\       )\  /(_)))\   /(_)) 
((_)_ __ ((_)((_)   _ ((_)(_)) ((_) (_))   
 | _ )\ \ / /| __| | | | |/ __|| __|| _ \  
 | _ \ \ V / | _|  | |_| |\__ \| _| |   /  
 |___/  |_|  |___|  \___/ |___/|___||_|_\  
                                           
    \033[1;m
            """)
            sys.exit()
        else:
            print("You must only select either A,B,C, or D.")
            print("Please try again")
Ejemplo n.º 3
0
def genre_search(input_albums):
    loop_handling = True    
    while loop_handling:
        ask_user_about_genre = input("Please enter genre you want to find: ")
        genres = []
        for album_data in input_albums:
            genres.append(album_data[3])
        if ask_user_about_genre in genres:    
            display.display_table_header()
            for album in input_albums:
                if ask_user_about_genre in album[3]:
                    display.display_album_to_print(album)
            loop_handling = False
        else:
            print('No genre with given name on imported list.')                
Ejemplo n.º 4
0
def album_name_search(input_albums):
    loop_handling = True    
    while loop_handling:
        ask_user_about_album_name = input("Please enter album name you want to search for: ").title()
        albums = []
        for album_data in input_albums:
            albums.append(album_data[1])
        if ask_user_about_album_name in albums:    
            display.display_table_header()
            for album in input_albums:
                if ask_user_about_album_name in album[1]:
                    display.display_album_to_print(album)
            loop_handling = False
        else:
            print('No album with given name on imported list.')
Ejemplo n.º 5
0
def artist_search(input_albums):
    loop_handling = True    
    while loop_handling:
        ask_user_about_artist_name = input("Please enter full artist name you want to find: ").title()
        artists = []
        for album_data in input_albums:
            artists.append(album_data[0])
        if ask_user_about_artist_name in artists:    
            display.display_table_header()
            for album in input_albums:
                if ask_user_about_artist_name in album[0]:
                    display.display_album_to_print(album)
            loop_handling = False
        else:
            print('No artist with given name on imported list.')
Ejemplo n.º 6
0
def position_search(input_cv):
    loop_handling = True
    while loop_handling:
        ask_user_about_position_name = input("Wpisz interesujące Cię stanowisko/ pełna nazwa/ : ").title()
        positions = []
        for cv_data in input_cv:
            positions.append(cv_data[0])
        if ask_user_about_position_name in positions:
            display.display_table_header()
            for cv in input_cv:
                if ask_user_about_position_name in cv[0]:
                    display.display_cv_to_print(cv)
            loop_handling = False
        else:
            print("Brak stanowiska na zaimportowanej liście.")
Ejemplo n.º 7
0
def year_search(input_cv):
    loop_handling = True
    while loop_handling:
        ask_user_about_year = input("Wpisz interesujący Cię rok:  ")
        year = []
        for cv_data in input_cv:
            year.append(cv_data[2])
        if ask_user_about_year in year:
            display.display_table_header()
            for cv in input_cv:
                if ask_user_about_year in cv[2]:
                    display.display_cv_to_print(cv)
            loop_handling = False
        else:
            print("Brak daty")
Ejemplo n.º 8
0
def genre_search(input_cv):
    loop_handling = True
    while loop_handling:
        ask_user_about_genre = input("Wpisz interesującą Cię kategorię: ")
        genres = []
        for cv_data in input_cv:
            genres.append(cv_data[3])
        if ask_user_about_genre in genres:
            display.display_table_header()
            for cv in input_cv:
                if ask_user_about_genre in cv[3]:
                    display.display_cv_to_print(cv)
            loop_handling = False
        else:
            print("Brak kategorii! ")
Ejemplo n.º 9
0
def company_search(input_cv):
    loop_handling = True
    while loop_handling:
        ask_about_company = input("Wpisz interesującą Cię firmę").title()
        company = []
        for cv_data in input_cv:
            company.append(cv_data[1])
        if ask_about_company in company:
            display.display_table_header()
            for cv in input_cv:
                if ask_about_company in cv[1]:
                    display.display_cv_to_print(cv)
            loop_handling = False
        else:
            print("Brak firmy na zaimportowanej liście")
Ejemplo n.º 10
0
def year_search(input_albums):
    loop_handling = True
    while loop_handling:
        year_range = input('Enter a year range from which you want to find albums (yyyy-yyyy): ')
        if '-' in year_range:
            year_range = year_range.split('-')
            year_range = [int(year) for year in year_range]
            display.display_table_header()
            for album in input_albums:
                if int(album[2]) in range(year_range[0],year_range[1]+1):
                    display.display_album_to_print(album)
                else:
                    print('No album from given year range on imported list.')
                    break
            loop_handling = False
        else:
            print('Please write year range in yyyy-yyyy format.')
Ejemplo n.º 11
0
def menu():
    cv_list = []
    loop_handling = True
    while loop_handling:
        print("\n\t\t**************CV MENU************\n")

        choice = input("""
                1: Import cv
                2: Wyświetlanie cv
                3: Wyszukiwanie danych
                4: Raport 
                5: Wyjście
                
                Wprowadź wybór:  
        """)

        if choice == "1":
            os.system("clear")
            display.logo_print()
            cv_list = file_handler.import_cv("cv.txt")
        elif choice == "2":
            os.system("clear")
            display.logo_print()
            display.display_table_header()
            for cv in cv_list:
                display.display_cv_to_print(cv)
        elif choice == "3":
            os.system("clear")
            display.logo_print()
            search_menu(cv_list)
        elif choice == "4":
            os.system("clear")
            display.logo_print()
            cv_raport.display_raport(cv_list)
        elif choice == "5":
            os.system("clear")
            print("""\033[1;38m
            
            01000111 01101111 01101111 01100100 01100010 01111001 01100101 


            \033[1;m""")
            sys.exit()
        else:
            print("Spróbuj ponownie")
Ejemplo n.º 12
0
def show_shortest_longest_album(input_albums, album_length):
    actual_shortest_time = 1000000
    actual_longest_time = 0
    shortest_longest_album = []
    SECONDS_IN_MINUTE = 60
    
    for album in input_albums:
        album_time = album[4].split(':')
        album_time = [int(time) for time in album_time]
        album_time = album_time[0] * SECONDS_IN_MINUTE + album_time[1]
        
        if album_length == 'shortest':
            if album_time < actual_shortest_time:
                actual_shortest_time = album_time
                shortest_longest_album = album
        elif album_length == 'longest':
            if album_time > actual_longest_time:
                actual_longest_time = album_time
                shortest_longest_album = album
    
    display.display_table_header()
    display.display_album_to_print(shortest_longest_album)