The mess i'm trying to make
This commit is contained in:
commit
e2157b76f7
10
inv.rs
Normal file
10
inv.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use invidious::reqwest::blocking::Client;
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
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(())
|
||||||
|
}
|
52
main.rs
Normal file
52
main.rs
Normal file
@ -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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user