-
-
Notifications
You must be signed in to change notification settings - Fork 131
Main Server Configuration
NOTE: The wiki documentation is deprecated and quickly becoming out of date. Please visit fieldstation42.com for complete documentation.
The confs/main_config.json file is optional. If it doesn't exist, FieldStation42 uses built-in defaults. Any settings you specify will override the defaults.
{
"server_host": "0.0.0.0",
"server_port": 4242,
"normalize_titles": true,
"day_parts": {
"morning": {"start_hour": 6, "end_hour": 10},
"daytime": {"start_hour": 10, "end_hour": 18},
"prime": {"start_hour": 18, "end_hour": 23},
"late": {"start_hour": 23, "end_hour": 2},
"overnight": {"start_hour": 2, "end_hour": 6}
}
}| Property | Type | Default | Description |
|---|---|---|---|
server_host |
string | "0.0.0.0" |
Host address for the web server |
server_port |
integer | 4242 |
Port for the web server |
channel_socket |
string | "runtime/channel.socket" |
File based socket for channel control |
status_socket |
string | "runtime/play_status.socket" |
File based socket for status updates |
time_format |
string | "%H:%M" |
Format for displaying times (strftime format) |
date_time_format |
string | "%Y-%m-%dT%H:%M:%S" |
Format for date/time values (strftime format) |
start_mpv |
boolean | true |
Whether to start mpv player automatically |
db_path |
string | "runtime/fs42_fluid.db" |
Path to the SQLite database |
normalize_titles |
boolean | true |
Enable automatic title normalization from filenames |
title_patterns |
array | [] |
Custom regex patterns for title parsing (see below) |
recall_last_channel |
boolean | true | Start on the last channel? |
tmdb_api_key |
string | None |
The movie database API key for PPV |
Day parts define time periods used for scheduling purposes. Each day part has a start and end hour (0-23).
{
"day_parts": {
"morning": {"start_hour": 6, "end_hour": 10},
"daytime": {"start_hour": 10, "end_hour": 18},
"prime": {"start_hour": 18, "end_hour": 23},
"late": {"start_hour": 23, "end_hour": 2},
"overnight": {"start_hour": 2, "end_hour": 6}
}
}When end_hour is less than start_hour, the period wraps around midnight. For example, late runs from 11 PM to 2 AM.
AM/PM 12 hour Format:
"time_format" : "%I:%M %p",24 Hour Format:
"time_format" : "%H:%M",When normalize_titles is enabled, FieldStation42 automatically parses video filenames to extract clean, display-ready titles. You can add custom regex patterns to handle special naming conventions in your media library.
The built-in patterns handle common formats like:
-
Show Name - s01e05.mp4→ "Show Name" -
Movie (2020).mp4→ "Movie" -
[Group] Title - 03.mkv→ "Title"
But if your files use a unique naming scheme, you can add custom patterns to parse them correctly.
Each pattern is an object with three fields:
{
"pattern": "regex pattern here",
"group": 1,
"description": "What this pattern matches"
}- pattern: A regular expression string (remember to escape backslashes in JSON!)
-
group: The capture group number containing the title (usually
1) - description: Optional human-readable description
{
"title_patterns": [
{
"pattern": "^\\[Studio\\][\\s._-]+(.+?)[\\s._-]+Special.*$",
"group": 1,
"description": "Studio specials with [Studio] prefix"
},
{
"pattern": "^(.+?)[\\s._-]+HD[\\s._-]+\\d+p.*$",
"group": 1,
"description": "Videos with HD quality markers"
},
{
"pattern": "^(.+?)_REMASTER_\\d{4}.*$",
"group": 1,
"description": "Remastered content"
}
]
}- Custom patterns are tried first, in the order you specify
- If a custom pattern matches, that title is used
- If no custom pattern matches, built-in patterns are tried
- The first matching pattern wins
Example:
Filename: [Studio] My Great Show - Special Edition.mp4
- Without custom pattern: "My Great Show Special Edition"
- With pattern above: "My Great Show"
JSON requires backslashes to be escaped. Here's a quick reference:
| Regex Pattern | In JSON String |
|---|---|
\d (any digit) |
"\\d" |
\s (whitespace) |
"\\s" |
\w (word character) |
"\\w" |
\. (literal period) |
"\\." |
\[ (literal bracket) |
"\\[" |
[abc] (character class) |
"[abc]" (no escape)
|
(group) (capture group) |
"(group)" (no escape)
|
.* (zero or more) |
".*" (no escape)
|
.+? (non-greedy) |
".+?" (no escape)
|
Many patterns use a "separator" regex to match spaces, dots, underscores, and dashes:
"pattern": "^(.+?)[\\s._-]+Episode[\\s._-]+\\d+$"This matches titles like:
Show Title Episode 05.mp4Show.Title.Episode.05.mp4Show_Title_Episode_05.mp4Show-Title-Episode-05.mp4
Before adding patterns to your config:
- Test your regex using a tool like regex101.com
- Make sure to select the Python flavor
- Remember to add the JSON escaping when copying to your config
- Check the FieldStation42 logs on startup - they will show if patterns fail to compile
{
"server_port": 4242,
"normalize_titles": true,
"title_patterns": [
{
"pattern": "^\\[STUDIO\\][\\s._-]+(.+?)[\\s._-]+\\d{4}[\\s._-]+\\d+.*$",
"group": 1,
"description": "Studio releases with year and episode"
},
{
"pattern": "^(.+?)[\\s._-]+REMASTERED[\\s._-]+.*$",
"group": 1,
"description": "Remastered editions"
}
],
"day_parts": {
"morning": {"start_hour": 6, "end_hour": 10},
"daytime": {"start_hour": 10, "end_hour": 18},
"prime": {"start_hour": 18, "end_hour": 23},
"late": {"start_hour": 23, "end_hour": 2},
"overnight": {"start_hour": 2, "end_hour": 6}
}
}When FieldStation42 loads main_config.json:
- Pattern validation: Each regex pattern is compiled to check for syntax errors
-
Required fields: Patterns must have both
patternandgroupfields - Logging: Successfully loaded patterns are logged with their descriptions
- Error recovery: Invalid patterns are logged and skipped (they won't crash the system)
Check your logs on startup to verify your patterns loaded correctly:
INFO: Loaded custom title pattern: Studio releases with year and episode
INFO: Loaded custom title pattern: Remastered editions
INFO: Loaded 2 custom title pattern(s)
- Start simple: Add one pattern at a time and test it
- Order matters: Put more specific patterns first
-
Be precise: Use
^and$anchors to match the whole filename -
Use non-greedy:
.+?instead of.+to avoid over-matching - Document: Always include a description for future reference
- Test filenames: Verify your patterns work with actual filenames from your library
Sometimes it's helpful to start MPV manually for debugging. Start MPV in a terminal:
mpv --input-ipc-server=/tmp/mpvsocket --idle --force-windowThen set this in confs/main_config.json:
{
"start_mpv": false
}Start field_player.py as usual. It will attach to the running MPV instance, and you can see MPV's output in your terminal for troubleshooting.