From 8df868eff32e140a57adb9fd8d842a6ff068da3b Mon Sep 17 00:00:00 2001
From: Dominic <git@msrd0.de>
Date: Wed, 10 Apr 2024 12:55:00 +0200
Subject: [PATCH] support changing label/docent in intro slide

---
 230101/project.toml |  9 ++++++---
 src/iotro.rs        | 13 +++++--------
 src/main.rs         | 17 ++++++++++++++++-
 src/render/mod.rs   |  2 +-
 4 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/230101/project.toml b/230101/project.toml
index 8fff98f..d90df0c 100644
--- a/230101/project.toml
+++ b/230101/project.toml
@@ -1,17 +1,20 @@
 [lecture]
-course = "23ws-malo"
+course = "23ws-malo2"
+label = "Mathematische Logik II"
+docent = "Prof. E. Grädel"
 date = "230101"
 
 [source]
 files = ["C01.mp4", "C02.mp4", "C03.mp4"]
+stereo = false
 start = "2"
 end = "12"
 fast = [["5", "7"], ["9", "11"]]
 
 [source.metadata]
-source_duration = "12.53333"
+source_duration = "12.53000"
 source_fps = "50/1"
-source_tbn = "1/12800"
+source_tbn = "1/1000"
 source_res = "FullHD"
 source_sample_rate = 48000
 
diff --git a/src/iotro.rs b/src/iotro.rs
index f430656..2dd0634 100644
--- a/src/iotro.rs
+++ b/src/iotro.rs
@@ -1,9 +1,6 @@
 //! A module for writing intros and outros
 
-use crate::{
-	time::{format_date_long, Date},
-	Resolution
-};
+use crate::{time::format_date_long, ProjectLecture, Resolution};
 use svgwriter::{
 	tags::{Group, Rect, TagWithPresentationAttributes, Text},
 	Graphic
@@ -74,17 +71,17 @@ impl Iotro {
 	}
 }
 
-pub(crate) fn intro(res: Resolution, date: Date) -> Graphic {
+pub(crate) fn intro(res: Resolution, lecture: &ProjectLecture) -> Graphic {
 	use self::{FontSize::*, FontWeight::*};
 
 	let mut intro = Iotro::new(res);
-	intro.add_text(Huge, Bold, 110, "Mathematische Logik II");
-	intro.add_text(Huge, SemiBold, 250, "Prof. E. Grädel");
+	intro.add_text(Huge, Bold, 110, &lecture.label);
+	intro.add_text(Huge, SemiBold, 250, &lecture.docent);
 	intro.add_text(
 		Huge,
 		SemiBold,
 		460,
-		format!("Vorlesung vom {}", format_date_long(date))
+		format!("Vorlesung vom {}", format_date_long(lecture.date))
 	);
 	intro.add_text(
 		Big,
diff --git a/src/main.rs b/src/main.rs
index 0b49c00..9cd51aa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -36,6 +36,14 @@ struct Args {
 	#[clap(short = 'c', long, default_value = "23ws-malo2")]
 	course: String,
 
+	/// The label of the course, e.g. "Mathematische Logik II".
+	#[clap(short, long, default_value = "Mathematische Logik II")]
+	label: String,
+
+	/// The docent of the course, e.g. "Prof. E. Grädel".
+	#[clap(short, long, default_value = "Prof. E. Grädel")]
+	docent: String,
+
 	/// The memory limit for external tools like ffmpeg.
 	#[clap(short, long, default_value = "12G")]
 	mem_limit: String,
@@ -134,6 +142,8 @@ struct Project {
 #[derive(Deserialize, Serialize)]
 struct ProjectLecture {
 	course: String,
+	label: String,
+	docent: String,
 	#[serde_as(as = "DisplayFromStr")]
 	date: Date
 }
@@ -257,7 +267,12 @@ fn main() {
 		assert!(!files.is_empty());
 
 		let project = Project {
-			lecture: ProjectLecture { course, date },
+			lecture: ProjectLecture {
+				course,
+				label: args.label,
+				docent: args.docent,
+				date
+			},
 			source: ProjectSource {
 				files,
 				stereo: args.stereo,
diff --git a/src/render/mod.rs b/src/render/mod.rs
index 3e9e8c8..279f3c4 100644
--- a/src/render/mod.rs
+++ b/src/render/mod.rs
@@ -261,7 +261,7 @@ impl<'a> Renderer<'a> {
 		let intro_svg = self.target.join("intro.svg");
 		fs::write(
 			&intro_svg,
-			intro(source_res, project.lecture.date)
+			intro(source_res, &project.lecture)
 				.to_string_pretty()
 				.into_bytes()
 		)?;
-- 
GitLab