Coder Social home page Coder Social logo

pianode's Introduction

Pianode

Node.js package to run pianobar (a pandora.com console client) headless, install it and manage all settings.

Table Of Contents

  1. Installation
  2. Events
  3. Status values
  4. Functions
  5. Objects
  6. Error Types
  7. Options
  8. ToDo

Installation

To use this package within your own application, just add it to your application's dependencies (package.json) and run npm install in your application's directory.

You can also install it seperately in your current directory with npm install https://github.com/FallingSnow/pianode/archive/master.tar.gz

The only thing you have to make sure additionally is that the listed lib dependencies are installed:

  • libao-dev
  • libmad0-dev
  • libfaad-dev
  • libgnutls-dev
  • libjson0-dev
  • libgcrypt11-dev
  • socat

Socat is used for interproccess unix socket communication between pianobar and pianode.

If your distribution uses apt just run this command, if not find and install the above listed packages in the available package manager. They are available for a lot of other distributions under the same name.

sudo apt-get install libao-dev libmad0-dev libfaad-dev libgnutls-dev libjson0-dev libgcrypt11-dev socat

Next run this installation script for pianobar using node lib/install.js

All other dependencies (including pianobar itself) will be installed automatically with npm. Pianode won't mess with your local pianobar installation (if you have one), it builds a totally new one and won't touch your configuration files at all, it loads the configuration from inside the pianode packagefiles (pianode/pianobar/config).

Events

Form: 'eventName' (parameterType additionalParameter)

Status Values

  • 'not running'
  • 'error'
  • 'undefined'
  • 'logging in'
  • 'playing'
  • 'paused'
  • 'receiving stations'
  • 'receiving playlist'
  • 'receiving explanation'

Functions

  • start()
    • Starts the pianobar client as child process
  • getStatus()
  • getState()
    • returns (object state)
  • on(event, callback)
    • The callback is called with a specific object as parameter when the given event occurrs

Objects

error

var error = {
  type: 'errorType',
  text: 'errorMessage'
};

see Error Types

song

var song = {
  name: '',
  artist: '',
  album: '',
  playlist: ''
};

station

var station = {
  name: '',
  id: ''
};

time

var time = {
  string: '',
  percent: 0,
  remaining: {
    string: '',
    seconds: 0
  },
  total: {
    string: '',
    seconds: 0
  },
  played: {
    string: '',
    seconds: 0
  }
};

statusChange

var statusChange = {
  status: '',
  prevStatus: ''
};

see Status Values

currentInfo

var currentInfo = {
  album: "...",
  art: "...",
  artist: "...",
  rating: "0-10",
  station: "...",
  title: "..."
};

stationsList

var stationsList = {
  0: "... Radio"
  1: "... Radio",
  2: "... Radio",
  3: "... Radio",
  4: "QuickMix"
};

Error Types

Possible values of error.type:

  • 'Pianobar error'
  • 'Network error'
  • 'Unknown error'

Options

var options = {
  station: Q, (integer or Q for quickmix)
  verbose: true,
  errorLog: true,
  startPaused: false,
};

ToDo

Problems:

  • pianobarConfig.js
  • Swap proxys
  • How do upvoted songs appear?
    • in Songlist
    • when playing
  • Windows support with thedmd/pianobar-windows?
    • neccessary to build on target maschine every time or are binarys enough
    • config named pianobar.cfg
    • executable?

Pianobar statusmessage coverage

Status Message
ok /!\ Cannot access audio file: Forbidden.
ok (i) Login...
ok (i) Get stations...
ok (i) Receiving new playlist...
ok (i) Receiving explanation...
    | (i) No history yet.

ok | [?] Select station: | [?] Select song: | [?] What to do with this song? ok | [?] Password: ok | [?] Email: ok | |> Station "QuickMix" (1057370371552570017) ok | |> "Ice Ice Baby" by "Vanilla Ice" on "To The Extreme" @ 90s Pop Radio ok | # -04:24/04:31 ok | 0) q 90s Pop Radio ok | 0) Q 90s Pop Radio ok | 0) 90s Pop Radio | 0) Aerosmith - I Don't Want To Miss A Thing | 0) Aphrodite - Return To Jedda ok | Network error: Read error. ok | Network error: Timeout. ok | Network error: TLS handshake failed. ok | Error: Pandora is not available in your country. Set up a control proxy (see manpage).

Functions:

  • Standalone
    • playPause()
    • play()
    • pause()
    • next()
    • love()
    • ban()
    • volumeUp()
    • volumeDown()
    • volumeReset()
    • tired()
    • selectQuickMix() ???
    • quit()
    • bookmark() ???
    • stationCreateFromSong() ???
  • Emitting events
    • history()
      • how to differ from upcoming?
      • "no history yet" possible!
    • upcoming()
      • how to differ from history?
    • songExplain()
    • songInfo()
  • Requesting input
    • changeStation(identifier)
    • songMove(newStation) ???
    • stationCreate() ???
    • stationDelete() ???
    • stationRename() ???
    • manageStation() ???
    • stationAddMusic() ???
    • stationAddByGenre() ???

pianode's People

Contributors

truckershitch avatar philippwiddra avatar fallingsnow avatar

Watchers

James Cloos 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.