cargo fix
This commit is contained in:
parent
e6621072cd
commit
8cf2d48a16
14 changed files with 85 additions and 115 deletions
|
@ -3,7 +3,7 @@ use crate::{Background, Slide, SlideBuilder, TextAlignment};
|
|||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
model::{LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
|
@ -45,13 +45,7 @@ impl Content for Image {
|
|||
}
|
||||
|
||||
fn background(&self) -> Option<Background> {
|
||||
if let Ok(background) =
|
||||
Background::try_from(self.path.clone())
|
||||
{
|
||||
Some(background)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
Background::try_from(self.path.clone()).ok()
|
||||
}
|
||||
|
||||
fn subtext(&self) -> String {
|
||||
|
|
|
@ -133,12 +133,12 @@ pub(crate) fn get_lists(exp: &Value) -> Vec<Value> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::fs::read_to_string;
|
||||
|
||||
|
||||
use lexpr::{parse::Options, Parser};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
// #[test]
|
||||
// fn test_list() {
|
||||
|
|
|
@ -4,7 +4,6 @@ use cosmic::iced::Executor;
|
|||
use miette::{miette, Result};
|
||||
use sqlx::{Connection, SqliteConnection};
|
||||
|
||||
use super::kinds::ServiceItemKind;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Model<T> {
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{Background, Slide, SlideBuilder, TextAlignment};
|
|||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
model::{LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
};
|
||||
|
||||
|
@ -57,13 +57,7 @@ impl Content for Presentation {
|
|||
}
|
||||
|
||||
fn background(&self) -> Option<Background> {
|
||||
if let Ok(background) =
|
||||
Background::try_from(self.path.clone())
|
||||
{
|
||||
Some(background)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
Background::try_from(self.path.clone()).ok()
|
||||
}
|
||||
|
||||
fn subtext(&self) -> String {
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::ops::Deref;
|
|||
|
||||
use cosmic::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use miette::{miette, Result};
|
||||
use miette::Result;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use crate::Slide;
|
||||
|
@ -153,52 +153,50 @@ impl From<&Value> for ServiceItem {
|
|||
database_id: 0,
|
||||
kind: ServiceItemKind::Content(slide),
|
||||
}
|
||||
} else {
|
||||
if let Some(background) =
|
||||
list.get(background_pos)
|
||||
{
|
||||
match background {
|
||||
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 if let Some(background) =
|
||||
list.get(background_pos)
|
||||
{
|
||||
match background {
|
||||
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()
|
||||
}
|
||||
} else {
|
||||
error!(
|
||||
"There is no background here: {:?}",
|
||||
background_pos
|
||||
);
|
||||
ServiceItem::default()
|
||||
}
|
||||
}
|
||||
Value::Symbol(Symbol(s)) if s == "song" => {
|
||||
|
@ -342,7 +340,7 @@ mod test {
|
|||
use crate::core::presentations::PresKind;
|
||||
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq, assert_ne};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
fn test_song() -> Song {
|
||||
Song {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// use cosmic::dialog::ashpd::url::Url;
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use gstreamer::query::Uri;
|
||||
use iced_video_player::Video;
|
||||
use miette::{miette, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
@ -8,14 +8,14 @@ use sqlx::{
|
|||
pool::PoolConnection, query, sqlite::SqliteRow, FromRow, Row,
|
||||
Sqlite, SqliteConnection, SqlitePool,
|
||||
};
|
||||
use tracing::{debug, error};
|
||||
use tracing::error;
|
||||
|
||||
use crate::{core::slide, Slide, SlideBuilder};
|
||||
|
||||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
model::{LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
slide::{Background, TextAlignment},
|
||||
};
|
||||
|
@ -132,10 +132,7 @@ impl FromRow<'_, SqliteRow> for Song {
|
|||
}),
|
||||
background: {
|
||||
let string: String = row.try_get(7)?;
|
||||
match Background::try_from(string) {
|
||||
Ok(background) => Some(background),
|
||||
Err(_) => None,
|
||||
}
|
||||
Background::try_from(string).ok()
|
||||
},
|
||||
text_alignment: Some({
|
||||
let horizontal_alignment: String = row.try_get(3)?;
|
||||
|
@ -423,7 +420,7 @@ pub async fn update_song_in_db(
|
|||
if let Some(vo) = item.verse_order {
|
||||
vo.into_iter()
|
||||
.map(|mut s| {
|
||||
s.push_str(" ");
|
||||
s.push(' ');
|
||||
s
|
||||
})
|
||||
.collect::<String>()
|
||||
|
@ -538,7 +535,7 @@ impl Song {
|
|||
lyric_list.push(lyric.to_string());
|
||||
} else {
|
||||
// error!("NOT WORKING!");
|
||||
()
|
||||
|
||||
};
|
||||
}
|
||||
// for lyric in lyric_list.iter() {
|
||||
|
@ -556,7 +553,7 @@ mod test {
|
|||
use std::fs::read_to_string;
|
||||
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq, assert_ne};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
pub fn test_song_lyrics() {
|
||||
|
@ -724,7 +721,7 @@ You saved my soul"
|
|||
let lisp = read_to_string("./test_song.lisp").expect("oops");
|
||||
let lisp_value = crisp::reader::read(&lisp);
|
||||
match lisp_value {
|
||||
Value::List(v) => v.get(0).unwrap().clone(),
|
||||
Value::List(v) => v.first().unwrap().clone(),
|
||||
_ => Value::Nil,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::{Background, SlideBuilder, TextAlignment};
|
|||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
model::{LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
slide::Slide,
|
||||
};
|
||||
|
@ -50,13 +50,7 @@ impl Content for Video {
|
|||
}
|
||||
|
||||
fn background(&self) -> Option<Background> {
|
||||
if let Ok(background) =
|
||||
Background::try_from(self.path.clone())
|
||||
{
|
||||
Some(background)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
Background::try_from(self.path.clone()).ok()
|
||||
}
|
||||
|
||||
fn subtext(&self) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue