diff --git a/README.md b/README.md index 5023c42..f1cca50 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cdn-api.py b/cdn-api.py index 3ea1e60..e0a6982 100644 --- a/cdn-api.py +++ b/cdn-api.py @@ -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. diff --git a/examples/builder.html b/examples/builder.html index 27e99ff..8424e35 100644 --- a/examples/builder.html +++ b/examples/builder.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/circuits.html b/examples/circuits.html index 68f31c5..18fa956 100644 --- a/examples/circuits.html +++ b/examples/circuits.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/grand-prix.html b/examples/grand-prix.html index 6bea802..407ca85 100644 --- a/examples/grand-prix.html +++ b/examples/grand-prix.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/index.html b/examples/index.html index f329b8e..68aaeb8 100644 --- a/examples/index.html +++ b/examples/index.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/kometa.html b/examples/kometa.html index 2318d83..557bc4c 100644 --- a/examples/kometa.html +++ b/examples/kometa.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/library.html b/examples/library.html index 962d971..0394d2b 100644 --- a/examples/library.html +++ b/examples/library.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/licences.html b/examples/licences.html index caee185..94e4773 100644 --- a/examples/licences.html +++ b/examples/licences.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/map.html b/examples/map.html index 10c046e..f4cebe1 100644 --- a/examples/map.html +++ b/examples/map.html @@ -25,6 +25,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/picker.html b/examples/picker.html index dbbe654..642f052 100644 --- a/examples/picker.html +++ b/examples/picker.html @@ -25,6 +25,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/posters.html b/examples/posters.html index 20f7282..fd720b6 100644 --- a/examples/posters.html +++ b/examples/posters.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/examples/site.css b/examples/site.css index a5f8b7d..eb99acb 100644 --- a/examples/site.css +++ b/examples/site.css @@ -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; } diff --git a/examples/tracks.html b/examples/tracks.html index 9ac13e4..f5055f0 100644 --- a/examples/tracks.html +++ b/examples/tracks.html @@ -23,6 +23,7 @@ Library Photo picker Licences + Guides
diff --git a/guides/emby.html b/guides/emby.html new file mode 100644 index 0000000..433a59b --- /dev/null +++ b/guides/emby.html @@ -0,0 +1,292 @@ + + + + + + Using the posters in Emby · Guides · F1 Circuits + + + + + +
+ F1 Circuits API + +
+ +
+

Using the posters in Emby

+

+ 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. +

+

+ Kometa, the helper the Plex guide uses, works only with Plex: it + cannot run without a Plex Media Server. In Emby you put the + pictures in yourself. +

+ +

What you will get

+
+
+ The 2025 season poster +
The show “Season 2025” gets the season poster.
+
+
+ The 2025 Qatar Grand Prix poster +
Each race weekend gets its race poster: here round 23, Qatar.
+
+
+ The thumbnail of the race session of the 2025 Qatar Grand Prix +
Each session gets its thumbnail: here the race.
+
+
+ +

What you need

+ + +
+

1. How the library is laid out

+

Emby calls the levels of a TV library show, season and episode. The pictures fit this layout, the one the + Library page shows:

+ +

Emby reads the numbers from the names of your folders and files, as its + TV naming page shows. For example:

+
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
+
+ Which episode number is which session +

This is how the Library page and the Plex guide number them. A sprint weekend has more sessions, so its numbers + differ:

+ + + + + + + + + + + + + + + + + + + +
EpisodeStandard weekendSprint weekend
1Free Practice 1Free Practice 1
2Free Practice 2Pre-Sprint-Qualifying Buildup
3Free Practice 3Sprint Qualifying
4Pre-Qualifying BuildupPost-Sprint-Qualifying
5QualifyingPre-Sprint Buildup
6Post-QualifyingSprint
7Pre-Race BuildupPost-Sprint
8RacePre-Qualifying Buildup
9Post-RaceQualifying
10HighlightsPost-Qualifying
11Pre-Race Buildup
12Race
13Post-Race
14Highlights
15Bonus Content
+
+
+ +
+

2. Find a picture's address

+

Every picture has its own web address. The Library page lists them all:

+
    +
  1. Open the Library page. When the site has just started, it can take a + few minutes to load.
  2. +
  3. Click a season, such as 2025. You see its season poster and one poster per race weekend.
  4. +
  5. Click a race weekend. You see its race poster and one thumbnail per session.
  6. +
  7. Under each picture is its address, with a Copy button and an Open button.
  8. +
+ + + + + + + + + + +
In EmbyPictureIts address, for example
The show “Season 2025”Season posterhttps://f1-circuits.zurag.be/posters/season/2025.png?v=a1
Season 23 of it (Qatar)Race posterhttps://f1-circuits.zurag.be/posters/race/Qatar%20Grand%20Prix/2025.png?v=a1
Episode 12 of season 23 (the race)Session thumbnailhttps://f1-circuits.zurag.be/posters/session/Qatar%20Grand%20Prix/2025/race.png?v=a1
+
+ +
+

