Change Shoutcast spelling and add SSL support.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-02-06 22:10:45 -06:00
parent 300db548b2
commit 983b6c50a8
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
10 changed files with 36 additions and 29 deletions

View File

@ -56,7 +56,7 @@ abstract class AbstractLogViewerController
];
break;
case FrontendAdapters::SHOUTcast:
case FrontendAdapters::Shoutcast:
$log_paths['shoutcast_log'] = [
'name' => __('SHOUTcast Log'),
'path' => $stationConfigDir . '/shoutcast.log',

View File

@ -6,7 +6,7 @@ namespace App\Controller\Api\Admin\Shoutcast;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Radio\Frontend\SHOUTcast;
use App\Radio\Frontend\Shoutcast;
use Psr\Http\Message\ResponseInterface;
class GetAction
@ -14,7 +14,7 @@ class GetAction
public function __invoke(
ServerRequest $request,
Response $response,
SHOUTcast $shoutcast
Shoutcast $shoutcast
): ResponseInterface {
return $response->withJson(
[

View File

@ -373,7 +373,7 @@ class StationMount implements
public function getAutodjProtocolEnum(): ?StreamProtocols
{
return match ($this->getAutodjAdapterTypeEnum()) {
FrontendAdapters::SHOUTcast => StreamProtocols::Icy,
FrontendAdapters::Shoutcast => StreamProtocols::Icy,
default => null
};
}

View File

@ -8,12 +8,12 @@ namespace App\Radio\Enums;
use App\Radio\Frontend\Icecast;
use App\Radio\Frontend\Remote;
use App\Radio\Frontend\SHOUTcast;
use App\Radio\Frontend\Shoutcast;
enum FrontendAdapters: string implements AdapterTypeInterface
{
case Icecast = 'icecast';
case SHOUTcast = 'shoutcast2';
case Shoutcast = 'shoutcast2';
case Remote = 'remote';
public function getValue(): string
@ -25,7 +25,7 @@ enum FrontendAdapters: string implements AdapterTypeInterface
{
return match ($this) {
self::Icecast => 'Icecast 2.4',
self::SHOUTcast => 'SHOUTcast DNAS 2',
self::Shoutcast => 'SHOUTcast DNAS 2',
self::Remote => 'Remote',
};
}
@ -34,7 +34,7 @@ enum FrontendAdapters: string implements AdapterTypeInterface
{
return match ($this) {
self::Icecast => Icecast::class,
self::SHOUTcast => SHOUTcast::class,
self::Shoutcast => Shoutcast::class,
self::Remote => Remote::class,
};
}

View File

@ -8,8 +8,8 @@ namespace App\Radio\Enums;
use App\Radio\Remote\AzuraRelay;
use App\Radio\Remote\Icecast;
use App\Radio\Remote\SHOUTcast1;
use App\Radio\Remote\SHOUTcast2;
use App\Radio\Remote\Shoutcast1;
use App\Radio\Remote\Shoutcast2;
enum RemoteAdapters: string implements AdapterTypeInterface
{
@ -36,8 +36,8 @@ enum RemoteAdapters: string implements AdapterTypeInterface
public function getClass(): string
{
return match ($this) {
self::SHOUTcast1 => SHOUTcast1::class,
self::SHOUTcast2 => SHOUTcast2::class,
self::SHOUTcast1 => Shoutcast1::class,
self::SHOUTcast2 => Shoutcast2::class,
self::Icecast => Icecast::class,
self::AzuraRelay => AzuraRelay::class,
};

View File

@ -5,12 +5,13 @@ declare(strict_types=1);
namespace App\Radio\Frontend;
use App\Entity;
use App\Radio\CertificateLocator;
use Exception;
use NowPlaying\Result\Result;
use Psr\Http\Message\UriInterface;
use Symfony\Component\Process\Process;
class SHOUTcast extends AbstractFrontend
class Shoutcast extends AbstractFrontend
{
public function supportsMounts(): bool
{
@ -114,19 +115,23 @@ class SHOUTcast extends AbstractFrontend
$configPath = $station->getRadioConfigDir();
$frontendConfig = $station->getFrontendConfig();
$config = array_filter([
'password' => $frontendConfig->getSourcePassword(),
'adminpassword' => $frontendConfig->getAdminPassword(),
'logfile' => $configPath . '/sc_serv.log',
'w3clog' => $configPath . '/sc_w3c.log',
'banfile' => $this->writeIpBansFile($station),
'ripfile' => $configPath . '/sc_serv.rip',
'maxuser' => $frontendConfig->getMaxListeners() ?? 250,
'portbase' => $frontendConfig->getPort(),
$certPaths = CertificateLocator::findCertificate();
$config = [
'password' => $frontendConfig->getSourcePassword(),
'adminpassword' => $frontendConfig->getAdminPassword(),
'logfile' => $configPath . '/sc_serv.log',
'w3clog' => $configPath . '/sc_w3c.log',
'banfile' => $this->writeIpBansFile($station),
'ripfile' => $configPath . '/sc_serv.rip',
'maxuser' => $frontendConfig->getMaxListeners() ?? 250,
'portbase' => $frontendConfig->getPort(),
'requirestreamconfigs' => 1,
'licenceid' => $frontendConfig->getScLicenseId(),
'userid' => $frontendConfig->getScUserId(),
]);
'licenceid' => $frontendConfig->getScLicenseId(),
'userid' => $frontendConfig->getScUserId(),
'sslCertificateFile' => $certPaths->getCertPath(),
'sslCertificateKeyFile' => $certPaths->getKeyPath(),
];
$customConfig = trim($frontendConfig->getCustomConfiguration() ?? '');
if (!empty($customConfig)) {
@ -137,6 +142,8 @@ class SHOUTcast extends AbstractFrontend
}
}
$config = array_filter($config);
$i = 0;
foreach ($station->getMounts() as $mount_row) {
/** @var Entity\StationMount $mount_row */

View File

@ -7,7 +7,7 @@ namespace App\Radio\Remote;
use App\Entity;
use NowPlaying\AdapterFactory;
class SHOUTcast1 extends AbstractRemote
class Shoutcast1 extends AbstractRemote
{
protected function getAdapterType(): string
{

View File

@ -6,7 +6,7 @@ namespace App\Radio\Remote;
use NowPlaying\AdapterFactory;
class SHOUTcast2 extends AbstractRemote
class Shoutcast2 extends AbstractRemote
{
protected function getAdapterType(): string
{

View File

@ -31,7 +31,7 @@ class StationFormComponent implements VueComponentInterface
'showAdminTab' => $request->getAcl()->isAllowed(GlobalPermissions::Stations),
'showAdvanced' => $settings->getEnableAdvancedFeatures(),
'timezones' => $this->getTimezones(),
'isShoutcastInstalled' => isset($installedFrontends[FrontendAdapters::SHOUTcast->value]),
'isShoutcastInstalled' => isset($installedFrontends[FrontendAdapters::Shoutcast->value]),
'countries' => Countries::getNames(),
'storageLocationApiUrl' => (string)$request->getRouter()->named('api:admin:stations:storage-locations'),
];

View File

@ -19,7 +19,7 @@ class Api_Admin_StationsCest extends CestAbstract
],
[
'name' => 'Modified Station',
'frontend_type' => \App\Radio\Enums\FrontendAdapters::SHOUTcast->value,
'frontend_type' => \App\Radio\Enums\FrontendAdapters::Shoutcast->value,
]
);
}