mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 10:24:13 +00:00
draft meta parser
This commit is contained in:
parent
1a644ee219
commit
4cdfaa2d6b
@ -10,11 +10,12 @@ use gtk::{
|
||||
prelude::{BoxExt, IOStreamExt, InputStreamExtManual, OutputStreamExtManual, SocketClientExt},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Page {
|
||||
widget: Box,
|
||||
navigation: Navigation,
|
||||
content: Content,
|
||||
content: Arc<Content>,
|
||||
}
|
||||
|
||||
impl Page {
|
||||
@ -76,23 +77,33 @@ impl Page {
|
||||
vec![0; 0xfffff], // 1Mb @TODO
|
||||
Priority::DEFAULT,
|
||||
Some(&Cancellable::new()),
|
||||
{
|
||||
move |result| match result {
|
||||
Ok(response) => {
|
||||
println!(
|
||||
"Result: {:?}",
|
||||
GString::from_utf8_until_nul(
|
||||
response.0
|
||||
)
|
||||
); // @TODO
|
||||
// @TODO connection.close(cancellable);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"Failed to read response: {:?}",
|
||||
e
|
||||
);
|
||||
move |result| match result {
|
||||
Ok(response) => {
|
||||
match GString::from_utf8_until_nul(
|
||||
response.0,
|
||||
) {
|
||||
Ok(data) => {
|
||||
// Detect page meta
|
||||
let meta = Regex::split_simple(
|
||||
r"^(\d+)?\s([\w]+\/[\w]+)?",
|
||||
data,
|
||||
RegexCompileFlags::DEFAULT,
|
||||
RegexMatchFlags::DEFAULT,
|
||||
);
|
||||
|
||||
//println!("{:?}", meta);
|
||||
//println!("Result: {}", data);
|
||||
}
|
||||
Err(_) => todo!(),
|
||||
}
|
||||
|
||||
// @TODO connection.close(cancellable);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"Failed to read response: {:?}",
|
||||
e
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user