Guide Plex and Emby users step by step to the posters, at /guides/ #12

Merged
mesh-tools merged 2 commits from docs/guides into master 2026-11-30 11:48:21 +00:00
20 changed files with 753 additions and 2 deletions
+10 -2
View File
@@ -50,6 +50,13 @@ A race is named as [Jolpica](https://github.com/jolpica/jolpica-f1) (the Ergast
its schedule, and its circuit is found by Jolpica's circuit id (`ergastId` in `circuits.json`), never by the
circuit's name: Jolpica renames circuits (Losail became Lusail), the id stays.
## Guides
Step-by-step guides for putting the posters in a media server, on the site at https://f1-circuits.zurag.be/guides/:
* [Plex](guides/plex.html), with Kometa: https://f1-circuits.zurag.be/guides/plex.html
* [Emby](guides/emby.html), by hand or as picture files: https://f1-circuits.zurag.be/guides/emby.html
## The data
`circuits/circuits.json` holds country → locality → circuit → layout. A circuit has its `name`, its Jolpica
@@ -168,8 +175,9 @@ are fetched only when a picture asks for them, at most two at once; Wikimedia Co
`merge-check.sh` runs before a change merges: every Python file the service ships must parse, and the tests in
`tests/` must pass (every circuit has one unique `ergastId`, a race resolves by it, a failed Jolpica fetch is never
kept, every link in this README leads to a file, an unknown circuit or layout is named; a poster's satellite source,
credits and licence, its options, keys and cache headers, the picture store's cap, and the picks `/picks/…` answers).
kept, every link in this README leads to a file, every directory the service serves is copied into its image, an
unknown circuit or layout is named; a poster's satellite source, credits and licence, its options, keys and cache
headers, the picture store's cap, and the picks `/picks/…` answers).
## Acknowledgment
+9
View File
@@ -98,6 +98,7 @@ async def root():
*poster_sources.PICKS_ROUTES,
],
"examples": "/examples/",
"guides": "/guides/",
"disclaimer": DISCLAIMER,
}
@@ -139,6 +140,14 @@ app.mount(
name="examples",
)
# The guides: step by step, putting the posters in a Plex or Emby library (guides/index.html), in the style of the
# example site.
app.mount(
"/guides",
StaticFiles(directory=Path(__file__).resolve().parent / "guides", html=True),
name="guides",
)
# The poster routes are plain defs, not async: a render fetches map tiles and a schedule and draws for
# seconds, so it runs in the threadpool instead of holding up every other request on the event loop.
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html" aria-current="page">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html" aria-current="page">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -25,6 +25,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -25,6 +25,7 @@
<a href="library.html">Library</a>
<a href="picker.html" aria-current="page">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+33
View File
@@ -445,3 +445,36 @@ table.sources th:nth-child(4), table.sources td:nth-child(4) { width: 34%; }
.photo-card .request.compact .url { font-size: 0.66rem; }
.photo-card .status { font-size: 0.75rem; margin: 0; }
#sat .choices { margin: 0.75rem 0 0.25rem; }
/* ---- guides (guides/): numbered steps, boxes to copy, example pictures ---- */
ol.steps { padding-left: 1.6rem; max-width: 60rem; }
ol.steps > li { margin: 0.55rem 0; padding-left: 0.2rem; }
ol.steps > li::marker { font-weight: 700; color: var(--accent); }
.see { color: var(--ok); font-weight: 600; }
.copy {
display: flex;
align-items: flex-start;
gap: 0.5rem;
background: var(--code-bg);
border: 1px solid var(--line);
border-radius: 8px;
padding: 0.5rem 0.6rem;
margin: 0.5rem 0;
max-width: 60rem;
}
.copy code { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.88rem; }
.copy button { flex: none; font-size: 0.8rem; padding: 0.2rem 0.6rem; }
.examples-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin: 0.75rem 0; }
.examples-row figure { margin: 0; }
.examples-row img { display: block; border-radius: 8px; border: 1px solid var(--line); height: 240px; width: auto; }
.examples-row figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; max-width: 22rem; }
.guide-step { max-width: 62rem; }
.guide-step h2 .num { color: var(--accent); }
details.more { margin: 0.6rem 0; max-width: 60rem; }
details.more summary { cursor: pointer; font-weight: 600; }
/* In a guide, an address or file name in a table wraps, so the table fits a phone. */
.guide-step td code { white-space: normal; overflow-wrap: anywhere; }
+1
View File
@@ -23,6 +23,7 @@
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
<a href="../guides/index.html">Guides</a>
</nav>
<div id="api-base"></div>
</header>
+292
View File
@@ -0,0 +1,292 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Using the posters in Emby · Guides · F1 Circuits</title>
<meta name="description" content="Step by step: give every season, race weekend and session of your Formula 1 library in Emby its poster or thumbnail from F1 Circuits, by hand or as picture files.">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="../examples/site.css">
</head>
<body>
<header class="site">
<a class="brand" href="../examples/index.html">F1 <span>Circuits</span> API</a>
<nav aria-label="Guides">
<a href="index.html">Guides</a>
<a href="plex.html">Plex</a>
<a href="emby.html" aria-current="page">Emby</a>
<a href="../examples/index.html">Examples</a>
</nav>
</header>
<main>
<h1>Using the posters in Emby</h1>
<p class="lead">
Emby can show your Formula 1 library with a poster for every season, a poster for every race weekend and a picture
for every session. This guide shows two ways to put them in: by hand in Emby's own screens, or as picture files
next to your videos.
</p>
<p class="notice info">
Kometa, the helper the <a href="plex.html">Plex guide</a> uses, works only with Plex: it
<a href="https://kometa.wiki/en/latest/config/plex/">cannot run</a> without a Plex Media Server. In Emby you put the
pictures in yourself.
</p>
<h2>What you will get</h2>
<div class="examples-row">
<figure>
<img src="https://f1-circuits.zurag.be/posters/season/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 season poster" loading="lazy">
<figcaption>The show “Season 2025” gets the season poster.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 Qatar Grand Prix poster" loading="lazy">
<figcaption>Each race weekend gets its race poster: here round 23, Qatar.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/session/Qatar%20Grand%20Prix/2025/race.png?v=a1&amp;width=640&amp;format=jpg"
alt="The thumbnail of the race session of the 2025 Qatar Grand Prix" loading="lazy">
<figcaption>Each session gets its thumbnail: here the race.</figcaption>
</figure>
</div>
<h2>What you need</h2>
<ul>
<li>Emby Server, and Emby's web app open in your browser, signed in as an administrator.</li>
<li>Your Formula 1 videos in a library of the type <strong>TV shows</strong>, in folders as step 1 shows.</li>
<li>For the second way: access to the folders your videos are in.</li>
</ul>
<section class="guide-step">
<h2><span class="num">1.</span> How the library is laid out</h2>
<p>Emby calls the levels of a TV library show, season and episode. The pictures fit this layout, the one the
<a href="../examples/library.html">Library page</a> shows:</p>
<ul>
<li>Every Formula 1 season is a <strong>show</strong>, such as <code>Season 2025</code>.</li>
<li>Every race weekend is a <strong>season</strong> of that show, numbered by its round: the Qatar Grand Prix,
round 23, is season 23.</li>
<li>Every session is an <strong>episode</strong> of that season: the race of a sprint weekend is episode 12.</li>
</ul>
<p>Emby reads the numbers from the names of your folders and files, as its
<a href="https://emby.media/support/articles/TV-Naming.html">TV naming page</a> shows. For example:</p>
<pre class="code">Formula 1 ← the library's folder
└── Season 2025 ← a show: the 2025 season
├── Season 1 ← a season of the show: round 1, Australia
│ └── Season 2025 S01E08 Race.mkv ← episode 8: the race
└── Season 23 ← round 23, Qatar, a sprint weekend
├── Season 2025 S23E06 Sprint.mkv
└── Season 2025 S23E12 Race.mkv</pre>
<details class="more">
<summary>Which episode number is which session</summary>
<p>This is how the Library page and the Plex guide number them. A sprint weekend has more sessions, so its numbers
differ:</p>
<table>
<thead><tr><th>Episode</th><th>Standard weekend</th><th>Sprint weekend</th></tr></thead>
<tbody>
<tr><td>1</td><td>Free Practice 1</td><td>Free Practice 1</td></tr>
<tr><td>2</td><td>Free Practice 2</td><td>Pre-Sprint-Qualifying Buildup</td></tr>
<tr><td>3</td><td>Free Practice 3</td><td>Sprint Qualifying</td></tr>
<tr><td>4</td><td>Pre-Qualifying Buildup</td><td>Post-Sprint-Qualifying</td></tr>
<tr><td>5</td><td>Qualifying</td><td>Pre-Sprint Buildup</td></tr>
<tr><td>6</td><td>Post-Qualifying</td><td>Sprint</td></tr>
<tr><td>7</td><td>Pre-Race Buildup</td><td>Post-Sprint</td></tr>
<tr><td>8</td><td>Race</td><td>Pre-Qualifying Buildup</td></tr>
<tr><td>9</td><td>Post-Race</td><td>Qualifying</td></tr>
<tr><td>10</td><td>Highlights</td><td>Post-Qualifying</td></tr>
<tr><td>11</td><td></td><td>Pre-Race Buildup</td></tr>
<tr><td>12</td><td></td><td>Race</td></tr>
<tr><td>13</td><td></td><td>Post-Race</td></tr>
<tr><td>14</td><td></td><td>Highlights</td></tr>
<tr><td>15</td><td></td><td>Bonus Content</td></tr>
</tbody>
</table>
</details>
</section>
<section class="guide-step">
<h2><span class="num">2.</span> Find a picture's address</h2>
<p>Every picture has its own web address. The Library page lists them all:</p>
<ol class="steps">
<li>Open the <a href="../examples/library.html">Library page</a>. When the site has just started, it can take a
few minutes to load.</li>
<li>Click a season, such as 2025. You see its season poster and one poster per race weekend.</li>
<li>Click a race weekend. You see its race poster and one thumbnail per session.</li>
<li>Under each picture is its address, with a <strong>Copy</strong> button and an <strong>Open</strong> button.</li>
</ol>
<table>
<thead><tr><th>In Emby</th><th>Picture</th><th>Its address, for example</th></tr></thead>
<tbody>
<tr><td>The show “Season 2025”</td><td>Season poster</td>
<td><code>https://f1-circuits.zurag.be/posters/season/2025.png?v=a1</code></td></tr>
<tr><td>Season 23 of it (Qatar)</td><td>Race poster</td>
<td><code>https://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1</code></td></tr>
<tr><td>Episode 12 of season 23 (the race)</td><td>Session thumbnail</td>
<td><code>https://f1-circuits.zurag.be/posters/session/Qatar%20Grand%20Prix/2025/race.png?v=a1</code></td></tr>
</tbody>
</table>
</section>
<section class="guide-step">
<h2><span class="num">3a.</span> The first way: by hand in Emby</h2>
<p>Nothing to install, nothing to save. Do this for the show, then for each race weekend, then for each session you
want a picture on.</p>
<ol class="steps">
<li>Copy the picture's address from the Library page (step 2).</li>
<li>In Emby's web app, open your Formula 1 library and find the show, race weekend or session.</li>
<li>On its picture, click <strong>⋯</strong> and choose <strong>Edit Images</strong>.</li>
<li>On the picture marked <strong>Primary</strong>, click <strong>⋯</strong> and choose
<strong>Set Image from URL</strong>.</li>
<li>Paste the address and confirm.</li>
</ol>
<p class="see">You should see: the Formula 1 picture on the item, in place of the old one.</p>
<p class="hint">A season has over 20 race weekends and over 200 sessions. By hand suits the show and the race
weekends; for every session, the second way with the script at the end of this page is faster.</p>
</section>
<section class="guide-step">
<h2><span class="num">3b.</span> The second way: picture files next to your videos</h2>
<p>Emby reads pictures that sit in your folders under these names (its
<a href="https://emby.media/support/articles/TV-Naming.html">TV naming page</a>, “Series &amp; Season Images” and
“Episode Images”):</p>
<table>
<thead><tr><th>For</th><th>Save the picture as</th><th>In the folder</th></tr></thead>
<tbody>
<tr><td>The show</td><td><code>folder.png</code></td><td>of the show: <code>Season 2025</code></td></tr>
<tr><td>A race weekend</td><td><code>folder.png</code></td><td>of the race weekend: <code>Season 23</code></td></tr>
<tr><td>A session</td><td>the video's name, with <code>-thumb.png</code> in place of its ending:
<code>Season 2025 S23E12 Race-thumb.png</code></td><td>next to the video</td></tr>
</tbody>
</table>
<ol class="steps">
<li>On the Library page (step 2), click <strong>Open</strong> under the picture. It opens on its own.</li>
<li>Right-click the picture and choose <strong>Save Image As</strong> (the words differ a little per browser).</li>
<li>Save it in the folder, under the name, that the table gives.</li>
<li>When the folder has its pictures: in Emby, on the show's picture, click <strong>⋯</strong> and choose
<strong>Refresh Metadata</strong>.</li>
<li>Set <strong>Refresh mode</strong> to <strong>Search for missing metadata</strong>, leave
<strong>Replace existing images</strong> off, and click <strong>Refresh</strong>.</li>
</ol>
<p class="see">You should see: the show, its race weekends and its sessions with the pictures you saved.</p>
<p class="hint">Emby also reads <code>poster.png</code> for a show or race weekend, and
<code>season23-poster.png</code> for round 23 when it sits in the show's folder. It looks for
<code>folder</code> first.</p>
</section>
<section class="guide-step">
<h2><span class="num">4.</span> When the pictures get a new look</h2>
<p>Emby keeps the picture it was given. When the pictures get a new look, they get new addresses (the Library page
always shows the current ones). Put the new ones in the same way: by hand (step 3a), or by saving the files again
and refreshing (step 3b).</p>
<p class="notice">Never switch on <strong>Replace existing images</strong> in Refresh Metadata for this library.
Emby then deletes the item's pictures, your own included, and downloads new ones from the online databases it
uses (<a href="https://emby.media/support/articles/Metadata-manager.html">Emby's metadata manager page</a>).</p>
</section>
<h2>If it doesn't work</h2>
<ul>
<li><strong>A picture you saved does not show.</strong> Check its name and folder against the table in step 3b,
and that it ends in <code>.png</code> or <code>.jpg</code>. Then, on the library itself, click <strong>⋯</strong>
and choose <strong>Scan Library Files</strong>.</li>
<li><strong>A race poster sits on the wrong race weekend.</strong> Emby's season number must be the round: check
the folder's name (<code>Season 23</code>) or the <code>S23</code> in the file names.</li>
<li><strong>A thumbnail sits on the wrong session.</strong> Check the episode numbers against the table in step 1:
a sprint weekend is numbered differently from a standard one.</li>
<li><strong>Your pictures were replaced.</strong> A refresh with <strong>Replace existing images</strong> on does
that. Put them in again (step 3a or 3b).</li>
<li><strong>Set Image from URL does nothing.</strong> Emby fetches the picture from this site itself, so the
computer Emby runs on must reach <code>https://f1-circuits.zurag.be</code>. Open
<a href="https://f1-circuits.zurag.be/posters/season/2025.png?v=a1">a poster</a> in a browser on that computer to
check.</li>
</ul>
<h2>For the technically minded</h2>
<h3>The pictures</h3>
<ul>
<li>Three routes, each a plain <code>GET</code>, no key: <code>/posters/season/{season}.png</code> (1000×1500),
<code>/posters/race/{race name}/{season}.png</code> (1000×1500) and
<code>/posters/session/{race name}/{season}/{session}.png</code> (1920×1080). The sessions are <code>fp1</code>,
<code>fp2</code>, <code>fp3</code>, <code>pre-qualifying</code>, <code>qualifying</code>,
<code>post-qualifying</code>, <code>pre-race</code>, <code>race</code>, <code>post-race</code>,
<code>highlights</code>, <code>pre-sprint-qualifying</code>, <code>sprint-qualifying</code>,
<code>post-sprint-qualifying</code>, <code>pre-sprint</code>, <code>sprint</code>, <code>post-sprint</code> and
<code>bonus</code>.</li>
<li>A race name is Jolpica's, its spaces and other characters encoded: <code>Qatar%20Grand%20Prix</code>,
<code>S%C3%A3o%20Paulo%20Grand%20Prix</code>.</li>
<li>Options as query parameters, such as <code>format=jpg</code> (smaller files; the address keeps its
<code>.png</code>), <code>width=600</code>, <code>style=minimal</code> and <code>bg=photo</code>. Try every option
in the <a href="../examples/builder.html">poster builder</a>; the <a href="https://f1-circuits.zurag.be/docs">API
reference</a> lists them.</li>
<li><code>?v=a1</code> is the address version. An address that carries it is kept by clients for good; it is raised
when the look changes. The <a href="https://f1-circuits.zurag.be/kometa/formula-1-metadata.yml">Kometa file</a>
always carries the current one, and lists every picture's address per season, round and episode number.</li>
</ul>
<h3>A whole season as files, with a script</h3>
<p>For Linux, macOS or a NAS with a shell. It reads the season's addresses from the Kometa file and saves, as JPEG,
<code>folder.jpg</code> in the show's folder, <code>seasonNN-poster.jpg</code> per round next to it, and
<code>&lt;video&gt;-thumb.jpg</code> next to every video whose name carries its round and episode
(<code>S23E12</code> or <code>23x12</code>). Keep one picture per item: delete a <code>.png</code> you saved by hand
for the same item. Then refresh as in step 3b.</p>
<div class="copy"><code>#!/bin/sh
# Usage: f1-emby-art.sh 2025 "/media/Formula 1/Season 2025"
season=$1 show=$2 api=https://f1-circuits.zurag.be opts=format=jpg
# Every address of the season: "round episode address", 0 for the show's or a round's own picture.
list=$(curl -fsS "$api/kometa/formula-1-metadata.yml" | awk -v season="$season" '
/^ "Season [0-9]+":/ { on = index($0, "\"Season " season "\":") &gt; 0; round = ep = 0; next }
!on { next }
/^ [0-9]+:$/ { round = $1 + 0; ep = 0; next }
/^ [0-9]+:$/ { ep = $1 + 0; next }
/url_poster:/ { print round, ep, $2 }')
address() { printf '%s\n' "$list" | awk -v r="$1" -v e="$2" -v o="$opts" '$1 == r &amp;&amp; $2 == e { print $3 "&amp;" o }'; }
curl -fsSo "$show/folder.jpg" "$(address 0 0)"
for round in $(printf '%s\n' "$list" | awk '$1 &gt; 0 &amp;&amp; $2 == 0 { print $1 }'); do
curl -fsSo "$show/$(printf 'season%02d-poster.jpg' "$round")" "$(address "$round" 0)"
done
find "$show" -type f | grep -Ei '\.(mkv|mp4|m4v|ts|avi|mov|webm)$' | while IFS= read -r file; do
set -- $(printf '%s\n' "${file##*/}" | sed -nE -e 's/.*[Ss]([0-9]+)[Ee]([0-9]+).*/\1 \2/p' -e t \
-e 's/^(.*[^0-9])?([0-9]+)x([0-9]+)([^0-9].*)?$/\2 \3/p')
[ $# = 2 ] &amp;&amp; url=$(address "$1" "$2") &amp;&amp; [ -n "$url" ] &amp;&amp; curl -fsSo "${file%.*}-thumb.jpg" "$url"
done</code></div>
<h3>Through Emby's API</h3>
<p>Emby downloads a picture from an address onto an item with
<a href="https://dev.emby.media/reference/RestAPI/RemoteImageService/postItemsByIdRemoteimagesDownload.html"><code>POST
/Items/{Id}/RemoteImages/Download</code></a>, with <code>Type</code> (<code>Primary</code> for the show's, a
season's and an episode's picture) and <code>ImageUrl</code> in the query. It needs an administrator: make an
<a href="https://dev.emby.media/doc/restapi/API-Key-Authentication.html">API key</a> in the server dashboard
(Advanced, Security, Add) and send it in the <code>X-Emby-Token</code> header.</p>
<div class="copy"><code>EMBY=http://localhost:8096/emby
KEY=your-api-key
# The show's Id: search the library for it
curl -fsS -H "X-Emby-Token: $KEY" "$EMBY/Items?IncludeItemTypes=Series&amp;Recursive=true&amp;SearchTerm=Season%202025"
# Its seasons (IndexNumber is the round) and one season's episodes (IndexNumber is the episode)
curl -fsS -H "X-Emby-Token: $KEY" "$EMBY/Shows/$SHOW/Seasons"
curl -fsS -H "X-Emby-Token: $KEY" "$EMBY/Shows/$SHOW/Episodes?SeasonId=$SEASON"
# Round 23's poster onto its season
curl -fsS -X POST -H "X-Emby-Token: $KEY" -G "$EMBY/Items/$SEASON/RemoteImages/Download" \
--data-urlencode Type=Primary \
--data-urlencode "ImageUrl=https://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1&amp;format=jpg"</code></div>
<p>Emby keeps the copy it downloaded. When the address version is raised, call it again with the new address.</p>
</main>
<footer class="pager">
<a rel="prev" href="plex.html">← Plex</a>
<span class="home"></span>
<a rel="next" href="index.html">Guides →</a>
</footer>
<footer class="disclaimer">
<p>This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE,
FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One
Licensing B.V.</p>
<p><a href="../examples/licences.html">Licences and credits</a>: every source the pictures are made from, the licence each
picture takes from its sources, and the licence of the track files and the GPS traces (MIT).</p>
</footer>
<script src="guides.js"></script>
</body>
</html>
+35
View File
@@ -0,0 +1,35 @@
/*
* The guides' one behaviour: a Copy button on every box of text to copy (`.copy`), copying the text of its
* `code` element. Without the script the text stays selectable by hand.
*/
(function () {
'use strict';
async function copy(text, button) {
let done = false;
try {
await navigator.clipboard.writeText(text);
done = true;
} catch {
const area = document.createElement('textarea');
area.value = text;
area.style.cssText = 'position:fixed;opacity:0';
document.body.append(area);
area.select();
try { done = document.execCommand('copy'); } catch { done = false; }
area.remove();
}
button.textContent = done ? 'Copied' : 'Select it and copy';
setTimeout(() => { button.textContent = 'Copy'; }, 1500);
}
for (const box of document.querySelectorAll('.copy')) {
const code = box.querySelector('code');
if (!code) continue;
const button = document.createElement('button');
button.type = 'button';
button.textContent = 'Copy';
button.addEventListener('click', () => copy(code.textContent, button));
box.append(button);
}
})();
+78
View File
@@ -0,0 +1,78 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guides · F1 Circuits</title>
<meta name="description" content="Step-by-step guides to show the F1 Circuits posters and thumbnails in your Formula 1 library in Plex or Emby.">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="../examples/site.css">
</head>
<body>
<header class="site">
<a class="brand" href="../examples/index.html">F1 <span>Circuits</span> API</a>
<nav aria-label="Guides">
<a href="index.html" aria-current="page">Guides</a>
<a href="plex.html">Plex</a>
<a href="emby.html">Emby</a>
<a href="../examples/index.html">Examples</a>
</nav>
</header>
<main>
<h1>Guides</h1>
<p class="lead">
Give your Formula 1 library a poster for every season, a poster for every race weekend and a picture for every
session. These guides take you through it one step at a time. Pick the media server you use.
</p>
<div class="examples-row">
<figure>
<img src="https://f1-circuits.zurag.be/posters/season/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 season poster" loading="lazy">
<figcaption>A season: the year over a photo of that season's cars.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 Qatar Grand Prix poster" loading="lazy">
<figcaption>A race weekend: its round, name, date and track over its circuit.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/session/Qatar%20Grand%20Prix/2025/race.png?v=a1&amp;width=640&amp;format=jpg"
alt="The thumbnail of the race session of the 2025 Qatar Grand Prix" loading="lazy">
<figcaption>A session: the race, a qualifying or a practice, over the circuit.</figcaption>
</figure>
</div>
<div class="pages">
<a class="page" href="plex.html">
<h3>Plex</h3>
<p>A free helper called Kometa puts every picture in your Plex library and keeps them up to date. You set it up
once.</p>
</a>
<a class="page" href="emby.html">
<h3>Emby</h3>
<p>Set the pictures by hand in Emby's own screens, or save them as picture files next to your videos.</p>
</a>
</div>
<p>
Every picture carries, at its bottom, the credit of the photo or map it is made from, and takes its licence from
them; the <a href="../examples/licences.html">licences page</a> lists every source and its licence.
</p>
</main>
<footer class="pager">
<a rel="prev" href="../examples/index.html">← Examples</a>
<span class="home"></span>
<a rel="next" href="plex.html">Plex →</a>
</footer>
<footer class="disclaimer">
<p>This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE,
FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One
Licensing B.V.</p>
<p><a href="../examples/licences.html">Licences and credits</a>: every source the pictures are made from, the licence each
picture takes from its sources, and the licence of the track files and the GPS traces (MIT).</p>
</footer>
</body>
</html>
+260
View File
@@ -0,0 +1,260 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Using the posters in Plex · Guides · F1 Circuits</title>
<meta name="description" content="Step by step: give every season, race weekend and session of your Formula 1 library in Plex its poster or thumbnail, set by Kometa from the F1 Circuits file.">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="../examples/site.css">
</head>
<body>
<header class="site">
<a class="brand" href="../examples/index.html">F1 <span>Circuits</span> API</a>
<nav aria-label="Guides">
<a href="index.html">Guides</a>
<a href="plex.html" aria-current="page">Plex</a>
<a href="emby.html">Emby</a>
<a href="../examples/index.html">Examples</a>
</nav>
</header>
<main>
<h1>Using the posters in Plex</h1>
<p class="lead">
Plex can show your Formula 1 library with a poster for every season, a poster for every race weekend and a picture
for every session. A free helper called <a href="https://kometa.wiki/">Kometa</a> puts them there for you, and
keeps them up to date. This guide takes you through it one step at a time.
</p>
<h2>What you will get</h2>
<div class="examples-row">
<figure>
<img src="https://f1-circuits.zurag.be/posters/season/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 season poster" loading="lazy">
<figcaption>The show “Season 2025” gets the season poster.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1&amp;width=400&amp;format=jpg"
alt="The 2025 Qatar Grand Prix poster" loading="lazy">
<figcaption>Each race weekend gets its race poster: here round 23, Qatar.</figcaption>
</figure>
<figure>
<img src="https://f1-circuits.zurag.be/posters/session/Qatar%20Grand%20Prix/2025/race.png?v=a1&amp;width=640&amp;format=jpg"
alt="The thumbnail of the race session of the 2025 Qatar Grand Prix" loading="lazy">
<figcaption>Each session gets its thumbnail: here the race.</figcaption>
</figure>
</div>
<p>The <a href="../examples/library.html">Library page</a> shows a whole library this way, season by season.</p>
<h2>What you need</h2>
<ul>
<li>Plex Media Server, and the Plex Web App open in your browser.</li>
<li>Your Formula 1 videos, in folders as step 1 shows.</li>
<li>A computer to run Kometa on. It can be the computer Plex runs on. Kometa has no window of its own: you set it
up by filling in one text file and starting it with one command.</li>
<li>A free account at <a href="https://www.themoviedb.org/">The Movie Database</a> (TMDb). Kometa always asks for
its key, even though this guide does not use it.</li>
</ul>
<section class="guide-step">
<h2><span class="num">1.</span> Put your videos in folders</h2>
<p>Kometa's <a href="https://kometa.wiki/en/latest/kometa/guides/formula/">Formula 1 guide</a> shapes the library
like this. Plex calls the levels show, season and episode:</p>
<ul>
<li>Every Formula 1 season is a <strong>show</strong>, in a folder named <code>Season 2025</code>. Keep that name:
the pictures are matched to the show by it.</li>
<li>Every race weekend is a <strong>season</strong> of that show, in a folder that starts with its round:
<code>23 - Qatar GP</code>. Plex numbers it by the round.</li>
<li>Every session is an <strong>episode</strong>: one file, named with the round, the episode number and the
session, such as <code>23x12 - Qatar GP - Race Session.mkv</code>.</li>
</ul>
<pre class="code">Formula 1 ← the library's folder
└── Season 2025 ← a show: the 2025 season
├── 01 - Australian GP ← a season of the show: round 1
│ ├── 01x01 - Australian GP - Free Practice 1.mkv
│ ├── 01x05 - Australian GP - Qualifying Session.mkv
│ └── 01x08 - Australian GP - Race Session.mkv
└── 23 - Qatar GP ← round 23, a sprint weekend
├── 23x06 - Qatar GP - Sprint Race Session.mkv
└── 23x12 - Qatar GP - Race Session.mkv</pre>
<details class="more">
<summary>Which episode number is which session</summary>
<p>The pictures go to the episodes by their number. A sprint weekend has more sessions, so its numbers differ:</p>
<table>
<thead><tr><th>Episode</th><th>Standard weekend</th><th>Sprint weekend</th></tr></thead>
<tbody>
<tr><td>1</td><td>Free Practice 1</td><td>Free Practice 1</td></tr>
<tr><td>2</td><td>Free Practice 2</td><td>Pre-Sprint-Qualifying Buildup</td></tr>
<tr><td>3</td><td>Free Practice 3</td><td>Sprint Qualifying</td></tr>
<tr><td>4</td><td>Pre-Qualifying Buildup</td><td>Post-Sprint-Qualifying</td></tr>
<tr><td>5</td><td>Qualifying</td><td>Pre-Sprint Buildup</td></tr>
<tr><td>6</td><td>Post-Qualifying</td><td>Sprint</td></tr>
<tr><td>7</td><td>Pre-Race Buildup</td><td>Post-Sprint</td></tr>
<tr><td>8</td><td>Race</td><td>Pre-Qualifying Buildup</td></tr>
<tr><td>9</td><td>Post-Race</td><td>Qualifying</td></tr>
<tr><td>10</td><td>Highlights</td><td>Post-Qualifying</td></tr>
<tr><td>11</td><td></td><td>Pre-Race Buildup</td></tr>
<tr><td>12</td><td></td><td>Race</td></tr>
<tr><td>13</td><td></td><td>Post-Race</td></tr>
<tr><td>14</td><td></td><td>Highlights</td></tr>
<tr><td>15</td><td></td><td>Bonus Content</td></tr>
</tbody>
</table>
</details>
</section>
<section class="guide-step">
<h2><span class="num">2.</span> Make the Formula 1 library in Plex</h2>
<p>The library needs Plex's <em>Personal Media Shows</em> agent. An agent is the part of Plex that looks up titles
and pictures; this one does not look your videos up on the internet, which suits recordings no online database
lists. Since Plex Media Server 1.43.0, Plex hides it when you make a new library unless one setting is on.</p>
<ol class="steps">
<li>In the Plex Web App, open <strong>Settings</strong> and choose your server.</li>
<li>Choose <strong>Library</strong>, turn on <strong>Show Legacy Agent during library set up</strong>, and save
the change. (An older Plex Media Server does not have this setting and shows the agent anyway.)</li>
<li>Under <strong>Manage</strong>, choose <strong>Libraries</strong>, then <strong>Add Library</strong>.</li>
<li>Choose <strong>TV Shows</strong> and name the library, for example <code>Formula 1</code>. Note the exact
name: you will type it in step 4.</li>
<li>Add the folder that holds your season folders (<code>Formula 1</code> in the example above).</li>
<li>Choose <strong>Advanced</strong>, and under <strong>Agent</strong> choose
<strong>Personal Media Shows (Legacy)</strong>.</li>
<li>Finish adding the library.</li>
</ol>
<p class="see">You should see: one show per season folder, such as “Season 2025”, and inside it one season per race
weekend.</p>
<p class="hint">Already have a Formula 1 library with another agent? Plex's
<a href="https://support.plex.tv/articles/200241558-agents/">page on agents</a> shows how to change it, and says
the change applies only to videos added after it.</p>
</section>
<section class="guide-step">
<h2><span class="num">3.</span> Install Kometa</h2>
<ol class="steps">
<li>Open Kometa's <a href="https://kometa.wiki/en/latest/kometa/install/">installation walkthrough</a> and choose
the computer you will run it on. Kometa recommends its Docker version unless you already use Python.</li>
<li>Follow it until it asks for three things, and gather them as it says:
<ul>
<li><strong>Your Plex address</strong>: the address that computer uses to reach Plex directly, such as
<code>http://192.0.2.10:32400</code>. Not app.plex.tv.</li>
<li><strong>Your Plex token</strong>, a password for programs: in the Plex Web App, open any video's
<strong>⋯</strong> menu, choose <strong>Get Info</strong>, then the <strong>XML</strong> link at the bottom
(<a href="https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/">Plex's
page</a>). The token is the part after <code>X-Plex-Token=</code> in the address of the page that opens.</li>
<li><strong>Your TMDb key</strong>: sign in at themoviedb.org, open <strong>Settings</strong> from your account
menu, choose <strong>API</strong> and request a key. If it shows two keys, use the v3 one.</li>
</ul>
</li>
<li>Make the file <code>config.yml</code> as the walkthrough shows, with your Plex address, Plex token and TMDb
key in it. Then come back here for its <code>libraries</code> part.</li>
</ol>
</section>
<section class="guide-step">
<h2><span class="num">4.</span> Point Kometa at the Formula 1 file</h2>
<p>One file on this site tells Kometa which picture goes on which season, race weekend and session, for every
season from 1950 on.</p>
<ol class="steps">
<li>Open <code>config.yml</code> in a plain text editor, such as Notepad on Windows or TextEdit on a Mac.</li>
<li>Replace its <code>libraries:</code> part with the lines below. If it already lists libraries of your own,
keep them and add the <code>Formula 1:</code> lines under them.
<div class="copy"><code>libraries:
Formula 1:
metadata_files:
- url: https://f1-circuits.zurag.be/kometa/formula-1-metadata.yml</code></div>
</li>
<li>Change <code>Formula 1</code> to your library's exact name in Plex, if you named it otherwise.</li>
<li>Keep the spaces at the start of each line as shown: two per level. Kometa reads the levels from them.</li>
<li>Save the file. The <code>plex:</code> and <code>tmdb:</code> parts stay as you filled them in.</li>
</ol>
</section>
<section class="guide-step">
<h2><span class="num">5.</span> Run Kometa once</h2>
<p>Type the command for the way you installed Kometa, in the window the walkthrough had you use:</p>
<ul>
<li>Kometa with Python, from its folder:
<div class="copy"><code>uv run python kometa.py --run</code></div></li>
<li>Kometa with Docker (put the full path of the folder that holds <code>config.yml</code> in place of
<code>FULL_PATH_TO_CONFIG</code>):
<div class="copy"><code>docker run --rm -it -v "FULL_PATH_TO_CONFIG:/config:rw" kometateam/kometa --run</code></div></li>
<li>Kometa with Docker Compose, from the folder that holds <code>compose.yml</code>:
<div class="copy"><code>docker compose run --rm kometa --run</code></div></li>
</ul>
<p>Kometa writes what it does as it goes. Let it finish: the first time it sets a picture on every season, race
weekend and session it finds, so it takes a while.</p>
<p class="see">You should see: Kometa connect to TMDb and to Plex, work through your Formula 1 library, and end. In
Plex, after reloading the page, every season, race weekend and session has its picture.</p>
</section>
<section class="guide-step">
<h2><span class="num">6.</span> Keep it up to date</h2>
<p>Leave Kometa running in its normal way, without <code>--run</code>: the part “Scheduling and updates” of the
<a href="https://kometa.wiki/en/latest/kometa/install/">walkthrough</a> shows how for your installation. Then it
runs by itself once a day, at 05:00 unless you change it. Each time it reads the Formula 1 file again, so a new
race weekend gets its pictures.</p>
<p>When the pictures get a new look, the file names new addresses for them, and Kometa puts the new pictures in on
its next run. A picture it has already put in is not sent again. To get a new look at once, run step 5 again.</p>
</section>
<h2>If it doesn't work</h2>
<ul>
<li><strong>Nothing changed in Plex.</strong> Open the newest <code>meta.log</code> in the <code>logs</code> folder
next to <code>config.yml</code>, and read the lines marked CRITICAL, then ERROR.</li>
<li><strong>Kometa does not work on the library.</strong> The name under <code>libraries:</code> must be the
library's name in Plex, letter for letter.</li>
<li><strong>A season gets no pictures.</strong> Its show must be called exactly <code>Season 2025</code> (with its
own year) in Plex.</li>
<li><strong>A race poster sits on the wrong race weekend.</strong> In Plex, each race weekend's season number must be
its round. Check the number at the start of its folder.</li>
<li><strong>A thumbnail sits on the wrong session.</strong> Check the episode numbers against the table in step 1:
a sprint weekend is numbered differently from a standard one.</li>
<li><strong>Pictures stay empty.</strong> Plex fetches every picture from this site, so the computer Plex runs on
must reach <code>https://f1-circuits.zurag.be</code>. Open
<a href="https://f1-circuits.zurag.be/posters/season/2025.png?v=a1">a poster</a> in a browser on that computer to
check.</li>
<li>Kometa's own <a href="https://kometa.wiki/en/latest/kometa/help/">help page</a> explains its messages.</li>
</ul>
<h2>For the technically minded</h2>
<ul>
<li>The file is <a href="https://f1-circuits.zurag.be/kometa/formula-1-metadata.yml">/kometa/formula-1-metadata.yml</a>,
a Kometa metadata file, explained on the <a href="../examples/kometa.html">Kometa page</a>. Per show
(<code>"Season 2025"</code>) it sets <code>f1_season</code>, <code>round_prefix</code>, <code>shorten_gp</code>
and the season poster as <code>url_poster</code>; per season of the show (a round) the race poster; per episode
the session thumbnail. It covers every season from 1950 to next year; Kometa skips what the library does not
hold. The first request after the service starts can take minutes: it reads every season's schedule from
Jolpica.</li>
<li>Every address in it carries the address version, <code>?v=a1</code>. Such an address is kept by clients for
good; the version is raised when the look changes, which gives every picture a new address. Kometa (with its
cache on, the default) sets a poster only when its address differs from the one it set last, so the raise is
what brings a new look in.</li>
<li>The pictures are three routes, each a plain <code>GET</code>:
<code>/posters/season/{season}.png</code>, <code>/posters/race/{race name}/{season}.png</code> and
<code>/posters/session/{race name}/{season}/{session}.png</code>. A race name is Jolpica's, with its spaces and
other characters encoded: <code>Qatar%20Grand%20Prix</code>, <code>S%C3%A3o%20Paulo%20Grand%20Prix</code>.</li>
<li>They take options such as <code>style=minimal</code>, <code>bg=photo</code>, <code>width=600</code> and
<code>format=jpg</code>. Try every option in the <a href="../examples/builder.html">poster builder</a>; all of
them are listed in the <a href="https://f1-circuits.zurag.be/docs">API reference</a>. The file uses the default
look. For another look, save a copy of the file, add your options to its addresses, and give Kometa that copy
with a <code>- file:</code> line in place of the <code>- url:</code> line
(<a href="https://kometa.wiki/en/latest/config/files/">Kometa's page on files</a>); your copy then no longer
takes in new races by itself.</li>
</ul>
</main>
<footer class="pager">
<a rel="prev" href="index.html">← Guides</a>
<span class="home"></span>
<a rel="next" href="emby.html">Emby →</a>
</footer>
<footer class="disclaimer">
<p>This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE,
FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One
Licensing B.V.</p>
<p><a href="../examples/licences.html">Licences and credits</a>: every source the pictures are made from, the licence each
picture takes from its sources, and the licence of the track files and the GPS traces (MIT).</p>
</footer>
<script src="guides.js"></script>
</body>
</html>
+2
View File
@@ -30,6 +30,8 @@ COPY circuits/ ./circuits/
COPY seasons/ ./seasons/
# The example site the app serves at /examples/.
COPY examples/ ./examples/
# The guides the app serves at /guides/.
COPY guides/ ./guides/
EXPOSE 8000
+23
View File
@@ -0,0 +1,23 @@
"""Every directory the service serves is copied into its image: a mount of a directory the image lacks stops the
service at its start (Starlette's StaticFiles checks its directory)."""
import re
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
class ImageTest(unittest.TestCase):
def test_every_served_directory_is_copied_into_the_image(self):
app = (ROOT / "cdn-api.py").read_text(encoding="utf-8")
served = re.findall(r'StaticFiles\(directory=Path\(__file__\)\.resolve\(\)\.parent / "([^"]+)"', app)
self.assertTrue(served, "cdn-api.py serves no directory")
dockerfile = (ROOT / "service" / "Dockerfile").read_text(encoding="utf-8")
copied = set(re.findall(r"^COPY (\S+)/ \./\1/$", dockerfile, re.M))
self.assertEqual(sorted(set(served) - copied), [], "served by cdn-api.py, not copied by service/Dockerfile")
for directory in served:
self.assertTrue((ROOT / directory / "index.html").is_file(), f"{directory}/ has no index.html")
if __name__ == "__main__":
unittest.main()