Skip to content

mballard29/this-sounds-like

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This sounds like...

a web application powered by Python, Flask, and BeautifulSoup

Create and activate a python virtual environment, download dependent packages, set flask environment variables, and run. View in localhost:5000. See example commands for Mac below.

source env/bin/activate
export FLASK_APP=app
export FLASK_ENV=development
flask --app app.py --debug run

Landing page

Enter a Genius.com page's url for an album or song to search for who created and contributed to your favorite tracks, get clues to what tracks your favorite songs sampled, and get a sense of what makes a songwriter's or producer's style unique.

When Album Page is in Dark Mode, Colors adapt to album cover

View alternate album covers for alongside the credits for each track. Click on the album title or individual track titles to go to the source page on Genius to dig deeper. In dark mode, see how the page adapts to the colors of the primary album artwork.

Song view example

Look at singles or individual songs to focus on individual production categories.

About

What is this?

A web application that collects the credits of your favorite albums and songs.

How?

The backend is a SQLite3 database. The website and it's routes were made with Python Flask. The data, including the album title, artist, tracklist, and the credits, are collected from Genius.com's credits section of each track of an album using BeautifulSoup for webscraping. Each webpage was made by customizing html and css templates from Bootstrap.

Why?

I wanted to try to explore web scraping. Creating something hosted in a browser application like a web application seemed like it may be able to be up and running sooner. Python is familiar to me, but it also a very flexible language. Genius pages have better attribution data than Spotify, but they are all on separate pages all the way at the bottom of the page. 'How' and 'why' questions drive so much of what I do, and they are also so central to my personality and the way my brain works. I've like music, and I like being able to see if I can tease apart musical influences and identifying features in my favorite works whether that's identifying what makes a melody sound like it was composed by Caroline Polacheck or if a newly released album sounds like it is part of the canon of PC Music pioneered by AG Cook and SOPHIE. All of that starts with getting the data on who did what, and then what connections can be made from there.

Usage

On the home page, enter the link to an album page or song lyrics page from Genius.com. Examples:
- 'https://genius.com/albums/<artist name>/<album name>' like https://genius.com/albums/Oklou/Choke-enough
- 'https://genius.com/<artist name>-<song name>-lyrics' like https://genius.com/Sza-the-weekend-lyrics

Future improvements

  • Extend functionality to work for singles/specific songs (that don't have album links available)
    • sort of: some song pages don't have album artwork links to be scraped
    • treating individual songs to be scraped as singles (hierarchical table structure) can lead to database bloat and (unhelpful) redundancy (higher normalization)(doesn't degrade performance right now)
    • is the formatting of an album page still the best presentation of info for individual songs, or does it need a unique layout (path)
  • Change color of color theme selector to something other than blue
  • Utilize Genius's list of alternate album covers to also display on track detail pages
    • data not available in page source, is dynamically loaded (not easily scraped)
  • Host on a publicly available site OR
  • Create desktop application version (ref. https://medium.com/@fareedkhandev/create-desktop-application-using-flask-framework-ee4386a583e9, rf. below)
    • add Github (CI/CD like) workflow to deploy and test upon commits
  • Create links at the bottom of each track card to visit the actual Genius page, or scrape lyrical content for easy access Added links on album and song pages to reference page - can click on song titles or album title to go to relevant page on Genius
  • Add "go to genius" button on home page (to go to site to get url and come back) (maybe to navbar)
  • Color elements of screen based on colors of album (ref. https://www.timpoulsen.com/2018/finding-the-dominant-colors-of-an-image.html)
  • Navbar background color on getData page(s)
  • Create flush db button for first page (index)
  • Refactor using MVC architecture
    • Since flask doesn't really work this way, could at least separate out functionality into other files/controllers (flask likes certain files in certain places, so... segmentation and modular design is not as easy as i'd like)
  • Refactor to use MySQL
  • Dynamic web scraping (ref. https://www.zenrows.com/blog/dynamic-web-pages-scraping-python#dynamic-webscraping-using-beautifulsoup)
  • Make detail pages 2 lanes wide, and reserve the third for annotations (would require building out an annotation functionality, refactoring the db schema)
    • left lane for album cover(s), middle lane for data, lane 3 for annotations
  • Does an album page have a "release date" for albums (versus sporadic release dates listed in credits on each track)?
    • would have to refactor db
  • isolate functionality from views and models
  • in app browser instance with hovering button to collect that page's data
  • make home search bar, actually like kw search, send text to search bar in genius

Issues:

  • Genius changes the class names of attributes on the page fairly often

You can turn your Python Flask application into an executable (.exe) using PyInstaller. Here's how:

Steps to Convert a Flask App to an Executable

  1. Install PyInstaller (if you haven't already)

    pip install pyinstaller
  2. Navigate to Your Flask App Directory

    cd /path/to/your/flask_app
  3. Run PyInstaller to Create Executable

    pyinstaller --onefile --windowed --name app_name app.py
    • --onefile: Packages everything into a single .exe.
    • --windowed: Prevents opening a terminal window (useful for GUI apps).
    • --name app_name: Sets the executable name to app_name.exe.
  4. Find the Executable

    • The .exe will be located in the dist/ folder after PyInstaller completes.

Handling Dependencies

If your Flask app relies on external dependencies, you may need to:

  • Include extra files with --add-data.
  • Use a virtual environment (venv) before packaging.

Would you like help fine-tuning this for specific Flask features or including additional dependencies? 🚀

About

Flask web scraping app to find music credits

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published