Skip to main content

Bridge streaming services easily with advanced matching

Project description

<style> .logo { filter: invert(100%); } @media (prefers-color-scheme: dark) { .logo { filter: invert(0%); } } </style>

downmixer is a library to support connecting between streaming services. It can match any song, from any streaming service (or any arbitrary library of files), with the same song or as close as possible when it straight up isn't available.

It's flexible, and provides a comprehensive API that can be extended for almost any use case. Making your own **provider ** (the bridge between services and downmixer) is as easy as...

import ... from ...


# Every provider needs a separate connection object
class MyProviderConnection(Connection):
    def initialize(self) -> bool:
        # Implement your APIs here
        pass

    # [...]


class MyProvider(BaseProvider):
    def fetch_song(self, id: str) -> Song:
        # Implement your APIs here
        pass

    def fetch_album(self, id: str) -> Album:
        # Implement your APIs here
        pass

    # [...]

    def fetch_audio(self, song: SearchResult | str, path: Path) -> LocalFile:
        # Implement your APIs here
        pass

Providers inherit from a base class, which has only the basic skeleton of a downmixer Provider; the actual interface the class will have is determined by the Protocols it implements.

You can make your classes inherit all the protocols it uses, but duck typing is recommended and used by the built-in Providers.

With your own providers, you can then automate tasks easily with any other service:

import

...
from ...


async def download_song(song_id: str, output: Path):
    # Initialize Spotify connection (requires OAuth)
    spotify_conn = SpotifyConnection()
    spotify_conn.initialize()
    spotify_conn.authenticate()
    spotify = SpotifyProvider(spotify_conn)

    # Get metadata from Spotify
    song = spotify.fetch_song(song_id)

    # Initialize your custom provider
    custom_conn = MyProviderConnection()
    custom_conn.initialize()
    custom = MyProvider(custom_conn)

    # First search the song on your provider
    results = custom.search(song.title, [ResourceType.SONG])
    # Then download it! 
    local_file = custom.fetch_audio(results[0], output)

    # Convert and tag
    converted = await Converter(local_file).convert()
    tag.tag_download(converted)

    return converted


# You can run it like this:
asyncio.run(download_song("spotify:track:abc123", Path("./downloads")))

The documentation is comprehensive and has a few guides to get you started.

Installation

Install the package with:

pip install downmixer

Building

Uses uv package manager. To build from source, run:

git clone https://github.com/neufter/downmixer
cd downmixer
uv build

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

downmixer-1.0.0.tar.gz (140.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

downmixer-1.0.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file downmixer-1.0.0.tar.gz.

File metadata

  • Download URL: downmixer-1.0.0.tar.gz
  • Upload date:
  • Size: 140.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for downmixer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 83ac39b7f11edf632d17669a981d11c071e33b433ab005d478b46fe8fb99feb8
MD5 bfc54c6e05440272e3cc2e69ebc5f2c0
BLAKE2b-256 a64cf4a5426ae4ebd3da8034a7c61130f598901fd60cb8dffc6509a89ab59af6

See more details on using hashes here.

File details

Details for the file downmixer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: downmixer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for downmixer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d2fe79d3bb7f4dbe8d749b4209b89b94ce5881ebcb6d94bb2a25b105fd263c5
MD5 80b0f57bffa7b2a8453cc9ff937aa880
BLAKE2b-256 e5506dd3b45f488a279de4ea17086f2e03aa520f4f9da66d44a3ad0b8e4b5a39

See more details on using hashes here.

Supported by

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