diff --git a/source/templates/video.html b/source/templates/video.html index 4d92d2d..0c9ca66 100644 --- a/source/templates/video.html +++ b/source/templates/video.html @@ -26,9 +26,10 @@ {% if let Some(mods) = speedrun.mods %}

Mods

diff --git a/source/video/filters.rs b/source/video/filters.rs index 1954e61..ba8297c 100644 --- a/source/video/filters.rs +++ b/source/video/filters.rs @@ -2,6 +2,19 @@ Filters for Askama templates. */ +/** +Get the DRG mod link and title from a given ID. +*/ +pub fn drg_mod(mod_id: &str) -> askama::Result<(String, &str)> { + let mods = std::collections::HashMap::<_, _>::from_iter([ + ("drglib", "DRGLib"), + ("simplemissiontimer", "SimpleMissionTimer"), + ]); + + let mod_title = mods.get(mod_id).unwrap(); + Ok((format!("https://drg.mod.io/{mod_id}"), mod_title)) +} + /** Turn a timestamp with format `mm:ss` into its total seconds. diff --git a/source/video/mod.rs b/source/video/mod.rs index 10e0874..a2bb33b 100644 --- a/source/video/mod.rs +++ b/source/video/mod.rs @@ -25,7 +25,7 @@ pub struct SpeedrunData { pub chapters: Option>, pub entry: String, pub leaderboard: String, - pub mods: Option>, + pub mods: Option>, } pub fn write_all(public_dir: &Path) -> Result<()> {