scheduled playlists can overlap now with each subsequent one interrupting one already playing
This commit is contained in:
parent
e412cfdac9
commit
f2098954b8
1 changed files with 14 additions and 9 deletions
|
@ -97,10 +97,15 @@ const std::string PostgresqlSchedule::scheduleCountStmt =
|
||||||
* Basically checks if the starts or ends value falls within the queried frame
|
* Basically checks if the starts or ends value falls within the queried frame
|
||||||
* or starts before and ends after the queried timeframe.
|
* or starts before and ends after the queried timeframe.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
//const std::string PostgresqlSchedule::isTimeframaAvailableStmt =
|
||||||
|
// "SELECT COUNT(*) FROM schedule WHERE "
|
||||||
|
// "((starts <= ? AND ? < ends) OR (starts < ? AND ? <= ends)) "
|
||||||
|
// "OR (? <= starts AND ends <= ?)";
|
||||||
|
|
||||||
|
//new criteria is that playlists cannot start at the same time
|
||||||
const std::string PostgresqlSchedule::isTimeframaAvailableStmt =
|
const std::string PostgresqlSchedule::isTimeframaAvailableStmt =
|
||||||
"SELECT COUNT(*) FROM schedule WHERE "
|
"SELECT COUNT(*) FROM schedule WHERE "
|
||||||
"((starts <= ? AND ? < ends) OR (starts < ? AND ? <= ends)) "
|
"starts = ?";
|
||||||
"OR (? <= starts AND ends <= ?)";
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The SQL statement for scheduling a playlist.
|
* The SQL statement for scheduling a playlist.
|
||||||
|
@ -213,13 +218,13 @@ PostgresqlSchedule :: isTimeframeAvailable(
|
||||||
isTimeframaAvailableStmt));
|
isTimeframaAvailableStmt));
|
||||||
timestamp = Conversion::ptimeToTimestamp(from, Conversion::roundDown);
|
timestamp = Conversion::ptimeToTimestamp(from, Conversion::roundDown);
|
||||||
pstmt->setTimestamp(1, *timestamp);
|
pstmt->setTimestamp(1, *timestamp);
|
||||||
pstmt->setTimestamp(2, *timestamp);
|
// pstmt->setTimestamp(2, *timestamp);
|
||||||
pstmt->setTimestamp(5, *timestamp);
|
// pstmt->setTimestamp(5, *timestamp);
|
||||||
|
//
|
||||||
timestamp = Conversion::ptimeToTimestamp(to, Conversion::roundUp);
|
// timestamp = Conversion::ptimeToTimestamp(to, Conversion::roundUp);
|
||||||
pstmt->setTimestamp(3, *timestamp);
|
// pstmt->setTimestamp(3, *timestamp);
|
||||||
pstmt->setTimestamp(4, *timestamp);
|
// pstmt->setTimestamp(4, *timestamp);
|
||||||
pstmt->setTimestamp(6, *timestamp);
|
// pstmt->setTimestamp(6, *timestamp);
|
||||||
|
|
||||||
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
Ptr<ResultSet>::Ref rs(pstmt->executeQuery());
|
||||||
result = (rs->next()) ? (rs->getLong(1) == 0) : false;
|
result = (rs->next()) ? (rs->getLong(1) == 0) : false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue