A package that contains two subpackages: stats and quiz. Stats allows users to gain insights about their Spotify playlist such as top artist, longest song, slowest song, etc. Quiz allows users to enter a game where they will be questioned on how well they know their playlist. The program will read a CSV file of the user playlist that users can obtain using Exportify.
Project description
Spot Your Spotify
Collaborative programming DATA 533 Project by Seamus Riordan-Short and Jason Samuel Suwito.
Travis CI passing build stamp:
Project idea: Personalized Spotify Playlist Stats & Quiz: Spot your Spotify.
A package that contains two subpackages: stats and quiz. Stats allows users to gain insights about their Spotify playlist such as top artist, longest song, slowest song, etc. Quiz allows users to enter a game where they will be questioned on how well they know their playlist. The program will read a CSV file of the user playlist that users can obtain using Exportify.
Package: spotyourspotify
-
Subpackage: stats: contains all the code for parsing and analysing playlist
-
Module:
readdata: for parsing the playlist-
Class:
Playlist: A class for playlist managing and interaction. The Question class loads the playlist data from a user's CSV file. It allows access to the data including functions to fetch specific songs and its corresponding attributes.- Methods:
showtable(): Prints the playlist table.getSong(index): Fetch a song data from the playlist at a specified index.getSongId(id): Fetch a song data from the playlist by a specified id.randSong(): Returns a random song from the playlist.
- Attributes:
-
filename: strName (or path) of the CSV file (without the .csv extension) that containes the playlist data.
-
table: pandas.DataFrameThe pandas DataFrame that contains the playlist data.
-
length: intTotal number of songs (rows) in the playlist.
-
ids: pandas.SeriesUnique identifiers (Track ID) of songs in the playlist
-
tracks: pandas.SeriesThe title(s) of the song(s) in the playlist.
-
albums: pandas.SeriesThe album(s) of the song(s) in the playlist.
-
artists: pandas.SeriesThe artist name(s) of the song(s) in the playlist.
-
releases: pandas.SeriesThe release date(s) of the song(s) in the playlist.
-
durations: pandas.SeriesThe duration (millisecond) of the song(s) in the playlist.
-
genres: pandas.SeriesThe genres of the song(s) in the playlist.
-
labels: pandas.SeriesThe record label that publishes the song(s) in the playlist.
-
tempos: pandas.SeriesThe tempo (BPM) of the song(s) in the playlist.
-
- Methods:
-
Class:
Song: A class for managing and interacting a single song in the playlist. The Song class is initialized with a playlist object and optional identifier (index or Track ID). A random song is selected if the optional identifier is not provided.
-
-
Module:
showstats: contains the code for analysing playlist and giving fun stats.- Class:
Playlist: A class that inherits the base Paylist class in the readdata module. This Playlist class extends the functionality of the base Playlist class by providing additional insights about the playlist data including information about most frequent labels, artists, genres, shortest duration, longest duration, slowest tempo, and fastest tempo.-
Attributes:
-
topLabel: listThe most frequent record label in the playlist and its corresponding count of occurence in the playlist.
-
topArtists: listThe most frequent artist in the playlist and its corresponding count of occurence in the playlist.
-
topGenres: listThe most frequent genre in the playlist and its corresponding count of occurence in the playlist.
-
shortest: listThe song with the shortest duration in the playlist (title, artist, duration).
-
longest: listThe song with the longest duration in the playlist (title, artist, duration).
-
slowest: listThe song with the slowest tempo in the playlist (title, artist, tempo).
-
fastest: listThe song with the fastest tempo in the playlist (title, artist, tempo).
-
-
Methods:
plstats(): Prints the statistical summary of the playlist.
-
- Class:
-
-
Subpackage:
quiz: contains modules and functions to build and run the quiz for the user based on their playlist stats.-
Module:
quizbuilder: build the quiz with question libraries-
Class:
Question: A class for a question in the quiz game. The Question class allows for questions to be built based on the current playlist. It includes functions for fetching songs, checking the desired question type, and checking the validity of answers.-
Attributes:
-
cur_question: strA string containing the question being asked of the user.
-
cur_options: list of strA list of strings containing four possible solutions to the question (one correct).
-
cur_solution:A string containing the correct answer to the question being asked.
-
-
Methods:
getdata(num_song=4): Builds a list of songs randomly selected from the playlist, used as options when generating questions.makequestion(question_type : str): Takes the desired question type as an argument, calls the appropriate question type function, and returns the question information (question, options, and solution).checker(user_input, solution): Compares the user input answer to the correct solution and returns True if correct, false otherwise.
-
-
Class
QuestionBuilder(Question): A class for different question types in the quiz game. Inherits from the Question class and includes methods for various types of questions.- Methods:
artist_question(): Builds a question identifying a song's artist.label_question(): Builds a question identifying a song's record label.length_question(): Builds a question comparing song lengths.age_question(): Builds a question comparing song release dates.tempo_question(): Builds a question comparing song tempos (BPM).
- Methods:
-
-
Module:
playgame: run the quiz-
Class
Game: A class for a quiz game. The Game class handles most aspects of conducting the quiz game, including all interactions with the user for the main game loop, as well as functions such as setting a random seed, asking questions, checking solutions, and keeping score.-
Attributes:
-
q_builder: QuestionBuilderAn instance of the 'QuestionBuilder' class specific to the current playlist.
-
score: intThe number of questions correctly answered in the current game.
-
q_count: intThe number of questions asked in the current game.
-
-
Methods:
getoptions(): Returns a list of possible question types.setseed(): Sets random seed for reproducibility in otherwise randomized actions (question order).ask(q_type : str): Gets a question, asks the user, and checks user input answer against correct solution.getscore(): Prints number of correct answers and number of total questions asked.play(): Takes the user through the main quiz game loop.
-
-
-
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spotyourspotify-0.0.2.tar.gz.
File metadata
- Download URL: spotyourspotify-0.0.2.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d6c41809ef514aba77d09051b6f39da4984a19be191bbfbbd85b7c3fef5c294
|
|
| MD5 |
74a550bcfdd9f8feac35296c4d5b7c5e
|
|
| BLAKE2b-256 |
bfa52fbff358f79c8ac3e81a698949aff3da54c2de9205a973c41b1e991240bd
|
File details
Details for the file SpotYourSpotify-0.0.2-py3-none-any.whl.
File metadata
- Download URL: SpotYourSpotify-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5515e22afe4b1f1742653db9a2a1bdafd00a55c1e5316fa138741c8d7f7171cd
|
|
| MD5 |
4033ef88adb718a973cd955fcaa9b4c3
|
|
| BLAKE2b-256 |
bca5f383dabd7bd5735b399fa662b78fc54f512735c8ed9935521a0a487a233a
|