npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shoutcastinfo

v1.0.16

Published

Get Shoutcast info from V1 and V2 versions

Downloads

6

Readme

Table of Contents

Installing

Using npm:

$ npm install shoutcastinfo

Example

const shoutcastInfo = require('shoutcastinfo');

Parameters

  // `ip` is the server IP
  ip: '127.0.0.1',

  // `port` is the server PORT
  port: '1234',
  
  // `password` is the admin password for shoutcast
  password: '123456789',
  
  // `timeout` Timeout for server response, if no response within that time. Request throws error. (Milliseconds)
  port: 2000,
  
  // `type` is the shoutcast version
  type: 1, // Shoutcast v1,
  type: 2, // Shoutcast v2,v2.5,
  
  // `sid` SID
  sid: 1,
  
  // `op` is the operation for request
  op: 'streaminfo', // Returns the stream info
  op: 'listeners', // Returns the listeners by IP and their listen time

Example-1


const shoutcastInfo = require('shoutcastinfo.js');

shoutcastInfo({
	ip: '192.168.1.1',
	port: '1234',
	password: '123456789',
	timeout: 2000,
	type: 2,
	sid: 1,
	op: 'streaminfo',
}).then(function (result)
{
	console.log(result);
	
	/*
	  Examples
	  console.log(result.SongTitle);
	  console.log(result.Bitrate);
	*/
	
}).catch(function (err)
{
	console.log(err);
});
      

/*
Results for Stream Info
{
  CurrentListeners: '0',
  PeakListeners: '0',
  MaxListeners: '0',
  UniqueListeners: '0',
  AverageTime: '0',
  ServerGenre: 'West',
  ServerURL: 'Test.Com',
  ServerTitle: 'TestFM',
  SongTitle: 'Country Roads',
  StreamHits: '0',
  StreamSource: '127.0.0.1',
  Bitrate: '128',
  Content: 'audio/mpeg',
  Version: '2.5.5.733 (posix(linux x64))'
}
*/

Example-2


shoutcastInfo({
	ip: '192.168.1.1',
	port: '1234',
	password: '123456789',
	timeout: 2000,
	type: 2,
	sid: 1,
	op: 'listeners',
}).then(function (result)
{
	console.log(result);
	
	/*
	  Examples
	  console.log(result[0].HOSTNAME[0]._text[0]);
	*/
}).catch(function (err)
{
	console.log(err);
});
     
			
/*
Results for Listeners Info as Array

[
  [
    {
      HOSTNAME: [ { _text: [ '127.0.0.1' ] } ],
      USERAGENT: [
        {
          _text: [
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64)6'
          ]
        }
      ],
      CONNECTTIME: [ { _text: [ '1138' ] } ],
      UID: [ { _text: [ '41' ] } ],
      TYPE: [ { _text: [ '33556480' ] } ],
      REFERER: [ { _text: [ 'http://ip:port:etc/index.html?sid=1' ] } ],
      XFF: [ {} ],
      GRID: [ { _text: [ '41' ] } ],
      TRIGGERS: [ { _text: [ '0' ] } ]
    },
    {
      HOSTNAME: [ { _text: [ '33.44.55.192' ] } ],
      USERAGENT: [
        {
          _text: [
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
          ]
        }
      ],
      CONNECTTIME: [ { _text: [ '3' ] } ],
      UID: [ { _text: [ '42' ] } ],
      TYPE: [ { _text: [ '33556480' ] } ],
      REFERER: [
        {
          _text: [
            'http://ip:port:etc8/admin.cgi?sid=1&page=1'
          ]
        }
      ],
      XFF: [ {} ],
      GRID: [ { _text: [ '42' ] } ],
      TRIGGERS: [ { _text: [ '0' ] } ]
    }
  ]
]
*/

Example-3 (with await)


const shoutcastInfo = require('shoutcastinfo.js');

async function getRadioInfo() {
    let results = await shoutcastInfo({
        ip: '192.168.1.1',
        port: '1234',
        password: '123456789',
        timeout: 2000,
        type: 2,
        sid: 1,
        op: 'streaminfo',
    });
    
    console.log(results);
}

Roadmap

  • Better Error Handling

License

MIT