Scrobbler for MPRIS 2 compatible clients
Project description
scrobblez
User-customizable scrobbler for Last.fm and MPRIS 2.
This scrobbler cleans up metadata (e.g. artist, album, track titles) produced by services with non-standard tagging schemes (e.g. Spotify). The cleaning process is extensible and can be customized to a user's particular needs.
Install
Install from PyPI:
pip install scrobblez
Or install from source:
git clone https://github.com/YodaEmbedding/scrobblez
cd scrobblez
pip install .
Usage
Simply run the following command:
scrobblez
Configuration
Within ~/.config/scrobblez/config.py
, you may specify a whitelist of valid
player names:
whitelist = ["spotify"]
Optionally, you can also customize the metadata cleaning process:
from scrobblez.metadata_filter import *
from scrobblez.types import Metadata
def fix_metadata(metadata: Metadata) -> Metadata:
m = dict(metadata)
# Keep first artist only in list of artists
m["artist"] = m["artist"][0]
m["album_artist"] = m["album_artist"][0]
# Specify which filter rules to use
rules = (
REMASTERED_FILTER_RULES
+ SUFFIX_FILTER_RULES
+ VERSION_FILTER_RULES
+ ORIGIN_FILTER_RULES
+ FEATURE_FILTER_RULES
+ CLEAN_EXPLICIT_FILTER_RULES
+ LIVE_FILTER_RULES
+ TRIM_WHITESPACE_FILTER_RULES
)
# Specify manual artist/album/title overrides
artist_overrides = {
"Yusuf": "Cat Stevens",
"Yusuf / Cat Stevens": "Cat Stevens",
}
album_overrides = {
"The Lord of the Rings - The Return of the King - "
"The Complete Recordings (Limited Edition)":
"The Lord of the Rings: Return of the King - the Complete Recordings",
}
title_overrides = {
"Better Get Hit In Your Soul - Instrumental":
"Better Git It in Your Soul",
}
def fix(k, overrides, f=lambda x: x):
m[k] = overrides.get(m[k], f(m[k]))
# Apply fixes
fix("artist", artist_overrides)
fix("album_artist", artist_overrides)
fix("album", album_overrides, lambda x: apply_filters(rules, x))
fix("title", title_overrides, lambda x: apply_filters(rules, x))
return m
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scrobblez-0.1.0.tar.gz
(8.5 kB
view hashes)
Built Distribution
Close
Hashes for scrobblez-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64e4bc81aacd15c4a1c147557c765fa0bef9abf9e4b46578a9562a2cb1ac36eb |
|
MD5 | ea3b6584192162121a270b2e85d3d6d0 |
|
BLAKE2b-256 | 03ff1885c4119720d6a15e765e023b7cceecb6c805a77cb5babd05effbe9afce |