-CC-1944
This commit is contained in:
parent
afaea87319
commit
d22ab329d8
|
@ -128,9 +128,8 @@ class ApiController extends Zend_Controller_Action
|
|||
if (Schedule::ValidPypoTimeFormat($from) && Schedule::ValidPypoTimeFormat($to)) {
|
||||
$result = Schedule::ExportRangeAsJson($from, $to);
|
||||
$result['stream_metadata'] = array();
|
||||
$result['stream_metadata']['format'] = "2";
|
||||
$result['stream_metadata']['station_name'] = "z103";
|
||||
$result['stream_metadata']['show_name'] = "dj danny D";
|
||||
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
||||
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
||||
echo json_encode($result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$values = $form->getValues();
|
||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
|
||||
Application_Model_Preference::SetStreamLabelFormat($values["streamFormat"]);
|
||||
|
||||
$this->view->statusMsg = "Preferences Updated.";
|
||||
}
|
||||
|
|
|
@ -34,10 +34,20 @@ class Application_Form_Preferences extends Zend_Form
|
|||
'value' => $defaultFade
|
||||
));
|
||||
|
||||
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
||||
$stream_format->setLabel('Stream Label:');
|
||||
$stream_format->setMultiOptions(array("Artist - Title",
|
||||
"Show - Artist - Title",
|
||||
"Show",
|
||||
"Station name - Show name"));
|
||||
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
||||
$this->addElement($stream_format);
|
||||
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'class' => 'ui-button ui-state-default',
|
||||
'ignore' => true,
|
||||
'label' => 'Submit',
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,5 +86,16 @@ class Application_Model_Preference
|
|||
return Application_Model_Preference::GetValue("default_fade");
|
||||
}
|
||||
|
||||
public static function SetStreamLabelFormat($type){
|
||||
Application_Model_Preference::SetValue("stream_label_format", $type);
|
||||
}
|
||||
|
||||
public static function GetStreamLabelFormat(){
|
||||
return Application_Model_Preference::getValue("stream_label_format");
|
||||
}
|
||||
|
||||
public static function GetStationName(){
|
||||
return Application_Model_Preference::getValue("station_name");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -396,14 +396,26 @@ class Schedule {
|
|||
$row["id"] = $row["group_id"];
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT MIN(name) AS name, MIN(creator) AS creator, group_id, "
|
||||
." SUM(clip_length) AS clip_length,"
|
||||
." MIN(file_id) AS file_id, COUNT(*) as count,"
|
||||
." MIN(playlist_id) AS playlist_id, MIN(starts) AS starts, MAX(ends) AS ends"
|
||||
." FROM $CC_CONFIG[scheduleTable]"
|
||||
." LEFT JOIN $CC_CONFIG[playListTable] ON playlist_id = $CC_CONFIG[playListTable].id"
|
||||
." WHERE (starts >= TIMESTAMP '$p_fromDateTime') AND (ends <= TIMESTAMP '$p_toDateTime')"
|
||||
." GROUP BY group_id"
|
||||
$sql = "SELECT MIN(st.name) AS name,"
|
||||
." MIN(pt.creator) AS creator,"
|
||||
." st.group_id, "
|
||||
." SUM(st.clip_length) AS clip_length,"
|
||||
." MIN(st.file_id) AS file_id,"
|
||||
." COUNT(*) as count,"
|
||||
." MIN(st.playlist_id) AS playlist_id,"
|
||||
." MIN(st.starts) AS starts,"
|
||||
." MAX(st.ends) AS ends,"
|
||||
." MIN(sh.name) AS show_name"
|
||||
." FROM $CC_CONFIG[scheduleTable] as st"
|
||||
." LEFT JOIN $CC_CONFIG[playListTable] as pt"
|
||||
." ON st.playlist_id = pt.id"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
||||
." ON st.instance_id = si.id"
|
||||
." LEFT JOIN $CC_CONFIG[showTable] as sh"
|
||||
." ON si.show_id = sh.id"
|
||||
." WHERE (st.starts >= TIMESTAMP '$p_fromDateTime')"
|
||||
." AND (st.ends <= TIMESTAMP '$p_toDateTime')"
|
||||
." GROUP BY st.group_id"
|
||||
." ORDER BY starts";
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
|
@ -645,6 +657,7 @@ class Schedule {
|
|||
$playlists[$pkey]['duration'] = $dx['clip_length'];
|
||||
$playlists[$pkey]['played'] = '0';
|
||||
$playlists[$pkey]['schedule_id'] = $dx['group_id'];
|
||||
$playlists[$pkey]['show_name'] = $dx['show_name'];
|
||||
$playlists[$pkey]['user_id'] = 0;
|
||||
$playlists[$pkey]['id'] = $dx["playlist_id"];
|
||||
$playlists[$pkey]['start'] = Schedule::CcTimeToPypoTime($dx["start"]);
|
||||
|
|
|
@ -93,7 +93,6 @@ class PypoFetch:
|
|||
|
||||
#encode in latin-1 due to this bug: http://bugs.python.org/issue1772794
|
||||
tn.write(('vars.stream_metadata_type %s\n' % stream_metadata['format']).encode('latin-1'))
|
||||
tn.write(('vars.show_name %s\n' % stream_metadata['show_name']).encode('latin-1'))
|
||||
tn.write(('vars.station_name %s\n' % stream_metadata['station_name']).encode('latin-1'))
|
||||
tn.write('exit\n')
|
||||
logger.debug(tn.read_all())
|
||||
|
@ -236,6 +235,7 @@ class PypoFetch:
|
|||
entry = dict()
|
||||
entry['type'] = 'file'
|
||||
entry['annotate'] = pl_entry
|
||||
entry['show_name'] = playlist['show_name']
|
||||
ls_playlist.append(entry)
|
||||
|
||||
logger.debug("everything ok, adding %s to playlist", pl_entry)
|
||||
|
|
|
@ -141,13 +141,13 @@ class PypoPush:
|
|||
|
||||
#Sending schedule table row id string.
|
||||
logger.debug("vars.pypo_data %s\n"%(str(liquidsoap_data["schedule_id"])))
|
||||
tn.write("vars.pypo_data %s\n"%(str(liquidsoap_data["schedule_id"])))
|
||||
tn.write(("vars.pypo_data %s\n"%str(liquidsoap_data["schedule_id"])).encode('latin-1'))
|
||||
|
||||
for item in playlist:
|
||||
annotate = str(item['annotate'])
|
||||
logger.debug(annotate)
|
||||
tn.write('queue.push %s' % (annotate))
|
||||
tn.write("\n")
|
||||
tn.write(('queue.push %s\n' % annotate).encode('latin-1'))
|
||||
tn.write(('vars.show_name %s\n' % item['show_name']).encode('latin-1'))
|
||||
|
||||
tn.write("exit\n")
|
||||
logger.debug(tn.read_all())
|
||||
|
|
Loading…
Reference in New Issue