Git Product home page Git Product logo

beoplay-macos-remote-cli's Introduction

beoplay-cli

This is an unofficial command line interface (CLI) for macOS to remote control network enabled Beoplay loudspeakers.

This repository contains:

  • Device Emulator: announces itself on the network (zeroconf/bonjour) and supports volume adjustments
  • RemoteCore: device discovery (zeroconf/bonjour), notification module (event based, auto reconnect)
  • RemoteCLI: command line interface using the RemoteCore library.

The RemoteCore library is also used by https://github.com/tlk/beoplay-macos-remote-gui which supports keyboard shortcuts.

Usage

Interactive mode with hints and tab-completion

screen recording

Non-interactive mode

$ beoplay-cli discover
+ "Beoplay Device"	http://BeoplayDevice.local.:8080

$ export BEOPLAY_NAME="Beoplay Device"
$ beoplay-cli getVolume
35
$ beoplay-cli setVolume 20
$ beoplay-cli getVolume
20
$ beoplay-cli pause
$ beoplay-cli play
$ beoplay-cli monitor
RemoteCore.NotificationBridge.DataConnectionNotification(state: RemoteCore.NotificationSession.ConnectionState.connecting, message: nil)
RemoteCore.NotificationBridge.DataConnectionNotification(state: RemoteCore.NotificationSession.ConnectionState.online, message: nil)
RemoteCore.Source(id: "radio:[email protected]", type: "TUNEIN", category: "RADIO", friendlyName: "TuneIn", productJid: "[email protected]", productFriendlyName: "Beoplay M5 i køkkenet", state: RemoteCore.DeviceState.play)
RemoteCore.NowPlayingRadio(stationId: "s37309", liveDescription: "Higher Love - Kygo & Whitney Houston", name: "96.5 | DR P4 København (Euro Hits)")
RemoteCore.Progress(playQueueItemId: "plid-4342.3", state: RemoteCore.DeviceState.play)
RemoteCore.Volume(volume: 35, muted: false, minimum: 0, maximum: 90)
RemoteCore.Progress(playQueueItemId: "plid-4342.3", state: RemoteCore.DeviceState.play)
RemoteCore.Progress(playQueueItemId: "plid-4342.3", state: RemoteCore.DeviceState.play)
RemoteCore.Progress(playQueueItemId: "plid-4342.3", state: RemoteCore.DeviceState.play)

RemoteCore.NotificationBridge.DataConnectionNotification(state: RemoteCore.NotificationSession.ConnectionState.disconnecting, message: nil)
RemoteCore.NotificationBridge.DataConnectionNotification(state: RemoteCore.NotificationSession.ConnectionState.offline, message: nil)
$
$ beoplay-cli monitor volume
RemoteCore.Volume(volume: 23, muted: false, minimum: 0, maximum: 90)
RemoteCore.Volume(volume: 27, muted: false, minimum: 0, maximum: 90)
RemoteCore.Volume(volume: 31, muted: false, minimum: 0, maximum: 90)
RemoteCore.Volume(volume: 35, muted: false, minimum: 0, maximum: 90)

$ beoplay-cli emulator "Nice Device"
emulating device "Nice Device" on port 80  (stop with ctrl+c)
^C
$

Installation

$ make install
swift build -c release
[5/5] Linking ./.build/x86_64-apple-macosx/release/beoplay-cli
cp .build/release/beoplay-cli /usr/local/bin/beoplay-cli

Alternatively, install with Homebrew:

brew install tlk/beoplayremote/beoplay-cli

Configuration

The beoplay-cli tool needs to know which device to connect to when issuing commands such as play, pause, etc.

Beoplay devices on the local network can be discovered in different ways:

The device name can be specified via an environment variable:

export BEOPLAY_NAME="Beoplay Device"
beoplay-cli play

Alternatively, host and port can be used:

export BEOPLAY_HOST=BeoplayDevice.local.
export BEOPLAY_PORT=8080
beoplay-cli play

Related Projects

beoplay-macos-remote-cli's People

Contributors

tlk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

gumpyoung

beoplay-macos-remote-cli's Issues

Emulator crashes on macOS Big Sur Beta 11.0 (release configuration)

The emulator crashes on macOS Big Sur Beta 11.0 when the tool is compiled in 'release' configuration. The emulator works as expected on earlier versions of macOS, and it works as expected when compiled in 'debug' configuration.

How to reproduce:

$ swift build -c release
$ .build/release/beoplay-cli emulator
emulating device "Beoplay Emulated Device" on port 80  (stop with ctrl+c)
beoplay-cli(58001,0x10daa9e00) malloc: Double free of object 0x7fe6eed3be00
beoplay-cli(58001,0x10daa9e00) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
$

Occasionally, it crashes with Segmentation fault: 11.

The crash can be triggered by changing the volume on the emulated device:

$ BEOPLAY_NAME="Beoplay Emulated Device" beoplay-cli setVolume 10

macOS Big Sur Beta 11.0
Swift version 5.3

Get B&O Radio favorites directly from device

B&O has replaced "TuneIn" support with "B&O Radio" in a recent firmware update.

Looks like favourite B&O Radio stations can be fetched from the device using this URL:
beodevice.local:8080/BeoContent/radio/netRadioProfile/favoriteList/favorite/favoriteListStation

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.