A beets plugin that fetches genre, secondary genre, descriptor, and grouping data from Rate Your Music (RYM) scraped data and applies it to your music collection during import.
This plugin does not directly access Rate Your Music's servers or API. Instead, it connects to a Firebase Realtime Database that contains data from a grassroots genre data collection project I made. This approach helps reduce load on RYM's servers while providing access to comprehensive genre data for the music community.
Learn more about this community data project here: (LINK TBD)
- Automatic Genre Tagging: Fetches primary genres from RYM during import
- Secondary Genres: Applies secondary genres to the
secondary_genrefield - Descriptors: Adds descriptors to the
descriptorfield - Hierarchical Groupings: Automatically derives parent genres for the
groupingfield - Flexible Matching: Intelligent fuzzy matching for artist and album names
- Caching: Built-in caching to reduce API calls and improve performance
- Manual Commands: CLI commands to update existing albums with RYM data
- FLAC Array Support: Proper multi-value tag support for FLAC files
- Python 3.7+
- beets 1.4.0+
-
Clone this repository:
git clone https://github.com/yourusername/beets-rym-genres.git cd beets-rym-genres -
Install the plugin:
pip install -e . -
Add the plugin to your beets configuration:
plugins: - rym_genres # ... your other plugins
Add the following to your beets config.yaml:
rym_genres:
# Required: Firebase URL for RYM data (you must obtain this separately)
firebase_url: 'YOUR_FIREBASE_URL_HERE'
# Matching thresholds
similarity_threshold: 0.8 # Minimum similarity for artist/album matching
title_match_threshold: 0.95 # High title match threshold for flexible matching
flexible_artist_matching: true # Allow matches with very high title similarity
# Tag limits
max_genres: 10 # Maximum primary genres
max_secondary_genres: 20 # Maximum secondary genres
max_descriptors: 60 # Maximum descriptors
max_groupings: 30 # Maximum parent genres
# Behavior settings
auto_tag: true # Auto-tag during import
use_hierarchy: true # Enable hierarchical parent genre tagging
require_rym_match: true # Fail import if no RYM match found
# Caching
cache_duration: 3600 # Cache duration in seconds (1 hour)
# Logging
log_missing_matches: true # Log albums without RYM matches
missing_matches_logfile: './rym_missing_matches.log'Important: You must configure your own Firebase URL that contains Rate Your Music scraped data. The plugin does not include access to any data source by default.
Note: The plugin automatically handles data file paths (genre tree, excluded genres, and cache files) - no need to configure these manually.
This plugin requires access to Rate Your Music data in a specific JSON format. You have a few options:
- Set up a Firebase Realtime Database
- Populate it with RYM data in the expected format (see Data Format section below)
- Configure the
firebase_urlto point to your database's JSON endpoint
The plugin can work with any HTTP endpoint that returns JSON data in the expected format. Simply set the firebase_url to your API endpoint.
The plugin expects JSON data in this structure:
{
"artist_key": {
"album_key": {
"artistName": "Artist Name",
"releaseTitle": "Album Title",
"genres": ["Genre1", "Genre2"],
"secondaryGenres": ["SecondaryGenre1"],
"descriptors": ["descriptor1", "descriptor2"]
}
}
}Note: This plugin is designed to work with scraped RYM data but does not provide the data itself. Users are responsible for obtaining RYM data through their own means in compliance with Rate Your Music's terms of service.
Once configured, the plugin will automatically fetch and apply RYM genre data during beets import:
beet import /path/to/musicUpdate existing albums with RYM genre data:
# Update all albums
beet rym
# Update specific albums
beet rym artist:"Pink Floyd"
beet rym album:"Dark Side of the Moon"The plugin maps RYM data to the following beets fields:
- Genres →
genrefield (primary RYM genres) - Secondary Genres →
secondary_genrefield (secondary RYM genres) - Descriptors →
descriptorfield (RYM descriptors) - Groupings →
groupingfield (hierarchical parent genres)
When the plugin writes to your audio files, it uses the following metadata tags:
| Beets Field | File Tag Name | Format | Description |
|---|---|---|---|
genre |
GENRE |
Array/List | Primary genres from RYM |
secondary_genre |
SECONDARY_GENRE |
Array/List | Secondary genres from RYM |
descriptor |
DESCRIPTORS |
Array/List | Descriptive tags from RYM |
grouping |
GROUPING |
Array/List | Hierarchical parent genres |
FLAC Files: For FLAC files, the plugin writes these as proper tag arrays (multiple values per tag) using Mutagen for optimal compatibility.
Other Formats: For non-FLAC formats, tags are written as semicolon-separated strings using beets' standard MediaFile system.
The plugin includes several data files that are automatically located:
rym-genre-tree.json: Complete RYM genre hierarchy (24,000+ genres)excluded-meta-genres.json: Meta-genres excluded from tagging (too broad)rym_genres_cache.json: Local cache for improved performance
The data files are automatically included with the plugin installation. If you need to customize the excluded genres, you can:
- Find the plugin's data directory (usually in your Python site-packages)
- Edit the
excluded-meta-genres.jsonfile - Restart beets to load the changes
When use_hierarchy: true, the plugin automatically adds parent genres. For example:
- If an album has "Post-Rock" genre
- The plugin will also add "Rock" and "Experimental Rock" as groupings
The plugin includes intelligent matching that handles:
- Artist name variations and aliases
- Articles (The, A, An) in different positions
- Special characters and Unicode normalization
- Multi-artist releases and collaborations
Results are cached locally to improve performance:
- Default cache duration: 1 hour
- Cache location: Automatically managed by the plugin
- Automatic cache cleanup and refresh
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- beets - The excellent music library management system
- Rate Your Music - For the comprehensive music genre data
- The beets community for plugin development guidance
For issues and questions:
- Check the Issues page
- Review the beets documentation
- Join the beets discussion forum