forked from Manal-jpg/csc111-group-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (36 loc) · 1.71 KB
/
main.py
File metadata and controls
45 lines (36 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
CSC111 Winter 2023 Project:
MelodyMatch: Tailored Music Recommendations Derived From Your Spotify Habits
This is the main module where the entire program is run.
Copyright and Usage Information
===============================
This file is provided solely for the personal and private use by students and faculty
of the CSC111 course department at the University of Toronto. All forms of distribution
of this code, whether as is or with changes, are prohibited. For more information on
copyright for this project's materials, please contact the developers directly.
This file is Copyright (c) 2023 Manaljav Munkhbayar, Kevin Hu, Stanley Pang, Jaeyong Lee.
"""
from user import generate_user
from decision_tree import load_tree_with_songs
from song import load_songs
import launch_web_server_ui
import application_ui
def get_spotify_data() -> None:
"""Obtains authorization to access user's Spotify data.
"""
launch_web_server_ui.create_initial_window()
def run(use_example_data: bool) -> None:
"""Runs the recommendation algorithm and displays results.
The use_example_data parameter determines whether to use data obtained from a Spotify account or
the sample data provided.
"""
try:
songs = load_songs()
tree = load_tree_with_songs(songs)
user = generate_user(use_example_data)
results = tree.find_songs_for_user(tree, user)
application_ui.create_application_window(list(results))
except FileNotFoundError:
print('The necessary data could not be found! Make sure you run get_spotify_data() first. \n'
'Did you want to use our provided example dataset? \n'
'Then, make sure to call run() with the boolean argument True.')