Skip to content

A way to extract artist genres from given Spotify playlist

License

Notifications You must be signed in to change notification settings

simisimis/genrefinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify playlist genre finder

Genrefinder goes through provided users playlists, looks up artists from the songs in playlists and retrieves their genres.

This program is looking up SPOTIFY_CLIENT(Client ID) and SPOTIFY_SECRET(Client Secret) environment variables to get a token. You can create an app in spotify developers dashboard.

Currently genrefinder:

  • retrieves token
  • Scenario1(default):
    • Goes through all provided user public playlists
  • Scenario2:
    • Uses a playlist that user chooses through select menu
  • generates a map of artists.
  • enriches artists map with names of playlists artist was found in.
  • adds genres artist is playing in to artists map
  • does a bulk upload to elasticsearch server running on http://localhost:9200

NOTE: elasticsearch index name and host details are hardcoded in the code

Screenshots

Kibana Alt text term Alt text

DELETE artists-18122019

PUT artists-18122019
{
  "settings": {
    "number_of_replicas": 0
  }
}

POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "artists-18122019",
        "alias": "artists"
      }
    }
  ]
}

PUT artists/_mapping
{
  "properties": {
    "artist": {
      "type": "text",
      "analyzer":"standard",
          "fielddata":true,
      "fields": {
        "raw": {
          "type": "keyword"
        }
      }
    },
    "genres": {
      "type": "text",
      "analyzer":"standard",
      "fielddata":true,
      "fields": {
        "raw": {
          "type": "keyword"
        }
      }
    },
    "playlists": {
      "type": "text",
      "analyzer":"standard",
      "fielddata":true,
      "fields": {
        "raw": {
          "type": "keyword"
        }
      }
    }
  }
}