hughsk / komponist

A simple, yet flexible, Node client library for MPD, the hackable headless audio playback server.
http://hughsk.github.com/komponist
36 stars 4 forks source link

Demo Project using komponist #1

Closed bebraw closed 7 years ago

bebraw commented 11 years ago

Hi,

I set up a project that uses komponist. juke provides a light user interface for it. Basically I took your example and wrapped it into an alternative UI.

Thanks a lot for the work! It saved me a lot of trouble.

Initially I tried setting up the project based on Express but ran into issues with WebSockets. I redefined komponist.install in that case as suggested by shoe documentation but it still failed. It might be nice to look into this.

The way the example project deals with static files is a bit unsecure. It might be a good idea to serve them some other way. I ended up using node-static myself.

hughsk commented 11 years ago

Hey man, thanks! ecstatic is a good drop-in alternative I've found. I'm planning to actually use komponist for something soon, so it'll be seeing a bit of a (much needed) cleanup: turning it into a clean Stream instead of extending net.Client, better documentation, etc.

What issues were you having with WebSockets? I'll have a dig around tonight :)

bebraw commented 11 years ago

Hey man, thanks! ecstatic is a good drop-in alternative I've found. I'm planning to actually use komponist for something soon, so it'll be seeing a bit of a (much needed) cleanup: turning it into a clean Stream instead of extending net.Client, better documentation, etc.

Great! It's very useful as is.

What issues were you having with WebSockets? I'll have a dig around tonight :)

I set up a branch illustrating the issue. Simply run the server (npm start) and open up the index (...:8000/) in browser. You should see some graphics and an error at console. Note that as you load the page the server crashes.

You should see something like: "Uncaught TypeError: Object # has no method 'end' " at client.build.js:1765 on browser. I inspected the object and it has some properties around. No idea why end is missing, though.

On the server side I get this:

stream.js:81
      throw er; // Unhandled stream error in pipe.
            ^
Error: connect ENOENT
    at errnoException (net.js:770:11)
    at Object.afterConnect [as oncomplete] (net.js:761:19)
npm ERR! juke@0.1.0 start: `node server.js`
npm ERR! `sh "-c" "node server.js"` failed with 1
npm ERR! 
npm ERR! Failed at the juke@0.1.0 start script.
npm ERR! This is most likely a problem with the juke package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls juke
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.27+
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! cwd /home/pi/src/juke
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/src/juke/npm-debug.log
npm ERR! not ok code 0

No idea what's going on there. My guess is that shoe fails with connect somehow although I could be wrong.

Btw do you know how change the currently active item at MPD playlist while it is not playing anything. I went through their API and couldn't find anything fitting this particular purpose. I know I could hack around bit (hit next/prev at volume zero :) ) but I'm hoping there would be something nicer around.

hughsk commented 11 years ago

Hmm, can't seem to work out what's going on - getting the same error with my demo now too. The end error isn't a problem either, the server still crashes... About time I fixed this up, will keep you posted!

The move command (here) should cut it. move 10 0 should move the 11th item to the top of the list :)

bebraw commented 11 years ago

The move command (here) should cut it. move 10 0 should move the 11th item to the top of the list :)

I ended up rethinking my approach. Now I track the position index of the current song on my side and then use play <id>. If it's not playing it will simply alter that index and won't use mpd at all. I made it to cycle (last goes to first, first to last) so that's kind of nice as well.

bebraw commented 7 years ago

Time to close as I don't work on juke anymore. 👍