Compare commits
11 Commits
main
...
9cccb7af89
Author | SHA1 | Date | |
---|---|---|---|
9cccb7af89
|
|||
b77c0cf50c
|
|||
2858158277
|
|||
61dd0f22a9
|
|||
aaabc484ad
|
|||
f8bc34a93d
|
|||
80b37cc348
|
|||
fa650374de
|
|||
22a443d5fd
|
|||
6b9e407f8f
|
|||
d7a1c50dc6
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/target
|
||||
Cargo.lock
|
23
.woodpecker.yml
Normal file
23
.woodpecker.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
pipeline:
|
||||
build:
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
image: rust:latest
|
||||
commands:
|
||||
- cargo update
|
||||
- cargo build
|
||||
- cargo test
|
||||
- echo "Done building!"
|
||||
gzip:
|
||||
when:
|
||||
event: [push]
|
||||
image: rust:latest
|
||||
commands:
|
||||
- mkdir ../artifact
|
||||
- mv target/debug ../artifact
|
||||
- tar -c -z -v -f gtubek-dev.tar.gz ../artifact
|
||||
#upload:
|
||||
#when:
|
||||
#event: [push]
|
||||
#image:
|
||||
|
16
Cargo.toml
Normal file
16
Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "gtubek"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
gtk = { version = "0.4.8", package = "gtk4" }
|
||||
adw = { version = "0.1.1", package = "libadwaita" }
|
||||
invidious = "0.3.2"
|
||||
gtk-ui-builder = "0.2.0"
|
||||
serde_json = "1.0"
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
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();
|
||||
}
|
BIN
nikolor.png
Normal file
BIN
nikolor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 110 KiB |
13
src/inv.rs
Normal file
13
src/inv.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use invidious::reqwest::blocking::Client;
|
||||
use std::error::Error;
|
||||
//use serde::{Deserialize, Serialize};
|
||||
//use serde_json::Result;
|
||||
|
||||
pub fn inv() -> Result<(), Box<dyn Error>> {
|
||||
let client = Client::new(String::from("https://invidious.projectsegfau.lt"));
|
||||
let search_results = client.search(Some("q=rust programming"))?.items;
|
||||
let video = client.video("5C_HPTJg5ek", None)?;
|
||||
//println!("{:?}", video);
|
||||
println!("{:?}", video.format_streams[2].url);
|
||||
Ok(())
|
||||
}
|
87
src/main.rs
Normal file
87
src/main.rs
Normal file
@@ -0,0 +1,87 @@
|
||||
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::*, ListBox, FlowBox, PolicyType, ScrolledWindow, Box, Orientation, Align::*};
|
||||
use crate::inv::inv;
|
||||
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!("{:?}", output);
|
||||
// Run the application
|
||||
app.run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn build_ui(app: &Application) {
|
||||
// Create a button
|
||||
let button = Button::builder()
|
||||
.label("Press me!")
|
||||
.icon_name("fingerprint-authentication-symbolic")
|
||||
.valign(Fill)
|
||||
.vexpand(true)
|
||||
.margin_top(12)
|
||||
.margin_bottom(12)
|
||||
.margin_start(12)
|
||||
.margin_end(12)
|
||||
.build();
|
||||
|
||||
//button.connect_clicked(move |_| trig_play());
|
||||
|
||||
|
||||
let video = Video::for_file(Some(&gio::File::for_path("/home/midou/Vidéos/miui.mp4")));
|
||||
//let output = inv::inv();
|
||||
|
||||
//let video = Video::for_media_stream(Some(&output));
|
||||
|
||||
/*
|
||||
// Set a listBox
|
||||
let listbox = ListBox::builder()
|
||||
.child(&video)
|
||||
.build();
|
||||
|
||||
*/
|
||||
|
||||
// Set a box
|
||||
let boxy = Box::new(Orientation::Vertical, 0);
|
||||
boxy.append(&video);
|
||||
boxy.append(&button);
|
||||
|
||||
// Then make the window scrollable
|
||||
let scrolled_window = ScrolledWindow::builder()
|
||||
// .hscrollbar_policy(PolicyType::Never) // Disable horizontal scrolling
|
||||
// .hscrollbar_policy()
|
||||
.min_content_width(360)
|
||||
.child(&boxy)
|
||||
.build();
|
||||
|
||||
// Create a window
|
||||
let window = ApplicationWindow::builder()
|
||||
.application(app)
|
||||
.default_width(1280)
|
||||
.default_height(720)
|
||||
.title("My GTK App")
|
||||
.child(&scrolled_window)
|
||||
.build();
|
||||
|
||||
// Present window
|
||||
window.present();
|
||||
}
|
||||
|
||||
//fn trig_play() {
|
||||
// let trigger =
|
||||
//}
|
Reference in New Issue
Block a user