GithubHelp home page GithubHelp logo

phts / qnap-dlna-adapter-for-foobar2k-mobile Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 30 KB

:house: ~ :notes: ~ :iphone: Adapter for QNAP NAS DLNA service to work with foobar2000 Mobile via Internet

Home Page: https://www.npmjs.com/package/qnap-dlna-adapter-for-foobar2k-mobile

Shell 21.83% JavaScript 78.17%
qnap adapter foobar2000 fb2k dlna dlna-server npm-package

qnap-dlna-adapter-for-foobar2k-mobile's Introduction

QNAP DLNA adapter for foobar2000 Mobile

npm

Why?

Let's imagine you want to make your DLNA server running on QNAP be available through the internet and to listen to music in foobar2000 Mobile player from it. You assigned internet address to your NAS (e.g. using DDNS service) and exposed a port of DLNA server via port forwarding in your router configuration then you can add your NAS to foobar2000 media server list like http://mynas.myqnapcloud.com:8888.

However most likely the player will not find it or will reject loading of any content. There are two reasons:

  1. Due to your server was added manually, foobar2000 tries to fetch device description by default path /DeviceDescription.xml.

    DLNA server may have any other entry point, e.g. native QNAP DLNA server has /rootDesc.xml. The server informs a client about this entry point when it is discovered by the client in the local network. But in our case the server cannot inform foobar2000 about its entry point and so the player just uses the default one.

  2. DLNA server returns XML responses containing hard-coded local URLs of the content and player is not able to reach them outside of local network.

This adapter solves these two problems.

Requirements

  1. Node.js v8 (install from QNAP App Center)

  2. Export npm bin folder to PATH:

    export PATH=/share/CACHEDEV1_DATA/.qpkg/nodejsv8/node/bin:$PATH

    If you have installed Entware then it is possible to export PATH from /opt/etc/profile to make it available every time when connecting via SSH.

Install

Connect to NAS via SSH as admin and run:

$ npm install -g qnap-dlna-adapter-for-foobar2k-mobile

Usage

Connect to NAS via SSH.

Create config file. Example:

{
  "deviceDescriptionPath": "/DeviceDescription.xml",
  "dlnaHostname": "http://127.0.0.1",
  "dlnaPort": 8200,
  "externalHostname": "http://example.com",
  "listenHostname": "0.0.0.0",
  "port": 8888
}

Start

$ dlna-adapter-for-foobar2k-mobile-start [options] [PATH_TO_CONFIG_FILE]

If PATH_TO_CONFIG_FILE is not specified then default path ~/dlna-adapter.config.json will be used.

Options:

  • --verbose — Print all incoming requests.

Stop

$ dlna-adapter-for-foobar2k-mobile-stop

How it works

The adapter is an express web-server. Once it is started it does the following:

  1. Redirects / and /DeviceDescription.xml requests to <deviceDescriptionPath> which is understandable by the DLNA server. All other requests are passing through the adapter without redirection.

  2. Replaces all occurrences of <dlnaHostname>:<dlnaPort> with <externalHostname>:<port> in XML output of all http requests. So the player will fetch audio files from QNAP server's external URL.

Expose <port> in your router and add <externalHostname>:<port> to foobar2000's media server list. <dlnaPort> is not needed to be exposed anymore.

▶️ ⏩ Now foobar2000 should find your server and be able to play music from it. 🎵 🎧 👍

Theoretically this adapter can work not only with foobar2000 but I did not check that.

Configuration

For QNAP DLNA server (native):

{
  "deviceDescriptionPath": "/rootDesc.xml",
  "dlnaHostname": "<NAS local address, e.g. http://192.168.1.66>",
  "dlnaPort": 8200,
  "...": "..."
}

For Asset UPnP:

{
  "deviceDescriptionPath": "/DeviceDescription.xml",
  "dlnaHostname": "http://127.0.0.1",
  "dlnaPort": 26125,
  "...": "..."
}

qnap-dlna-adapter-for-foobar2k-mobile's People

Contributors

phts avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.