Repository navigation
Block Channels
A block channel changes what it plays by time of day, like late-night cable. Kids' cartoons in the morning, sitcoms in prime time, weird movies after midnight. Short "bump" cards play as each block starts.
This needs a script. The Stations page can't set bump folders or random picks, so you write the station config yourself. Read Making Channels first, especially the part about scripts.
Each block gets a folder, and each show in it gets its own list:
catalog/by-genre/Night Owl/
├── Morning/
│ ├── Show A/ links to /mnt/media/tv/Show A/...
│ └── Show B/
├── Prime Time/
│ ├── Show C/
│ └── Show D/
├── Late Movie/
│ └── Some Movie (1999).mkv
└── ~bumps/
├── morning/ bump cards: real video files, not links
└── night/
Why a list per show? FieldStation42 can pick a show at random first, then that show's next episode. A show with 800 episodes then gets the same airtime as one with 20. Without it, the big show would take over the block.
You can build these folders on the Lists & files page. Make one list per show, named like Night Owl/Prime Time/Show C, and add the show's folder to it with Keep folders up to date ticked. New episodes then join the block by themselves.
A block channel is a normal "standard" station. Each hour of the day gets its own entry:
"20": {
"tags": ["Night Owl/Prime Time/Show C", "Night Owl/Prime Time/Show D"],
"random_tags": true,
"start_bump": "Night Owl/~bumps/night"
}-
tags: the lists this hour can play. -
random_tags: pick one of those lists at random for each show, then play its next episode. -
start_bump: a folder of bump cards. FieldStation42 plays one random card at the start of the hour slot. It does not play one between every show.
Every day needs all 24 hours, "0" to "23". You can have different kinds of days. For example, a weekday and a weekend template:
import sys
sys.path.insert(0, "/opt/tuner")
import console_client
name = "Night Owl"
morning = {"tags": ["Night Owl/Morning/Show A", "Night Owl/Morning/Show B"],
"random_tags": True, "start_bump": "Night Owl/~bumps/morning"}
prime = {"tags": ["Night Owl/Prime Time/Show C", "Night Owl/Prime Time/Show D"],
"random_tags": True, "start_bump": "Night Owl/~bumps/night"}
movie = {"tags": "Night Owl/Late Movie", "start_bump": "Night Owl/~bumps/night"}
def day(prime_until):
hours = {}
for h in range(24):
if 6 <= h < 18:
hours[str(h)] = morning
elif 18 <= h < prime_until:
hours[str(h)] = prime
else:
hours[str(h)] = movie
return hours
conf = {"station_conf": {
"network_name": name,
"channel_number": 101,
"network_type": "standard",
"content_dir": "catalog/by-genre",
"off_air_video": "/opt/assets/test-pattern.mp4",
"schedule_increment": 30,
"break_strategy": "end",
"commercial_free": False,
"commercial_dir": ".commercials.off",
"bump_dir": ".cards.off",
"wrapper_no_breaks": True,
"day_templates": {"weekday": day(prime_until=23), "weekend": day(prime_until=21)},
"monday": "weekday", "tuesday": "weekday", "wednesday": "weekday", "thursday": "weekday",
"friday": "weekend", "saturday": "weekend", "sunday": "weekday",
}}
assert all(len(t) == 24 for t in conf["station_conf"]["day_templates"].values())
c = console_client.Console()
c.create(conf)
c.rebuild_catalog(name)
c.add_day(name)
c.add_day(name)Run it the same way as any script:
docker exec -i -w /opt/tuner station-wrapper-43 python3 -u - < night_owl.py
curl -s 'http://192.168.1.20:5004/xmltv.xml?refresh' > /dev/nullA bump card is a short video of a still picture: a few words on a plain background, like "we'll be right back" or "up next: cartoons". Any short video works, so you can make them however you like. Here's one way with ffmpeg, which is already in the container.
First, draw the picture. Any image editor works. Make it 1280x720. If the channel will also play on a 4:3 TV that crops the sides, keep the words inside the middle part of the picture (about 190 to 1090 pixels across).
Then turn it into a 5 second video with a quick fade in and out, and silent sound:
ffmpeg -loop 1 -framerate 30 -t 5 -i card.png -f lavfi -t 5 -i anullsrc=r=48000:cl=stereo \
-vf "fade=in:st=0:d=0.35,fade=out:st=4.65:d=0.35" -c:v libx264 -tune stillimage -preset veryfast \
-crf 22 -pix_fmt yuv420p -c:a aac -b:a 96k -shortest -movflags +faststart night-01.mp4Put the cards in the bump folder on the server:
mkdir -p ~/fieldstation42/data/catalog/by-genre/"Night Owl"/~bumps/night
cp night-*.mp4 ~/fieldstation42/data/catalog/by-genre/"Night Owl"/~bumps/night/The silent sound track matters. Some players stumble when a video has no audio at all.
- Adding a show to a block: make its list and follow its folder. The 4 am catalog update picks it up. Add its list to the right hours in the config too.
-
Changing hours or templates: edit the script and save with
c.update(conf). Days already scheduled keep the old layout. Runc.reset_schedule(name)and thenc.add_day(name)to start fresh. -
New bump cards: drop them in the folder, then press Update videos on the station (or run
c.update_catalog(name)). The schedule stays the same.
Guides
- Server Setup
- Making Channels
- Client Mode Player (the easy way to a TV)
The manual way to a TV
Extras