Repository navigation
Expand file tree
/
Copy pathpresets.py
More file actions
614 lines (599 loc) · 28.1 KB
/
Copy pathpresets.py
File metadata and controls
614 lines (599 loc) · 28.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
"""Named visual presets for the anonymous public tier (ElfHosted fork).
The public preset endpoint ``/p/{preset}/{type}/{imdb_id}.jpg`` resolves a
preset name to a fixed ``raw_params`` dict, then runs the SAME render
pipeline as ``/poster`` — but the route enforces a set of quota- and
overload-safety invariants that make every anonymous hit cheap and
CDN-cacheable, REGARDLESS of what a preset's params request:
* No per-user keys — the operator's server TMDB/MDBList keys are used.
* No access_key gating — anonymous (the operator opts in via PRESET_ENABLED).
* Rating + quality data are used ONLY if already cached — an anonymous
hit never fans out to MDBList or AIOStreams.
* Burned-in-text (PP-OCRv5) detection is used ONLY if already cached — an
anonymous hit never triggers a foreground OCR scan; uncached titles are
queued to the background detector and served without the OCR-dependent
poster swap, with a short Cache-Control so the CDN isn't poisoned.
* All preset traffic shares one operator-wide "preset" rate-limit bucket.
These presets mirror upstream's configurator preset GALLERY (same ids, same
params), so a /p/<id> URL renders the same look as picking that gallery card —
the public tier exposes exactly the curated set, while authenticated tenants
keep the full configurator. Keep this list and the ``PRESETS`` array in
configurator.html in sync.
The mirror is deliberately manual rather than parsed out of the gallery at
import. A preset id here is a public URL that lives in metadata addon configs
we do not control, so the gallery is a source to follow, not a source of
truth to track automatically: upstream renaming a card must not 404 a URL
someone is already using. That is why retired ids stay in ``PRESETS`` with
their old params and are simply left out of ``preset_catalog()``.
Cherry-pick guide:
* Upstream has no server-side preset route — this whole module + the /p
handler are ElfHosted-only. The param dicts are pure data extracted from
the gallery; retuning a preset is a one-file change here (mirror it in
configurator.html's PRESETS so the gallery card matches).
* When upstream changes the gallery, re-extract the current cards from
configurator.html's PRESETS array into the first block below, and move
any id that vanished into the retired block rather than deleting it.
"""
from __future__ import annotations
# Each value is the preset's render params as strings (build_request_config
# parses raw query-param strings), keeping a /p call bit-for-bit equivalent
# to the matching gallery selection. tmdb_id/imdb_id/type are supplied by the
# route path and are intentionally absent here.
PRESETS: dict[str, dict[str, str]] = {
# --- Current gallery (upstream v1.2.0) --------------------------------
'tinted_mini_notch': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'medium',
'top_vignette_sash_only': 'true',
'vignette_poster_color_bottom': 'true',
'vignette_color_local': 'false',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '3',
'minimalist_mode_font_size_ratio': '0.060',
'minimalist_mode_font_x_offset': '0.065',
'rating_text_color': 'FFFFFF',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.17',
'logo_bottom_anchor': 'true',
'sash_mode': 'notch',
'sash_badge_size_w': '1.80',
'sash_badge_size_h': '1.20',
'sash_badge_inset': '0.000',
'sash_badge_font_ratio': '0.46',
'notch_vignette_color': 'true',
'badge_display_mode': '0',
},
'tinted_mini_sash': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'medium',
'top_vignette_sash_only': 'true',
'vignette_poster_color_bottom': 'true',
'vignette_color_local': 'false',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '3',
'minimalist_mode_font_size_ratio': '0.060',
'minimalist_mode_font_x_offset': '0.065',
'rating_text_color': 'FFFFFF',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.17',
'logo_bottom_anchor': 'true',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'badge_display_mode': '0',
},
'bar_notch': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '4',
'frost_reference': 'true',
'bar_bottom_inset': '0.000',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.17',
'logo_bottom_anchor': 'true',
'sash_mode': 'notch',
'sash_badge_size_w': '1.80',
'sash_badge_size_h': '1.20',
'sash_badge_inset': '0.000',
'sash_badge_font_ratio': '0.46',
'badge_display_mode': '0',
},
'bar_sash': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '4',
'frost_reference': 'true',
'bar_bottom_inset': '0.000',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.17',
'logo_bottom_anchor': 'true',
'sash_poster_color': 'true',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'badge_display_mode': '0',
},
'ratingbar_notch': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'frost_reference': 'true',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.23',
'logo_bottom_anchor': 'true',
'sash_mode': 'notch',
'sash_badge_size_w': '1.80',
'sash_badge_size_h': '1.20',
'sash_badge_inset': '0.000',
'sash_badge_font_ratio': '0.46',
'badge_display_mode': '0',
},
'ratingbar_sash': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'frost_reference': 'true',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.23',
'logo_bottom_anchor': 'true',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'badge_display_mode': '0',
},
'clean_notch': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '2',
'frost_reference': 'true',
'numeric_score_font_size_ratio': '0.090',
'numeric_score_y_offset': '0.91',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.21',
'logo_bottom_anchor': 'true',
'sash_mode': 'notch',
'sash_badge_size_w': '1.80',
'sash_badge_size_h': '1.20',
'sash_badge_inset': '0.000',
'sash_badge_font_ratio': '0.46',
'badge_display_mode': '0',
},
'clean_sash': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '2',
'frost_reference': 'true',
'numeric_score_font_size_ratio': '0.090',
'numeric_score_y_offset': '0.91',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.21',
'logo_bottom_anchor': 'true',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'badge_display_mode': '0',
},
'mini_sash_oa': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'low',
'bottom_gradient': 'medium',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '3',
'minimalist_mode_font_size_ratio': '0.060',
'minimalist_mode_font_x_offset': '0.065',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'use_original_art': 'true',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.23',
'logo_bottom_anchor': 'true',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'badge_display_mode': '0',
},
'bar_notch_oa': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'low',
'top_vignette_sash_only': 'true',
'fallback_to_imdb': 'true',
'imdb_rating_source': 'fallback',
'tmdb_rating_source': 'fallback',
'rating_display_mode': '4',
'frost_reference': 'true',
'bar_bottom_inset': '0.000',
'movie_weights': 'letterboxd:0.99,trakt:0.01',
'tv_weights': 'trakt:0.80,tomatoes:0.20',
'use_original_art': 'true',
'fallback_bg_style': 'photoreal',
'logo_max_h_ratio': '0.20',
'logo_bottom_ratio': '0.23',
'logo_bottom_anchor': 'true',
'sash_mode': 'notch',
'sash_badge_size_w': '1.80',
'sash_badge_size_h': '1.20',
'sash_badge_inset': '0.000',
'sash_badge_font_ratio': '0.46',
'badge_display_mode': '0',
},
# --- Retired ids, kept resolvable ------------------------------------
# v1.2.0 replaced the gallery outright: new ids, new params, new
# screenshots. Eight of the ten ids below are gone from it.
#
# They stay here because a preset id is not an internal name in this
# fork — it is a public URL. /p/black_rating_bar_oa/movie/tt0133093.jpg
# is sitting in metadata addon configs we do not control, and deleting
# the id turns every one of those into a 404. They keep their v1.1.0
# params, so an existing URL keeps rendering the look it has always
# rendered rather than silently becoming a different poster.
#
# They are deliberately absent from preset_catalog(), so the locked-mode
# UI offers only the current ten — and does not link screenshots that
# v1.2.0 deleted. clean_notch and clean_sash are NOT repeated here: they
# are still gallery ids, so they track the current definitions above. (A
# dict literal keeps the LAST duplicate key, so listing them here too
# would silently revert both cards to their v1.1.0 looks.)
'prestige_rating_bar': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '1',
'score_color_mode': '2',
'accent_bar_font_size_ratio': '0.080',
'accent_bar_y_offset': '0.90',
'accent_bar_append_mode': '0',
'accent_bar_bottom_ratio': '0.040',
'score_glow_threshold': '85',
'score_glow_blur': '1',
'score_glow_alpha': '40',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'false',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'sash_mode': 'sash',
'cinema_greyscale': 'true',
'cinema_greyscale_skip_if_available': 'false',
'release_status_cinema_only': 'true',
'muted': 'false',
'sash_poster_color': 'false',
'sash_length_ratio': '1.20',
'sash_height_ratio': '0.135',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '5',
'badge_height': '28',
'badge_anchor_x': '0.060',
'badge_anchor_y': '0.045',
'badge_min_score': '5',
},
'light_rating_bar': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '1',
'score_color_mode': '0',
'accent_bar_font_size_ratio': '0.080',
'accent_bar_y_offset': '0.90',
'accent_bar_append_mode': '0',
'accent_bar_bottom_ratio': '0.040',
'score_glow_threshold': '85',
'score_glow_blur': '1',
'score_glow_alpha': '40',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'false',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'sash_mode': 'notch',
'cinema_greyscale': 'true',
'cinema_greyscale_skip_if_available': 'false',
'release_status_cinema_only': 'true',
'sash_badge_style': 'frosted',
'sash_badge_size_w': '1.40',
'sash_badge_size_h': '1.20',
'sash_badge_font_ratio': '0.43',
'sash_badge_frost_opacity': '0.75',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '4',
'badge_height': '20',
'badge_anchor_x': '0.060',
'badge_anchor_y': '0.045',
'badge_min_score': '5',
},
'mini': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '3',
'score_color_mode': '0',
'minimalist_append_mode': '0',
'minimalist_mode_font_size_ratio': '0.056',
'minimalist_mode_font_x_offset': '0.065',
'minimalist_mode_font_y_offset': '0.920',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'false',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'sash_mode': 'sash',
'cinema_greyscale': 'true',
'cinema_greyscale_skip_if_available': 'false',
'release_status_cinema_only': 'true',
'muted': 'false',
'sash_poster_color': 'false',
'sash_length_ratio': '1.15',
'sash_height_ratio': '0.120',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '5',
'badge_height': '28',
'badge_anchor_x': '0.060',
'badge_anchor_y': '0.045',
'badge_min_score': '5',
},
'frosted_notch': {
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '4',
'bar_style': 'frosted',
'bar_append': 'rating_year',
'bar_score_out_of_10': 'false',
'bar_match_notch': 'true',
'bar_height_ratio': '0.080',
'bar_font_size_ratio': '0.55',
'bar_frost_opacity': '0.85',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'false',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'show_award_sash': 'true',
'cinema_greyscale': 'true',
'release_status_cinema_only': 'true',
'sash_badge': 'true',
'sash_badge_style': 'frosted',
'sash_badge_size_w': '1.40',
'sash_badge_size_h': '1.20',
'sash_badge_font_ratio': '0.43',
'sash_badge_frost_opacity': '0.75',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '0',
},
'black_rating_bar_light_notch': {
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '4',
'bar_style': 'rating_black',
'bar_accent': 'palette_0',
'bar_append': 'rating_year',
'bar_score_out_of_10': 'false',
'bar_height_ratio': '0.080',
'bar_font_size_ratio': '0.55',
'bar_frost_opacity': '0.85',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'false',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'show_award_sash': 'true',
'sash_badge': 'true',
'sash_badge_style': 'frosted',
'sash_badge_size_w': '1.40',
'sash_badge_size_h': '1.20',
'sash_badge_font_ratio': '0.43',
'sash_badge_frost_opacity': '0.75',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '0',
'cinema_greyscale': 'true',
'release_status_cinema_only': 'true',
},
'black_rating_bar_oa': {
'top_gradient': 'off',
'bottom_gradient': 'low',
'fallback_to_imdb': 'true',
'rating_display_mode': '4',
'bar_style': 'rating_black',
'bar_accent': 'palette_0',
'bar_append': 'rating_year',
'bar_score_out_of_10': 'false',
'bar_height_ratio': '0.080',
'bar_font_size_ratio': '0.55',
'bar_frost_opacity': '0.85',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'true',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'show_award_sash': 'true',
'sash_badge': 'false',
'muted': 'false',
'sash_length_ratio': '1.15',
'sash_height_ratio': '0.120',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '0',
'cinema_greyscale': 'true',
'release_status_cinema_only': 'true',
},
'frosted_rating_bar_oa': {
'top_gradient': 'off',
'bottom_gradient': 'low',
'fallback_to_imdb': 'true',
'rating_display_mode': '4',
'bar_style': 'rating_frosted',
'bar_accent': 'silver',
'bar_append': 'sash',
'bar_score_out_of_10': 'false',
'bar_height_ratio': '0.080',
'bar_font_size_ratio': '0.55',
'bar_frost_opacity': '0.85',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'true',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'show_award_sash': 'false',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '0',
'cinema_greyscale': 'true',
'release_status_cinema_only': 'true',
},
'mini_oa': {
'primary_client': 'stremio_tv_nuvio',
'top_gradient': 'medium',
'bottom_gradient': 'high',
'fallback_to_imdb': 'true',
'rating_display_mode': '3',
'score_color_mode': '0',
'minimalist_append_mode': '0',
'minimalist_mode_font_size_ratio': '0.056',
'minimalist_mode_font_x_offset': '0.065',
'minimalist_mode_font_y_offset': '0.920',
'movie_weights': 'letterboxd:0.99,trakt:0.01,tomatoes:0.00,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,rogerebert:0.00,myanimelist:0.00',
'tv_weights': 'trakt:0.80,tomatoes:0.20,popcorn:0.00,imdb:0.00,metacritic:0.00,metacriticuser:0.00,tmdb:0.00,myanimelist:0.00',
'textless': 'false',
'use_original_art': 'true',
'original_art_source': 'primary',
'logo_language': 'en',
'logo_priority': 'native_original',
'fallback_bg_style': 'photoreal',
'logo_max_w_ratio': '0.75',
'logo_max_h_ratio': '0.25',
'logo_bottom_ratio': '0.28',
'sash_mode': 'sash',
'cinema_greyscale': 'true',
'cinema_greyscale_skip_if_available': 'false',
'release_status_cinema_only': 'true',
'muted': 'false',
'sash_poster_color': 'false',
'sash_length_ratio': '1.15',
'sash_height_ratio': '0.120',
'sash_priority': 'wins,gg_wins,festival,pic_noms,gg_noms,studio,director,cast,trending,cult,foreign,new_release,metacritic,true_story,structural,release_status',
'badge_display_mode': '0',
},
}
_PRESET_META: dict[str, dict[str, str]] = {
'tinted_mini_notch': {'name': 'Tinted Minimalist Notch', 'description': 'Tinted vignette with minimal rating mode displaying the rating color (gold, silver, bronze) genre and year. A matching notch at the top displays interesting information.', 'screenshot': '/static/presets/preset1.webp'},
'tinted_mini_sash': {'name': 'Tinted Minimalist Sash', 'description': 'Tinted vignette with minimal rating mode displaying the rating color (gold, silver, bronze) genre and year. A sash at the top displays interesting information, color matched to sash type.', 'screenshot': '/static/presets/preset2.webp'},
'bar_notch': {'name': 'Bar with matching notch', 'description': 'Notch and bar sampled from the posters colour, clean and easy to read.', 'screenshot': '/static/presets/preset3.webp'},
'bar_sash': {'name': 'Bar with matching sash', 'description': 'Sash and bar sampled from the posters colour, clean and easy to read.', 'screenshot': '/static/presets/preset4.webp'},
'ratingbar_notch': {'name': 'Rating Bar with Notch', 'description': 'The bar at the bottom is colored based on the rating for "at a glance" ratings, along with a notch sampled from the posters colour at the top.', 'screenshot': '/static/presets/preset5.webp'},
'ratingbar_sash': {'name': 'Rating Bar with Sash', 'description': 'The bar at the bottom is colored based on the rating for "at a glance" ratings, along with a sash colored based on the sash type at the top.', 'screenshot': '/static/presets/preset6.webp'},
'clean_notch': {'name': 'Clean Notch', 'description': 'Clear genre and rating text with a notch at the top sampled from the posters colour.', 'screenshot': '/static/presets/preset7.webp'},
'clean_sash': {'name': 'Clean Sash', 'description': 'Clean genre and rating text with a sash at the top, the colour is based on sash type.', 'screenshot': '/static/presets/preset8.webp'},
'mini_sash_oa': {'name': 'Original Art - Mini & Sash', 'description': 'Uses the original art mode with a minimal rating and sash that attempt to stay out of the way.', 'screenshot': '/static/presets/preset9.webp'},
'bar_notch_oa': {'name': 'Original Art - Bar & Notch', 'description': 'Uses the original art mode with a bar rating and notch that attempt to stay out of the way.', 'screenshot': '/static/presets/preset10.webp'},
}
def get_preset(name: str) -> dict[str, str] | None:
"""Return a COPY of the raw_params dict for a preset name, or None."""
p = PRESETS.get(name)
return dict(p) if p is not None else None
def preset_names() -> list[str]:
"""Registered preset ids — used by /server-caps for discovery."""
return list(PRESETS.keys())
def preset_catalog() -> list[dict[str, str]]:
"""Ordered [{id, name, description, screenshot}] for the locked-mode
configurator gallery and /server-caps. Mirrors the gallery order."""
return [
{"id": pid, **_PRESET_META[pid]}
for pid in PRESETS
if pid in _PRESET_META
]