3a. The first way: by hand in Emby

+

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.

+
    +
  1. Copy the picture's address from the Library page (step 2).
  2. +
  3. In Emby's web app, open your Formula 1 library and find the show, race weekend or session.
  4. +
  5. On its picture, click ⋯ and choose Edit Images.
  6. +
  7. On the picture marked Primary, click ⋯ and choose + Set Image from URL.
  8. +
  9. Paste the address and confirm.
  10. +
+

You should see: the Formula 1 picture on the item, in place of the old one.

+

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.

+
+ +
+

3b. The second way: picture files next to your videos

+

Emby reads pictures that sit in your folders under these names (its + TV naming page, “Series & Season Images” and + “Episode Images”):

+ + + + + + + +
ForSave the picture asIn the folder
The showfolder.pngof the show: Season 2025
A race weekendfolder.pngof the race weekend: Season 23
A sessionthe video's name, with -thumb.png in place of its ending: + Season 2025 S23E12 Race-thumb.pngnext to the video
+
    +
  1. On the Library page (step 2), click Open under the picture. It opens on its own.
  2. +
  3. Right-click the picture and choose Save Image As (the words differ a little per browser).
  4. +
  5. Save it in the folder, under the name, that the table gives.
  6. +
  7. When the folder has its pictures: in Emby, on the show's picture, click ⋯ and choose + Refresh Metadata.
  8. +
  9. Set Refresh mode to Search for missing metadata, leave + Replace existing images off, and click Refresh.
  10. +
+

You should see: the show, its race weekends and its sessions with the pictures you saved.

+

Emby also reads poster.png for a show or race weekend, and + season23-poster.png for round 23 when it sits in the show's folder. It looks for + folder first.

+
+ +
+

4. When the pictures get a new look

+

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).

+

Never switch on Replace existing images 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 (Emby's metadata manager page).

+
+ +

If it doesn't work

+ + +

For the technically minded

+ +

The pictures

+ + +

A whole season as files, with a script

+

For Linux, macOS or a NAS with a shell. It reads the season's addresses from the Kometa file and saves, as JPEG, + folder.jpg in the show's folder, seasonNN-poster.jpg per round next to it, and + <video>-thumb.jpg next to every video whose name carries its round and episode + (S23E12 or 23x12). Keep one picture per item: delete a .png you saved by hand + for the same item. Then refresh as in step 3b.

+
#!/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 "\":") > 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 && $2 == e { print $3 "&" o }'; } + +curl -fsSo "$show/folder.jpg" "$(address 0 0)" +for round in $(printf '%s\n' "$list" | awk '$1 > 0 && $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 ] && url=$(address "$1" "$2") && [ -n "$url" ] && curl -fsSo "${file%.*}-thumb.jpg" "$url" +done
+ +

Through Emby's API

+

Emby downloads a picture from an address onto an item with + POST + /Items/{Id}/RemoteImages/Download, with Type (Primary for the show's, a + season's and an episode's picture) and ImageUrl in the query. It needs an administrator: make an + API key in the server dashboard + (Advanced, Security, Add) and send it in the X-Emby-Token header.

+
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&Recursive=true&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&format=jpg"
+

Emby keeps the copy it downloaded. When the address version is raised, call it again with the new address.

+
+ + + + + + diff --git a/guides/guides.js b/guides/guides.js new file mode 100644 index 0000000..e2ee7d7 --- /dev/null +++ b/guides/guides.js @@ -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); + } +})(); diff --git a/guides/index.html b/guides/index.html new file mode 100644 index 0000000..4159ec5 --- /dev/null +++ b/guides/index.html @@ -0,0 +1,78 @@ + + + + + + Guides · F1 Circuits + + + + + +
+ F1 Circuits API + +
+ +
+

Guides

+

+ 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. +

+ +
+
+ The 2025 season poster +
A season: the year over a photo of that season's cars.
+
+
+ The 2025 Qatar Grand Prix poster +
A race weekend: its round, name, date and track over its circuit.
+
+
+ The thumbnail of the race session of the 2025 Qatar Grand Prix +
A session: the race, a qualifying or a practice, over the circuit.
+
+
+ +
+ +

Plex

+

A free helper called Kometa puts every picture in your Plex library and keeps them up to date. You set it up + once.

+
+ +

Emby

+

Set the pictures by hand in Emby's own screens, or save them as picture files next to your videos.

+
+
+ +

+ Every picture carries, at its bottom, the credit of the photo or map it is made from, and takes its licence from + them; the licences page lists every source and its licence. +

+
+ + + + + diff --git a/guides/plex.html b/guides/plex.html new file mode 100644 index 0000000..30d9484 --- /dev/null +++ b/guides/plex.html @@ -0,0 +1,260 @@ + + + + + + Using the posters in Plex · Guides · F1 Circuits + + + + + +
+ F1 Circuits API + +
+ +
+

Using the posters in Plex

+

