Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adinan-cenci committed Mar 5, 2022
1 parent b96df49 commit 0c1e737
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 98 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0] - 2022-03-05

### Changed
- Tidying up the documentation.

### Added
- Documentation for the methods `::getStationCheckResults()` and `::getStationClicks()`.
- Added the `$limit` parameter for the `::getStationCheckResults()` method.

### Fixed
- Bug: without specifying the uuid, `::getStationCheckResults()` and `::getStationClicks()` would return empty results.

## [2.0.1] - 2021-11-01

### Changed
Expand All @@ -16,9 +28,10 @@ Added `guzzlehttp/guzzle` to the project, replacing my own `adinan-cenci/simple-
### Changed

The `RadioBrowser` class is now a wrapper for the new `RadioBrowserApi` class.
`RadioBrowserApi` is the general one, its methods return strings, `RadioBrowser` methods return arrays.
`RadioBrowserApi` is the general one, its methods return strings, `RadioBrowser` methods return arrays or objects depending on the parameters informed to the constructor.

### Added

- RadioBrowserApi class
- The read-only proprieties $server and $format.
- ::getStationsByClicks()
Expand All @@ -37,5 +50,4 @@ The `RadioBrowser` class is now a wrapper for the new `RadioBrowserApi` class.
## [0.1.1] - 2021-01-28

### Fixed
- ::getStationsByExactTag($tag) and ::getStationsByTag($tag) no longer strip "#" from $tag before request.

- `::getStationsByExactTag($tag)` and `::getStationsByTag($tag)` no longer strip "#" from `$tag` before request.
172 changes: 117 additions & 55 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "library",
"keywords": ["radio", "music"],
"license": "MIT",
"version": "2.0.1",
"version": "2.1.0",
"authors": [
{
"name": "Adinan Cenci",
Expand Down
11 changes: 8 additions & 3 deletions examples/a-get-tags.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
/**
* In this example we'll see how to fetch tags.
* Tags are used to describe radio stations, we can use tags to find them.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;

//-----------------------------
Expand All @@ -13,9 +18,9 @@
//-----------------------------

$browser = new RadioBrowser();
$filter = 'metal';
$orderBy = 'stationcount';
$reverse = true; // ( decrescent )
$filter = 'metal'; // optional
$orderBy = 'stationcount'; // optional
$reverse = true; // ( decrescent ) optional
$data = $browser->getTags($filter, $orderBy, $reverse);

echo '<pre>';
Expand Down
17 changes: 9 additions & 8 deletions examples/b-get-states.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* Search states by name
* In this example we'll see how to fetch states.
* We can use this information to find radio stations.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;
Expand All @@ -17,13 +18,13 @@
//-----------------------------

$browser = new RadioBrowser();
$filter = 'Texas';
$country = '';
$orderBy = 'name';
$reverse = true; // ( decrescent )
$hideBroken = false;
$offset = 0;
$limit = 50;
$filter = 'Texas'; // optional
$country = ''; // optional
$orderBy = 'name'; // optional
$reverse = true; // ( decrescent ) optional
$hideBroken = false; // Optional
$offset = 0; // optional
$limit = 50; // optional
$data = $browser->getStates($filter, $country, $orderBy, $reverse, $hideBroken);

echo '<pre>';
Expand Down
17 changes: 11 additions & 6 deletions examples/c-get-stations-by-tag.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
/**
* In this example we'll see how to find stations described with a
* specific tag.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;

//-----------------------------
Expand All @@ -13,12 +18,12 @@
//-----------------------------

$browser = new RadioBrowser();
$tag = 'power metal';
$orderBy = 'clickcount';
$reverse = true; // ( decrescent )
$hideBroken = false;
$offset = 0;
$limit = 50;
$tag = 'power metal'; // optional
$orderBy = 'clickcount'; // optional
$reverse = true; // ( decrescent ) optional
$hideBroken = false; // optional
$offset = 0; // optional
$limit = 50; // optional
$data = $browser->getStationsByTag($tag, $orderBy, $reverse, $hideBroken, $offset, $limit);

echo '<pre>';
Expand Down
16 changes: 10 additions & 6 deletions examples/d-get-stations-by-country.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
/**
* In this example we'll see how to find stations from a specific country.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;

//-----------------------------
Expand All @@ -13,12 +17,12 @@
//-----------------------------

$browser = new RadioBrowser();
$country = 'Brazil';
$orderBy = 'clickcount';
$reverse = true; // ( decrescent )
$hideBroken = false;
$offset = 0;
$limit = 10;
$country = 'Brazil'; // optional
$orderBy = 'clickcount'; // optional
$reverse = true; // ( decrescent ) optional
$hideBroken = false; // optional
$offset = 0; // optional
$limit = 10; // optional
$data = $browser->getStationsByCountry($country, $orderBy, $reverse, $hideBroken, $offset, $limit);

echo '<pre>';
Expand Down
11 changes: 8 additions & 3 deletions examples/e-get-stations-by-clicks.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
/**
* In this example we'll see how to fetch the most synthonized stations.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;

//-----------------------------
Expand All @@ -13,9 +17,10 @@
//-----------------------------

$browser = new RadioBrowser();
$offset = 0;
$limit = 10;
$data = $browser->getStationsByClicks($offset, $limit);
$offset = 0; // optional
$limit = 10; // optional
$hideBroken = true; // optional
$data = $browser->getStationsByClicks($offset, $limit, $hideBroken);

echo '<pre>';
print_r($data);
Expand Down
11 changes: 8 additions & 3 deletions examples/f-get-stations-by-votes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
/**
* In this example we'll see how to fetch the highest voted stations.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;

//-----------------------------
Expand All @@ -13,9 +17,10 @@
//-----------------------------

$browser = new RadioBrowser();
$offset = 0;
$limit = 10;
$data = $browser->getStationsByVotes($offset, $limit);
$offset = 0; // optional
$limit = 10; // optional
$hideBroken = true; // optional
$data = $browser->getStationsByVotes($offset, $limit, $hideBroken);

echo '<pre>';
print_r($data);
Expand Down
14 changes: 9 additions & 5 deletions examples/g-get-stations-in-xml-format.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
/**
* In this example we'll see how to fetch data formatted in XML.
*/

use AdinanCenci\RadioBrowser\RadioBrowserApi;

//-----------------------------
Expand All @@ -13,11 +17,11 @@
//-----------------------------

$browser = new RadioBrowserApi(false, 'xml');
$orderBy = 'clickcount';
$reverse = true; // ( decrescent )
$hideBroken = false;
$offset = 0;
$limit = 10;
$orderBy = 'clickcount'; // optional
$reverse = true; // ( decrescent ) optional
$hideBroken = false; // optional
$offset = 0; // optional
$limit = 10; // optional
$data = $browser->getStations($orderBy, $reverse, $hideBroken, $offset, $limit);

header ("Content-Type:text/xml");
Expand Down
2 changes: 1 addition & 1 deletion examples/y-get-servers-ips.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* List available servers IPs
* In this example we'll get a list of IPs from available servers.
*/

use AdinanCenci\RadioBrowser\RadioBrowser;
Expand Down
9 changes: 5 additions & 4 deletions src/RadioBrowserApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,22 @@ public function getStations($order = 'name', $reverse = false, $hideBroken = fal

//------------------------------------

public function getStationCheckResults($stationUuid = '', $lastCheckUuid = null, $seconds = 0)
public function getStationCheckResults($stationUuid = '', $lastCheckUuid = null, $seconds = 0, $limit = 999999)
{
$url = $this->server.$this->format.'/checks/'.$stationUuid;
$url = $this->server.$this->format.'/checks' . ( $stationUuid ? '/' . $stationUuid : '');

$variables = [
'lastcheckuuid' => $lastCheckUuid,
'seconds' => $seconds
'seconds' => $seconds,
'limit' => $limit
];

return $this->fetchBody($url, $variables);
}

public function getStationClicks($stationUuid = '', $lastClickUuid = null, $seconds = 0)
{
$url = $this->server.$this->format.'/clicks/'.$stationUuid;
$url = $this->server.$this->format.'/clicks' . ( $stationUuid ? '/' . $stationUuid : '');

$variables = [
'lastclickuuid' => $lastClickUuid,
Expand Down

0 comments on commit 0c1e737

Please sign in to comment.