diff --git a/Cargo.lock b/Cargo.lock index 7a8f9cf..c54d1b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,630 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "c2-chacha" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "chorus-client" version = "0.1.0" +dependencies = [ + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "tungstenite 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "generic-array" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hermit-abi" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "http" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "input_buffer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.66" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "native-tls" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl" +version = "0.10.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl-sys" +version = "0.9.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ppv-lite86" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "schannel" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "security-framework" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "security-framework-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_json" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tungstenite" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "typenum" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "url" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "utf-8" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vcpkg" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +"checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" +"checksum http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +"checksum input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b822cc844905551931d6f81608ed5f50a79c1078a4e2b4d42dbc7c1eedfbf" +"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +"checksum openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)" = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f" +"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" +"checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df" +"checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895" +"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +"checksum serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" +"checksum sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum tungstenite 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0c2bd5aeb7dcd2bb32e472c8872759308495e5eccc942e929a513cd8d36110" +"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +"checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +"checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 7a2e84a..c6a6c1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,9 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] + +clap = "2.33.0" +tokio-tungstenite = "*" +url = "2.1.1" +serde_json = "1.0" +rand = "0.7.3" diff --git a/Config.toml b/Config.toml new file mode 100644 index 0000000..a73428d --- /dev/null +++ b/Config.toml @@ -0,0 +1,16 @@ +[LapCountScenes] +RX1 = "RX1LAP" +RX2 = "RX2LAP" +RX3 = "RX3LAP" +RX4 = "" +RX5 = "" +RX6 = "" + +[LapTimeScenes] +RX1 = "" +RX2 = "" +RX3 = "" +RX4 = "" +RX5 = "" +RX6 = "" + diff --git a/Other tries/Udp.lua b/Other tries/Udp.lua new file mode 100644 index 0000000..81b276a --- /dev/null +++ b/Other tries/Udp.lua @@ -0,0 +1,91 @@ +function script_description() + return "This script lets you select a text source to force it to reread files every frame instead of once per second." +end + +obs = obslua +source_name = nil + +local open = io.open + +local function read_file(path) + local file = open(path, "rb") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + return content +end + + + + + +function script_update(settings) + source_name = obs.obs_data_get_string(settings, "source") + filepath = obs.obs_data_get_string(settings, "filepath") + + local fileContent = read_file("/Users/LB/Desktop/z_Projects/chorus-client/racestate.txt"); + set_text(fileContent) +end + +function script_properties() + local props = obs.obs_properties_create() + local p = obs.obs_properties_add_list(props, "source", "Text Source", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) + local p2 = obs.obs_properties_add_path(props, "filepath", "File", obs.OBS_PATH_FILE, nil, nil) + + local sources = obs.obs_enum_sources() + if sources ~= nil then + for _, source in ipairs(sources) do + source_id = obs.obs_source_get_id(source) + if source_id == "text_gdiplus" or source_id == "text_ft2_source" or source_id == "text_pango_source" then + local name = obs.obs_source_get_name(source) + obs.obs_property_list_add_string(p, name, name) + end + end + end + + obs.source_list_release(sources) + + return props +end + +function set_text(text) + + local source = obs.obs_get_source_by_name(source_name) + + if source ~= nil then + local settings = obs.obs_data_create() + obs.obs_data_set_string(settings, "text", text) + obs.obs_source_update(source, settings) + obs.obs_data_release(settings) + obs.obs_source_release(source) + end + end + +function script_tick(seconds) + if source_name == nil then return end + local fileContent = read_file(filepath); + set_text(fileContent) +end + +local socket = require("socket") +local udp = assert(socket.udp()) +local data + +udp:settimeout(1) +assert(udp:setsockname("*",0)) +assert(udp:setpeername("example.com",1234)) + +for i = 0, 2, 1 do + assert(udp:send("ping")) + data = udp:receive() + if data then + break + end +end + + +if data == nil then + print("timeout") +else + print(data) +end diff --git a/Other tries/client.py b/Other tries/client.py new file mode 100644 index 0000000..76aa9cf --- /dev/null +++ b/Other tries/client.py @@ -0,0 +1,352 @@ +# +# Project OBS Twitch Chat Spam Script +# @author David Madison +# @link github.com/dmadison/OBS-ChatSpam +# @license GPLv3 - Copyright (c) 2018 David Madison +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import obspython as obs +import socket +import time + + +class TwitchIRC: + def __init__(self, chan="", nick="", passw="", host="irc.twitch.tv", port=6667): + self.channel = chan + self.nickname = nick + self.password = passw + self.host = host + self.port = port + + self.rate_num_msgs = 19 # Number of messages allowed... + self.rate_timeframe = 30 # ...in timeframe of x seconds + self.__message_timestamps = [] + + self.__connected = False + self.__last_message = None # Last connection timestamp + self.timeout = 10.0 # Time before open connection is closed, in seconds + + self.__sock = socket.socket() + + def connect(self, suppress_warnings=True): + connection_result = self.__connect() + + if connection_result is not True: + self.__connected = False + if suppress_warnings: + print("Connection Error:", connection_result) + return False + else: + raise UserWarning(connection_result) + + self.__connected = True + return True + + def __connect(self): + if self.__connected: + return True # Already connected, nothing to see here + + self.__sock = socket.socket() + self.__sock.settimeout(1) # One second to connect + + try: + self.__sock.connect((self.host, self.port)) + except socket.gaierror: + return "Cannot find server" + except (TimeoutError, socket.timeout): + return "No response from server (connection timed out)" + + if self.password is not "": + self.__sock.send("PASS {}\r\n".format(self.password).encode("utf-8")) + self.__sock.send("NICK {}\r\n".format(self.nickname).encode("utf-8")) + self.__sock.send("JOIN #{}\r\n".format(self.channel).encode("utf-8")) + + auth_response = self.read() + if "Welcome, GLHF!" not in auth_response: + return "Bad Authentication! Check your Oauth key" + + try: + self.read() # Wait for "JOIN" response + except socket.timeout: + return "Channel not found!" + + return True + + def disconnect(self): + if self.__connected: + self.__sock.shutdown(socket.SHUT_RDWR) + self.__sock.close() + self.__connected = False + + def connection_timeout(self): + if self.__connected and time.time() >= self.__last_message + self.timeout: + self.disconnect() + + def test_authentication(self): + if self.connect(False): + self.disconnect() + print("Authentication successful!") + + def chat(self, msg, suppress_warnings=True): + if not self.check_rates() or not self.connect(suppress_warnings): + return + + # Store timestamps for rate limit and connection timeout + message_time = time.time() + self.__message_timestamps.append(message_time + self.rate_timeframe) + self.__last_message = message_time + + self.__chat_direct(msg) + print("Sent \'" + msg + "\'", "as", self.nickname, "in #" + self.channel) + + def __chat_direct(self, msg): + self.__sock.send("PRIVMSG #{} :{}\r\n".format(self.channel, msg).encode("utf-8")) + + def read(self): + response = self.__read_socket() + while self.__ping(response): + response = self.__read_socket() + return response.rstrip() + + def __read_socket(self): + return self.__sock.recv(1024).decode("utf-8") + + def __ping(self, msg): + if msg[:4] == "PING": + self.__pong(msg[4:]) + return True + return False + + def __pong(self, host): + self.__sock.send(("PONG" + host).encode("utf-8")) + + def check_rates(self): + index = 0 + + # Remove timestamps that have passed + for index, timestamp in enumerate(self.__message_timestamps): + if time.time() <= timestamp: + break + self.__message_timestamps = self.__message_timestamps[index:] + + # If at max rate, throw an error + if len(self.__message_timestamps) >= self.rate_num_msgs: + next_clear = int(self.__message_timestamps[0] - time.time()) + msg_plural = "s" + + if next_clear <= 1: + next_clear = 1 # Avoiding "wait 0 more seconds" messages + msg_plural = "" + + print("Error: Rate limit reached. Please wait " + str(next_clear) + " more second" + msg_plural) + return False + + return True + +twitch = TwitchIRC() + +class ChatMessage: + messages = [] + max_description_length = 32 + + def __init__(self, msg, position, obs_settings, irc=twitch): + self.text = msg + self.irc = irc + + self.obs_data = obs_settings + + self.position = position + self.hotkey_id = obs.OBS_INVALID_HOTKEY_ID + self.hotkey_saved_key = None + + self.load_hotkey() + self.register_hotkey() + self.save_hotkey() + + def __del__(self): + self.cleanup() + + def cleanup(self): + self.deregister_hotkey() + self.release_memory() + + def release_memory(self): + obs.obs_data_array_release(self.hotkey_saved_key) + + def new_text(self, msg): + self.text = msg + self.deregister_hotkey() + self.register_hotkey() + + def new_position(self, pos): + self.deregister_hotkey() + self.unsave_hotkey() + self.position = pos + self.register_hotkey() + + def register_hotkey(self): + if len(self.text) > ChatMessage.max_description_length: + key_description = self.text[:ChatMessage.max_description_length - 3] + "..." + else: + key_description = self.text + key_description = "Chat \'" + key_description + "\'" + + self.callback = lambda pressed: self.key_passthrough(pressed) # Small hack to get around the callback signature reqs. + self.hotkey_id = obs.obs_hotkey_register_frontend("chat_hotkey", key_description, self.callback) + obs.obs_hotkey_load(self.hotkey_id, self.hotkey_saved_key) + + def deregister_hotkey(self): + obs.obs_hotkey_unregister(self.callback) + + def load_hotkey(self): + self.hotkey_saved_key = obs.obs_data_get_array(self.obs_data, "chat_hotkey_" + str(self.position)) + + def save_hotkey(self): + self.hotkey_saved_key = obs.obs_hotkey_save(self.hotkey_id) + obs.obs_data_set_array(self.obs_data, "chat_hotkey_" + str(self.position), self.hotkey_saved_key) + + def unsave_hotkey(self): + obs.obs_data_erase(self.obs_data, "chat_hotkey_" + str(self.position)) + + def key_passthrough(self, pressed): + if pressed: + self.send() + + def send(self, suppress_warnings=True): + self.irc.chat(self.text, suppress_warnings) + + @staticmethod + def check_messages(new_msgs, settings): + # Check if list hasn't changed + if len(new_msgs) == len(ChatMessage.messages): + num_diff = 0 + diff_index = None + + for index, msg in enumerate(ChatMessage.messages): + if new_msgs[index] != msg.text: + num_diff += 1 + diff_index = index + if num_diff > 1: + break + else: + if num_diff != 0: + ChatMessage.messages[diff_index].new_text(new_msgs[diff_index]) # single entry modified + return # Lists identical + + # Check if objects already exist, otherwise create them + new_list = [] + for pos, msg in enumerate(new_msgs): + for msg_obj in ChatMessage.messages: + if msg == msg_obj.text: + new_list.append(msg_obj) + break + else: + new_list.append(ChatMessage(msg, pos, settings)) + + # Clean up old objects + for msg in ChatMessage.messages: + for msg_new in new_msgs: + if msg.text == msg_new: + break + else: + msg.cleanup() + msg.unsave_hotkey() + + # Assign to master array and reindex + ChatMessage.messages = new_list + ChatMessage.__reindex_messages() + + @staticmethod + def __reindex_messages(): + for index, msg in enumerate(ChatMessage.messages): + msg.new_position(index) + + for msg in ChatMessage.messages: # Separate loop as to avoid memory overwrites + msg.save_hotkey() + + +# ------------------------------------------------------------ + +# OBS Script Functions + +def check_connection(): + twitch.connection_timeout() + +def test_authentication(prop, props): + twitch.test_authentication() + +def test_message(prop, props): + ChatMessage.messages[0].send(False) + +def script_description(): + return "Twitch Chat Spam" + \ + "
" + \ + "Python script for sending messages to Twitch chat using OBS hotkeys." + \ + "

