70 lines
3.0 KiB
Markdown
70 lines
3.0 KiB
Markdown
# Airplay Predictor
|
|
|
|
Collects what Danish radio stations play and models when an artist is likely to be played
|
|
again. The methods come from finance and insurance: survival and hazard models (bankruptcy,
|
|
credit default), self-exciting point processes (trading), regime switching (currencies) and
|
|
credibility theory (insurance pricing).
|
|
|
|
**Stations:** DR P3, every regional P4, P5, P6 Beat and P8 Jazz, plus Bauer Media's NOVA, Radio Soft, The Voice, Pop FM and Radio 100 (all of Bauer's Danish web stations with `--all-bauer`).
|
|
|
|
**DR extras:**
|
|
- each artist's 52-week airplay history per channel;
|
|
- the weekly rotation lists (which songs are in rotation category A, B or C).
|
|
|
|
- [docs/DATA_SOURCES.md](docs/DATA_SOURCES.md): where the data comes from and its limits. The stations only keep about 7 days.
|
|
- [docs/MODELS.md](docs/MODELS.md): how airplay works and the models to try.
|
|
|
|
## Build and run
|
|
|
|
Rust 1.80+.
|
|
|
|
```
|
|
cargo build --release
|
|
./target/release/airplay collect # last 7 days, everything it doesn't have yet
|
|
./target/release/airplay stats # what's in the database
|
|
```
|
|
|
|
Data goes to `data/airplay.db` (SQLite) and `data/rotations/*.pdf`.
|
|
|
|
**Tables:**
|
|
- `plays`: one row per play, in UTC, deduplicated.
|
|
- `dr_artist_weeks`: weekly plays per DR artist and channel.
|
|
- `dr_artists`: the raw artist pages.
|
|
- `stations`, `runs`.
|
|
|
|
## Collect continuously
|
|
|
|
The sources forget after about a week. `deploy/` has a systemd timer that collects daily (a weekly run would have no margin):
|
|
|
|
```
|
|
cp deploy/airplay-collect.* /etc/systemd/system/
|
|
systemctl daemon-reload && systemctl enable --now airplay-collect.timer
|
|
```
|
|
|
|
## Be polite
|
|
|
|
One request at a time, at least 0.4 s apart, with a User-Agent that links here. Programmes already read are not fetched again.
|
|
|
|
## Playground site
|
|
|
|
`airplay serve` serves the ranking, artist pages and a what-if at https://idiotmaxxing.com/airplay/ (rankings from the `forecasts` table; the what-if models are fitted at start and again when a newer forecast run appears).
|
|
|
|
```
|
|
cp deploy/airplay-web.service /etc/systemd/system/ && systemctl daemon-reload && systemctl enable --now airplay-web
|
|
cp deploy/traefik-airplay.yaml /data/coolify/proxy/dynamic/airplay.yaml # Coolify's Traefik picks it up live
|
|
```
|
|
|
|
After `cargo build --release`, run `systemctl restart airplay-web`. The daily collection runs `airplay model rank` afterwards, so the site refreshes by itself.
|
|
|
|
## Models
|
|
|
|
```
|
|
airplay rotations [--wayback] [--reparse] DR rotation-list PDFs -> rotation_lists
|
|
airplay model calibrate [--out FILE] rotation thresholds from the lists
|
|
airplay model adds [--h 0,4] backtest of the new-add model -> docs/BACKTEST-ADDS.md
|
|
airplay model backtest [--h 1,4,8] backtest of weekly plays / in rotation -> docs/BACKTEST.md
|
|
airplay model ifpi 20-year IFPI test bed -> docs/IFPI.md
|
|
airplay model nmf [--out FILE] New Music Friday Denmark vs DR adds
|
|
airplay model rank forecasts for the site (forecasts table)
|
|
```
|