From e1133b21db8c1dac6ad9170c728ad2be7f6eafce Mon Sep 17 00:00:00 2001 From: Syfaro Date: Tue, 7 Jan 2020 03:05:51 -0600 Subject: [PATCH] Go back to bktree index. --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/main.rs | 12 +++--------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d79a91..20e093c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -275,7 +275,7 @@ name = "fa-watcher" version = "0.1.0" dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "furaffinity-rs 0.1.0 (git+https://git.huefox.com/syfaro/furaffinity-rs?rev=fb0a65a1619e6f9bfecdcb4badcfc8be1e78911f)", + "furaffinity-rs 0.1.0 (git+https://git.huefox.com/syfaro/furaffinity-rs?rev=75254a58385b3a8ea7fde0c86ff764fd1688bad9)", "postgres 0.17.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "r2d2 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", "r2d2_postgres 0.16.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -334,7 +334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "furaffinity-rs" version = "0.1.0" -source = "git+https://git.huefox.com/syfaro/furaffinity-rs?rev=fb0a65a1619e6f9bfecdcb4badcfc8be1e78911f#fb0a65a1619e6f9bfecdcb4badcfc8be1e78911f" +source = "git+https://git.huefox.com/syfaro/furaffinity-rs?rev=75254a58385b3a8ea7fde0c86ff764fd1688bad9#75254a58385b3a8ea7fde0c86ff764fd1688bad9" dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2155,7 +2155,7 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum furaffinity-rs 0.1.0 (git+https://git.huefox.com/syfaro/furaffinity-rs?rev=fb0a65a1619e6f9bfecdcb4badcfc8be1e78911f)" = "" +"checksum furaffinity-rs 0.1.0 (git+https://git.huefox.com/syfaro/furaffinity-rs?rev=75254a58385b3a8ea7fde0c86ff764fd1688bad9)" = "" "checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" "checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" "checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" diff --git a/Cargo.toml b/Cargo.toml index e96bd3c..c3e0d6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,4 @@ chrono = "0.4" [dependencies.furaffinity-rs] git = "https://git.huefox.com/syfaro/furaffinity-rs" -rev = "fb0a65a1619e6f9bfecdcb4badcfc8be1e78911f" +rev = "75254a58385b3a8ea7fde0c86ff764fd1688bad9" diff --git a/src/main.rs b/src/main.rs index d79e28d..d38d2a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,15 +73,9 @@ fn insert_submission( let hash = sub.hash.clone(); let url = sub.content.url(); - if hash.is_some() { - client.execute("INSERT INTO submission (id, artist_id, url, filename, hash, rating, posted_at, description, c) VALUES ($1, $2, $3, $4, decode($5, 'base64'), $6, $7, $8, CUBE(ARRAY[get_byte(decode($5, 'base64'), 0), get_byte(decode($5, 'base64'), 1), get_byte(decode($5, 'base64'), 2), get_byte(decode($5, 'base64'), 3), get_byte(decode($5, 'base64'), 4), get_byte(decode($5, 'base64'), 5), get_byte(decode($5, 'base64'), 6), get_byte(decode($5, 'base64'), 7)]::smallint[]))", &[ - &sub.id, &artist_id, &url, &sub.filename, &hash, &sub.rating.serialize(), &sub.posted_at, &sub.description, - ])?; - } else { - client.execute("INSERT INTO submission (id, artist_id, url, filename, hash, rating, posted_at, description) VALUES ($1, $2, $3, $4, decode($5, 'base64'), $6, $7, $8)", &[ - &sub.id, &artist_id, &url, &sub.filename, &hash, &sub.rating.serialize(), &sub.posted_at, &sub.description, - ])?; - } + client.execute("INSERT INTO submission (id, artist_id, url, filename, hash, rating, posted_at, description, hash_int) VALUES ($1, $2, $3, $4, decode($5, 'base64'), $6, $7, $8, $9)", &[ + &sub.id, &artist_id, &url, &sub.filename, &hash, &sub.rating.serialize(), &sub.posted_at, &sub.description, &sub.hash_num, + ])?; let stmt = client.prepare( "INSERT INTO tag_to_post (tag_id, post_id) VALUES ($1, $2) ON CONFLICT DO NOTHING",