Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Test invocation

ctrlaltca edited this page Sep 11, 2018 · 1 revision

Create a new test.php file in the same directory as subsonic.php with the following content:

<?php

include_once('subsonic.php');

$sub = new Subsonic;
$sub->setHost('https://your.server.com');
$sub->setUser('admin');
$sub->setPass('password');

$ret = $sub->apiSearch('song name', 'artist name', $count = 1);

var_export($ret);

Then execute the script (either from the commandline or calling its url) and ensure that the result is something like this:

array (
  0 => 
  array (
    'id' => '115577',
    'parent' => '115179',
    'isDir' => false,
    'title' => 'Sona name',
    'album' => 'Album name',
    'artist' => 'Artist name',
    'track' => 2,
    'genre' => 'Lounge',
    'coverArt' => '115179',
    'size' => 2761357,
    'contentType' => 'audio/mpeg',
    'suffix' => 'mp3',
    'duration' => 171,
    'bitRate' => 128,
    'path' => 'path/to/file.mp3',
    'playCount' => 0,
    'created' => '2015-11-16T18:47:24.000Z',
    'albumId' => '592',
    'type' => 'music',
    'url' => 'https://...',
    'coverUrl' => 'https://...',
  ),

Clone this wiki locally