Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
5100613049
4 changed files with 186 additions and 15 deletions
|
@ -466,6 +466,30 @@ class Schedule {
|
|||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT DISTINCT"
|
||||
." pt.name,"
|
||||
." ft.track_title,"
|
||||
." ft.artist_name,"
|
||||
." ft.album_title,"
|
||||
." st.starts,"
|
||||
." st.ends,"
|
||||
." st.clip_length,"
|
||||
." st.media_item_played,"
|
||||
." st.group_id,"
|
||||
." show.name as show_name,"
|
||||
." st.instance_id"
|
||||
." FROM $CC_CONFIG[scheduleTable] st"
|
||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN $CC_CONFIG[playListTable] pt"
|
||||
." ON st.playlist_id = pt.id"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] si"
|
||||
." ON st.instance_id = si.id"
|
||||
." LEFT JOIN $CC_CONFIG[showTable] show"
|
||||
." ON si.show_id = show.id"
|
||||
." WHERE st.starts < si.ends";
|
||||
|
||||
/*
|
||||
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.media_item_played, st.group_id, show.name as show_name, st.instance_id"
|
||||
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
|
||||
." WHERE st.playlist_id = pt.id"
|
||||
|
@ -473,6 +497,7 @@ class Schedule {
|
|||
." AND st.instance_id = si.id"
|
||||
." AND si.show_id = show.id"
|
||||
." AND st.starts < si.ends";
|
||||
*/
|
||||
|
||||
if ($timePeriod < 0){
|
||||
$sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
|
||||
|
@ -628,17 +653,24 @@ class Schedule {
|
|||
* @param string $p_toDateTime
|
||||
* In the format "YYYY-MM-DD-HH-mm-SS"
|
||||
*/
|
||||
public static function GetScheduledPlaylists()
|
||||
public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$t1 = new DateTime();
|
||||
$range_start = $t1->format("Y-m-d H:i:s");
|
||||
|
||||
$t2 = new DateTime();
|
||||
$t2->add(new DateInterval("PT24H"));
|
||||
$range_end = $t2->format("Y-m-d H:i:s");
|
||||
|
||||
if (is_null($p_fromDateTime)) {
|
||||
$t1 = new DateTime();
|
||||
$range_start = $t1->format("Y-m-d H:i:s");
|
||||
} else {
|
||||
$range_start = Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
|
||||
}
|
||||
if (is_null($p_fromDateTime)) {
|
||||
$t2 = new DateTime();
|
||||
$t2->add(new DateInterval("PT24H"));
|
||||
$range_end = $t2->format("Y-m-d H:i:s");
|
||||
} else {
|
||||
$range_end = Schedule::PypoTimeToAirtimeTime($p_toDateTime);
|
||||
}
|
||||
|
||||
// Scheduler wants everything in a playlist
|
||||
$data = Schedule::GetItems($range_start, $range_end, true);
|
||||
$playlists = array();
|
||||
|
|
|
@ -948,7 +948,31 @@ class Show_DAL {
|
|||
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
||||
//checking for st.starts IS NULL so that the query also returns shows that do not have any items scheduled.
|
||||
." AND (st.starts < si.ends OR st.starts IS NULL)"
|
||||
." ORDER BY st.starts";
|
||||
." ORDER BY si.starts, st.starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public static function GetShowsByDayOfWeek($day){
|
||||
//DOW FROM TIMESTAMP
|
||||
//The day of the week (0 - 6; Sunday is 0) (for timestamp values only)
|
||||
|
||||
//SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
|
||||
//Result: 5
|
||||
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT"
|
||||
." si.starts as show_starts,"
|
||||
." si.ends as show_ends,"
|
||||
." s.name as show_name,"
|
||||
." s.url as url"
|
||||
." FROM $CC_CONFIG[showInstances] si"
|
||||
." LEFT JOIN $CC_CONFIG[showTable] s"
|
||||
." ON si.show_id = s.id"
|
||||
." WHERE EXTRACT(DOW FROM si.starts) = $day"
|
||||
." AND EXTRACT(WEEK FROM si.starts) = EXTRACT(WEEK FROM localtimestamp)";
|
||||
|
||||
//echo $sql;
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue