Skip to main content

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: Build Status

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 : str

            Name (or path) of the CSV file (without the .csv extension) that containes the playlist data.

          • table : pandas.DataFrame

            The pandas DataFrame that contains the playlist data.

          • length : int

            Total number of songs (rows) in the playlist.

          • ids : pandas.Series

            Unique identifiers (Track ID) of songs in the playlist

          • tracks : pandas.Series

            The title(s) of the song(s) in the playlist.

          • albums : pandas.Series

            The album(s) of the song(s) in the playlist.

          • artists : pandas.Series

            The artist name(s) of the song(s) in the playlist.

          • releases : pandas.Series

            The release date(s) of the song(s) in the playlist.

          • durations : pandas.Series

            The duration (millisecond) of the song(s) in the playlist.

          • genres : pandas.Series

            The genres of the song(s) in the playlist.

          • labels : pandas.Series

            The record label that publishes the song(s) in the playlist.

          • tempos : pandas.Series

            The tempo (BPM) of the song(s) in the playlist.

      • 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 : list

            The most frequent record label in the playlist and its corresponding count of occurence in the playlist.

          • topArtists : list

            The most frequent artist in the playlist and its corresponding count of occurence in the playlist.

          • topGenres : list

            The most frequent genre in the playlist and its corresponding count of occurence in the playlist.

          • shortest : list

            The song with the shortest duration in the playlist (title, artist, duration).

          • longest : list

            The song with the longest duration in the playlist (title, artist, duration).

          • slowest : list

            The song with the slowest tempo in the playlist (title, artist, tempo).

          • fastest : list

            The song with the fastest tempo in the playlist (title, artist, tempo).

        • Methods:

          • plstats(): Prints the statistical summary of the playlist.
  • 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 : str

            A string containing the question being asked of the user.

          • cur_options : list of str

            A 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).
    • 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 : QuestionBuilder

            An instance of the 'QuestionBuilder' class specific to the current playlist.

          • score : int

            The number of questions correctly answered in the current game.

          • q_count : int

            The 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spotyourspotify-0.0.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SpotYourSpotify-0.0.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

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

Hashes for spotyourspotify-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7d6c41809ef514aba77d09051b6f39da4984a19be191bbfbbd85b7c3fef5c294
MD5 74a550bcfdd9f8feac35296c4d5b7c5e
BLAKE2b-256 bfa52fbff358f79c8ac3e81a698949aff3da54c2de9205a973c41b1e991240bd

See more details on using hashes here.

File details

Details for the file SpotYourSpotify-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for SpotYourSpotify-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5515e22afe4b1f1742653db9a2a1bdafd00a55c1e5316fa138741c8d7f7171cd
MD5 4033ef88adb718a973cd955fcaa9b4c3
BLAKE2b-256 bca5f383dabd7bd5735b399fa662b78fc54f512735c8ed9935521a0a487a233a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page