rename RecyclePolicy→RotationPolicy, collapse AccessMode, clean OIDC refs
This commit is contained in:
@@ -9,10 +9,10 @@ use crate::models::{
|
||||
ScheduledSlot,
|
||||
};
|
||||
use crate::ports::{ChannelQuery, IProviderRegistry, ScheduleCommand, ScheduleQuery, StreamQuality};
|
||||
use crate::value_objects::{BlockId, ChannelId, FillStrategy, MediaFilter, MediaItemId, RecyclePolicy, Weekday};
|
||||
use crate::value_objects::{BlockId, ChannelId, FillStrategy, MediaFilter, MediaItemId, RotationPolicy, Weekday};
|
||||
|
||||
mod fill;
|
||||
mod recycle;
|
||||
mod rotation;
|
||||
|
||||
const SCHEDULE_DURATION_DAYS: i64 = 7;
|
||||
|
||||
@@ -27,12 +27,12 @@ struct AlgorithmicParams<'a> {
|
||||
strategy: &'a FillStrategy,
|
||||
block_id: BlockId,
|
||||
loop_on_finish: bool,
|
||||
ignore_recycle_policy: bool,
|
||||
ignore_rotation_policy: bool,
|
||||
}
|
||||
|
||||
struct RecycleContext<'a> {
|
||||
struct RotationContext<'a> {
|
||||
history: &'a [PlaybackRecord],
|
||||
policy: &'a RecyclePolicy,
|
||||
policy: &'a RotationPolicy,
|
||||
generation: u32,
|
||||
last_item_id: Option<&'a MediaItemId>,
|
||||
}
|
||||
@@ -131,9 +131,9 @@ impl ScheduleEngineService {
|
||||
start: slot_start,
|
||||
end: slot_end,
|
||||
},
|
||||
RecycleContext {
|
||||
RotationContext {
|
||||
history: &history,
|
||||
policy: channel.recycle_policy(),
|
||||
policy: channel.rotation_policy(),
|
||||
generation,
|
||||
last_item_id,
|
||||
},
|
||||
@@ -255,7 +255,7 @@ impl ScheduleEngineService {
|
||||
&self,
|
||||
block: &ProgrammingBlock,
|
||||
window: BlockTimeWindow,
|
||||
recycle: RecycleContext<'_>,
|
||||
rotation: RotationContext<'_>,
|
||||
) -> DomainResult<Vec<ScheduledSlot>> {
|
||||
match block.content() {
|
||||
BlockContent::Manual { items, .. } => {
|
||||
@@ -274,10 +274,10 @@ impl ScheduleEngineService {
|
||||
strategy,
|
||||
block_id: block.id(),
|
||||
loop_on_finish: block.loop_on_finish(),
|
||||
ignore_recycle_policy: block.ignore_recycle_policy(),
|
||||
ignore_rotation_policy: block.ignore_rotation_policy(),
|
||||
},
|
||||
window,
|
||||
recycle,
|
||||
rotation,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -313,7 +313,7 @@ impl ScheduleEngineService {
|
||||
&self,
|
||||
params: AlgorithmicParams<'_>,
|
||||
window: BlockTimeWindow,
|
||||
recycle: RecycleContext<'_>,
|
||||
rotation: RotationContext<'_>,
|
||||
) -> DomainResult<Vec<ScheduledSlot>> {
|
||||
let candidates = self
|
||||
.provider_registry
|
||||
@@ -324,10 +324,10 @@ impl ScheduleEngineService {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
|
||||
let pool = if params.ignore_recycle_policy {
|
||||
let pool = if params.ignore_rotation_policy {
|
||||
candidates.clone()
|
||||
} else {
|
||||
recycle::apply_recycle_policy(&candidates, recycle.history, recycle.policy, recycle.generation)
|
||||
rotation::apply_rotation_policy(&candidates, rotation.history, rotation.policy, rotation.generation)
|
||||
};
|
||||
let target_secs = (window.end - window.start).num_seconds() as u32;
|
||||
let selected = fill::fill_block(
|
||||
@@ -335,7 +335,7 @@ impl ScheduleEngineService {
|
||||
&pool,
|
||||
target_secs,
|
||||
params.strategy,
|
||||
recycle.last_item_id,
|
||||
rotation.last_item_id,
|
||||
params.loop_on_finish,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user