GithubHelp home page GithubHelp logo

mpd-web's Introduction

mpd-web

This repository contains a simple HTTP-server which allows basic control of an mpd server running upon localhost:

  • Move to the next track.
  • Move to the previous track.
  • Stop playback, and restart it.
  • Show the current playlist, and allow jumping to specific songs within it.

Rational

I have mpd installed upon my desktop, and I use it for playing music when I'm in front of my PC.

When I'm outside the office I often have playback sent through some bluetooth speakers - and I don't want to have to go back to my PC to skip to the next track.

I can stop playback by turning off the speaker, of course!

So I make sure that I launch this deamon too, and then I can skip tracks with my mobile phone.

Installation

Assuming you have a working go compiler, & etc, you can install via:

$ go install github.com/skx/mpd-web@latest

Otherwise clone this repository and build/install like so:

$ cd mpd-web
$ go build .
$ go install .

You can see a simple installation-recipe, which launches this as a user-service via systemd in install - You should read the contents before blindly executing it!

NOTE: The embedded HTML template we use for our UI requires the use of go version 1.17, or higher, to build this service.

Configuration

There are zero configuration options; the server defaults to serving on port 8888 (all interfaces), and contacting the mpd server on localhost:6600.

Implementation

  • main.go configures some HTTP-routes, and starts the HTTP-server
    • No command-line parsing/handling.
  • http.go contains the HTTP-handlers.
    • These trigger actions against the MPD server
  • embed.go is a helper which embeds the text/template file served.
    • No real code here.
  • web/index.html is the HTML-template served when the user visits http://127.0.0.1:8888/

Bugs?

Report as you see them :)

Steve

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.