diff --git a/Baby2.wav b/Baby2.wav new file mode 100644 index 0000000..59eded3 Binary files /dev/null and b/Baby2.wav differ diff --git a/Baby3.wav b/Baby3.wav new file mode 100644 index 0000000..936c377 Binary files /dev/null and b/Baby3.wav differ diff --git a/Baby4.wav b/Baby4.wav new file mode 100644 index 0000000..1c0eb32 Binary files /dev/null and b/Baby4.wav differ diff --git a/Baby5.wav b/Baby5.wav new file mode 100644 index 0000000..6482ed0 Binary files /dev/null and b/Baby5.wav differ diff --git a/Cargo.lock b/Cargo.lock index 5492ed4..cd3eedb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,12 +23,30 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base64" +version = "0.21.0" +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 = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + [[package]] name = "cc" version = "1.0.78" @@ -65,6 +83,22 @@ dependencies = [ "libloading", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "crossterm" version = "0.25.0" @@ -102,12 +136,224 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "inquire" version = "0.5.3" @@ -124,6 +370,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + [[package]] name = "isg_4real" version = "0.1.0" @@ -131,8 +392,16 @@ dependencies = [ "anyhow", "inquire", "opencv", + "tokio", + "youtube_dl", ] +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + [[package]] name = "jobserver" version = "0.1.25" @@ -142,6 +411,15 @@ dependencies = [ "libc", ] +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -195,6 +473,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "mio" version = "0.8.5" @@ -207,6 +491,24 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "newline-converter" version = "0.2.2" @@ -225,6 +527,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "once_cell" version = "1.17.0" @@ -266,6 +578,51 @@ dependencies = [ "regex", ] +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -295,6 +652,18 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.26" @@ -345,18 +714,145 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys", +] + [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c4437699b6d34972de58652c68b98cb5b53a4199ab126db8e20ec8ded29a721" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +[[package]] +name = "serde" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "shlex" version = "1.1.0" @@ -393,12 +889,31 @@ dependencies = [ "libc", ] +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "syn" version = "1.0.107" @@ -410,6 +925,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "thiserror" version = "1.0.38" @@ -430,12 +959,129 @@ dependencies = [ "syn", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicode-bidi" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" + [[package]] name = "unicode-ident" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.10.0" @@ -448,18 +1094,124 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" @@ -538,3 +1290,26 @@ name = "windows_x86_64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "youtube_dl" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3525e9e8fe49f1c976a6d1ed2878b2637a0c1d202ef2a32529ad4b64f4b73f" +dependencies = [ + "log", + "reqwest", + "serde", + "serde_json", + "tokio", + "wait-timeout", +] diff --git a/Cargo.toml b/Cargo.toml index 55818b1..1e5261e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,6 @@ edition = "2021" anyhow = "1.0.68" inquire = "0.5.3" opencv = "0.75.0" +tokio = {version = "1.24.2", features = ["full"]} +# youtube_dl = "0.8.0" +youtube_dl = { version = "0.8.0", features = ["downloader"] } diff --git a/src/embedsource.rs b/src/embedsource.rs index 2512330..6a90631 100644 --- a/src/embedsource.rs +++ b/src/embedsource.rs @@ -32,9 +32,13 @@ impl EmbedSource { let width = image.cols(); let height = image.rows(); + // dbg!(width, height, size); + //Cuts off borders if size doesn't perfectly fit, also -1 cuz index - let width = width - (width % size) - 1; - let height = height - (height % size) - 1; + // let width = width - (width % size) - 1; + // let height = height - (height % size) - 1; + let width = width - (width % size); + let height = height - (height % size); EmbedSource { image, diff --git a/src/etcher.rs b/src/etcher.rs index 62efade..5599efd 100644 --- a/src/etcher.rs +++ b/src/etcher.rs @@ -43,7 +43,7 @@ pub fn rip_binary(byte_data: Vec) -> anyhow::Result> { } } println!("Binary ripped succesfully"); - println!("Binary length: {}", binary_data.len()); + // println!("Binary length: {}", binary_data.len()); return Ok(binary_data); } @@ -246,7 +246,7 @@ fn read_frame(source: &EmbedSource, out_mode: &OutputMode) -> anyhow::Result= 127 { binary_data.push(true); } else { binary_data.push(false); @@ -254,8 +254,9 @@ fn read_frame(source: &EmbedSource, out_mode: &OutputMode) -> anyhow::Result {}, - Err(_) => {println!("End of data reached")} + Err(_) => {println!("Instructions written")} } // highgui::named_window("window", WINDOW_FULLSCREEN)?; @@ -311,7 +312,14 @@ fn etch_instructions(settings: &Settings, data: &Data) } fn read_instructions(source: &EmbedSource) -> anyhow::Result<(OutputMode, Settings)> { + // highgui::named_window("window", WINDOW_FULLSCREEN)?; + // highgui::imshow("window", &source.image)?; + // highgui::wait_key(10000000)?; + + // imwrite("src/out/test1.png", &source.image, &Vector::new())?; + let byte_data = read_frame(source, &OutputMode::Binary)?; + // dbg!(&byte_data); let out_mode = byte_data[0]; @@ -344,7 +352,8 @@ pub fn etch(path: &str, data: Data, settings: Settings) -> anyhow::Result<()> { match etch_frame(&mut source, &data, &mut index) { Ok(_) => frames.push(source), Err(v) => { - dbg!(v); + frames.push(source); + println!("Reached the end of data"); break;}, } } @@ -376,6 +385,7 @@ pub fn read(path: &str) -> anyhow::Result> { video.read(&mut frame)?; let instruction_source = EmbedSource::from(frame.clone(), 5); let (out_mode, settings) = read_instructions(&instruction_source)?; + dbg!(&settings); let mut byte_data: Vec = Vec::new(); loop { diff --git a/src/main.rs b/src/main.rs index 1ac1eb9..e02fd10 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,35 +7,20 @@ use settings::{Data, Settings}; //Make RGB a struct //Make it calculate how much data is jammed in 1 frame for user -fn main() -> anyhow::Result<()> { - // ui::summon_gooey(); - let bytes = etcher::rip_bytes("src/tests/Baby.wav")?; - - dbg!(bytes.len()); - // for i in 0..10000 { - // if bytes[i] != 0 { - // dbg!(bytes[i]); - // } - // } - +#[tokio::main] +async fn main() -> anyhow::Result<()> { + ui::summon_gooey().await?; + // let bytes = etcher::rip_bytes("src/tests/Baby.wav")?; // let binary = etcher::rip_binary(bytes)?; - let data = Data::from_color(bytes); - let settings = Settings::new(1, 30, 640, 360); + // let data = Data::from_binary(binary); + // let settings = Settings::new(1, 30, 640, 360); - etcher::etch("src/out/output.avi", data, settings)?; + // etcher::etch("src/out/output.avi", data, settings)?; - let out_data = etcher::read("src/out/output.avi")?; - - //WHO ATE THE BYTES ??? - dbg!(out_data.len()); - // for i in 0..10000 { - // if out_data[i] != 0 { - // dbg!(out_data[i]); - // } - // } + // let out_data = etcher::read("src/out/output.avi")?; - etcher::write_bytes("src/out/imbaby.wav", out_data)?; + // etcher::write_bytes("src/out/Baby2.wav", out_data)?; return Ok(()); } diff --git a/src/settings.rs b/src/settings.rs index 68340af..18b147a 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -36,6 +36,7 @@ impl Data { } } +#[derive(Debug)] pub struct Settings { pub size: i32, pub fps: f64, diff --git a/src/ui.rs b/src/ui.rs index aef63a3..657d828 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,13 +1,13 @@ use anyhow; - use inquire::{ CustomType, min_length, Confirm, MultiSelect, Password, Select, Text, }; +use youtube_dl::{download_yt_dlp, YoutubeDl}; -// use crate::settings::{Settings, OutputMode}; -// use crate::etcher::Embedder; +use crate::settings::{Settings, OutputMode, Data}; +use crate::etcher; -pub fn summon_gooey() { +pub async fn summon_gooey() -> anyhow::Result<()> { let options = vec![ "Embed", @@ -22,14 +22,14 @@ pub fn summon_gooey() { match modes { "Embed" => return embed_path(), - "Download" => return download_path(), + "Download" => return download_path().await, "Dislodge" => return dislodge_path(), _ => {panic!("Something weird happened when selecting modes");} } } -fn embed_path() { +fn embed_path() -> anyhow::Result<()> { let out_modes = vec![ "Colored", "B/W (Binary)", @@ -37,9 +37,7 @@ fn embed_path() { let resolutions = vec![ "144p", - "240p", "360p", - "480p", "720p", ]; @@ -48,25 +46,22 @@ fn embed_path() { .prompt() .unwrap(); - let size = 1usize; - if out_mode == out_modes[1] { - let size = CustomType::::new("What size should the blocks be ?") - .with_error_message("Please type a valid number") - .with_help_message("Bigger blocks are more resistant to compression, I recommend 5-15 if you use this feature.") - .with_default(1) - .prompt(); - } + let size = CustomType::::new("What size should the blocks be ?") + .with_error_message("Please type a valid number") + .with_help_message("Bigger blocks are more resistant to compression, I recommend 5-15 if you use this feature.") + .with_default(1) + .prompt()?; - // let out_mode = match out_mode { - // "Colored" => OutputMode::Color, - // "B/W (Binary)" => OutputMode::Binary, - // _ => {panic!("AAAAAAAAAAAAAAAA")}, - // }; + let out_mode = match out_mode { + "Colored" => OutputMode::Color, + "B/W (Binary)" => OutputMode::Binary, + _ => {panic!("AAAAAAAAAAAAAAAA")}, + }; - let fps = CustomType::::new("What fps should the video be at ?") + let fps = CustomType::::new("What fps should the video be at ?") .with_error_message("Please type a valid number") .with_help_message("Decreasing fps may decrease chance of compression") - .with_default(30.0) + .with_default(30) .prompt() .expect("Invalid fps"); @@ -80,8 +75,9 @@ fn embed_path() { .with_default("src/tests/Baby.wav") .prompt().unwrap(); + //For some reason only 360p and 720p work let (width, height) = match resolution { - "144p" => (256, 144), + "144p" => (192, 144), "240p" => (426, 240), "360p" => (640, 360), "480p" => (854, 480), @@ -89,16 +85,65 @@ fn embed_path() { _ => (640, 360), }; - // let settings = Settings::new(out_mode, size, fps, width, height).expect("Could not finish making settings"); - - // let mut embdr = Embedder::encode(&path, settings).expect("Could not encode"); - // embdr.embed("output.avi").expect("Could not embed"); + match out_mode { + OutputMode::Color => { + let bytes = etcher::rip_bytes(&path)?; + + let data = Data::from_color(bytes); + let settings = Settings::new(size, fps, width, height); + + etcher::etch("output.avi", data, settings)?; + }, + OutputMode::Binary => { + let bytes = etcher::rip_bytes(&path)?; + let binary = etcher::rip_binary(bytes)?; + + let data = Data::from_binary(binary); + let settings = Settings::new(size, fps, width, height); + + etcher::etch("output.avi", data, settings)?; + }, + } + + return Ok(()); } -fn download_path() { +async fn download_path() -> anyhow::Result<()> { + // + let url = Text::new("What is the url to the video ?") + .prompt().unwrap(); + let yt_dlp_path = download_yt_dlp(".").await?; + + println!("Starting the download, there is no progress bar"); + let output = YoutubeDl::new(&url) + .youtube_dl_path(yt_dlp_path) + .format("best") + .download(true) + .run_async() + .await?; + + let video = output.into_single_video().unwrap(); + let title = video.title; + + println!("Video downloaded succesfully"); + + return Ok(()); } -fn dislodge_path() { +//TEMPORARY DEFAULTS +fn dislodge_path() -> anyhow::Result<()> { + let in_path = Text::new("What is the path to your video ?") + .with_default("output.avi") + .prompt().unwrap(); + let out_path = Text::new("Where should the output go ?") + .with_default("Baby2.wav") + .with_help_message("Please include name of file and extension") + .prompt().unwrap(); + + let out_data = etcher::read(&in_path)?; + etcher::write_bytes(&out_path, out_data)?; + + return Ok(()); } \ No newline at end of file diff --git a/yt-dlp b/yt-dlp new file mode 100755 index 0000000..8ade5eb Binary files /dev/null and b/yt-dlp differ diff --git a/yt_out.mp4 b/yt_out.mp4 new file mode 100644 index 0000000..29f8f70 Binary files /dev/null and b/yt_out.mp4 differ diff --git a/yt_out2.mp4 b/yt_out2.mp4 new file mode 100644 index 0000000..30a5668 Binary files /dev/null and b/yt_out2.mp4 differ diff --git a/yt_out3.mp4 b/yt_out3.mp4 new file mode 100644 index 0000000..735bc54 Binary files /dev/null and b/yt_out3.mp4 differ diff --git a/yt_out5.mp4 b/yt_out5.mp4 new file mode 100644 index 0000000..33d78e2 Binary files /dev/null and b/yt_out5.mp4 differ