New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nTunes

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nTunes

An extendable REST API for interacting with iTunes

  • 0.0.5
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by87.5%
Maintainers
0
Weekly downloads
 
Created
Source

nTunes

A REST (HTTP) API for interacting with iTunes

nTunes (nodeTunes?) is an HTTP-based API for interacting with your iTunes installation (currently only for Mac OSX), written with NodeJS.

In other words, it's the foundation for writing web applications based on your iTunes library. You could potentially write a website that remotely controls the volume of the iTunes on your computer.

Installation

If you're lazy, just use the awesome npm of course!

npm install nTunes

Usage

nTunes itself is a Connect HTTP Server subclass, which can either be run stand-alone or created by your own NodeJS code, with the capability to add layers (to serve your implementing website perhaps?).

Stand-alone mode...

If you're only interested in nTunes as-is, then it comes with a convenient executable file to easily start the HTTP server for you to play with. Once you've installed via npm, simply invoke:

nTunes

This starts nTunes as a stand-alone HTTP server in development mode. While the server is running you can interact with your iTunes library through simple HTTP requests sent to your computer. Here are some examples:

To get the name of the current track with a GET request:

curl localhost:8888/current%20track/name
  // Returns "Lateralus"

To set your iTunes' volume to 50% with through a POST request:

curl -d value=50 localhost:8888/sound%20volume
  // Returns 50

The API mostly returns JSON encoded values, and is mostly intended to be used with the XMLHttpRequest object and JSON.parse function in the web browser.

Adding 'layers' to the nTunes module...

For familiarity, creating your own nTunes instance works exactly the same as creating a connect server, except that nTunes' layers get added after your passed layers, so be very careful not to overwrite part of the nTunes API! Here's an example of serving an index.html file when it's requested, otherwise falling-through to the nTunes layers:

var nTunes = require("nTunes");

nTunes.createServer(function(req, res, next) {
  if (req.url == "/index.html") {
    // Serve your index file...
  } else {
    // Fall-though to the nTunes API
    next();
  }
}).listen(80);

Keywords

FAQs

Package last updated on 29 Apr 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc