Giter Club home page Giter Club logo

mpd-album-art's Introduction

MPD Album Art

Python module to query current MPD song, and find an album art match from local filesystem or LastFM.

Install

$ pip install mpd-album-art

Example Usage

Play some jams

Start up your MPD session as normal, e.g.

$ mpd

Take note of which port it's running on (normally localhost:6600).

With the commandline script (the easy way)

$ mpd_album_art.py -n localhost -p 6600 -m ~/music/ -a ~/.covers -l current

With the Python module (the manual way)

Hook up to the MPD server

import mpd_album_art, mpd
# Open an MPD client
mpd_client = MPDClient()
# Connect to MPD session
mpd_client.connect("localhost", 6600)
# ...

Find what's making those groovy vibes

# ...
song = mpd_client.currentsong()
# ...

Grab some art

Artwork is saved to save_dir library_dir should be where your music files are (this is used in Grabber.get_local_art)

# ...
grabber = mpd_album_art.Grabber(
    save_dir="/home/jamie/.conky/scripts/album_art",
    library_dir="/home/jamie/Music/Library"
    )
grabber.get_art(song)

Now, if the album isn't too obscurely titled, you should have its artwork in save_dir saved as something like "Artist_Name_Album_Name_h4sh.png". And a symlink should exist in there saved as "current" pointing to it.

You can also check your local filesystem for artwork in the music directory:

grabber.get_local_art(song)

This will create a symlink called "current" in save_dir pointing to the largest image file in the directory

Issuing these commands when there's no music pumping will remove the symlink.

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.