Compare commits
No commits in common. "0eccfd03fceb0ac0e41b7e0aa9f70be1a7e8ae3c" and "e3b645e1502bebb5a7f91c48dbf76cbcc02360cd" have entirely different histories.
0eccfd03fc
...
e3b645e150
@ -1,3 +1,5 @@
|
||||
# GTubeK
|
||||
|
||||
## Attempt to make a invidious GTK4/Libadwaita client using Rust.
|
||||
|
||||
(Warning: i barely know anything about rust. Open Issues when something is wrong!)
|
10
inv.rs
10
inv.rs
@ -1,10 +0,0 @@
|
||||
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
52
main.rs
@ -1,52 +0,0 @@
|
||||
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