Skip to main content

Music search engine for CrossPlay web service.

Project description

Python Music-Browser

A lightweight and modular python library to query tracks and their metadata from various sources.

Plugins features

Browse tracks

You can use plugin to issue any tracks provider (like Spotify) a query.

from music_browser.plugins import SpotifyPlugin

spotify = SpotifyPlugin(
    client_id="97e316da02e94644b332c3ad77554c68", client_secret="9b999c62cf324a428a335a7d87b3d0a9"
)
tracks = spotify.search(query)

for simple_track in tracks:
    print(simple_track)

As a result you will get a list of SimpleTrack, an object containing most basic properties of a track.

Complete track metadata

Coming soon...

Make your own plugin

First of all, your plugin should inherit from the Plugin base class. You will have to implement the following methods.

from typing import List, Set
from music_browser.plugins import Plugin
from music_browser.models import SimpleTrack, FullTrack


class DeezerPlugin(Plugin):
    @property
    def known_fields(self) -> Set[str]:
        # indicates list of field that your plugin can return
        return {"title", "artist", "album"}

    def complete(self, simple_track) -> FullTrack:
        # workout full track properties
        return FullTrack(...)

    def search(self, query) -> List[SimpleTrack]:
        # workout search results
        return [SimpleTrack(...), ..., SimpleTrack(...)]

Objects structure

SimpleTrack

A SimpleTrack object has the following structure. It is returned when a list of tracks is asked to give a quick preview of each track. If later you would like to query more details, refere to FullTrack.

simple_track.__json__()
{
    "title": "Lovers On the Sun (Metal Version)",
    "artist": "UMC",
    "album": "Lovers On the Sun (Metal Version)",
    "cover": "https://i.scdn.co/image/ab67616d0000b273fa786b81f34442a68738be05",
    "source": {
        "id": "5fVCKGCQcZ1VPJNZrWqCO0",
        "platform": "spotify"
    }
},

FullTrack

Coming soon...

Roadmap

  • Add ability to search in SoundCloud by adding a new plugin.
  • Prototype advanced metadata-completion for a SimpleTrack.
  • Study ability to use multiple search_plugins at once in browser.
  • Study where cache would be interesting to optimise performances.

Changelog

0.0.4 Document package (2020-11-30)

  • Add users and contributors documentation to README.
  • Add commons metadata used by PyPI.
  • Add licensing information.

0.0.3 First release (2020-11-30)

  • Initiate plugins structure.
  • Add search feature for Spotify and Deezer plugins.
  • First attempt to specify plugin interface
  • Setup CI/CD for the project
    • Simple integration on master and integration branches.
    • Full integration before release, testing all supported python versions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

music-browser-0.0.4.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

music_browser-0.0.4-py3-none-any.whl (9.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page