spotify-genres/README.md

122 lines
2.8 KiB
Markdown

# Spotify Genrebase
This repository is an attempt to collect information about the currently 6271 genres on
Spotify. This includes localized names, description texts, countries, languages and a
simple hierarchical structure.
This project aims to provide the necessary data for the following use cases:
- Display an artist's genres as served by the
[Spotify API](https://developer.spotify.com/documentation/web-api/reference/get-an-artist)
using pretty, localized names
- Display all genres as a tree for easy navigation
- Show the user relevant genres depending on their configured locale
- Flatten genres into a more simple structure for organization (e.g.
`symphonic melodic death metal` -> `metal`)
## Package format
**Genre metadata**
Path: `genres.json`
```json
{
"indie rock": {
"parent": "rock",
"language": "en",
"country": "DE",
"region": "DH",
"rank": 91,
"playlists": {
"2018": "4hEtcsHM3c35tEuDzIpbPf",
"2019": "7JdvwjoMsTgzdxSuEPQx2P",
"2020": "3Zcsc2oJjZCKMTXdgyx8jh",
"2021": "2vnNPYH27nCaClMbPYdJWg",
"2022": "4IvGeVlcJB2ZcrTNtkpv8m",
"2023": "0Rwl2tuvaiGbHTdQ5YxXHN",
"edge": "1Xf43rER49rVtWjinjP5fw",
"intro": "57LVDJMvyx5crhWfpFQfgJ",
"pulse": "6zj2ZyaP4WLzE5AhilyeX0",
"sound": "4XXr357Jej7eUBh7XPK8hb"
},
"metagenre": false,
"deprecated": false
}
}
```
**Genre tree**
Path: `tree/tree.{lang}.json`
```json
[
{
"id": "singer-songwriter",
"name": "Singer-Songwriter",
"rank": 48,
"playlists": {
"sound": "6gD9fCYGxsT9A8t3BHDVuj"
},
"children": [
{
"id": "scottish singer-songwriter",
"name": "Schottischer Singer-Songwriter",
"country": "UK",
"rank": 1117,
"playlists": {
"sound": "2r6lIp87MMXvjAfJRg7Rgo"
}
}
]
}
]
```
**Translations**
Path: `lang/{lang}.json`
```json
{
"<ID>": "Name",
"indie rock": "Indie rock"
}
```
## Development
### Update genre metadata
```sh
# Update genres from everynoise.com (updates everynoise_genres.json)
python genres/get_everynoise.py
# Write updated genres to metadata files
python genres/genres_to_meta.py genres2meta
npx prettier -w metadata/*
# Annotate new genres (add parent, country, language)
# Validate genre metadata
python genres/genres_to_meta.py validate
# Update _main translation
python genres/genres_to_meta.py maketl
# Scrape playlist IDs
python genres/genres_to_meta.py scrapePlaylists
python genres/genres_to_meta.py scrapePlaylistsYear --year 2023
npx prettier -w metadata/*
```
### Create translation
```sh
python genres/genres_to_meta.py newtl --file translations/xy.json
```
## Translation status
[![Translation status](https://translate.codeberg.org/widget/tiraya/spotify-genres/multi-auto.svg)](https://translate.codeberg.org/engage/tiraya/)