Skip to content

Distributed Art

Erik Massop edited this page Nov 4, 2017 · 1 revision

This is an idea that would boost the sharing of album art between xmms2 users. The idea is to have a central server that stores art based on Musicbrainz Album ID. The client software can be executed in fetch or transmit mode.

The initial implementation could easily be done in Python with netstrings and send dicts back and forth. An option that would only require stdlib could use ThreadingSocketServer and a simple socket based client.

An untested proof of concept implementation of the server (not totally feature complete) using ThreadingSocketServer and cPickle is available at: http://people.xmms2.org/~alex/ArtDealer.py.txt

protocol

helo command client: {"cmd":"helo", "version":1} server: {"cmd":"helo", "status":"ok"} # if not ok, the reason why failed transmit command client: {"cmd":"transmit", "mbid":"xxx....", "data":"...", "mime":"image/jpeg"} server: {"cmd":"transmit", "status":"ok"} lookup command client: {"cmd":"lookup", "mbid":"xxx..."} server: {"cmd":"lookup", "status":"ok", "data":"...", "mime":"image/jpeg"} # can be "notfound" as status also. lookup without mbid client: {"cmd":"lookup", "artist":"Foobar", "album":"korv"} # all strings in unicode objects. server: {"cmd":"lookup", "status":"ok", "mbid":"xxx...", "data":"...", "mime":"image/jpeg"} # always tell the client what the mbid is

The server could store the art as mbid.ext. If two clients transmit art for the same mbid it will do a rough calculation about which has higher resolution and store that one. Maybe we should add support for multiple images in the future, but who cares :-)

the transmit client could actually be the following pseudo code:

for h in xs.medialib_select("select m1.value as mbid, m2.value as hash from Media m1 ...")   data = bindata_get(hash)   transmit(mbid, data)

easy as pie!

Clone this wiki locally