Skip to content

djsoftnet/radioboss-php-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RadioBoss PHP Wrapper Packagist

This is a PHP wrapper/client for the RadioBoss API.

Table of Contents

  1. Requirements
  2. Installation
  3. General Usage
  4. Examples

Requirements

  • PHP 7.2 or later.

Installation

Install it using Composer:

composer require djsoftnet/radioboss-php-api

General-Usage

Before using the RadioBoss API, you'll need to enable it in the RadioBoss Settings. After you have activated the API and set a password, you can retrieve data.

<?php

require 'vendor/autoload.php';

$client = new \RadioBoss\RadioBossAPIClient("127.0.0.1", "9000");
$api = new \RadioBoss\RadioBossAPI($client);

Examples

  • Track

    • Get informations from Track Object (Artist, Title, Duration, ...)
      $track->getArtist();
      $track->getTitle();
      $track->getDuration();
    • Get current Track
      $api->getPlaybackInfo()->getCurrentTrack();
    • Get next Track
      $api->getPlaybackInfo()->getNextTrack();
    • Get previous Track
      $api->getPlaybackInfo()->getPreviousTrack();
    • Get last played Songs
      //all last played songs
      $api->getLastPlayed();
      //filters out songs that were not sent to the server
      $api->getLastPlayed(true);
    • Get Artwork of current or next Track
      $api->getTrackArtwork();
      $api->getNextTrackArtwork();
    • Set next Track
      $api->setNextTack(123);
    • Read Track data by filename
      $api->readTag("C:\Music\song.mp3");
  • Playlist

    • Get data from Playlist Object (Tracks, Track count)
      $playlist->getTracks();
      $playlist->getCount();
    • Get Playlist (provides all information, may be slow for some large Playlists)
      //all songs
      $api->getPlaylist();
      //only songs from 5-10
      $api->getPlaylist(5, 10);
    • Get Playlist (doesn't provide all information)
      //all songs
      $api->getPlaylist2();
      //only songs the first 10 songs
      $api->getPlaylist2(10);
  • Microphone

    • Get Microphone status
      $api->getMicrophone();
    • Enable/Disable Microphone
      $api->setMicrophone(true);
      $api->setMicrophone(false);
  • Playback

    • Get data from Playback Object (Position, Length, State, ...)
      $playback->getPosition();
      $playback->getLength();
      $playback->getState();
    • Get Playback Object
      $api->getPlaybackInfo()->getPlayback();
  • Encoder

    • Get data from Encoder Object (Status, Error, ...)
      $encoder->getStatus();
      $encoder->getError();
    • Get Encoder Object
      $api->getEncoderStatus();
  • Player

    • Get data from Player Object (Version, Uptime)
      $player->getVersion();
      $player->getUptime();
    • Get Player Object
      $api->getStatus();