extracted sync with server to a shell file

This commit is contained in:
Alie 2023-07-09 21:15:58 +02:00
parent 110b17bfcf
commit f9e4d1afff
6 changed files with 22 additions and 58 deletions

14
Cargo.lock generated
View File

@ -24,13 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "booru_image_tag_curating_helper"
name = "bitch"
version = "0.1.0"
dependencies = [
"futures",
@ -40,6 +34,12 @@ dependencies = [
"toml",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
version = "3.12.0"

View File

@ -1,5 +1,5 @@
[package]
name = "booru_image_tag_curating_helper"
name = "bitch"
version = "0.1.0"
edition = "2021"

View File

@ -13,10 +13,9 @@ Tool for curating booru image bots
- [x] Write
## Config file
### Hardcoded for now
- [ ] Tags
- [ ] Keybinds
- [ ] DB config (CSV for now)
- [ ] API URLS (MAYBE I CAN JUST CURL?)
- [x] Tags
- [x] Keybinds
- [x] DB config (CSV for now)
## Downloader
- [x] Downloader (Gelbooru API)
## Uploader

View File

@ -12,4 +12,4 @@ tags = ["2girls", "sleeping"]
# Routes to the files used by the program
pending = "./pending.csv"
rejected = "./rejected.csv"
verified = "./verified.csv"
verified = "./urls.csv"

View File

@ -37,7 +37,6 @@ struct Storage {
#[tokio::main]
async fn main() {
pull();
let config: Config = parse_config(CONFIG);
let mut arg = std::env::args().skip(1);
match &arg
@ -48,8 +47,6 @@ async fn main() {
"-v" => verify_mode(&config.keybinds, &config.storage),
_ => {}
}
push();
}
/// 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();
}
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 {
loop {
let key = std::io::stdin()

10
synced_run.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
rsync -v\
bot:/home/bot/sleepinggaysbot/*.csv\
. &&\
bitch $@ &&\
rsync -v\
*.csv\
bot:/home/bot/sleepinggaysbot/