adding text items to slides
This commit is contained in:
parent
43dce4dca4
commit
2695d1b70f
|
@ -76,47 +76,73 @@ impl From<&Value> for ServiceItem {
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.map_or_else(|| 1, |pos| pos + 1);
|
.map_or_else(|| 1, |pos| pos + 1);
|
||||||
if let Some(background) = list.get(background_pos)
|
if let Some(content) =
|
||||||
{
|
list.iter().position(|v| match v {
|
||||||
match background {
|
Value::List(list)
|
||||||
Value::List(item) => match &item[0] {
|
if list.iter().next()
|
||||||
Value::Symbol(Symbol(s))
|
== Some(&Value::Symbol(
|
||||||
if s == "image" =>
|
Symbol("text".into()),
|
||||||
{
|
)) =>
|
||||||
Self::from(&Image::from(
|
{
|
||||||
background,
|
list.iter().next().is_some()
|
||||||
))
|
|
||||||
}
|
|
||||||
Value::Symbol(Symbol(s))
|
|
||||||
if s == "video" =>
|
|
||||||
{
|
|
||||||
Self::from(&Video::from(
|
|
||||||
background,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
Value::Symbol(Symbol(s))
|
|
||||||
if s == "presentation" =>
|
|
||||||
{
|
|
||||||
Self::from(&Presentation::from(
|
|
||||||
background,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
_ => todo!(),
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
error!(
|
|
||||||
"There is no background here: {:?}",
|
|
||||||
background
|
|
||||||
);
|
|
||||||
ServiceItem::default()
|
|
||||||
}
|
}
|
||||||
|
_ => false,
|
||||||
|
})
|
||||||
|
{
|
||||||
|
let slide = Slide::from(value);
|
||||||
|
let title = slide.text();
|
||||||
|
Self {
|
||||||
|
id: 0,
|
||||||
|
title,
|
||||||
|
database_id: 0,
|
||||||
|
kind: ServiceItemKind::Content(slide),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error!(
|
if let Some(background) =
|
||||||
"There is no background here: {:?}",
|
list.get(background_pos)
|
||||||
background_pos
|
{
|
||||||
);
|
match background {
|
||||||
ServiceItem::default()
|
Value::List(item) => match &item[0] {
|
||||||
|
Value::Symbol(Symbol(s))
|
||||||
|
if s == "image" =>
|
||||||
|
{
|
||||||
|
Self::from(&Image::from(
|
||||||
|
background,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Value::Symbol(Symbol(s))
|
||||||
|
if s == "video" =>
|
||||||
|
{
|
||||||
|
Self::from(&Video::from(
|
||||||
|
background,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Value::Symbol(Symbol(s))
|
||||||
|
if s == "presentation" =>
|
||||||
|
{
|
||||||
|
Self::from(
|
||||||
|
&Presentation::from(
|
||||||
|
background,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
_ => todo!(),
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
error!(
|
||||||
|
"There is no background here: {:?}",
|
||||||
|
background
|
||||||
|
);
|
||||||
|
ServiceItem::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error!(
|
||||||
|
"There is no background here: {:?}",
|
||||||
|
background_pos
|
||||||
|
);
|
||||||
|
ServiceItem::default()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Value::Symbol(Symbol(s)) if s == "song" => {
|
Value::Symbol(Symbol(s)) if s == "song" => {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
||||||
fmt::Display,
|
fmt::Display,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
use tracing::error;
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use super::songs::Song;
|
use super::songs::Song;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue