[DEPRECATED] Moved to OrigamiVision/StationPlaylist, (*1)
, (*2)
SPLRequest is a very small PHP library which makes it able to connect
with StationPlaylist Studio, loading all available songs in the library
and even do live song requests to the server., (*3)
You can obtain the latest version from our GitHub repository
or install it via Composer:, (*4)
composer require lanarea/splrequest
or manually add it to composer.json:, (*5)
{
"require": {
"lanarea/splrequest": "dev-master"
}
}
Preparation
Some (local) settings need to be applied before you can use this script:, (*6)
- Open StationPlaylist Studio
-
Open the Options window (Ctrl+O or View > Options), (*7)
-
Enable the connection with SPL from the outside:, (*8)
- On the left, select the tab named "Communications"
- Set the port for TCP connections to StationPlaylist Studio
- You don't need to set the "Send Response" value, as far as I know
- Optionally, but preferably, set an IP Restriction (to the same IP as where the script is running)
- Possibly: Forward the previously mentioned port so it's reachable from your public IP. This option can be found in your Router's settings or via your ISP
-
Set which directories to make public:, (*9)
- On the left, select the tab named "Folder Locations"
- The input box next to the "Search Folders" label contains the folders where this script can cruise through
- Don't forget to enable the checkbox for "Include subfolders"
Usage
Autoload or include the class, and enable the namespace to make use of the class:, (*10)
use LANarea\SPLRequest;
Make a new SPLRequest object and include the IP-address/Hostname, and the TCP port:, (*11)
$spl = new SPLRequest('0.0.0.0', 0);
Get all available songs via the getAllSongs() method:, (*12)
$results = $spl->getAllSongs(); // returns an array of all songs
The above is equal to the following:, (*13)
$results = $spl->search('*');
Might be subject to the "Max Search Results"-setting under the "Communications" tab., (*14)
Searching for a song:
- Use * as a wildcard operator (eg. "Avril" for all songs starting with 'Avril')
- Use | as an end to the query (eg. "A|" for a list of all songs starting with an A), (*15)
$results = $spl->search('Avril Lavigne*'); // returns an array, or false
Tip: Surround all your queries with the wildcard operator, eg. "*Elvis*", (*16)
Do a song request:, (*17)
$spl->doRequest('C:/path/to/music - file.mp3'); // returns true or false
Alternatively you can add even more useful information:, (*18)
$spl->doRequest('C:/path/to/music - file.mp3', 'John Doe', 'Brussels, Belgium');
Check out the example.php file for free por.. uh, examples of course., (*19)
Note
You'll have to implement your own request limititations, cacheing, etc., (*20)
With this package, you can only handle the data we can get to and from SPL., (*21)
Known issues
- ~~Special signs like é,ä,û; are rendered as questionmarks. Probably something with the encoding.~~ [UTF-8 output since 5.20]
License
It is licensed under the New BSD License., (*22)