support changing label/docent in intro slide

This commit is contained in:
Dominic 2024-04-10 12:55:00 +02:00
parent 8e2b72c431
commit 8df868eff3
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
4 changed files with 28 additions and 13 deletions

View file

@ -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

View file

@ -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,

View file

@ -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,

View file

@ -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()
)?;