feat: move off_air_meta stream setting to pref table (#2023)
This commit is contained in:
parent
e408237be1
commit
6c59ff588b
|
@ -0,0 +1,44 @@
|
|||
# pylint: disable=invalid-name
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
insert into cc_pref ("keystr", "valstr")
|
||||
select
|
||||
"keyname" as "keystr",
|
||||
coalesce("value", 'LibreTime - offline') as "valstr"
|
||||
from cc_stream_setting
|
||||
where "keyname" = 'off_air_meta';
|
||||
|
||||
delete from cc_stream_setting
|
||||
where "keyname" = 'off_air_meta';
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
insert into cc_stream_setting ("keyname", "value", "type")
|
||||
select
|
||||
"keystr" as "keyname",
|
||||
coalesce("valstr", 'LibreTime - offline') as "value",
|
||||
'string' as "type"
|
||||
from cc_pref
|
||||
where "keystr" = 'off_air_meta';
|
||||
|
||||
delete from cc_pref
|
||||
where "keystr" = 'off_air_meta';
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0036_3_0_0_alpha_13_10"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.14.1",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
|
@ -1 +1 @@
|
|||
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.10"
|
||||
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.14.1"
|
||||
|
|
|
@ -8,6 +8,7 @@ INSERT INTO cc_live_log ("state", "start_time") VALUES ('S', now() at time zone
|
|||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('import_timestamp', '0');
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('timezone', 'UTC');
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('default_stream_mount_point', 'main');
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('off_air_meta', 'LibreTime - offline');
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('enable_replay_gain', 1);
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('locale', 'en_US');
|
||||
INSERT INTO cc_pref ("keystr", "valstr") VALUES ('max_bitrate', '320');
|
||||
|
@ -24,7 +25,6 @@ INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'
|
|||
INSERT INTO cc_pref ("subjid", "keystr", "valstr") VALUES (1, 'user_locale', 'en_US');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('off_air_meta', 'LibreTime - offline', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device_type', 'ALSA', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_StreamSetting::setDjLiveStreamPort($values['show_source_port']);
|
||||
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values['show_source_mount']);
|
||||
|
||||
Application_Model_StreamSetting::setOffAirMeta($values['offAirMeta']);
|
||||
Application_Model_Preference::setOffAirMeta($values['offAirMeta']);
|
||||
|
||||
// store stream update timestamp
|
||||
Application_Model_Preference::SetStreamUpdateTimestamp();
|
||||
|
|
|
@ -65,7 +65,7 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
|
||||
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
|
||||
$offAirMeta->setLabel(_('Off Air Metadata'))
|
||||
->setValue(Application_Model_StreamSetting::getOffAirMeta())
|
||||
->setValue(Application_Model_Preference::getOffAirMeta())
|
||||
->setDecorators(['ViewHelper']);
|
||||
$this->addElement($offAirMeta);
|
||||
|
||||
|
|
|
@ -350,6 +350,16 @@ class Application_Model_Preference
|
|||
return self::getValue('stream_label_format');
|
||||
}
|
||||
|
||||
public static function getOffAirMeta()
|
||||
{
|
||||
return self::getValue('off_air_meta');
|
||||
}
|
||||
|
||||
public static function setOffAirMeta($offAirMeta)
|
||||
{
|
||||
self::setValue('off_air_meta', $offAirMeta);
|
||||
}
|
||||
|
||||
public static function GetStationName()
|
||||
{
|
||||
return self::getValue('station_name');
|
||||
|
|
|
@ -207,7 +207,7 @@ class Application_Model_StreamSetting
|
|||
$settings['master_live_stream_mp'] = self::getMasterLiveStreamMountPoint();
|
||||
$settings['dj_live_stream_port'] = self::getDjLiveStreamPort();
|
||||
$settings['dj_live_stream_mp'] = self::getDjLiveStreamMountPoint();
|
||||
$settings['off_air_meta'] = self::getOffAirMeta();
|
||||
$settings['off_air_meta'] = Application_Model_Preference::getOffAirMeta();
|
||||
$settings['icecast_vorbis_metadata'] = self::getIcecastVorbisMetadata();
|
||||
$settings['output_sound_device'] = self::getOutputSoundDevice();
|
||||
$settings['output_sound_device_type'] = self::getOutputSoundDeviceType();
|
||||
|
@ -507,16 +507,6 @@ class Application_Model_StreamSetting
|
|||
self::setValue($stream . '_admin_pass', $v, 'string');
|
||||
}
|
||||
|
||||
public static function getOffAirMeta()
|
||||
{
|
||||
return self::getValue('off_air_meta');
|
||||
}
|
||||
|
||||
public static function setOffAirMeta($offAirMeta)
|
||||
{
|
||||
self::setValue('off_air_meta', $offAirMeta, 'string');
|
||||
}
|
||||
|
||||
public static function GetAllListenerStatErrors()
|
||||
{
|
||||
$sql = 'SELECT * FROM cc_stream_setting WHERE keyname like :p1';
|
||||
|
|
Loading…
Reference in New Issue