" + \ + "Made by David Madison, © 2018" + \ + "

" + \ + "github.com/dmadison/OBS-ChatSpam" + \ + "
" + \ + "partsnotincluded.com" + +def script_update(settings): + twitch.channel = obs.obs_data_get_string(settings, "channel").lower() + twitch.nickname = obs.obs_data_get_string(settings, "user").lower() + + new_oauth = obs.obs_data_get_string(settings, "oauth").lower() + if new_oauth != twitch.password: + twitch.disconnect() # Disconnect old oauth connection, if it exists + twitch.password = new_oauth + + obs_messages = obs.obs_data_get_array(settings, "messages") + num_messages = obs.obs_data_array_count(obs_messages) + + messages = [] + for i in range(num_messages): # Convert C array to Python list + message_object = obs.obs_data_array_item(obs_messages, i) + messages.append(obs.obs_data_get_string(message_object, "value")) + + ChatMessage.check_messages(messages, settings) + obs.obs_data_array_release(obs_messages) + + #print("Settings JSON", obs.obs_data_get_json(settings)) + +def script_properties(): + props = obs.obs_properties_create() + + obs.obs_properties_add_text(props, "channel", "Channel", obs.OBS_TEXT_DEFAULT) + obs.obs_properties_add_text(props, "user", "User", obs.OBS_TEXT_DEFAULT) + obs.obs_properties_add_text(props, "oauth", "Oauth", obs.OBS_TEXT_PASSWORD) + + obs.obs_properties_add_editable_list(props, "messages", "Messages", obs.OBS_EDITABLE_LIST_TYPE_STRINGS, "", "") + obs.obs_properties_add_button(props, "test_auth", "Test Authentication", test_authentication) + obs.obs_properties_add_button(props, "test_message", "Test Message #1", test_message) + + return props + +def script_save(settings): + for message in ChatMessage.messages: + message.save_hotkey() + +def script_load(settings): + obs.timer_add(check_connection, 1000) # Check for timeout every second + +def script_unload(): + obs.timer_remove(check_connection) + + for message in ChatMessage.messages: + message.cleanup() +cargo \ No newline at end of file diff --git a/index.html b/Other tries/index.html similarity index 100% rename from index.html rename to Other tries/index.html diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..770160e --- /dev/null +++ b/Readme.md @@ -0,0 +1 @@ +# ChorusOBSsync \ No newline at end of file diff --git a/rx1.txt b/rx1.txt index 857f065..c227083 100644 --- a/rx1.txt +++ b/rx1.txt @@ -1 +1 @@ -00 \ No newline at end of file +0 \ No newline at end of file diff --git a/rx1_laptime.txt b/rx1_laptime.txt new file mode 100644 index 0000000..5cf4ae9 --- /dev/null +++ b/rx1_laptime.txt @@ -0,0 +1 @@ +-.- \ No newline at end of file diff --git a/rx2.txt b/rx2.txt index 857f065..c227083 100644 --- a/rx2.txt +++ b/rx2.txt @@ -1 +1 @@ -00 \ No newline at end of file +0 \ No newline at end of file diff --git a/rx2_laptime.txt b/rx2_laptime.txt new file mode 100644 index 0000000..5cf4ae9 --- /dev/null +++ b/rx2_laptime.txt @@ -0,0 +1 @@ +-.- \ No newline at end of file diff --git a/rx3.txt b/rx3.txt index 857f065..c227083 100644 --- a/rx3.txt +++ b/rx3.txt @@ -1 +1 @@ -00 \ No newline at end of file +0 \ No newline at end of file diff --git a/rx3_laptime.txt b/rx3_laptime.txt new file mode 100644 index 0000000..5cf4ae9 --- /dev/null +++ b/rx3_laptime.txt @@ -0,0 +1 @@ +-.- \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ba0c02a..d8e3bc9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,29 @@ +extern crate clap; + +use clap::{App, Arg}; +use rand::random; +use serde_json::json; use std::i64; +use std::io; use std::io::Write; use std::net; +use std::thread; +use std::thread::sleep; +use std::time::{Duration, Instant}; +use tungstenite::{connect, Error, Message, Result}; +use url::Url; fn listen(socket: &net::UdpSocket) { let mut buf: [u8; 20] = [0; 20]; - let number_of_bytes: usize = 0; let mut result: Vec = Vec::new(); match socket.recv_from(&mut buf) { Ok((number_of_bytes, _)) => { result = Vec::from(&buf[0..number_of_bytes]); } - Err(fail) => println!("failed listening {:?}", fail), + Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { + return (); + } + Err(e) => println!("failed listening {:?}", e), } let display_result = result.clone(); @@ -70,6 +83,52 @@ fn write_file(text: String, filename: &str) { } fn main() { + let matches = App::new("chorusOBSsync") + .version("1.0") + .author("Lukas B. ") + .about("Get data from the CHorus32 Laptimer Project and use it to control OBS") + .arg( + Arg::with_name("config") + .short("c") + .long("config") + .value_name("FILE") + .help("Sets a custom config file") + .takes_value(true), + ) + .arg( + Arg::with_name("INPUT") + .help("Sets the input file to use") + .required(false) + .index(1), + ) + .arg( + Arg::with_name("v") + .short("v") + .multiple(true) + .help("Sets the level of verbosity"), + ) + .get_matches(); + + // Gets a value for config if supplied by user, or defaults to "default.conf" + let config = matches.value_of("config").unwrap_or("default.conf"); + println!("Value for config: {}", config); + + // Calling .unwrap() is safe here because "INPUT" is required (if "INPUT" wasn't + // required we could have used an 'if let' to conditionally get the value) + if let Some(input) = matches.value_of("INPUT") { + println!("Using input file: {}", input); + } + + // Vary the output based on how many times the user used the "verbose" flag + // (i.e. 'myprog -v -v -v' or 'myprog -vvv' vs 'myprog -v' + match matches.occurrences_of("v") { + 0 => println!("No verbose info"), + 1 => println!("Some verbose info"), + 2 => println!("Tons of verbose info"), + 3 | _ => println!("Don't be crazy"), + } + + //////////---------------- write_file("Race inactive".to_string(), "racestate.txt"); write_file("0".to_string(), "rx1.txt"); write_file("0".to_string(), "rx2.txt"); @@ -79,15 +138,37 @@ fn main() { write_file("-.-".to_string(), "rx2_laptime.txt"); write_file("-.-".to_string(), "rx3_laptime.txt"); - let socket = net::UdpSocket::bind("0.0.0.0:0").expect("failed to bind host socket"); // local bind port + // Setup websocket for OBS + let mut now = Instant::now(); + + let (mut obssocket, _) = + connect(Url::parse("ws://localhost:4444/").unwrap()).expect("Could not connect to OBS"); + let source_id = "LAPTIME"; + + // Setup the UDP Socket + let udpsocket = net::UdpSocket::bind("0.0.0.0:0").expect("failed to bind host udp socket"); // local bind port + udpsocket.set_nonblocking(true).unwrap(); let msg = String::from("ok").into_bytes(); - - socket + udpsocket .send_to(&msg, "192.168.0.141:9000") .expect("cannot send"); loop { - listen(&socket); // this call is blockig + listen(&udpsocket); + + if let Ok(msg) = obssocket.read_message() { + let text = msg.into_text().unwrap_or("".to_string()); + println!("{}", text); + } + + if now.elapsed().as_secs() >= 5 { + let request = json!({"request-type":"SetTextFreetype2Properties", "source":source_id,"message-id": random::().to_string(), "text": now.elapsed().as_millis().to_string() }); + obssocket + .write_message(Message::Text(request.to_string())) + .unwrap(); + println!("{}", now.elapsed().as_secs()); + now = Instant::now(); + } } } diff --git a/src/some.rs b/src/some.rs new file mode 100644 index 0000000..89f05cf --- /dev/null +++ b/src/some.rs @@ -0,0 +1,33 @@ +use rand::random; +use serde_json::json; +use std::thread; +use std::thread::sleep; +use std::time::{Duration, Instant}; +use tungstenite::{connect, Error, Message, Result}; +use url::Url; + +fn main() { + let now = Instant::now(); + + let (mut socket, _) = + connect(Url::parse("ws://localhost:4444/").unwrap()).expect("Could not connect"); + let source_id = "LAPTIME"; + let new_text = "rusty"; + let handler = thread::spawn(|| loop { + let request = json!({"request-type":"SetTextFreetype2Properties", "source":source_id,"message-id": random::().to_string(), "text": now.elapsed().as_millis().to_string() }); + socket + .write_message(Message::Text(request.to_string())) + .unwrap(); + println!("{}", now.elapsed().as_secs()); + sleep(Duration::from_millis(100)); + }); + + /* + loop { + let msg = socket.read_message().unwrap(); + let text = msg.into_text().unwrap_or("".to_string()); + println!("{}", text); + } + */ + //socket.close(None).unwrap(); +}