Skip to content

Commit

Permalink
Improve README.md a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
toresbe committed Nov 14, 2022
1 parent 059f1c5 commit 22418ac
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
# jukebox

**Note**: This generates the schedule for Frikanalen v3, currently running on [beta.frikanalen.no]().
Until v2 is decommissioned, schedule is still generated by [these scripts](https://github.com/Frikanalen/frikanalen/tree/master/packages/fkweb/agenda/management/commands), invoked by [these cron jobs](https://github.com/Frikanalen/frikanalen/tree/master/infra/k8s/django/periodic-schedule-tasks).

![Coverage](https://raw.githubusercontent.com/Frikanalen/jukebox/main/badges/coverage-jest%20coverage.svg)

This automatically schedules videos on the Frikanalen linear schedule.
This schedules videos on the Frikanalen linear schedule.

It weights candidates videos according to various criteria, like so:

```typescript
const entries = fillPeriod(startAt, endAt, {
weightings: [
{ criteria: "notRecentlySeenFromSameOrganization", multiplier: 100 },
{ criteria: "notScheduled", multiplier: 30 },
{ criteria: "notRecentlySeen", multiplier: 20 },
{ criteria: "notSeenThisWeek", multiplier: 10 },
{ criteria: "notSeenToday", multiplier: 10 },
{ criteria: "isRecent", multiplier: 2 },
{ criteria: "rand", multiplier: 1 },
],
videos,
})
```

To get to an MVP of Frikanalen v3.0 as soon as possible while retaining flexibility for future
support for eg. live events, the schedule is split into multiple layers.

The previous generation of software had limited to no support for live events, and in migrations the schedule is copied directly into the jukebox table.

The jukebox generates the "background layer", currently the only one in the database.

In the future, user-scheduled videos and live events will occupy other database tables, which will then override whatever is defined by the jukebox.

## Requirements / configuration

Set the environment variable FK_API_KEY to the same value as seen by toches, and set `FK_API` to an URL pointing to it.

Copy dev-env to .env for standard defaults for development.

## Cron job

```yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: jukebox
namespace: beta
spec:
jobTemplate:
spec:
template:
spec:
containers:
- env:
- name: FK_API
value: https://beta.frikanalen.no/api/v2
- name: FK_API_KEY
valueFrom:
secretKeyRef:
key: FK_API_KEY
name: fk-api-key
image: frikanalen/jukebox-v2:latest
name: jukebox
schedule: 00 22 * * *
successfulJobsHistoryLimit: 3
suspend: false
```

0 comments on commit 22418ac

Please sign in to comment.