split ticker-update into libticker
This commit is contained in:
parent
b5f731aefe
commit
db76004e82
|
@ -503,6 +503,16 @@ name = "libc"
|
|||
version = "0.2.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libticker"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.2"
|
||||
|
@ -1169,6 +1179,7 @@ dependencies = [
|
|||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libticker 0.1.0",
|
||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "libticker"
|
||||
version = "0.1.0"
|
||||
authors = ["Astro <astro@spaceboyz.net>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
diesel = { version = "~1", features = ["postgres", "chrono"] }
|
||||
chrono = "~0.4"
|
||||
serde = { version = "~1.0", features = ["derive"] }
|
||||
serde_yaml = "~0.8"
|
|
@ -0,0 +1,7 @@
|
|||
#[macro_use]
|
||||
extern crate diesel;
|
||||
|
||||
pub mod config;
|
||||
pub mod ics;
|
||||
pub mod model;
|
||||
pub mod schema;
|
|
@ -12,3 +12,4 @@ serde = { version = "~1.0", features = ["derive"] }
|
|||
serde_yaml = "~0.8"
|
||||
num_cpus = "~1"
|
||||
crossbeam = "~0.7"
|
||||
libticker = { path = "../libticker" }
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#[macro_use]
|
||||
extern crate diesel;
|
||||
|
||||
use std::mem::replace;
|
||||
use std::io::Read;
|
||||
use std::fs::read_to_string;
|
||||
|
@ -10,14 +7,12 @@ use chrono::offset::Utc;
|
|||
use reqwest::header::{IF_NONE_MATCH, IF_MODIFIED_SINCE, ETAG, LAST_MODIFIED, USER_AGENT};
|
||||
use diesel::{Connection, pg::PgConnection, prelude::*};
|
||||
|
||||
mod config;
|
||||
use config::{Config, CalendarOptions};
|
||||
mod schema;
|
||||
use schema::{calendars::dsl::calendars};
|
||||
mod model;
|
||||
use model::{Calendar, NewCalendar, Event};
|
||||
mod ics;
|
||||
use ics::{Parser, Object, Timestamp, GetValue};
|
||||
use libticker::{
|
||||
config::{Config, CalendarOptions},
|
||||
schema::{self, calendars::dsl::calendars},
|
||||
model::{Calendar, NewCalendar, Event},
|
||||
ics::{Parser, Object, Timestamp, GetValue},
|
||||
};
|
||||
|
||||
fn extract_vevent_objs(results: &mut Vec<Object>, mut obj: Object) {
|
||||
let children = replace(&mut obj.children, vec![]);
|
||||
|
|
Loading…
Reference in New Issue