+ 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 Kometa puts them there for you, and + keeps them up to date. This guide takes you through it one step at a time. +

+ +

What you will get

+
+
+ The 2025 season poster +
The show “Season 2025” gets the season poster.
+
+
+ The 2025 Qatar Grand Prix poster +
Each race weekend gets its race poster: here round 23, Qatar.
+
+
+ The thumbnail of the race session of the 2025 Qatar Grand Prix +
Each session gets its thumbnail: here the race.
+
+
+

The Library page shows a whole library this way, season by season.

+ +

What you need

+ + +
+

1. Put your videos in folders

+

Kometa's Formula 1 guide shapes the library + like this. Plex calls the levels show, season and episode:

+ +
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
+
+ Which episode number is which session +

The pictures go to the episodes by their number. A sprint weekend has more sessions, so its numbers differ:

+ + + + + + + + + + + + + + + + + + + +
EpisodeStandard weekendSprint weekend
1Free Practice 1Free Practice 1
2Free Practice 2Pre-Sprint-Qualifying Buildup
3Free Practice 3Sprint Qualifying
4Pre-Qualifying BuildupPost-Sprint-Qualifying
5QualifyingPre-Sprint Buildup
6Post-QualifyingSprint
7Pre-Race BuildupPost-Sprint
8RacePre-Qualifying Buildup
9Post-RaceQualifying
10HighlightsPost-Qualifying
11Pre-Race Buildup
12Race
13Post-Race
14Highlights
15Bonus Content
+
+
+ +
+

2. Make the Formula 1 library in Plex

+

The library needs Plex's Personal Media Shows 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.

+
    +
  1. In the Plex Web App, open Settings and choose your server.
  2. +
  3. Choose Library, turn on Show Legacy Agent during library set up, and save + the change. (An older Plex Media Server does not have this setting and shows the agent anyway.)
  4. +
  5. Under Manage, choose Libraries, then Add Library.
  6. +
  7. Choose TV Shows and name the library, for example Formula 1. Note the exact + name: you will type it in step 4.
  8. +
  9. Add the folder that holds your season folders (Formula 1 in the example above).
  10. +
  11. Choose Advanced, and under Agent choose + Personal Media Shows (Legacy).
  12. +
  13. Finish adding the library.
  14. +
+

You should see: one show per season folder, such as “Season 2025”, and inside it one season per race + weekend.

+

Already have a Formula 1 library with another agent? Plex's + page on agents shows how to change it, and says + the change applies only to videos added after it.

+
+ +
+

3. Install Kometa

+
    +
  1. Open Kometa's installation walkthrough and choose + the computer you will run it on. Kometa recommends its Docker version unless you already use Python.
  2. +
  3. Follow it until it asks for three things, and gather them as it says: +
      +
    • Your Plex address: the address that computer uses to reach Plex directly, such as + http://192.0.2.10:32400. Not app.plex.tv.
    • +
    • Your Plex token, a password for programs: in the Plex Web App, open any video's + ⋯ menu, choose Get Info, then the XML link at the bottom + (Plex's + page). The token is the part after X-Plex-Token= in the address of the page that opens.
    • +
    • Your TMDb key: sign in at themoviedb.org, open Settings from your account + menu, choose API and request a key. If it shows two keys, use the v3 one.
    • +
    +
  4. +
  5. Make the file config.yml as the walkthrough shows, with your Plex address, Plex token and TMDb + key in it. Then come back here for its libraries part.
  6. +
+
+ +
+

4. Point Kometa at the Formula 1 file

+

One file on this site tells Kometa which picture goes on which season, race weekend and session, for every + season from 1950 on.

+
    +
  1. Open config.yml in a plain text editor, such as Notepad on Windows or TextEdit on a Mac.
  2. +
  3. Replace its libraries: part with the lines below. If it already lists libraries of your own, + keep them and add the Formula 1: lines under them. +
    libraries: + Formula 1: + metadata_files: + - url: https://f1-circuits.zurag.be/kometa/formula-1-metadata.yml
    +
  4. +
  5. Change Formula 1 to your library's exact name in Plex, if you named it otherwise.
  6. +
  7. Keep the spaces at the start of each line as shown: two per level. Kometa reads the levels from them.
  8. +
  9. Save the file. The plex: and tmdb: parts stay as you filled them in.
  10. +
+
+ +
+

5. Run Kometa once

+

Type the command for the way you installed Kometa, in the window the walkthrough had you use:

+ +

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.

+

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.

+
+ +
+

6. Keep it up to date

+

Leave Kometa running in its normal way, without --run: the part “Scheduling and updates” of the + walkthrough 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.

+

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.

+
+ +

If it doesn't work

+ + +

For the technically minded

+ +
+ + + + + + diff --git a/service/Dockerfile b/service/Dockerfile index 6e0463c..0092514 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -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 diff --git a/tests/test_image.py b/tests/test_image.py new file mode 100644 index 0000000..c70481e --- /dev/null +++ b/tests/test_image.py @@ -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()