GitHub - mycoboco/canary: a music streaming server/client with DAAP support (original) (raw)

canary: a music streaming server/client

canary is a package of a music streaming server and its companion iOS client that run uponDAAP. Employing DAAP for streaming andmDNS/DNS-SD for service advertisement let canary work perfectly withiTunes.

running canary and iTunes

This document explains the server. See the files in the client directory for the client.

The server supports, among other things:

but does not support yet:

The initial scan of songs is fairly fast thanks to high performance of themusic-metadata module; about 7 mins with 5,000+ songs on my Gentoo machine withIntel Atom D525, 4GB RAM and a 5400-rpm HDD. Once the database has been built, rescanning is even faster; about 1 min on the same condition. The server remembers the mtime, modification time of files and reads only added or modified files.

Prerequisites

The only thing you need to run canary is a node.js environment. canarystarted to support a stand-alone DB,NeDB as well as MongoDB. You better depend on MongoDB, however, if a huge number of songs need to be served, because NeDB stores all its indexed data on memory.

canary can run with avahi ordns-sd, or launch its own instance of mDNS/DNS-SD service implemented in pure JavaScript (node-mdns-js) when you have neither installed.

Having more than one instance of mDNS/DNS-SD service on the same machine confuses the service to prevent it from properly working.

The value for mdns in server.conf (see below) chooses a service for mDNS publication.

If your system have avahi or dns-sd, please make sure thatavahi-publish-service or dns-sd is accessible without specifying a path from the location canary runs.

Whenever avahi or dns-sd fails to start, mdns-js is selected as a fallback.

If you are not able to get the service advertisement to work with any of these options, please let me know to help you.

Configuration

Two configuration files need to be provided for the server, one for its database and the other for the server itself.

The server configuration, config/server.json looks like:

{
    "name":     "canary music",
    "port":     3689,
    "runAs": {
        "uid": "userid",
        "gid": "groupid"
    },
    "password": "password",
    "scan": {
        "path":  [ "/path/to/mp3/files" ],
        "cycle": [ "17:00:00" ],
        "utc":   false
    },
    "db":    "neDB",
    "mdns":  "auto",
    "debug": false
}

One of config/db.ne.json and config/db.mongo.json is used depending on the setting of the db field above; both files must exist and be syntactically correct.

config/db.mongo.json contains:

{
    "host":          "localhost",
    "port":          27017,
    "db":            "canary",
    "user":          "user",
    "password":      "password",
    "reconnectTime": 2
}

The options from host to password inclusive specify basic information for DB connection. If no authentication is required, user and password can be omitted.

reconnectTime specifies a time interval in seconds for which the server waits before trying to reconnect when disconnected from the DB.

config/db.ne.json looks like:

to specify a path into which persistent DB files go.

How to run

As other node.js programs, you can run canary-server with

node server.js -c config/

where the -c option (or --config) specifies a configuration directory the server will use.

Since version 0.2.2, canary extracts cover images from media files. If you have database built by a previous version, the --rebuild option will help cover images be prepared.

Clients tested

The following DAAP clients have been tested with canary-server. If your favorite client is not on the list or does not work with the server, pleaseopen a new issue to describe the problem concisely.

Help needed

canary-server is implemented in a very short time. It already works well but needs many improvements that include, but not limited to:

INSTALL.md explains how to build and install the library. For the copyright issues, see the accompanying LICENSE.md file.

If you have a question or suggestion, do not hesitate to contact me via email (woong.jun at gmail.com) or web (https://code.woong.org/).