crier

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs

commit 3c73d4179b75afa886d59cf5d9d3edca081ad15b
parent 485c181276492633e483f3de7d6496df085b4d21
Author: lash <dev@holbrook.no>
Date:   Sun, 28 Jul 2024 15:35:08 +0100

Remove commented code

Diffstat:
Mcrier-lib/Cargo.toml | 8--------
Mcrier-lib/src/io/fs.rs | 4----
Mcrier-lib/src/lib.rs | 113+++++--------------------------------------------------------------------------
Mcrier-lib/src/tests.rs | 2--
4 files changed, 7 insertions(+), 120 deletions(-)

diff --git a/crier-lib/Cargo.toml b/crier-lib/Cargo.toml @@ -8,10 +8,7 @@ authors = ["Louis Holbrook <dev@holbrook.no>"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -#activitypub_federation = "^0.4.0" -#json-ld = "^0.14.1" digest = "^0.10.7" -#sha2 = "^0.10.8" rs_sha512 = "^0.1.3" http = "^1.0" chrono = "^0.4" @@ -19,10 +16,6 @@ itertools = "^0.13" serde = "^1.0" atom_syndication = "^0.12" -#[dependencies.quick-xml] -#version = "^0.31" -#features = ["serialize"] - [dependencies.uuid] version = "^1.9" features = ["v4"] @@ -32,7 +25,6 @@ version = "^2.0" features = ["atom"] [patch.crates-io] -#atom_syndication = { path = "/home/lash/src/contrib/atom_syndication" } atom_syndication = { git = "git://holbrook.no/contrib/atom_syndication", rev="9985c1610b2b819f5bd2f7a719567ee0b5419b85" } #branch="lash/entry-fromstr" [dev-dependencies] diff --git a/crier-lib/src/io/fs.rs b/crier-lib/src/io/fs.rs @@ -1,10 +1,7 @@ -//use http::Uri; use std::path::Path; use std::path::PathBuf; use std::fs::File; use std::collections::HashMap; -//use core::str::FromStr; -//use std::io::stderr; use std::io::Write; use atom_syndication::Feed; @@ -26,7 +23,6 @@ pub struct FsCache { impl FeedGet for FsFeed { fn get(&self, s: &str, _method: Option<FeedMethod>) -> Result<Feed, u64> { let feed: Feed; - //let uri = Uri::from_str(s).unwrap(); match rss_from_file(s, false) { Ok(v) => { feed = v; diff --git a/crier-lib/src/lib.rs b/crier-lib/src/lib.rs @@ -7,10 +7,7 @@ use std::fmt::Debug; use std::io::BufWriter; use std::str::FromStr; -//use feed_rs::model::Entry; -//use feed_rs::model::Feed; use rs_sha512::Sha512Hasher; -//use chrono::DateTime; use chrono::Local; use atom_syndication::Feed as Feed; use atom_syndication::Entry as Entry; @@ -231,19 +228,13 @@ impl SequencerEntry { None => { }, } -// -// if !have_date { -// match &o.entry.updated { -// Some(v) => { -// id_part = v.timestamp() as u32; -// o.digest = id_part as u64; -// o.digest <<= 32; -// have_date = true; -// }, -// None => { -// }, -// } -// } + + if !have_date { + id_part = o.entry.updated.timestamp() as u32; + o.digest = id_part as u64; + o.digest <<= 32; + have_date = true; + } let mut h = Sha512Hasher::default(); o.hash(&mut h); @@ -272,96 +263,6 @@ impl Into<Vec<u8>> for SequencerEntry { b = Vec::new(); w = o.to_writer(b); -// //let mut d = get_base_date(&self.entry); -// let mut d = Local::now().to_utc(); -// -// out_entry = Entry::default(); -// out_entry.set_id(self.entry.id); -// //out_entry.set_title(self.entry.title.unwrap().content); -// out_entry.set_title(self.entry.title); -// -// //out_entry.set_published(d.clone()); -// -//// match self.entry.updated { -//// Some(v) => { -//// d = FixedDateTime::parse_from_rfc2822(v.to_rfc2822().as_str()).unwrap(); -//// out_entry.set_updated(d.clone()); -//// }, -//// None => {}, -//// } -// -// match self.entry.summary { -// Some(v) => { -// let text_out: OutText; -// let summary_out_type: OutTextType; -// let summary_subtype = String::from(v.content_type.subty().as_str()); -// if summary_subtype.contains("xhtml") { -// summary_out_type = OutTextType::Xhtml; -// } else if summary_subtype.contains("html") { -// summary_out_type = OutTextType::Html; -// } else { -// summary_out_type = OutTextType::Text; -// } -// text_out = OutText{ -// value: v.content, -// r#type: summary_out_type, -// base: None, -// lang: None, -// }; -// out_entry.set_summary(Some(text_out)); -// }, -// None => {}, -// } -// -// match self.entry.content { -// Some(v) => { -// let mut content_out = OutContent::default(); -// content_out.content_type = Some(String::from(v.content_type.as_str())); -// match v.src { -// Some(vv) => { -// content_out.src = Some(vv.href); -// }, -// None => {}, -// }; -// match v.body { -// Some(vv) => { -// content_out.value = Some(vv); -// }, -// None => {}, -// }; -// out_entry.set_content(Some(content_out)); -// }, -// None => {}, -// } -// -// for v in self.entry.authors { -// let o = OutPerson{ -// name: v.name, -// uri: v.uri, -// email: v.email, -// }; -// out_entry.authors.push(o); -// } -// -// for v in self.entry.contributors { -// let o = OutPerson{ -// name: v.name, -// uri: v.uri, -// email: v.email, -// }; -// out_entry.contributors.push(o); -// } -// -// for v in self.entry.categories { -// let o = OutCategory { -// term: v.term, -// scheme: v.scheme, -// label: v.label, -// }; -// out_entry.categories.push(o); -// } - - //w = out_entry.write_to(w).unwrap(); w = self.entry.write_to(w).unwrap(); b = Vec::from(w.buffer()); b diff --git a/crier-lib/src/tests.rs b/crier-lib/src/tests.rs @@ -3,8 +3,6 @@ use std::fs::File; use std::io::{SeekFrom, Seek, Read}; use std::str; -//use feed_rs::model::Entry; -//use feed_rs::model::Text; use mediatype::MediaTypeBuf; use chrono::DateTime; use tempfile::NamedTempFile;