extracted sync with server to a shell file
This commit is contained in:
parent
110b17bfcf
commit
f9e4d1afff
|
@ -24,13 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitch"
|
||||||
version = "1.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "booru_image_tag_curating_helper"
|
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
|
@ -40,6 +34,12 @@ dependencies = [
|
||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.12.0"
|
version = "3.12.0"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "booru_image_tag_curating_helper"
|
name = "bitch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,9 @@ Tool for curating booru image bots
|
||||||
- [x] Write
|
- [x] Write
|
||||||
## Config file
|
## Config file
|
||||||
### Hardcoded for now
|
### Hardcoded for now
|
||||||
- [ ] Tags
|
- [x] Tags
|
||||||
- [ ] Keybinds
|
- [x] Keybinds
|
||||||
- [ ] DB config (CSV for now)
|
- [x] DB config (CSV for now)
|
||||||
- [ ] API URLS (MAYBE I CAN JUST CURL?)
|
|
||||||
## Downloader
|
## Downloader
|
||||||
- [x] Downloader (Gelbooru API)
|
- [x] Downloader (Gelbooru API)
|
||||||
## Uploader
|
## Uploader
|
||||||
|
|
|
@ -12,4 +12,4 @@ tags = ["2girls", "sleeping"]
|
||||||
# Routes to the files used by the program
|
# Routes to the files used by the program
|
||||||
pending = "./pending.csv"
|
pending = "./pending.csv"
|
||||||
rejected = "./rejected.csv"
|
rejected = "./rejected.csv"
|
||||||
verified = "./verified.csv"
|
verified = "./urls.csv"
|
||||||
|
|
45
src/main.rs
45
src/main.rs
|
@ -37,7 +37,6 @@ struct Storage {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
pull();
|
|
||||||
let config: Config = parse_config(CONFIG);
|
let config: Config = parse_config(CONFIG);
|
||||||
let mut arg = std::env::args().skip(1);
|
let mut arg = std::env::args().skip(1);
|
||||||
match &arg
|
match &arg
|
||||||
|
@ -48,8 +47,6 @@ async fn main() {
|
||||||
"-v" => verify_mode(&config.keybinds, &config.storage),
|
"-v" => verify_mode(&config.keybinds, &config.storage),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
push();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses the given filename to a config struct
|
/// Parses the given filename to a config struct
|
||||||
|
@ -123,48 +120,6 @@ fn verify_mode(keybinds: &Keybinds, storage: &Storage) {
|
||||||
std::fs::write(&storage.pending, "").unwrap();
|
std::fs::write(&storage.pending, "").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pull() {
|
|
||||||
let mut c1 = Command::new("scp")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/urls.csv")
|
|
||||||
.arg("verified.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
let mut c2 = Command::new("scp")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/rejected.csv")
|
|
||||||
.arg("rejected.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
let mut c3 = Command::new("scp")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/pending.csv")
|
|
||||||
.arg("pending.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
c1.wait().unwrap();
|
|
||||||
c2.wait().unwrap();
|
|
||||||
c3.wait().unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn push() {
|
|
||||||
let mut c1 = Command::new("scp")
|
|
||||||
.arg("verified.csv")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/urls.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
let mut c2 = Command::new("scp")
|
|
||||||
.arg("rejected.csv")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/rejected.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
let mut c3 = Command::new("scp")
|
|
||||||
.arg("pending.csv")
|
|
||||||
.arg("bot:/home/bot/sleepinggaysbot/pending.csv")
|
|
||||||
.spawn()
|
|
||||||
.expect("open command failed to start");
|
|
||||||
c1.wait().unwrap();
|
|
||||||
c2.wait().unwrap();
|
|
||||||
c3.wait().unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn input_parse(storage: &Storage, keybinds: &Keybinds, image_uri: &str) -> bool {
|
fn input_parse(storage: &Storage, keybinds: &Keybinds, image_uri: &str) -> bool {
|
||||||
loop {
|
loop {
|
||||||
let key = std::io::stdin()
|
let key = std::io::stdin()
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rsync -v\
|
||||||
|
bot:/home/bot/sleepinggaysbot/*.csv\
|
||||||
|
. &&\
|
||||||
|
bitch $@ &&\
|
||||||
|
rsync -v\
|
||||||
|
*.csv\
|
||||||
|
bot:/home/bot/sleepinggaysbot/
|
||||||
|
|
Loading…
Reference in New Issue