The Spotify Genre Popularity Project uses Spotify Developer Tool: Spotify API to provide users with such information as:
- top genre of the year or multiple years
- info about the whole year, which includes track sample link, their name, genres and authors.
- result of either search by track name or genre
- line graphs with information about genre popularity throughout the history.
Information is provided either visually in browser or in command console.
Project is implemented using Python, Python OOP, abstract data types and structures, Python libraries and modules. All the information about the process of developing and research is available on the project's wiki.
main.py -- main module to use the program to its fullest in form of menu.
main_test.py –– main module with the actual program, which launches a simulation and gives tutorial for the code.
json_builder.py -- module for creating JSOn file, that uses Spotify API and web-parse. It provide repeated usuability of the program without having to wait for half an hour.
music_adt.py –– module with Music ADT.
list.py –– module with list data structure.
linkedlist.py –– module with linked list data structure.
dictionary.py –– module with modified dict data structures.
Project's purpose is to make it easier for people who research or are interested in music trends and genres by giving the code to use API and receive the information they can research on. Graph with data also make it much easier to research tendencies, congruences and changes of the music genres.
In order to use it such modules and libraries should be installed (in addition to project's main modules): bs4, plotly, spotipy, others are inbuilt.
The graph page is opened locally. The text info is printed in the console of the program you are using to open this project.
All the data is created, loaded and saved automatically, using Spotify's API, with no need in input from the user.
Output data is represented visually by graphics, or text in the command console.
Main module consists of functions, used to create and interact with the ADT in the form of menu app.
Module with MusicADT contains functions to fill it with premade json string data, create and open in browser window graphics, provide information for targeted years or genres, or perform search though itself. All the important music data is stored in that container.
Module json_builder creates a json, using Spotify API and web-page parsing to get all the necessary info and save it, so that program wouldn't run for half an hour each time it is launched.
Modules with list, linked list and dictionary data structures consist of corresponding classes (and their node classes).
To get more information about functions, classes and their methods, have a look at the documentation.
libs_and_modules_usage_example.py –– module with examples of libraries and modules usage.
spotify_api_usage_example.py –– module with Spotify API usage example.
adt_usage_example.py –– module with MusicADT usage example.
Obtaining Spotify's developer key is necessary only for creating already existing JSON file. If you want to do this yourself, you need to create dashboard and get Client ID and Secret. It can be done here: https://developer.spotify.com/dashboard/
Install Spotipy, Plotly and BeautifulSoup:
pip install bs4
pip install spotipy
pip install plotly
There are three modules, provided for testing libraries and modules, used in the project (they should be installed on the computer, the module will show, how the data is extracted, used and represented), abstract data type Music container (the module demonstrates capabilities of the adt and its functionality, by loading data into the adt and showing some visual representations, using adt methods and plotly) and API (the module demonstrates, which data can be get with that Spotify API).
They are located in the 'examples' folder.
- Butynets' Danylo, Ukrainian Catholic University, 2020
- MIT License