Project_Report
Project_Report
Group 7
In today's digital era, managing and organizing a personalized movie
watchlist can be confusing. Users often struggle to keep track of their
favorite movies and find relevant details, such as genre, release year, and
IMDb ratings. This project aims to solve this problem by providing a Python-
based movie/series management application that allows users to view,
select, and store their favorite shows in a structured and reusable format.
How it works
1. show_movies()
The function begins by extracting the titles from the first column of an
Excel dataset. It iterates over each row in the column, starting from the
second row (to skip headers), and stores the titles in a list named titles.
Display Logic:
First Page: If the user is on the first page, only the "Next" option is
available for navigation.
Middle Pages: If the user is in the middle of the list, both "Next" and
"Back" options are provided to navigate forwards or backwards.
Last Page: When the user reaches the last page, only the "Back"
option is available.
Handling User Input:
The function waits for user input to determine the next action:
2. Show_descriptions()
The function begins by preparing a list called descriptions, which contains all
the relevant data from the dataset. Each row of the dataset corresponds to a
movie, and the columns represent various attributes, such as the movie's
title, genre, release year, and IMDb rating.
This is achieved by iterating over the rows in the dataset, starting from
the second row (to skip headers), and appending each row to the
descriptions list. Each row is stored as a tuple of values.
Displaying the Selected Movie's Details:
The function takes an integer i as input, representing the index of the movie
selected in the show_movies function. Using this index, it retrieves the
corresponding movie's details from the descriptions list.
After displaying the movie's details, the function asks the user whether they
want to add this movie to their favorites list:
Yes: If the user chooses "Yes," the function creates a new list, movie,
containing only the movie's title, type, genre, release year, and IMDb
rating. This list is then returned to the caller, signaling that the movie
has been added to the favorites list.
No: If the user chooses "No," the function exits without adding the
movie to the favorites list and returns None.
3. Favorite_add
The favorite_add function saves the user's selected favorite movies to
an Excel file named favorite_movies.xlsx. It ensures data persistence by
creating or updating the file with the user's favorites while avoiding duplicate
entries. This function is critical for maintaining a structured record of movies
the user has chosen.
Error Handling:
If the file does not exist or cannot be loaded, the function catches the
exception, prints an error message, and creates a new workbook from
scratch. The default sheet is renamed to "Favorites".
The function checks whether the sheet is empty (no existing rows or
cells are populated).
If empty, the header row is added at the top to label the columns. This
ensures consistency in the structure of the data.
The function reads all existing rows in the sheet and converts them
into a set of tuples (existing_data).
Before appending a new movie, it checks if the movie (represented as
a tuple of its details) is already in existing_data. This prevents
duplicate entries.
After updating the sheet with new movies, the workbook is saved back
to favorite_movies.xlsx.
If there is an issue during saving, the function catches the exception
and prints an error message.
The function provides clear feedback, notifying the user whether the
favorites were successfully saved or if an error occurred during the
process.
Main
The main function is the central hub of the application, responsible for
managing user interactions and orchestrating the flow of operations. It
provides users with three main options:
Option 1: Display the movie list and allow users to search for
movies to add to their favorites.
Option 2: Display the current list of favorite movies stored in an
Excel file.
Option 3: Delete the Excel file containing the favorite movies.
3. View Favorites:
Appendix