Skip to content
Permalink
Browse files

Merge pull request #620 from tarasfrompir/patch-4

Patch 4
  • Loading branch information...
sergejey committed Sep 9, 2019
2 parents 385dc31 + cb99228 commit ab883eddf1c604442e87a1747ac68d119b8ce0a7
Showing with 30 additions and 0 deletions.
  1. +30 −0 modules/app_player/addons/majordroid.addon.php
@@ -47,6 +47,36 @@ function play($input) {
}
return $this->success;
}
// Volume
function set_volume($volume) {
$this->reset_properties();
if(strlen($volume)) {
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if($socket === false) {
$this->success = FALSE;
$this->message = socket_strerror(socket_last_error());
$this->message = iconv('CP1251', 'UTF-8', $this->message);
} else {
$result = @socket_connect($socket, $this->terminal['HOST'], $this->terminal['PLAYER_PORT']);
if($result === false) {
$this->success = FALSE;
$this->message = socket_strerror(socket_last_error($socket));
$this->message = iconv('CP1251', 'UTF-8', $this->message);
} else {
$packet = 'volume:'.$volume;
socket_write($socket, $packet, strlen($packet));
$this->success = TRUE;
$this->message = 'OK';
}
socket_close($socket);
}
} else {
$this->success = FALSE;
$this->message = 'Input is missing!';
}
return $this->success;
}
// Pause
function pause() {

0 comments on commit ab883ed

Please sign in to comment.
You can’t perform that action at this time.