funjack / launchcontrol

Launchcontrol is a server that can control/playback scripts on a Launch
BSD 3-Clause "New" or "Revised" License
22 stars 3 forks source link
funscript launch launchcontrol

Launchcontrol

GoDoc Go Report Card Build Status codecov.io

Launchcontrol logo

Launchcontrol is a server that can control/playback scripts on a Launch. This project contains plugins for both Kodi and VLC to communicate with the Launchcontrol server (loading scripts, pausing playback, etc.)

The main platform for Launchcontrol is Linux, but it has been successfully tested on Mac OS X. Works great on a Raspberry Pi with LibreELEC using the Kodi addon.

Windows versions require Buttplug.io Websocket server. Information on how to install and run Buttplug.io Websocket server can be found here. Check out the Metafetish blog and forums for the latest status.

The Kodi and VLC addons work on all platforms (Linux, Mac and Windows.) Kodi's addon also works with their Android versions.

The Launch's firmware needs to be 1.2 (or higher.)

Script formats

Supported haptic script formats:

Format Content Type File extensions
Funscript application/prs.funscript+json .funscript .json
Raw application/prs.launchraw+json .launch .json
Kiiroo text/prs.kiiroo .kiiroo
Kiiroo (Feel-Me/VR) application/prs.kiiroo+json .meta

Create your own Funscripts using the Funscripting Blender addon.

Downloads

Check the releases page for the latest binary downloads.

Filename Description
launchcontrol_linux_amd64 Linux (64-bit)
launchcontrol_linux_386 Linux (32-bit)
launchcontrol_darwin_amd64 Mac OS X
launchcontrol_linux_arm Linux ARM (Raspberry Pi)
launchcontrol_windows_amd64 Windows (64-bit) (see note)
launchcontrol_windows_386 Windows (32-bit) (see note)
script.service.launchcontrol.zip Kodi Addon
launchcontrol.lua VLC Extension

NOTE: Windows versions of Launchcontrol do not have native Bluetooth support and require Buttplug.io Websocket server. Information on how to install and run Buttplug.io Websocket server can be found here. Check out the Metafetish blog and forums for the latest status.

Usage

Usage of launchcontrol:
  -buttplug string
        buttplug server websocket address
  -ca string
        certificate authority in PEM format
  -insecure
        skip certificate verification
  -licenses
        show licenses
  -listen string
        listen address (default "127.0.0.1:6969")
  -noact
        simulate launch on console
  -version
        show version

Start using native Bluetooth (BLE)

# Start server (listening on localhost:6969 by default)
./launchcontrol

Start using Buttplug.io Websocket Server

Buttplug.io can take care of communicating with BLE toys. This is the only way for Launchcontrol to communicate with a Launch on Windows.

With TLS

By default Buttplug is running with TLS enabled using a self-signed certificate. (Note that the certificate is stored in PFX format and needs to be converted to PEM before Launchcontrol can use it.)

./launchcontrol -ca certificate.pem -buttplug wss://localhost:12345/buttplug

Alternatively the certificate validation can be skipped:

./launchcontrol -insecure -buttplug wss://localhost:12345/buttplug

Without TLS

./launchcontrol -buttplug ws://localhost:12345/buttplug

Execute commands on HTTP endpoint using cURL

# Load and play script
curl -XPOST -H "Content-Type: text/prs.kiiroo" --data-ascii \
    "{0.50:1,1.00:4,1.15:0,2.00:2}" http://localhost:6969/v1/play
# Pause a playing script
curl http://localhost:6969/v1/pause
# Resume paused script
curl http://localhost:6969/v1/resume
# Jump to a position in the script
curl http://localhost:6969/v1/skip\?p=1m3s
# Stop and reset script
curl http://localhost:6969/v1/stop
# Start playing last loaded script
curl http://localhost:6969/v1/play
# Dump loaded script raw data:
curl http://localhost:6969/v1/dump

Kodi Integration

The Launchcontrol Kodi service addon connects to a local Launchcontrol server and auto loads scripts and synchronizes playback, taking into account actions like pausing and seeking.

Kodi screenshot

Scripts that are paired with the movie file will be loaded. Pairing is done by placing a script file next a movie using the same base filename (this mirrors the same convention as for nfo or artwork). The addon uses Kodi's VFS while searching and loading scripts, so even movies on remote sources like SMB or HTTP servers will work.

Movie/script pairing example:

Install

Download script.service.launchcontrol.zip from the releases page. Or package the plugin yourself from contrib/kodi/script.service.launchcontrol. Just zip up the directory (or use the Makefile.)

This guide shows how to install the zip file in Kodi. After installation the plugin will automatically start.

NOTE: If you are running Launchcontrol on another machine then Kodi or are not using the default port, the address can be changed in the add-ons configure menu.

VLC Integration

VLC extension for Launchcontrol loads script from the local machine into a Launchcontrol server to play them in sync with a video. Pairing works the same as for the Kodi addon, just place the script file next to the video using the same base filename.

VLC Screenshot

Note: The VLC extension has less features then the Kodi addon, see VLC Extension README for details on what's included.

Install

Place the launchcontrol.lua in VLC's lua/extensions/ directory and reload extensions or restart VLC. The extension must be enabled every time VLC is restarted by clicking view -> Launchcontrol. See VLC Extension README for more details on the extension.

Build

go get ./...
go build
sudo setcap 'cap_net_raw,cap_net_admin=eip' ./launchcontrol

Raspberry Pi v2/v3 with LibreELEC

Make sure Bluetooth is disabled in the LibreELEC Services tab.

Build Launchcontrol server for arm:

go get ./...
GOARCH=arm GOARM=7 go build

Build the script addon:

make -C contrib/kodi/

Note: Pre-build binaries are also available on the releases page.

Copy the build results and an autostart.sh to the Raspberry Pi:

ssh root@libreelec 'mkdir /storage/launchcontrol'
scp launchcontrol root@libreelec:/storage/launchcontrol/
scp contrib/kodi/autostart.sh root@libreelec:/storage/.config/
scp contrib/kodi/script.service.launchcontrol.zip root@libreelec:/storage/

Reboot LibreELEC and install the script.service.launchcontrol.zip addon.

Thats it!

Personalize screenshot

Bluetooth requirements

See the gatt docs for the Bluetooth requirements/setup.

Other examples

Build and run example (Linux)

go build contrib/examples/playkiiroo.go
sudo setcap 'cap_net_raw,cap_net_admin=eip' ./playkiiroo
./playkiiroo -file input.txt

Launchcontrol is released under a BSD-style license.