Both the script and the Readme are generated by AI using google Gemini ;)
This is a Python script that helps you manage your record collection. It allows you to add, view, search, edit, and delete records, and it saves your data to a JSON file.
-
Prerequisites:
- Python 3.x installed on your system.
-
Download the script:
- Download the
record_manager.pyfile.
- Download the
-
Run the script:
- Open your terminal or command prompt.
- Navigate to the directory where you saved the
record_manager.pyfile. - Run the script using the command:
python record_manager.py
-
Follow the menu:
- The script will display a menu with the following options:
- Add Record: Add a new record to your collection.
- View Collection: Display all records in your collection.
- Search Collection: Search for records by artist, album title, genre, or year.
- Edit Record: Edit an existing record in your collection.
- Delete Record: Delete a record from your collection.
- Sort Collection by Artist: Sort the records in your collection alphabetically by artist name.
- Generate HTML List: Generate an HTML file of your record collection.
- Save and Exit: Save your collection to a file and exit the script.
- Enter the number corresponding to your choice and press Enter.
- The script will display a menu with the following options:
-
Enter record details:
- When adding or editing a record, you will be prompted to enter the following information:
- Artist
- Album Title
- Genre
- Release Year
- Format (e.g., LP, 7", CD)
- Notes (optional)
- When adding or editing a record, you will be prompted to enter the following information:
-
Search for records:
- When searching, you will be prompted to choose a search criterion (artist, album, genre, year) and enter your search term.
-
Edit or delete records:
- When editing or deleting, you will be shown a numbered list of your records. Enter the number of the record you want to edit or delete.
-
Save your collection:
- Choose the "Save and Exit" option to save your collection to the
record_collection.jsonfile. This file will be created in the same directory as the script. Your data will be preserved between script runs.
- Choose the "Save and Exit" option to save your collection to the
- The script stores your record collection in a JSON file named
record_collection.json. - This file is created automatically when you run the script for the first time or when you save your collection.
- The script also generates an HTML file named
record_collection.htmlwhen you choose the "Generate HTML List" option.
- Add Record: Add new records to your collection.
- View Collection: View all records in your collection.
- Search Collection: Search for records by artist, album, genre, or year.
- Sort Collection by Artist: Sort the records in your collection alphabetically by artist name.
- Edit Record: Modify existing records.
- Delete Record: Remove records from your collection.
- Generate HTML List: Generate an HTML file of your record collection.
- Save and Exit: Save your data to a JSON file.
- Data Persistence: Your collection is saved to a file and loaded when you run the script again.
- Basic Input Validation: The script includes basic input validation, such as stripping whitespace.
- The script includes error handling for file loading issues. If the JSON file is corrupted, the script will start with an empty collection.
- The script also handles invalid user input, such as entering non-numeric values when a number is expected.