ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_config.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <stddef.h>
18#include <stdint.h>
19
20#include "mdl_politeness.h"
21#include "mdl_storage.h"
22#include "ra8_err.h"
23
30
41
46typedef struct {
51
52 /* Chapter list, found on a series page. */
57
58 /* Page images, found on a chapter page. */
61
62 /* Search / discovery (#304). Empty when the site descriptor supplies none. */
68
69 /* Metadata extraction (#306). Selectors use the bounded grammar documented
70 * by mdl_extract_selector(): meta:, class:, label:, or literal:. */
84
85 /* Politeness jitter (milliseconds); baseline spacing, jittered in [min,max].
86 */
87 uint32_t img_delay_min;
88 uint32_t img_delay_max;
91
92 /* Governor: closed-loop per-host rate/backoff/concurrency (see
93 * mdl_politeness). */
94 uint32_t rate_per_min;
95 uint32_t burst;
96 uint32_t backoff_base_ms;
97 uint32_t backoff_max_ms;
98 uint32_t max_inflight;
100
124[[nodiscard]] ra8_err_t mdl_config_load(mdl_storage_t* storage, const char* path, mdl_site_t* out);
125
150
ra8_err_t mdl_config_load(mdl_storage_t *storage, const char *path, mdl_site_t *out)
Load a site descriptor from a flat key=value file.
Definition mdl_config.c:557
mdl_gov_cfg_t mdl_config_gov_cfg(const mdl_site_t *site)
Build the politeness-governor tunables for a loaded site descriptor.
Definition mdl_config.c:594
mdl_chapter_order_t
How to order chapters extracted from a series page.
Definition mdl_config.h:25
@ k_mdl_order_asc
Sort by the number parsed from the URL.
Definition mdl_config.h:28
@ k_mdl_order_reverse
Reverse document order (newest-first -> old).
Definition mdl_config.h:27
@ k_mdl_order_doc
Keep document order.
Definition mdl_config.h:26
void mdl_config_apply_polite(mdl_site_t *site)
Raise a descriptor's per-request delay floors for --polite.
Definition mdl_config.c:625
mdl_config_limits_t
Fixed field sizes for a site descriptor.
Definition mdl_config.h:32
@ k_mdl_host_max
Host bytes.
Definition mdl_config.h:34
@ k_mdl_attr_max
Image attribute name bytes.
Definition mdl_config.h:37
@ k_mdl_match_max
Selector/substring field bytes.
Definition mdl_config.h:36
@ k_mdl_contact_max
Operator contact string bytes.
Definition mdl_config.h:38
@ k_mdl_search_url_max
Search/browse URL template bytes.
Definition mdl_config.h:39
@ k_mdl_kind_max
"manga"/"manhwa"/... bytes.
Definition mdl_config.h:35
@ k_mdl_name_max
Site display name bytes.
Definition mdl_config.h:33
Jittered inter-request delay plus the per-host politeness governor.
Injected portable storage resources for downloader domain code.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Per-site politeness tunables the governor is initialised with.
One site's scraping rules (all data, no logic).
Definition mdl_config.h:46
char chapter_number_selector[k_mdl_match_max]
Per-chapter number selector.
Definition mdl_config.h:80
uint32_t chapter_delay_min
Inter-chapter spacing floor.
Definition mdl_config.h:89
char browse_url[k_mdl_search_url_max]
Latest-updates page (no {q}).
Definition mdl_config.h:67
char series_author_selector[k_mdl_match_max]
Series writer selector.
Definition mdl_config.h:75
char kind[k_mdl_kind_max]
Content kind hint (reader mode).
Definition mdl_config.h:49
uint32_t burst
Token-bucket capacity, in requests.
Definition mdl_config.h:95
uint32_t rate_per_min
Sustained per-host request ceiling (0 = off).
Definition mdl_config.h:94
char search_url[k_mdl_search_url_max]
Query template with a {q} slot.
Definition mdl_config.h:63
uint32_t img_delay_max
Per-image spacing ceiling.
Definition mdl_config.h:88
char reading_direction[k_mdl_kind_max]
ltr or rtl.
Definition mdl_config.h:83
char name[k_mdl_name_max]
Human-readable site name.
Definition mdl_config.h:47
uint32_t chapter_delay_max
Inter-chapter spacing ceiling.
Definition mdl_config.h:90
char host[k_mdl_host_max]
Site host, e.g.
Definition mdl_config.h:48
char contact[k_mdl_contact_max]
Operator contact for the UA.
Definition mdl_config.h:50
char chapter_title_selector[k_mdl_match_max]
Per-chapter title selector.
Definition mdl_config.h:78
char page_img_url_contains[k_mdl_match_max]
Keep only URLs with this.
Definition mdl_config.h:60
char series_cover_selector[k_mdl_match_max]
Series cover-URL selector.
Definition mdl_config.h:77
uint32_t backoff_base_ms
First backoff window on a 429/503.
Definition mdl_config.h:96
char chapter_url_contains[k_mdl_match_max]
href must contain this.
Definition mdl_config.h:53
uint32_t backoff_max_ms
Backoff-window ceiling.
Definition mdl_config.h:97
char language[k_mdl_kind_max]
BCP-47 language tag.
Definition mdl_config.h:82
char series_summary_selector[k_mdl_match_max]
Series synopsis selector.
Definition mdl_config.h:73
char page_img_attr[k_mdl_attr_max]
Preferred attr (fallback other).
Definition mdl_config.h:59
mdl_chapter_order_t chapter_order
Ordering to apply.
Definition mdl_config.h:56
uint32_t img_delay_min
Per-image spacing floor.
Definition mdl_config.h:87
char search_result_contains[k_mdl_match_max]
Series-link substring on results.
Definition mdl_config.h:65
char series_artist_selector[k_mdl_match_max]
Series artist selector.
Definition mdl_config.h:76
uint32_t max_inflight
Per-host in-flight request cap.
Definition mdl_config.h:98
char chapter_url_prefix[k_mdl_search_url_max]
Absolute series-chapter prefix.
Definition mdl_config.h:54
char series_title_selector[k_mdl_match_max]
Series display-title selector.
Definition mdl_config.h:71
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40