Skip to content

The shairport-sync metadata parser which provides track information, works on multi platforms.

License

Notifications You must be signed in to change notification settings

idubnori/shairport-sync-trackinfo-reader

Repository files navigation

ShairportSync.TrackInfoReader for .NET

NuGet GitHub license Build status

ShairportSync.TrackInfoReader is a shairport-sync metadata parser which provides track information (artist, album, song title, artwork image, etc.) as Rx (IObservable<TrackInfo>).

This library works on .NET Standard 2.0 compliant platforms like .NET Core 2 / Mono.
i.e. works on Raspberry Pi 2 / 3, Mac, Linux, etc.

Examples

Contains two usage example apps below.

Web Viewer

WebViewer

Console Viewer

ConsoleViewer

Quick Start

Install via NuGet

Package Manager:

PM> Install-Package ShairportSync.TrackInfoReader

.NET CLI:

dotnet add package ShairportSync.TrackInfoReader

Subscribe Track Information

var trackInfoSource = TrackInfoReader.GetObservable("/tmp/shairport-sync-metadata");
trackInfoSource.Subscribe(t => Console.WriteLine($"{t.Artist} {t.Album} {t.Song}"));

Run examples on Raspberry Pi 2 / 3

Preparation

On your Pi, download, unzip and set permission as follows.
(No need to install .NET Core.)

curl -s https://api.github.com/repos/idubnori/shairport-sync-trackinfo-reader/releases/latest \
| grep "examples-linux-arm.zip" \
| cut -d '"' -f 4 \
| wget -qi -
unzip examples-linux-arm.zip
chmod +x ./console-viewer/ConsoleViewer ./web-viewer/WebViewer

Run shairport-sync with metadata pipe parameter.

shairport-sync --pipe=/tmp/shairport-sync-metadata

ConsoleViewer

./ConsoleViewer /tmp/shairport-sync-metadata

WebViewer

./WebViewer pipe=/tmp/shairport-sync-metadata

Browse http://<Pi HostName>:5000/

How to Build

Install NET Core 2.2 SDK.

VisualStudio / Rider

Open TrackInfoReader.sln. And Build it.

Console

# Move to solution root directory.
dotnet build

Publish build example apps for Pi

# Move to ConsoleViewer or WebViewer directory.
dotnet publish -c Release -r linux-arm
# Deploy ./bin/Release/netcoreapp2.0/linux-arm/publish/ to Pi.

License

ShairportSync.TrackInfoReader is Copyright © 2019 idubnori under the MIT License.

Dependencies