Giter VIP home page Giter VIP logo

scrobblez's Introduction

scrobblez

License: MIT

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

scrobblez's People

Contributors

yodaembedding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sourcery-ai-bot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.