Re-scheduling currently playing item now stops currnet playback, and re-schedules a clone. Allowing for DB-Friendly schedule2scrub functionality.

This commit is contained in:
rainbow napkin 2025-09-09 08:19:46 -04:00
parent 92659929b9
commit 9eeed591ad
4 changed files with 112 additions and 58 deletions

View file

@ -99,7 +99,7 @@ class canopyUXUtils{
return outString;
}
humieFriendlyDuration(seconds){
humieFriendlyDuration(seconds, compact = false){
//If we have an invalid duration
if(seconds <= 0){
//bitch, moan, and complain!
@ -119,41 +119,62 @@ class canopyUXUtils{
//Remove recorded minutes
seconds -= minutes * 60;
//If we have an hour
if(hours == 1){
//Add the string
timeStrings.push('1 Hour');
//If we have hours
}else if(hours > 0){
//Add the string
timeStrings.push(`${hours} Hours`);
//If we're rendering compact, alarm-clock style duration
if(compact){
if(hours > 0){
//Push hours, pad start with 0
timeStrings.push(String(hours).padStart(2, '0'));
}
if(hours > 0 || minutes > 0){
//Push minutes, pad start with 0
timeStrings.push(String(minutes).padStart(2, '0'));
}
if(hours > 0 || minutes > 0 || seconds > 0){
//Push seconds, pre-fix a 00: if hours and minutes are empty, round to nearest int and pad start with 0
timeStrings.push(`${(hours == 0 && minutes == 0) ? '00:' : ''}${String(Math.round(seconds)).padStart(2, '0')}`);
}
return timeStrings.join(':');
//If we're rendering out using our words
}else{
//If we have an hour
if(hours == 1){
//Add the string
timeStrings.push('1 Hour');
//If we have hours
}else if(hours > 0){
//Add the string
timeStrings.push(`${hours} Hours`);
}
//If we have a minute
if(minutes == 1){
//Add the string
timeStrings.push('1 Minute');
//If we have minutes
}else if(minutes > 0){
//Add the string
timeStrings.push(`${minutes} Minutes`);
}
//Add the 'and ' if we need it
const secondsPrefix = timeStrings.length > 0 ? 'and ' : '';
//If we have a second
if(seconds == 1){
//Add the string
timeStrings.push(`${secondsPrefix}1 Second`);
//If we have more than a second
}else if(seconds > 1){
//Add the string
timeStrings.push(`${secondsPrefix}${Math.round(seconds)} Seconds`);
}
//Join the time strings together
return timeStrings.join(', ');
}
//If we have a minute
if(minutes == 1){
//Add the string
timeStrings.push('1 Minute');
//If we have minutes
}else if(minutes > 0){
//Add the string
timeStrings.push(`${minutes} Minutes`);
}
//Add the 'and ' if we need it
const secondsPrefix = timeStrings.length > 0 ? 'and ' : '';
//If we have a second
if(seconds == 1){
//Add the string
timeStrings.push(`${secondsPrefix}1 Second`);
//If we have more than a second
}else if(seconds > 1){
//Add the string
timeStrings.push(`${secondsPrefix}${Math.round(seconds)} Seconds`);
}
//Join the time strings together
return timeStrings.join(', ');
}
//Update this and popup class to use nodes