trying out rust

This commit is contained in:
2024-11-01 17:25:51 +01:00
parent b6ea267ddf
commit a8f2919fdd
4 changed files with 24 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
gallery-dl/*.sqlite3
gallery-dl/log.txt
Artists
/target

7
Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "Hentai"
version = "0.1.0"
edition = "2021"
[dependencies]
postgres = "0.19.9"

View File

@ -1,6 +1,5 @@
#!/usr/bin/bash
for dir in /mnt/nsfb/Hentai/Artists/*/ ; do
cd "$dir"
[[ -f Links.md ]] || cp /home/rene/projects/Hentai/Links.md .
[[ -f $dir/Links.md ]] || cp /home/rene/projects/Hentai/Links.md "$dir"
done

15
src/main.rs Normal file
View File

@ -0,0 +1,15 @@
use postgres::{Client, NoTls};
fn main() {
let mut client = Client::connect("host=192.168.0.10 port=28945 user=hentai password=h99nqaNPhpfbuuhCDwQXLpZAnoVTjSQP7taoqmQhpzc2rPLVC4JUAKxAHfuuhuU9", NoTls).unwrap();
let output = client.query("SELECT * FROM get_urls_and_paths('Rule34');", &[]).unwrap();
let mut url: &str;
let mut path: &str;
for row in output {
url = row.get(0);
path = row.get(1);
println!("{} {}", url, path);
}
}