diff --git a/README.md b/README.md index e83a0c2..99b861d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ # GTubeK ## Attempt to make a invidious GTK4/Libadwaita client using Rust. - -(Warning: i barely know anything about rust. Open Issues when something is wrong!) \ No newline at end of file diff --git a/inv.rs b/inv.rs new file mode 100644 index 0000000..5c47af1 --- /dev/null +++ b/inv.rs @@ -0,0 +1,10 @@ +use invidious::reqwest::blocking::Client; +use std::error::Error; + +fn main() -> Result<(), Box> { + let client = Client::new(String::from("https://vid.puffyan.us")); + let search_results = client.search(Some("q=rust programming"))?.items; + let video = client.video("5C_HPTJg5ek", None)?; + + Ok(()) +} \ No newline at end of file diff --git a/main.rs b/main.rs new file mode 100644 index 0000000..7af0eab --- /dev/null +++ b/main.rs @@ -0,0 +1,52 @@ +use adw::Application; +use std::time::Duration; +use gtk::Video; +use gtk::gio; +use std::fs::File; +use std::path::Path; +use gtk::prelude::*; +use gtk::{self, ApplicationWindow, Button, prelude::*}; +use invidious::reqwest::blocking::functions::video; +mod inv; + + +const APP_ID: &str = "org.gtk_rs.MainEventLoop1"; + +fn main() { + // Create a new application + let app = Application::builder().application_id(APP_ID).build(); + + // Connect to "activate" signal of `app` + app.connect_activate(build_ui); + + print!("{}: {}", video.title, video.author); + + // Run the application + app.run(); +} + +fn build_ui(app: &Application) { + // Create a button + let button = Button::builder() + .label("Press me!") + .margin_top(12) + .margin_bottom(12) + .margin_start(12) + .margin_end(12) + .build(); + + + let video = Video::for_file(Some(&gio::File::for_path("/home/midou/Vidéos/miui.mp4"))); + + + // Create a window + let window = ApplicationWindow::builder() + .application(app) + .title("My GTK App") + .child(&button) + .child(&video) + .build(); + + // Present window + window.present(); +} diff --git a/uai.rs b/uai.rs new file mode 100644 index 0000000..b71b381 --- /dev/null +++ b/uai.rs @@ -0,0 +1 @@ +pub mod ui; \ No newline at end of file diff --git a/uai/ui.rs b/uai/ui.rs new file mode 100644 index 0000000..bd70cd1 --- /dev/null +++ b/uai/ui.rs @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +