Coder Social home page Coder Social logo

bum's Introduction

๐ŸŽต bum

PyPI MIT licensed Build Status Donate

bum is a daemon that downloads album art for songs playing in mpd/mopidy and displays them in a little window. bum doesn't loop on a timer, instead it waits for mpd/mopidy to send a player event. When it receives a player event it wakes up and downloads album art for the current playing track. This makes bum lightweight and makes it idle at ~0% CPU usage.

bum uses musicbrainz to source and download cover art, if an album is missing it's cover art you can easily create an account and fill in the data yourself. bum outputs a release-id which you can use to find the exact entry on musicbrainz.

Note: bum is meant to be used with files that don't have embedded album art (mopidy-spotify).

showcase

Dependencies

  • python 3.6+
  • python-mpv
  • python-mpd2
  • musicbrainzngs

Installation

pip3 install --user bum

Usage

usage: bum [-h] [--size "px"] [--cache_dir "/path/to/dir"] [--version]

bum - Download and display album art for mpd tracks.

optional arguments:
  -h, --help            show this help message and exit
  --size "px"           what size to display the album art in.
  --cache_dir "/path/to/dir"
                        Where to store the downloaded cover art.
  --version             Print "bum" version.
  --port                Use a custom mpd port.

Donate

Donations will allow me to spend more time working on bum.

If you like bum and want to give back in some way you can donate here:

https://patreon.com/dyla

bum's People

Contributors

blackhippy avatar dylanaraps avatar gadgetoid avatar johnhamelink avatar poltar avatar tankernn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bum's Issues

song['album'] KeyError

song dictionary doesn't have to contain the key album (when the song doesn't belong to an album) which results in a KeyError in several places in the program.

"Just once" mode

It would be nice to have a command line flag to avoid running bum as a server, and to only fetch the album artwork of the current track and then exit.

run error?

Hi

I could not install using pip3 for some pip errors on Debian testing. So I used the source "python3 setup.py install"

This is what I am getting when I try to run it.

Traceback (most recent call last):
File "/usr/local/bin/bum", line 11, in
load_entry_point('bum==0.1.3', 'console_scripts', 'bum')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2693, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2324, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2330, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/usr/local/lib/python3.6/dist-packages/bum-0.1.3-py3.6.egg/bum/main.py", line 14, in
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/usr/local/lib/python3.6/dist-packages/bum-0.1.3-py3.6.egg/bum/song.py", line 6, in
File "/usr/local/lib/python3.6/dist-packages/mpd.py", line 399
except socket.error, err:
^
SyntaxError: invalid syntax

cache_dir params not working?

Hi,
Thx for this good program, under archlinux i got with python3

โฏ bum --cache_dir=/home/cyril/.covers/
Traceback (most recent call last):
  File "/usr/bin/bum", line 11, in <module>
    load_entry_point('bum==0.1.3', 'console_scripts', 'bum')()
  File "/usr/lib/python3.7/site-packages/bum/__main__.py", line 69, in main
    song.get_art(args.cache_dir, args.size, client)
  File "/usr/lib/python3.7/site-packages/bum/song.py", line 34, in get_art
    file_name = cache_dir / file_name
TypeError: unsupported operand type(s) for /: 'str' and 'str'

Fails if song metadata does not contain an "album" property

In some cases a downloaded, single song (in this case, Dark all Day by GUNSHIP grabbed from BandCamp) may not have an "album" associated with it.

This causes a hard fail where it's assumed "album" exists, for example in brainz.py:

data = mus.search_releases(artist=song["artist"],
                           release=song["album"],
                           limit=1)

This can be fixed by using "title" in lieu of "album", and this seems to correctly fetch the album art too:

artist = song.get("artist")
title = song.get("title")
album = song.get("album", title)
data = mus.search_releases(artist=artist,
                           release=album,
                           limit=1)

I'm happy to do a PR to fix this, but can anyone think of instances where this might fail?

A new release? :)

Hey there,

I'm looking to use bum to download album art covers and feed them into Conky. The master branch version of bum works fine for me with Conky, but the pypi version does not have this function.

Infinite loop on network failure

In brainz.py, if it fails to connect to musicbrainz.org it will immediately retry by recursively calling the get_cover function. This would effectively lock up the process, repeatedly hitting musicbrainz.org in case of network or service issues.

I've put together a naive fix for this, which you can find here- pimoroni@0dbe807

Would you be interested in a PR?

Add option for remote MPD server

Hey Dylan! It would be great to have the option to connect to a non-localhost server. I found localhost hardcoded into song.py, changing it to one of my MPD server IPs seems to work.

Port

The custom port is not working anymore.

Default image if no album art was found?

When I get the error "error: Couldn't find album art for ..." the last successfully downloaded album art is still the current.jpg in the cache folder which in most or many cases will not be the correct image.
It would be great to have a default image stating "no album art" for such cases.

'MPDClient' object has no attribute 'send_idle'

I just recently installed and gave it a test.

Whenever bum tries to switch cover art, it displays the following:

album: Using release-id: 098060d4-ba3c-469d-88b0-08642261c7ab
album: Swapped art to Daft Punk, Discovery.
Traceback (most recent call last):
  File "/usr/bin/bum", line 33, in <module>
    sys.exit(load_entry_point('bum==0.1.3', 'console_scripts', 'bum')())
  File "/usr/lib/python3.9/site-packages/bum/__main__.py", line 77, in main
    client.send_idle()
AttributeError: 'MPDClient' object has no attribute 'send_idle'```

My mpd client is ncmpcpp.

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.