Skip to content

Commit

Permalink
fix: apply replay gain preferences on scheduled files (#2945)
Browse files Browse the repository at this point in the history
### Description

The replay gain preferences are applied in the legacy code, but the
playout code was missing this feature. The replay gain was not applied
when playout fetched the schedules.

https://github.com/libretime/libretime/blob/37d1a7685e37e45734553a0eb4a4da793ca858cb/legacy/application/models/Schedule.php#L881-L886
libretime/libretime@35d0dec

9574cd2
  • Loading branch information
paddatrapper authored and libretime-bot committed Feb 8, 2024
1 parent 9574cd2 commit c60387c
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 9 deletions.
12 changes: 12 additions & 0 deletions javascript-client/model/stream-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,17 @@ export interface StreamPreferences {
* @memberof StreamPreferences
*/
'message_offline': string;
/**
*
* @type {boolean}
* @memberof StreamPreferences
*/
'replay_gain_enabled': boolean;
/**
*
* @type {number}
* @memberof StreamPreferences
*/
'replay_gain_offset': number;
}

2 changes: 2 additions & 0 deletions php-client/docs/Model/StreamPreferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ Name | Type | Description | Notes
**input_fade_transition** | **float** | | [readonly]
**message_format** | **int** | | [readonly]
**message_offline** | **string** | | [readonly]
**replay_gain_enabled** | **bool** | | [readonly]
**replay_gain_offset** | **float** | | [readonly]

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
86 changes: 80 additions & 6 deletions php-client/lib/Model/StreamPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class StreamPreferences implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static $openAPITypes = [
'input_fade_transition' => 'float',
'message_format' => 'int',
'message_offline' => 'string'
'message_offline' => 'string',
'replay_gain_enabled' => 'bool',
'replay_gain_offset' => 'float'
];

/**
Expand All @@ -72,7 +74,9 @@ class StreamPreferences implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static $openAPIFormats = [
'input_fade_transition' => 'double',
'message_format' => null,
'message_offline' => null
'message_offline' => null,
'replay_gain_enabled' => null,
'replay_gain_offset' => 'double'
];

/**
Expand All @@ -83,7 +87,9 @@ class StreamPreferences implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static array $openAPINullables = [
'input_fade_transition' => false,
'message_format' => false,
'message_offline' => false
'message_offline' => false,
'replay_gain_enabled' => false,
'replay_gain_offset' => false
];

/**
Expand Down Expand Up @@ -174,7 +180,9 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'input_fade_transition' => 'input_fade_transition',
'message_format' => 'message_format',
'message_offline' => 'message_offline'
'message_offline' => 'message_offline',
'replay_gain_enabled' => 'replay_gain_enabled',
'replay_gain_offset' => 'replay_gain_offset'
];

/**
Expand All @@ -185,7 +193,9 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'input_fade_transition' => 'setInputFadeTransition',
'message_format' => 'setMessageFormat',
'message_offline' => 'setMessageOffline'
'message_offline' => 'setMessageOffline',
'replay_gain_enabled' => 'setReplayGainEnabled',
'replay_gain_offset' => 'setReplayGainOffset'
];

/**
Expand All @@ -196,7 +206,9 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'input_fade_transition' => 'getInputFadeTransition',
'message_format' => 'getMessageFormat',
'message_offline' => 'getMessageOffline'
'message_offline' => 'getMessageOffline',
'replay_gain_enabled' => 'getReplayGainEnabled',
'replay_gain_offset' => 'getReplayGainOffset'
];

/**
Expand Down Expand Up @@ -259,6 +271,8 @@ public function __construct(array $data = null)
$this->setIfExists('input_fade_transition', $data ?? [], null);
$this->setIfExists('message_format', $data ?? [], null);
$this->setIfExists('message_offline', $data ?? [], null);
$this->setIfExists('replay_gain_enabled', $data ?? [], null);
$this->setIfExists('replay_gain_offset', $data ?? [], null);
}

/**
Expand Down Expand Up @@ -297,6 +311,12 @@ public function listInvalidProperties()
if ($this->container['message_offline'] === null) {
$invalidProperties[] = "'message_offline' can't be null";
}
if ($this->container['replay_gain_enabled'] === null) {
$invalidProperties[] = "'replay_gain_enabled' can't be null";
}
if ($this->container['replay_gain_offset'] === null) {
$invalidProperties[] = "'replay_gain_offset' can't be null";
}
return $invalidProperties;
}

Expand Down Expand Up @@ -392,6 +412,60 @@ public function setMessageOffline($message_offline)

return $this;
}

/**
* Gets replay_gain_enabled
*
* @return bool
*/
public function getReplayGainEnabled()
{
return $this->container['replay_gain_enabled'];
}

/**
* Sets replay_gain_enabled
*
* @param bool $replay_gain_enabled replay_gain_enabled
*
* @return self
*/
public function setReplayGainEnabled($replay_gain_enabled)
{
if (is_null($replay_gain_enabled)) {
throw new \InvalidArgumentException('non-nullable replay_gain_enabled cannot be null');
}
$this->container['replay_gain_enabled'] = $replay_gain_enabled;

return $this;
}

/**
* Gets replay_gain_offset
*
* @return float
*/
public function getReplayGainOffset()
{
return $this->container['replay_gain_offset'];
}

/**
* Sets replay_gain_offset
*
* @param float $replay_gain_offset replay_gain_offset
*
* @return self
*/
public function setReplayGainOffset($replay_gain_offset)
{
if (is_null($replay_gain_offset)) {
throw new \InvalidArgumentException('non-nullable replay_gain_offset cannot be null');
}
$this->container['replay_gain_offset'] = $replay_gain_offset;

return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
Expand Down
2 changes: 2 additions & 0 deletions python-client/docs/StreamPreferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Name | Type | Description | Notes
**input_fade_transition** | **float** | | [readonly]
**message_format** | **int** | | [readonly]
**message_offline** | **str** | | [readonly]
**replay_gain_enabled** | **bool** | | [readonly]
**replay_gain_offset** | **float** | | [readonly]

## Example

Expand Down
14 changes: 11 additions & 3 deletions python-client/libretime_client/models/stream_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import re # noqa: F401
import json

from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Union
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -29,7 +29,9 @@ class StreamPreferences(BaseModel):
input_fade_transition: Union[StrictFloat, StrictInt]
message_format: StrictInt
message_offline: StrictStr
__properties: ClassVar[List[str]] = ["input_fade_transition", "message_format", "message_offline"]
replay_gain_enabled: StrictBool
replay_gain_offset: Union[StrictFloat, StrictInt]
__properties: ClassVar[List[str]] = ["input_fade_transition", "message_format", "message_offline", "replay_gain_enabled", "replay_gain_offset"]

model_config = {
"populate_by_name": True,
Expand Down Expand Up @@ -64,11 +66,15 @@ def to_dict(self) -> Dict[str, Any]:
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
"""
excluded_fields: Set[str] = set([
"input_fade_transition",
"message_format",
"message_offline",
"replay_gain_enabled",
"replay_gain_offset",
])

_dict = self.model_dump(
Expand All @@ -90,7 +96,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"input_fade_transition": obj.get("input_fade_transition"),
"message_format": obj.get("message_format"),
"message_offline": obj.get("message_offline")
"message_offline": obj.get("message_offline"),
"replay_gain_enabled": obj.get("replay_gain_enabled"),
"replay_gain_offset": obj.get("replay_gain_offset")
})
return _obj

Expand Down

0 comments on commit c60387c

Please sign in to comment.