Closes #112 - Return to using harbor to allow both IC and SC2 to share streamer config and update streamer pages accordingly.
This commit is contained in:
parent
579ca54ace
commit
6236781fc8
|
@ -7,7 +7,7 @@ class StreamersController extends BaseController
|
|||
{
|
||||
protected function preDispatch()
|
||||
{
|
||||
if (!$this->frontend->supportsStreamers()) {
|
||||
if (!$this->backend->supportsStreamers()) {
|
||||
throw new \App\Exception(_('This feature is not currently supported on this station.'));
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ class StreamersController extends BaseController
|
|||
}
|
||||
|
||||
$this->view->server_url = $this->em->getRepository('Entity\Settings')->getSetting('base_url', '');
|
||||
$this->view->stream_port = $this->backend->getStreamPort();
|
||||
|
||||
$this->view->streamers = $this->station->streamers;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<li><a href="<?=$url->named('stations:mounts:index', ['station' => $station->id]) ?>"><i class="zmdi zmdi-portable-wifi"></i> <?=_('Mount Points') ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($acl->isAllowed('manage station streamers', $station->id) && $frontend->supportsStreamers()): ?>
|
||||
<?php if ($acl->isAllowed('manage station streamers', $station->id) && $backend->supportsStreamers()): ?>
|
||||
<li><a href="<?=$url->named('stations:streamers:index', ['station' => $station->id]) ?>"><i class="zmdi zmdi-account"></i> <?=_('Streamer/DJ Accounts') ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -47,41 +47,32 @@
|
|||
<h2><?=_('Connection Information') ?></h2>
|
||||
</div>
|
||||
<div class="card-body card-padding">
|
||||
<?php
|
||||
$frontend_type = $station->frontend_type;
|
||||
$frontend_info = (array)$station->frontend_config;
|
||||
<h4><?=_('IceCast Clients') ?></h4>
|
||||
<dl>
|
||||
<dt><?=_('Server') ?>:</dt>
|
||||
<dd><?=$server_url ?></dd>
|
||||
|
||||
if ($frontend_type == 'icecast'):
|
||||
?>
|
||||
<h4><?=_('IceCast Clients') ?></h4>
|
||||
<dl>
|
||||
<dt><?=_('Server') ?>:</dt>
|
||||
<dd><?=$server_url ?></dd>
|
||||
<dt><?=_('Port') ?>:</dt>
|
||||
<dd><?=$stream_port ?></dd>
|
||||
|
||||
<dt><?=_('Port') ?>:</dt>
|
||||
<dd><?=(int)$frontend_info['port'] ?></dd>
|
||||
<dt><?=_('Mount Name') ?>:</dt>
|
||||
<dd>/</dd>
|
||||
</dl>
|
||||
|
||||
<dt><?=_('Mount Name') ?>:</dt>
|
||||
<dd>/radio.mp3</dd>
|
||||
</dl>
|
||||
<h4><?=_('ShoutCast v1 Clients') ?></h4>
|
||||
<dl>
|
||||
<dt><?=_('Server') ?>:</dt>
|
||||
<dd><?=$server_url ?></dd>
|
||||
|
||||
<h4><?=_('ShoutCast 1.x Legacy Clients') ?></h4>
|
||||
<dl>
|
||||
<dt><?=_('Server') ?>:</dt>
|
||||
<dd><?=$server_url ?></dd>
|
||||
<dt><?=_('Port') ?>:</dt>
|
||||
<dd><?=($stream_port + 1) ?></dd>
|
||||
|
||||
<dt><?=_('Port') ?>:</dt>
|
||||
<dd><?=(int)$frontend_info['port']+1 ?></dd>
|
||||
|
||||
<dt><?=('Username') ?>:</dt>
|
||||
<dd>(Leave blank)</dd>
|
||||
|
||||
<dt><?=_('Password') ?>:</dt>
|
||||
<dd><?=$frontend_info['streamer_pw'] ?></dd>
|
||||
</dl>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<dt><?=_('Password') ?>:</dt>
|
||||
<dd>
|
||||
dj_username:dj_password<br>
|
||||
<small><?=_('(DJ username and password separated by a colon)') ?></small>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -57,6 +57,11 @@ class StreamerAuth extends \App\Console\Command\CommandAbstract
|
|||
return $this->_return($output, 'false');
|
||||
}
|
||||
|
||||
$fe_config = (array)$station->frontend_config;
|
||||
if (!empty($fe_config['source_pw']) && strcmp($fe_config['source_pw'], $pass) === 0) {
|
||||
return $this->_return($output, 'true');
|
||||
}
|
||||
|
||||
if ($this->di['em']->getRepository(StationStreamer::class)->authenticate($station, $user, $pass)) {
|
||||
return $this->_return($output, 'true');
|
||||
} else {
|
||||
|
|
|
@ -17,6 +17,18 @@ abstract class BackendAbstract extends \AzuraCast\Radio\AdapterAbstract
|
|||
return $this->supports_requests;
|
||||
}
|
||||
|
||||
protected $supports_streamers = true;
|
||||
|
||||
public function supportsStreamers()
|
||||
{
|
||||
return $this->supports_streamers;
|
||||
}
|
||||
|
||||
public function getStreamPort()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function log($message, $class = 'info')
|
||||
{
|
||||
if (!empty(trim($message))) {
|
||||
|
|
|
@ -33,18 +33,10 @@ class LiquidSoap extends BackendAbstract
|
|||
$ls_config[] = 'set("server.telnet.port", ' . $this->_getTelnetPort() . ')';
|
||||
$ls_config[] = 'set("server.telnet.reverse_dns",false)';
|
||||
|
||||
$ls_config[] = '';
|
||||
$ls_config[] = 'set("harbor.bind_addr","0.0.0.0")';
|
||||
$ls_config[] = 'set("harbor.reverse_dns",false)';
|
||||
|
||||
/*
|
||||
// Set up harbor auth script.
|
||||
$ls_config[] = '# DJ Authentication';
|
||||
$ls_config[] = 'def dj_auth(user,password) =';
|
||||
$ls_config[] = ' ret = get_process_lines("/usr/bin/php '.APP_INCLUDE_ROOT.'/util/cli.php streamer:auth '.$this->station->id.' #{user} #{password}")';
|
||||
$ls_config[] = ' ret = list.hd(ret)';
|
||||
$ls_config[] = ' bool_of_string(ret)';
|
||||
$ls_config[] = 'end';
|
||||
$ls_config[] = '';
|
||||
*/
|
||||
|
||||
// Clear out existing playlists directory.
|
||||
$current_playlists = array_diff(scandir($playlist_path), ['..', '.']);
|
||||
|
@ -158,12 +150,28 @@ class LiquidSoap extends BackendAbstract
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Add harbor live.
|
||||
$ls_config[] = '# Harbor Live DJs';
|
||||
$ls_config[] = 'live = input.harbor("/", port='.$this->_getHarborPort().', user="shoutcast", auth=dj_auth, icy=true)';
|
||||
// Set up harbor auth script.
|
||||
$ls_config[] = '# DJ Authentication';
|
||||
$ls_config[] = 'def dj_auth(user,password) =';
|
||||
$ls_config[] = ' ret = get_process_lines("/usr/bin/php '.APP_INCLUDE_ROOT.'/util/cli.php streamer:auth '.$this->station->id.' #{user} #{password}")';
|
||||
$ls_config[] = ' ret = list.hd(ret)';
|
||||
$ls_config[] = ' bool_of_string(ret)';
|
||||
$ls_config[] = 'end';
|
||||
$ls_config[] = '';
|
||||
|
||||
// Add harbor live.
|
||||
$harbor_params = [
|
||||
'"/"',
|
||||
'port='.$this->getStreamPort(),
|
||||
'user="shoutcast"',
|
||||
'auth=dj_auth',
|
||||
'icy=true',
|
||||
];
|
||||
|
||||
$ls_config[] = '# Harbor Live DJs';
|
||||
$ls_config[] = 'live = input.harbor('.implode(', ', $harbor_params).')';
|
||||
$ls_config[] = 'radio = fallback(track_sensitive = false, [live, radio])';
|
||||
$ls_config[] = '';
|
||||
*/
|
||||
|
||||
// Add fallback error file.
|
||||
// $error_song_path = APP_INCLUDE_ROOT.'/resources/error.mp3';
|
||||
|
@ -359,6 +367,11 @@ class LiquidSoap extends BackendAbstract
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function getStreamPort()
|
||||
{
|
||||
return (8000 + (($this->station->id - 1) * 10) + 5);
|
||||
}
|
||||
|
||||
protected function _getTelnetPort()
|
||||
{
|
||||
return (8500 + (($this->station->id - 1) * 10));
|
||||
|
|
|
@ -7,6 +7,8 @@ class None extends BackendAbstract
|
|||
|
||||
protected $supports_requests = false;
|
||||
|
||||
protected $supports_streamers = false;
|
||||
|
||||
public function read()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,12 +16,7 @@ abstract class FrontendAbstract extends \AzuraCast\Radio\AdapterAbstract
|
|||
{
|
||||
}
|
||||
|
||||
protected $supports_streamers = true;
|
||||
|
||||
public function supportsStreamers()
|
||||
{
|
||||
return $this->supports_streamers;
|
||||
}
|
||||
|
||||
public function getProgramName()
|
||||
{
|
||||
|
|
|
@ -7,8 +7,6 @@ class Remote extends FrontendAbstract
|
|||
{
|
||||
protected $supports_mounts = false;
|
||||
|
||||
protected $supports_streamers = false;
|
||||
|
||||
/* Process a nowplaying record. */
|
||||
protected function _getNowPlaying(&$np)
|
||||
{
|
||||
|
|
|
@ -193,6 +193,7 @@ class ShoutCast2 extends FrontendAbstract
|
|||
'ripfile' => $config_path . '/sc_serv.rip',
|
||||
'maxuser' => 500,
|
||||
'portbase' => $this->_getRadioPort(),
|
||||
'requirestreamconfigs' => 1,
|
||||
];
|
||||
|
||||
return $defaults;
|
||||
|
|
Loading…
Reference in New Issue