Example #1
0
def handle_find_albums_by_genre(albums_list):
    """ Handler for manu option to search for albums with given by user genre. """
    music_reports.default_view()
    chosen_genre = music_reports.get_user_string_input('Enter music genre: ')
    albums_by_genre = music_reports.find_albums_by_condition(
        albums_list, chosen_genre, 3)
    music_reports.default_view()
    display.show_table(albums_by_genre, 'Albums in ' + chosen_genre + ' genre')
Example #2
0
def handel_albums_in_time_range(albums_list):
    """ Handler for menu option to serach for albums between given by user years. """
    music_reports.default_view()
    time = music_reports.get_dates_to_filter()
    music_reports.default_view()
    albums_between_time = music_reports.albums_from_given_time_range(
        albums_list, *time)
    display.show_table(
        albums_between_time,
        'Albums between years ' + str(time[0]) + ' and ' + str(time[1]))
Example #3
0
def handle_editing_entry(albums_list):
    """
    Handler for menu option to pick and edit entry from albums collection. After editing, entry is added to albums
    list and text file with albums data is updated.
    """
    music_reports.default_view()
    albums_list = music_reports.sort_list_by_column(albums_list, 0)
    display.show_table(albums_list, 'All albums in collection')
    album_index_to_edit = music_reports.get_user_index_input(
        'Enter number of entry to edit: ', albums_list)
    music_reports.default_view()
    albums_list = music_reports.edit_album_entry(albums_list,
                                                 album_index_to_edit)
    music_reports.export_list_to_file(albums_list)
    music_reports.default_view()