Scheduling and Playback - screenly/chrome-extension

Scheduling and Playback for the Screenly Chrome Extension:

The Screenly Chrome Extension allows you to schedule content to play on specific displays at designated times. This can be achieved through various options, including Google Apps Script, JavaScript, GitLab pipelines, and Backstage plugins.

  1. Google Apps Script:

Create a time-based trigger that runs a function (e.g., updateEvents) every few minutes:

function createTrigger() {
ScriptApp.newTrigger('updateEvents')
.timeBased()
.everyMinutes(5)
.create();
}

Source: https://opensource.com/article/19/1/automate-calendar

  1. JavaScript:

Create a content script that matches all URLs and injects the content.js file:

{
"manifest_version": 2,
"name": "Screenly",
"description": "Scheduling and Playback",
"version": "2.0",
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"content.js"
]
}
]
}

Source: https://opensource.com/article/17/8/using-javascript-hack-web

  1. GitLab Pipelines:

Schedule pipelines to run at specific times or intervals:

schedule:
- cron: '0 0 * * *'

Source: https://docs.gitlab.com/ee/ci/pipelines/schedules.html

  1. Backstage Plugins:

Use the PluginTaskScheduler.scheduleTask() method to schedule a task function for recurring runs:

await PluginTaskScheduler.scheduleTask({
task: {
name: 'screenly-task',
schedule: {
cron: '0 * * * *'
},
timeout: {
minutes: 15
},
priority: 10,
maxRetries: 3,
retryDelay: {
minutes: 1
}
},
invocation: {
args: {
displayId: '123',
contentId: '456'
}
}
});

Source: https://backstage.io/docs/reference/backend-tasks.plugintaskscheduler.scheduletask

  1. Backstage Scheduler:

Use the Scheduler.addToSchedule() method to add tasks and intervals to the schedule:

Scheduler.addToSchedule({
id: 'screenly-scheduler',
task: {
name: 'screenly-task',
schedule: {
cron: '0 * * * *'
},
timeout: {
minutes: 15
},
priority: 10,
maxRetries: 3,
retryDelay: {
minutes: 1
}
},
invocation: {
args: {
displayId: '123',
contentId: '456'
}
}
});

Source: https://backstage.io/docs/reference/plugin-search-backend-node.scheduler.addtoschedule

  1. Web-based Schedules (Grafana OnCall):

Create and manage on-call schedules directly in the Grafana OnCall plugin:

type: web
name: Engineering
timezone: America/Los_Angeles
oncall_order:
- name: Engineer 1
start_time: 2022-01-01T00:00:00.000Z
end_time: 2022-01-07T00:00:00.000Z
- name: Engineer 2
start_time: 2022-01-07T00:00:00.000Z
end_time: 2022-01-14T00:00:00.000Z
escalation_policy:
- name: Primary
targets:
- name: Engineer 1
rotation_order:
- name: Engineer 1
escalation_delay: 0
- name: Engineer 2
escalation_delay: 10

Source: https://grafana.com/docs/oncall/latest/on-call-schedules/web-schedule

  1. Cron Jobs (Linux):

Schedule tasks to run at specific times using the cron syntax:

15 8 * * 1-5 playsound ~/short-school-bell-sound-effect.mp3

Source: https://opensource.com/article/20/9/linux-school-bell

These are some of the possible options for scheduling and playback in the Screenly Chrome Extension. You can choose the one that best fits your needs and use case.