Commit 7b5aa671fe
Unsigned
Layout: unified · split
Cargo.lock +101 −123
| @@ -38,6 +38,12 @@ version = "0.13.1" | |||
| 38 | source = "registry+https://github.com/rust-lang/crates.io-index" | 38 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 39 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" | 39 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" |
| 40 | 40 | ||
| 41 | [[package]] | ||
| 42 | name = "base64" | ||
| 43 | version = "0.21.0" | ||
| 44 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 45 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" | ||
| 46 | |||
| 41 | [[package]] | 47 | [[package]] |
| 42 | name = "bit_field" | 48 | name = "bit_field" |
| 43 | version = "0.10.1" | 49 | version = "0.10.1" |
| @@ -58,15 +64,15 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" | |||
| 58 | 64 | ||
| 59 | [[package]] | 65 | [[package]] |
| 60 | name = "bumpalo" | 66 | name = "bumpalo" |
| 61 | version = "3.11.1" | 67 | version = "3.12.0" |
| 62 | source = "registry+https://github.com/rust-lang/crates.io-index" | 68 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 63 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" | 69 | checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" |
| 64 | 70 | ||
| 65 | [[package]] | 71 | [[package]] |
| 66 | name = "bytemuck" | 72 | name = "bytemuck" |
| 67 | version = "1.12.3" | 73 | version = "1.13.0" |
| 68 | source = "registry+https://github.com/rust-lang/crates.io-index" | 74 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 69 | checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" | 75 | checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" |
| 70 | 76 | ||
| 71 | [[package]] | 77 | [[package]] |
| 72 | name = "byteorder" | 78 | name = "byteorder" |
| @@ -88,9 +94,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" | |||
| 88 | 94 | ||
| 89 | [[package]] | 95 | [[package]] |
| 90 | name = "cc" | 96 | name = "cc" |
| 91 | version = "1.0.78" | 97 | version = "1.0.79" |
| 92 | source = "registry+https://github.com/rust-lang/crates.io-index" | 98 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 93 | checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" | 99 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" |
| 94 | 100 | ||
| 95 | [[package]] | 101 | [[package]] |
| 96 | name = "cfg-if" | 102 | name = "cfg-if" |
| @@ -150,14 +156,14 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" | |||
| 150 | 156 | ||
| 151 | [[package]] | 157 | [[package]] |
| 152 | name = "console" | 158 | name = "console" |
| 153 | version = "0.15.4" | 159 | version = "0.15.5" |
| 154 | source = "registry+https://github.com/rust-lang/crates.io-index" | 160 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 155 | checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a" | 161 | checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" |
| 156 | dependencies = [ | 162 | dependencies = [ |
| 157 | "encode_unicode", | 163 | "encode_unicode", |
| 158 | "lazy_static", | 164 | "lazy_static", |
| 159 | "libc", | 165 | "libc", |
| 160 | "windows-sys 0.42.0", | 166 | "windows-sys", |
| 161 | ] | 167 | ] |
| 162 | 168 | ||
| 163 | [[package]] | 169 | [[package]] |
| @@ -233,6 +239,22 @@ name = "crossterm" | |||
| 233 | version = "0.25.0" | 239 | version = "0.25.0" |
| 234 | source = "registry+https://github.com/rust-lang/crates.io-index" | 240 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 235 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" | 241 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" |
| 242 | dependencies = [ | ||
| 243 | "bitflags", | ||
| 244 | "crossterm_winapi", | ||
| 245 | "libc", | ||
| 246 | "mio", | ||
| 247 | "parking_lot", | ||
| 248 | "signal-hook", | ||
| 249 | "signal-hook-mio", | ||
| 250 | "winapi", | ||
| 251 | ] | ||
| 252 | |||
| 253 | [[package]] | ||
| 254 | name = "crossterm" | ||
| 255 | version = "0.26.0" | ||
| 256 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 257 | checksum = "77f67c7faacd4db07a939f55d66a983a5355358a1f17d32cc9a8d01d1266b9ce" | ||
| 236 | dependencies = [ | 258 | dependencies = [ |
| 237 | "bitflags", | 259 | "bitflags", |
| 238 | "crossterm_winapi", | 260 | "crossterm_winapi", |
| @@ -262,9 +284,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" | |||
| 262 | 284 | ||
| 263 | [[package]] | 285 | [[package]] |
| 264 | name = "cxx" | 286 | name = "cxx" |
| 265 | version = "1.0.85" | 287 | version = "1.0.88" |
| 266 | source = "registry+https://github.com/rust-lang/crates.io-index" | 288 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 267 | checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" | 289 | checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" |
| 268 | dependencies = [ | 290 | dependencies = [ |
| 269 | "cc", | 291 | "cc", |
| 270 | "cxxbridge-flags", | 292 | "cxxbridge-flags", |
| @@ -274,9 +296,9 @@ dependencies = [ | |||
| 274 | 296 | ||
| 275 | [[package]] | 297 | [[package]] |
| 276 | name = "cxx-build" | 298 | name = "cxx-build" |
| 277 | version = "1.0.85" | 299 | version = "1.0.88" |
| 278 | source = "registry+https://github.com/rust-lang/crates.io-index" | 300 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 279 | checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" | 301 | checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" |
| 280 | dependencies = [ | 302 | dependencies = [ |
| 281 | "cc", | 303 | "cc", |
| 282 | "codespan-reporting", | 304 | "codespan-reporting", |
| @@ -289,15 +311,15 @@ dependencies = [ | |||
| 289 | 311 | ||
| 290 | [[package]] | 312 | [[package]] |
| 291 | name = "cxxbridge-flags" | 313 | name = "cxxbridge-flags" |
| 292 | version = "1.0.85" | 314 | version = "1.0.88" |
| 293 | source = "registry+https://github.com/rust-lang/crates.io-index" | 315 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 294 | checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" | 316 | checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" |
| 295 | 317 | ||
| 296 | [[package]] | 318 | [[package]] |
| 297 | name = "cxxbridge-macro" | 319 | name = "cxxbridge-macro" |
| 298 | version = "1.0.85" | 320 | version = "1.0.88" |
| 299 | source = "registry+https://github.com/rust-lang/crates.io-index" | 321 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 300 | checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" | 322 | checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" |
| 301 | dependencies = [ | 323 | dependencies = [ |
| 302 | "proc-macro2", | 324 | "proc-macro2", |
| 303 | "quote", | 325 | "quote", |
| @@ -318,9 +340,9 @@ checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" | |||
| 318 | 340 | ||
| 319 | [[package]] | 341 | [[package]] |
| 320 | name = "either" | 342 | name = "either" |
| 321 | version = "1.8.0" | 343 | version = "1.8.1" |
| 322 | source = "registry+https://github.com/rust-lang/crates.io-index" | 344 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 323 | checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" | 345 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" |
| 324 | 346 | ||
| 325 | [[package]] | 347 | [[package]] |
| 326 | name = "encode_unicode" | 348 | name = "encode_unicode" |
| @@ -532,9 +554,9 @@ dependencies = [ | |||
| 532 | 554 | ||
| 533 | [[package]] | 555 | [[package]] |
| 534 | name = "half" | 556 | name = "half" |
| 535 | version = "2.2.0" | 557 | version = "2.2.1" |
| 536 | source = "registry+https://github.com/rust-lang/crates.io-index" | 558 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 537 | checksum = "6c467d36af040b7b2681f5fddd27427f6da8d3d072f575a265e181d2f8e8d157" | 559 | checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" |
| 538 | dependencies = [ | 560 | dependencies = [ |
| 539 | "crunchy", | 561 | "crunchy", |
| 540 | ] | 562 | ] |
| @@ -719,9 +741,9 @@ dependencies = [ | |||
| 719 | 741 | ||
| 720 | [[package]] | 742 | [[package]] |
| 721 | name = "ipnet" | 743 | name = "ipnet" |
| 722 | version = "2.7.0" | 744 | version = "2.7.1" |
| 723 | source = "registry+https://github.com/rust-lang/crates.io-index" | 745 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 724 | checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" | 746 | checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" |
| 725 | 747 | ||
| 726 | [[package]] | 748 | [[package]] |
| 727 | name = "itoa" | 749 | name = "itoa" |
| @@ -847,7 +869,7 @@ dependencies = [ | |||
| 847 | "libc", | 869 | "libc", |
| 848 | "log", | 870 | "log", |
| 849 | "wasi", | 871 | "wasi", |
| 850 | "windows-sys 0.42.0", | 872 | "windows-sys", |
| 851 | ] | 873 | ] |
| 852 | 874 | ||
| 853 | [[package]] | 875 | [[package]] |
| @@ -1009,15 +1031,15 @@ dependencies = [ | |||
| 1009 | 1031 | ||
| 1010 | [[package]] | 1032 | [[package]] |
| 1011 | name = "parking_lot_core" | 1033 | name = "parking_lot_core" |
| 1012 | version = "0.9.5" | 1034 | version = "0.9.6" |
| 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1014 | checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" | 1036 | checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" |
| 1015 | dependencies = [ | 1037 | dependencies = [ |
| 1016 | "cfg-if", | 1038 | "cfg-if", |
| 1017 | "libc", | 1039 | "libc", |
| 1018 | "redox_syscall", | 1040 | "redox_syscall", |
| 1019 | "smallvec", | 1041 | "smallvec", |
| 1020 | "windows-sys 0.42.0", | 1042 | "windows-sys", |
| 1021 | ] | 1043 | ] |
| 1022 | 1044 | ||
| 1023 | [[package]] | 1045 | [[package]] |
| @@ -1084,9 +1106,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" | |||
| 1084 | 1106 | ||
| 1085 | [[package]] | 1107 | [[package]] |
| 1086 | name = "proc-macro2" | 1108 | name = "proc-macro2" |
| 1087 | version = "1.0.49" | 1109 | version = "1.0.50" |
| 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1089 | checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" | 1111 | checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" |
| 1090 | dependencies = [ | 1112 | dependencies = [ |
| 1091 | "unicode-ident", | 1113 | "unicode-ident", |
| 1092 | ] | 1114 | ] |
| @@ -1142,9 +1164,9 @@ dependencies = [ | |||
| 1142 | 1164 | ||
| 1143 | [[package]] | 1165 | [[package]] |
| 1144 | name = "rayon-core" | 1166 | name = "rayon-core" |
| 1145 | version = "1.10.1" | 1167 | version = "1.10.2" |
| 1146 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1168 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1147 | checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" | 1169 | checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" |
| 1148 | dependencies = [ | 1170 | dependencies = [ |
| 1149 | "crossbeam-channel", | 1171 | "crossbeam-channel", |
| 1150 | "crossbeam-deque", | 1172 | "crossbeam-deque", |
| @@ -1172,11 +1194,11 @@ dependencies = [ | |||
| 1172 | 1194 | ||
| 1173 | [[package]] | 1195 | [[package]] |
| 1174 | name = "reqwest" | 1196 | name = "reqwest" |
| 1175 | version = "0.11.13" | 1197 | version = "0.11.14" |
| 1176 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1198 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1177 | checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" | 1199 | checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" |
| 1178 | dependencies = [ | 1200 | dependencies = [ |
| 1179 | "base64", | 1201 | "base64 0.21.0", |
| 1180 | "bytes", | 1202 | "bytes", |
| 1181 | "encoding_rs", | 1203 | "encoding_rs", |
| 1182 | "futures-core", | 1204 | "futures-core", |
| @@ -1233,12 +1255,11 @@ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" | |||
| 1233 | 1255 | ||
| 1234 | [[package]] | 1256 | [[package]] |
| 1235 | name = "schannel" | 1257 | name = "schannel" |
| 1236 | version = "0.1.20" | 1258 | version = "0.1.21" |
| 1237 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1238 | checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" | 1260 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" |
| 1239 | dependencies = [ | 1261 | dependencies = [ |
| 1240 | "lazy_static", | 1262 | "windows-sys", |
| 1241 | "windows-sys 0.36.1", | ||
| 1242 | ] | 1263 | ] |
| 1243 | 1264 | ||
| 1244 | [[package]] | 1265 | [[package]] |
| @@ -1261,9 +1282,9 @@ checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" | |||
| 1261 | 1282 | ||
| 1262 | [[package]] | 1283 | [[package]] |
| 1263 | name = "security-framework" | 1284 | name = "security-framework" |
| 1264 | version = "2.7.0" | 1285 | version = "2.8.2" |
| 1265 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1266 | checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" | 1287 | checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" |
| 1267 | dependencies = [ | 1288 | dependencies = [ |
| 1268 | "bitflags", | 1289 | "bitflags", |
| 1269 | "core-foundation", | 1290 | "core-foundation", |
| @@ -1274,9 +1295,9 @@ dependencies = [ | |||
| 1274 | 1295 | ||
| 1275 | [[package]] | 1296 | [[package]] |
| 1276 | name = "security-framework-sys" | 1297 | name = "security-framework-sys" |
| 1277 | version = "2.6.1" | 1298 | version = "2.8.0" |
| 1278 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1299 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1279 | checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" | 1300 | checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" |
| 1280 | dependencies = [ | 1301 | dependencies = [ |
| 1281 | "core-foundation-sys", | 1302 | "core-foundation-sys", |
| 1282 | "libc", | 1303 | "libc", |
| @@ -1327,9 +1348,9 @@ dependencies = [ | |||
| 1327 | 1348 | ||
| 1328 | [[package]] | 1349 | [[package]] |
| 1329 | name = "serde_yaml" | 1350 | name = "serde_yaml" |
| 1330 | version = "0.9.16" | 1351 | version = "0.9.17" |
| 1331 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1332 | checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834" | 1353 | checksum = "8fb06d4b6cdaef0e0c51fa881acb721bed3c924cfaa71d9c94a3b771dfdf6567" |
| 1333 | dependencies = [ | 1354 | dependencies = [ |
| 1334 | "indexmap", | 1355 | "indexmap", |
| 1335 | "itoa", | 1356 | "itoa", |
| @@ -1447,9 +1468,9 @@ dependencies = [ | |||
| 1447 | 1468 | ||
| 1448 | [[package]] | 1469 | [[package]] |
| 1449 | name = "termcolor" | 1470 | name = "termcolor" |
| 1450 | version = "1.1.3" | 1471 | version = "1.2.0" |
| 1451 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1472 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1452 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" | 1473 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" |
| 1453 | dependencies = [ | 1474 | dependencies = [ |
| 1454 | "winapi-util", | 1475 | "winapi-util", |
| 1455 | ] | 1476 | ] |
| @@ -1491,9 +1512,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" | |||
| 1491 | 1512 | ||
| 1492 | [[package]] | 1513 | [[package]] |
| 1493 | name = "tokio" | 1514 | name = "tokio" |
| 1494 | version = "1.24.0" | 1515 | version = "1.24.2" |
| 1495 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1496 | checksum = "7125661431c26622a80ca5051a2f936c9a678318e0351007b0cc313143024e5c" | 1517 | checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" |
| 1497 | dependencies = [ | 1518 | dependencies = [ |
| 1498 | "autocfg", | 1519 | "autocfg", |
| 1499 | "bytes", | 1520 | "bytes", |
| @@ -1503,7 +1524,7 @@ dependencies = [ | |||
| 1503 | "num_cpus", | 1524 | "num_cpus", |
| 1504 | "pin-project-lite", | 1525 | "pin-project-lite", |
| 1505 | "socket2", | 1526 | "socket2", |
| 1506 | "windows-sys 0.42.0", | 1527 | "windows-sys", |
| 1507 | ] | 1528 | ] |
| 1508 | 1529 | ||
| 1509 | [[package]] | 1530 | [[package]] |
| @@ -1564,9 +1585,9 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" | |||
| 1564 | 1585 | ||
| 1565 | [[package]] | 1586 | [[package]] |
| 1566 | name = "try-lock" | 1587 | name = "try-lock" |
| 1567 | version = "0.2.3" | 1588 | version = "0.2.4" |
| 1568 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1569 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" | 1590 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" |
| 1570 | 1591 | ||
| 1571 | [[package]] | 1592 | [[package]] |
| 1572 | name = "tui" | 1593 | name = "tui" |
| @@ -1576,7 +1597,7 @@ checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" | |||
| 1576 | dependencies = [ | 1597 | dependencies = [ |
| 1577 | "bitflags", | 1598 | "bitflags", |
| 1578 | "cassowary", | 1599 | "cassowary", |
| 1579 | "crossterm", | 1600 | "crossterm 0.25.0", |
| 1580 | "serde", | 1601 | "serde", |
| 1581 | "unicode-segmentation", | 1602 | "unicode-segmentation", |
| 1582 | "unicode-width", | 1603 | "unicode-width", |
| @@ -1584,11 +1605,11 @@ dependencies = [ | |||
| 1584 | 1605 | ||
| 1585 | [[package]] | 1606 | [[package]] |
| 1586 | name = "tui-additions" | 1607 | name = "tui-additions" |
| 1587 | version = "0.1.12" | 1608 | version = "0.1.13" |
| 1588 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1609 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1589 | checksum = "3bfce9dd63be9026ffd15ea51ee0afb2fe386263decb04e2bcc0c23556a79a1f" | 1610 | checksum = "37ad46291f8753853eb83c3e47c34c67a59f61129a13a93ba11907ca458bd72b" |
| 1590 | dependencies = [ | 1611 | dependencies = [ |
| 1591 | "crossterm", | 1612 | "crossterm 0.26.0", |
| 1592 | "dyn-clone", | 1613 | "dyn-clone", |
| 1593 | "tui", | 1614 | "tui", |
| 1594 | "typemap", | 1615 | "typemap", |
| @@ -1606,9 +1627,9 @@ dependencies = [ | |||
| 1606 | 1627 | ||
| 1607 | [[package]] | 1628 | [[package]] |
| 1608 | name = "unicode-bidi" | 1629 | name = "unicode-bidi" |
| 1609 | version = "0.3.8" | 1630 | version = "0.3.10" |
| 1610 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1631 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1611 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" | 1632 | checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" |
| 1612 | 1633 | ||
| 1613 | [[package]] | 1634 | [[package]] |
| 1614 | name = "unicode-ident" | 1635 | name = "unicode-ident" |
| @@ -1676,9 +1697,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1676 | checksum = "b511f7e9ae27b5750f12ca50c353a1179bd4cc964a47294eb0d2cdad40cb41c0" | 1697 | checksum = "b511f7e9ae27b5750f12ca50c353a1179bd4cc964a47294eb0d2cdad40cb41c0" |
| 1677 | dependencies = [ | 1698 | dependencies = [ |
| 1678 | "ansi_colours", | 1699 | "ansi_colours", |
| 1679 | "base64", | 1700 | "base64 0.13.1", |
| 1680 | "console", | 1701 | "console", |
| 1681 | "crossterm", | 1702 | "crossterm 0.25.0", |
| 1682 | "image", | 1703 | "image", |
| 1683 | "lazy_static", | 1704 | "lazy_static", |
| 1684 | "sixel-rs", | 1705 | "sixel-rs", |
| @@ -1815,19 +1836,6 @@ version = "0.4.0" | |||
| 1815 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1836 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1816 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | 1837 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" |
| 1817 | 1838 | ||
| 1818 | [[package]] | ||
| 1819 | name = "windows-sys" | ||
| 1820 | version = "0.36.1" | ||
| 1821 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1822 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" | ||
| 1823 | dependencies = [ | ||
| 1824 | "windows_aarch64_msvc 0.36.1", | ||
| 1825 | "windows_i686_gnu 0.36.1", | ||
| 1826 | "windows_i686_msvc 0.36.1", | ||
| 1827 | "windows_x86_64_gnu 0.36.1", | ||
| 1828 | "windows_x86_64_msvc 0.36.1", | ||
| 1829 | ] | ||
| 1830 | |||
| 1831 | [[package]] | 1839 | [[package]] |
| 1832 | name = "windows-sys" | 1840 | name = "windows-sys" |
| 1833 | version = "0.42.0" | 1841 | version = "0.42.0" |
| @@ -1835,85 +1843,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1835 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" | 1843 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" |
| 1836 | dependencies = [ | 1844 | dependencies = [ |
| 1837 | "windows_aarch64_gnullvm", | 1845 | "windows_aarch64_gnullvm", |
| 1838 | "windows_aarch64_msvc 0.42.0", | 1846 | "windows_aarch64_msvc", |
| 1839 | "windows_i686_gnu 0.42.0", | 1847 | "windows_i686_gnu", |
| 1840 | "windows_i686_msvc 0.42.0", | 1848 | "windows_i686_msvc", |
| 1841 | "windows_x86_64_gnu 0.42.0", | 1849 | "windows_x86_64_gnu", |
| 1842 | "windows_x86_64_gnullvm", | 1850 | "windows_x86_64_gnullvm", |
| 1843 | "windows_x86_64_msvc 0.42.0", | 1851 | "windows_x86_64_msvc", |
| 1844 | ] | 1852 | ] |
| 1845 | 1853 | ||
| 1846 | [[package]] | 1854 | [[package]] |
| 1847 | name = "windows_aarch64_gnullvm" | 1855 | name = "windows_aarch64_gnullvm" |
| 1848 | version = "0.42.0" | 1856 | version = "0.42.1" |
| 1849 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1850 | checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" | ||
| 1851 | |||
| 1852 | [[package]] | ||
| 1853 | name = "windows_aarch64_msvc" | ||
| 1854 | version = "0.36.1" | ||
| 1855 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1857 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1856 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" | 1858 | checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" |
| 1857 | 1859 | ||
| 1858 | [[package]] | 1860 | [[package]] |
| 1859 | name = "windows_aarch64_msvc" | 1861 | name = "windows_aarch64_msvc" |
| 1860 | version = "0.42.0" | 1862 | version = "0.42.1" |
| 1861 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1863 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1862 | checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" | 1864 | checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" |
| 1863 | 1865 | ||
| 1864 | [[package]] | 1866 | [[package]] |
| 1865 | name = "windows_i686_gnu" | 1867 | name = "windows_i686_gnu" |
| 1866 | version = "0.36.1" | 1868 | version = "0.42.1" |
| 1867 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1869 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1868 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" | 1870 | checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" |
| 1869 | |||
| 1870 | [[package]] | ||
| 1871 | name = "windows_i686_gnu" | ||
| 1872 | version = "0.42.0" | ||
| 1873 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1874 | checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" | ||
| 1875 | 1871 | ||
| 1876 | [[package]] | 1872 | [[package]] |
| 1877 | name = "windows_i686_msvc" | 1873 | name = "windows_i686_msvc" |
| 1878 | version = "0.36.1" | 1874 | version = "0.42.1" |
| 1879 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1875 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1880 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" | 1876 | checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" |
| 1881 | |||
| 1882 | [[package]] | ||
| 1883 | name = "windows_i686_msvc" | ||
| 1884 | version = "0.42.0" | ||
| 1885 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1886 | checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" | ||
| 1887 | 1877 | ||
| 1888 | [[package]] | 1878 | [[package]] |
| 1889 | name = "windows_x86_64_gnu" | 1879 | name = "windows_x86_64_gnu" |
| 1890 | version = "0.36.1" | 1880 | version = "0.42.1" |
| 1891 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1892 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" | ||
| 1893 | |||
| 1894 | [[package]] | ||
| 1895 | name = "windows_x86_64_gnu" | ||
| 1896 | version = "0.42.0" | ||
| 1897 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1881 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1898 | checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" | 1882 | checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" |
| 1899 | 1883 | ||
| 1900 | [[package]] | 1884 | [[package]] |
| 1901 | name = "windows_x86_64_gnullvm" | 1885 | name = "windows_x86_64_gnullvm" |
| 1902 | version = "0.42.0" | 1886 | version = "0.42.1" |
| 1903 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1887 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1904 | checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" | 1888 | checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" |
| 1905 | 1889 | ||
| 1906 | [[package]] | 1890 | [[package]] |
| 1907 | name = "windows_x86_64_msvc" | 1891 | name = "windows_x86_64_msvc" |
| 1908 | version = "0.36.1" | 1892 | version = "0.42.1" |
| 1909 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1893 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1910 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" | 1894 | checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" |
| 1911 | |||
| 1912 | [[package]] | ||
| 1913 | name = "windows_x86_64_msvc" | ||
| 1914 | version = "0.42.0" | ||
| 1915 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1916 | checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" | ||
| 1917 | 1895 | ||
| 1918 | [[package]] | 1896 | [[package]] |
| 1919 | name = "winreg" | 1897 | name = "winreg" |
| @@ -1945,11 +1923,11 @@ dependencies = [ | |||
| 1945 | 1923 | ||
| 1946 | [[package]] | 1924 | [[package]] |
| 1947 | name = "youtube-tui" | 1925 | name = "youtube-tui" |
| 1948 | version = "0.6.1" | 1926 | version = "0.6.2" |
| 1949 | dependencies = [ | 1927 | dependencies = [ |
| 1950 | "chrono", | 1928 | "chrono", |
| 1951 | "clipboard", | 1929 | "clipboard", |
| 1952 | "crossterm", | 1930 | "crossterm 0.26.0", |
| 1953 | "dyn-clone", | 1931 | "dyn-clone", |
| 1954 | "futures", | 1932 | "futures", |
| 1955 | "home", | 1933 | "home", |
Cargo.toml +5 −5
| @@ -1,6 +1,6 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "youtube-tui" | 2 | name = "youtube-tui" |
| 3 | version = "0.6.1" | 3 | version = "0.6.2" |
| 4 | authors = ["Siriusmart <siriusmart@tuta.io>"] | 4 | authors = ["Siriusmart <siriusmart@tuta.io>"] |
| 5 | edition = "2021" | 5 | edition = "2021" |
| 6 | description = "An aesthetically pleasing YouTube TUI written in Rust" | 6 | description = "An aesthetically pleasing YouTube TUI written in Rust" |
| @@ -8,10 +8,10 @@ documentation = "https://docs.rs/youtube-tui" | |||
| 8 | readme = "README.md" | 8 | readme = "README.md" |
| 9 | homepage = "https://siriusmart.github.io/youtube-tui" | 9 | homepage = "https://siriusmart.github.io/youtube-tui" |
| 10 | repository = "https://github.com/siriusmart/youtube-tui" | 10 | repository = "https://github.com/siriusmart/youtube-tui" |
| 11 | license = "GPL-3.0" | 11 | license = "GPL-3.0-or-later" |
| 12 | keywords = ["cli", "terminal", "youtube", "tui"] | 12 | keywords = ["cli", "terminal", "youtube", "tui"] |
| 13 | categories =["command-line-interface", "command-line-utilities"] | 13 | categories =["command-line-interface", "command-line-utilities"] |
| 14 | exclude = ["/docs"] | 14 | exclude = ["/docs", "/LICENSE"] |
| 15 | 15 | ||
| 16 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | 16 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
| 17 | 17 | ||
| @@ -23,12 +23,12 @@ halfblock = ["viuer"] | |||
| 23 | [dependencies] | 23 | [dependencies] |
| 24 | serde = {version = "1.0", default-features = false, features = ["derive"]} | 24 | serde = {version = "1.0", default-features = false, features = ["derive"]} |
| 25 | tui = {version = "0.19", default-features = false, features = ["serde"]} | 25 | tui = {version = "0.19", default-features = false, features = ["serde"]} |
| 26 | crossterm = {version = "0.25", default-features = false, features = ["serde"]} | 26 | crossterm = {version = "0.26", default-features = false, features = ["serde"]} |
| 27 | viuer = {version = "0.6", default-features = false, optional = true} | 27 | viuer = {version = "0.6", default-features = false, optional = true} |
| 28 | home = "0.5" | 28 | home = "0.5" |
| 29 | chrono = {version = "0.4", default-features = false, features = ["clock"]} | 29 | chrono = {version = "0.4", default-features = false, features = ["clock"]} |
| 30 | typemap = {version = "0.3", default-features = false} | 30 | typemap = {version = "0.3", default-features = false} |
| 31 | tui-additions = {version = "0.1", default-features = false, features = ["framework", "widgets"]} | 31 | tui-additions = {version = "0.1.13", default-features = false, features = ["framework", "widgets"]} |
| 32 | invidious = {version = "0.4", default-features = false, features = ["reqwest"]} | 32 | invidious = {version = "0.4", default-features = false, features = ["reqwest"]} |
| 33 | serde_yaml = {version = "0.9", default-features = false} | 33 | serde_yaml = {version = "0.9", default-features = false} |
| 34 | dyn-clone = {version = "1.0", default-features = false} | 34 | dyn-clone = {version = "1.0", default-features = false} |
README.md +3 −3
| @@ -58,12 +58,12 @@ It also includes features like: | |||
| 58 | 58 | ||
| 59 | - Vim-like commands | 59 | - Vim-like commands |
| 60 | - Mouse support | 60 | - Mouse support |
| 61 | - Entensible keybindings system | ||
| 61 | 62 | ||
| 62 | ### What it doesn't have | 63 | ### What it doesn't have |
| 63 | 64 | ||
| 64 | - Binding commands to keys (first priority) | 65 | - Subscriptions (first priority) |
| 65 | - Channel search (will implement) | 66 | - Download library (will implement) |
| 66 | - Subscriptions (will implement) | ||
| 67 | 67 | ||
| 68 | ## How to contribute | 68 | ## How to contribute |
| 69 | 69 | ||
docs/src/README.md +3 −3
| @@ -50,12 +50,12 @@ It also includes features like: | |||
| 50 | 50 | ||
| 51 | - Vim-like commands | 51 | - Vim-like commands |
| 52 | - Mouse support | 52 | - Mouse support |
| 53 | - Entensible keybindings system | ||
| 53 | 54 | ||
| 54 | ### What it doesn't have | 55 | ### What it doesn't have |
| 55 | 56 | ||
| 56 | - Binding commands to keys (first priority) | 57 | - Subscriptions (first priority) |
| 57 | - Channel search (will implement) | 58 | - Download library (will implement) |
| 58 | - Subscriptions (will implement) | ||
| 59 | 59 | ||
| 60 | ## How to contribute | 60 | ## How to contribute |
| 61 | 61 | ||
docs/src/SUMMARY.md +1
| @@ -11,6 +11,7 @@ | |||
| 11 | - [main](config/main.md) | 11 | - [main](config/main.md) |
| 12 | - [commands](config/commands.md) | 12 | - [commands](config/commands.md) |
| 13 | - [keybindings](config/keybindings.md) | 13 | - [keybindings](config/keybindings.md) |
| 14 | - [commandbindings](config/commandbindings.md) | ||
| 14 | - [pages](config/pages.md) | 15 | - [pages](config/pages.md) |
| 15 | - [appearance](config/appearance.md) | 16 | - [appearance](config/appearance.md) |
| 16 | - [search](config/search.md) | 17 | - [search](config/search.md) |
docs/src/basic_usage.md +4
| @@ -61,6 +61,10 @@ Command mode is like that of Vim, it can be started by pressing `:` when nothing | |||
| 61 | 61 | ||
| 62 | More about commands in the [next chapter](commands.md). | 62 | More about commands in the [next chapter](commands.md). |
| 63 | 63 | ||
| 64 | ## Command bindings | ||
| 65 | |||
| 66 | Keys can be binded to a command, more about it in the next chapter. | ||
| 67 | |||
| 64 | ## Buttons | 68 | ## Buttons |
| 65 | 69 | ||
| 66 | Buttons have no use on their own, but allows you to navigate between pages. | 70 | Buttons have no use on their own, but allows you to navigate between pages. |
docs/src/changelogs.md +13 −3
| @@ -1,14 +1,24 @@ | |||
| 1 | # Changelogs | 1 | # Changelogs |
| 2 | 2 | ||
| 3 | ## v0.6.1 | 3 | ## v0.6.2 |
| 4 | 4 | ||
| 5 | ### Added | 5 | #### Added |
| 6 | |||
| 7 | - Command bindings | ||
| 8 | |||
| 9 | #### Fixed | ||
| 10 | |||
| 11 | - Image not cleared when going back to "switch view" | ||
| 12 | |||
| 13 | ### v0.6.1 | ||
| 14 | |||
| 15 | #### Added | ||
| 6 | 16 | ||
| 7 | - Rework of the env system, now using environment variables provided by the OS as opposed to implmenting own version of env | 17 | - Rework of the env system, now using environment variables provided by the OS as opposed to implmenting own version of env |
| 8 | - Ability to use envs in command mode | 18 | - Ability to use envs in command mode |
| 9 | - Launch commands (including `youtube-tui help`) | 19 | - Launch commands (including `youtube-tui help`) |
| 10 | 20 | ||
| 11 | ### Fixed | 21 | #### Fixed |
| 12 | 22 | ||
| 13 | - Screen blinking when pressing up arrow on the first item in playlist page, videos view | 23 | - Screen blinking when pressing up arrow on the first item in playlist page, videos view |
| 14 | 24 | ||
docs/src/commands.md +14
| @@ -6,6 +6,8 @@ Commands can be entered to the TUI by pressing the `:` key, the same as in Vim. | |||
| 6 | 6 | ||
| 7 | **Loadpage commands** can also be used when launching, for example `youtube-tui loadpage popular` or `youtube-tui popular`. | 7 | **Loadpage commands** can also be used when launching, for example `youtube-tui loadpage popular` or `youtube-tui popular`. |
| 8 | 8 | ||
| 9 | > Commands can be joined together using `;;`. | ||
| 10 | |||
| 9 | Below are the avaliable commands: | 11 | Below are the avaliable commands: |
| 10 | 12 | ||
| 11 | ## Loadpage | 13 | ## Loadpage |
| @@ -53,3 +55,15 @@ Text commands generates a *text only response* without launching the TUI. | |||
| 53 | help | 55 | help |
| 54 | version | 56 | version |
| 55 | ``` | 57 | ``` |
| 58 | |||
| 59 | ## Command bindings | ||
| 60 | |||
| 61 | Commands can be binded to keys just like normal key bindings, bindings can be edited in `commandbindings.yml`. Below are the default bindings: | ||
| 62 | |||
| 63 | |Key|Description| | ||
| 64 | |---|---| | ||
| 65 | |`Ctrl + F`|Open page in browser| | ||
| 66 | |`Ctrl + C`|Copy page url| | ||
| 67 | |`Ctrl + P`|Play hovered video| | ||
| 68 | |`Ctrl + A`|Play hovered audio| | ||
| 69 | |`Shift + A`|Play hovered audio on repeat (shuffled if hovering a playlist)| | ||
docs/src/config/commandbindings.md added +35
| @@ -0,0 +1,35 @@ | |||
| 1 | # Command bindings | ||
| 2 | |||
| 3 | Commands can be binded to keys (just like normal keybindings), it allows functionalities such as <u>playing hovered videos</u>. Bindings can be either *global* or *page specific*, it is located in `~/.config/youtube-tui/commandbindings.yml`. | ||
| 4 | |||
| 5 | ## Example commandbindings config | ||
| 6 | |||
| 7 | ```yml | ||
| 8 | global: | ||
| 9 | 'f': | ||
| 10 | 2: run ${browser} '${url}' | ||
| 11 | 'c': | ||
| 12 | 2: cp ${url} | ||
| 13 | video: {} | ||
| 14 | search: | ||
| 15 | 'a': | ||
| 16 | 2: run ${terminal-emulator} mpv '${hover-url}' --no-video | ||
| 17 | 'A': | ||
| 18 | 1: run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle | ||
| 19 | 'p': | ||
| 20 | 2: run mpv '${hover-url}' | ||
| 21 | watchhistory: | ||
| 22 | 'A': | ||
| 23 | 1: run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle | ||
| 24 | 'p': | ||
| 25 | 2: run mpv '${hover-url}' | ||
| 26 | 'a': | ||
| 27 | 2: run ${terminal-emulator} mpv '${hover-url}' --no-video | ||
| 28 | # etc | ||
| 29 | ``` | ||
| 30 | |||
| 31 | <hr> | ||
| 32 | |||
| 33 | Specifications are same as [`comamnds.yml`](commands.md), the exact same envs can be used. | ||
| 34 | |||
| 35 | Default bindings can be found in [this section](../commands.md#command-bindings). | ||
docs/src/config/commands.md +7 −18
| @@ -5,6 +5,7 @@ The commands config file decides what options (that will run a certain command o | |||
| 5 | ## Example commands config | 5 | ## Example commands config |
| 6 | 6 | ||
| 7 | ```yaml | 7 | ```yaml |
| 8 | launch_command: loadpage popular ;; flush ;; history clear # suggested to set page to watchhistory if you don't want to wait for popular to load | ||
| 8 | video: | 9 | video: |
| 9 | - Play video: ${video-player} ${embed-url} | 10 | - Play video: ${video-player} ${embed-url} |
| 10 | - Play audio: ${terminal-emulator} ${video-player} ${embed-url} --no-video | 11 | - Play audio: ${terminal-emulator} ${video-player} ${embed-url} --no-video |
| @@ -34,6 +35,7 @@ Notice that a lot of the commands contains the `${label}` pattern, this actually | |||
| 34 | Replacing all these with known values it might look something like this: | 35 | Replacing all these with known values it might look something like this: |
| 35 | 36 | ||
| 36 | ```yaml | 37 | ```yaml |
| 38 | launch_command: loadpage popular ;; flush ;; history clear | ||
| 37 | video: | 39 | video: |
| 38 | - Play video: mpv 'https://youtube.com/embed/dQw4w9WgXcQ' | 40 | - Play video: mpv 'https://youtube.com/embed/dQw4w9WgXcQ' |
| 39 | - Play audio: konsole -e mpv 'https://youtube.com/embed/dQw4w9WgXcQ' --no-video | 41 | - Play audio: konsole -e mpv 'https://youtube.com/embed/dQw4w9WgXcQ' --no-video |
| @@ -53,14 +55,6 @@ playlist: | |||
| 53 | 55 | ||
| 54 | > Global commands can also be used here. (Ones that start with an `:`). | 56 | > Global commands can also be used here. (Ones that start with an `:`). |
| 55 | 57 | ||
| 56 | ## Item commands | ||
| 57 | |||
| 58 | (will be replaced by global vim-like commands in the next major version) | ||
| 59 | |||
| 60 | Notice that there is another pattern in the commands, it is the `%label%` commands. They are special cases that are consumed by the item and is never actually ran as a system command. | ||
| 61 | |||
| 62 | For instance `%switch-provider%` toggles the provider between `YouTube` and `Invidious`. | ||
| 63 | |||
| 64 | <hr> | 58 | <hr> |
| 65 | 59 | ||
| 66 | Below are the description of each of the fields: | 60 | Below are the description of each of the fields: |
| @@ -83,15 +77,10 @@ Does not include custom env set in `main.yml`. | |||
| 83 | 77 | ||
| 84 | |Name|Page|Value| | 78 | |Name|Page|Value| |
| 85 | |---|---|---| | 79 | |---|---|---| |
| 86 | |`url`|video & playlist|String url to the web page| | 80 | |`url`|search, popular, trending, video, playlist|String url to the web page| |
| 87 | |`id`|video & playlist|String id of the video or playlist| | 81 | |`id`|video, playlist|String id of the video or playlist| |
| 88 | |`channel-id`|video & playlist|String id of the channel| | 82 | |`channel-id`|video, playlist|String id of the channel| |
| 89 | |`embed-url`|video|String url to the embed video (required to play video using mpv from Invidious)| | 83 | |`embed-url`|video|String url to the embed video (required to play video using mpv from Invidious)| |
| 90 | |`all-videos`|playlist|String url***s*** separated by space to all embed videos in a playlist| | 84 | |`all-videos`|playlist|String url***s*** separated by space to all embed videos in a playlist| |
| 91 | |`provider`|video & playlist|To display the current provider, is the only env that can be displayed in the label, and can only be used when `%switch-provider%` is the command| | 85 | |`hover-url`|trending, popular, search|Url of the currenly hovering item.| |
| 92 | 86 | |`all-ids`|playlist|IDs of all videos in a playlist, separated with space.| | |
| 93 | ## Item command reference | ||
| 94 | |||
| 95 | |Name|Page|Use| | ||
| 96 | |---|---|---| | ||
| 97 | |`swtich-provider`|video & playlist|Toggles the provider between `YouTube` and `Invidious`| | ||
docs/src/config/main.md +1 −1
| @@ -91,7 +91,7 @@ Usually you don't want to use the max resolution as it will create a large gap b | |||
| 91 | 91 | ||
| 92 | ### Provider | 92 | ### Provider |
| 93 | 93 | ||
| 94 | This changes the `${url}` and `${embed_url}` of videos, allowing you to watch videos from Invidious if it is restricted on YouTube. | 94 | This changes the `${url}` and `${embed-url}` of videos, allowing you to watch videos from Invidious if it is restricted on YouTube. |
| 95 | 95 | ||
| 96 | (Don't always use Invidious if YouTube is working, because first of all the load time if gonna be much slower, and secondly you will be DDoSing Invidious) | 96 | (Don't always use Invidious if YouTube is working, because first of all the load time if gonna be much slower, and secondly you will be DDoSing Invidious) |
| 97 | 97 | ||
docs/src/contributors.md +1 −1
| @@ -6,7 +6,7 @@ Creator and main developer of YouTube TUI. | |||
| 6 | 6 | ||
| 7 | ## <a href="https://github.com/zaedus" target=_blank>Zaedus</a> | 7 | ## <a href="https://github.com/zaedus" target=_blank>Zaedus</a> |
| 8 | 8 | ||
| 9 | Made the PKGBUILD and maintainer of the `youtube-tui-git` package on <a href="https://aur.archlinux.org/packages/youtube-tui-git" target=_blank>the AUR</a>. | 9 | Made the PKGBUILD and maintainer of the `youtube-tui-full-bin`, `youtube-tui-nodefaults-bin` and `youtube-tui-git` package on <a href="https://aur.archlinux.org/packages/youtube-tui-git" target=_blank>the AUR</a>. |
| 10 | 10 | ||
| 11 | ## <a href="https://github.com/fractal-tess" target=_blank>Fractal Tess</a> | 11 | ## <a href="https://github.com/fractal-tess" target=_blank>Fractal Tess</a> |
| 12 | 12 | ||
src/config/commandbindings.rs +48 −12
| @@ -58,7 +58,9 @@ impl CommandBindings { | |||
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | if let Some(command) = command { | 60 | if let Some(command) = command { |
| 61 | out.push_str("&&"); | 61 | if !out.is_empty() { |
| 62 | out.push_str("&&"); | ||
| 63 | } | ||
| 62 | out.push_str(command); | 64 | out.push_str(command); |
| 63 | } | 65 | } |
| 64 | 66 | ||
| @@ -151,14 +153,24 @@ fn get_command<'a>( | |||
| 151 | // default functions | 153 | // default functions |
| 152 | 154 | ||
| 153 | fn global_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 155 | fn global_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 154 | HashMap::default() | 156 | HashMap::from([ |
| 157 | ( | ||
| 158 | KeyCodeSerde::Char('f'), | ||
| 159 | HashMap::from([(2, String::from("run ${browser} '${url}'"))]), | ||
| 160 | ), | ||
| 161 | ( | ||
| 162 | KeyCodeSerde::Char('c'), | ||
| 163 | HashMap::from([(2, String::from("cp ${url}"))]), | ||
| 164 | ), | ||
| 165 | ]) | ||
| 155 | } | 166 | } |
| 156 | 167 | ||
| 157 | fn search_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 168 | fn search_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 158 | HashMap::from([( | 169 | HashMap::from([ |
| 159 | KeyCodeSerde::Char('f'), | 170 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), |
| 160 | HashMap::from([(2, String::from("run ${browser} ${url}"))]), | 171 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), |
| 161 | )]) | 172 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), |
| 173 | ]) | ||
| 162 | } | 174 | } |
| 163 | 175 | ||
| 164 | fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 176 | fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| @@ -166,23 +178,43 @@ fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 166 | } | 178 | } |
| 167 | 179 | ||
| 168 | fn channel_playlists_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 180 | fn channel_playlists_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 169 | HashMap::default() | 181 | HashMap::from([ |
| 182 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 183 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 184 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), | ||
| 185 | ]) | ||
| 170 | } | 186 | } |
| 171 | 187 | ||
| 172 | fn channel_videos_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 188 | fn channel_videos_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 173 | HashMap::default() | 189 | HashMap::from([ |
| 190 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 191 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 192 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), | ||
| 193 | ]) | ||
| 174 | } | 194 | } |
| 175 | 195 | ||
| 176 | fn playlist_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 196 | fn playlist_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 177 | HashMap::default() | 197 | HashMap::from([ |
| 198 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 199 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 200 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), | ||
| 201 | ]) | ||
| 178 | } | 202 | } |
| 179 | 203 | ||
| 180 | fn popular_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 204 | fn popular_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 181 | HashMap::default() | 205 | HashMap::from([ |
| 206 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 207 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 208 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), | ||
| 209 | ]) | ||
| 182 | } | 210 | } |
| 183 | 211 | ||
| 184 | fn trending_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 212 | fn trending_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 185 | HashMap::default() | 213 | HashMap::from([ |
| 214 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 215 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 216 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])), | ||
| 217 | ]) | ||
| 186 | } | 218 | } |
| 187 | 219 | ||
| 188 | fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 220 | fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| @@ -190,5 +222,9 @@ fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 190 | } | 222 | } |
| 191 | 223 | ||
| 192 | fn watchhistory_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 224 | fn watchhistory_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 193 | HashMap::default() | 225 | HashMap::from([ |
| 226 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | ||
| 227 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | ||
| 228 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])) | ||
| 229 | ]) | ||
| 194 | } | 230 | } |
src/config/commands.rs +8 −8
| @@ -35,7 +35,7 @@ impl From<CommandsConfigSerde> for CommandsConfig { | |||
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /// Hashmaps are better formatted in YAML, impls Into<CommandsConfig> | 38 | /// Hashmaps are better formatted in YAML, impls `Into<CommandsConfig>` |
| 39 | // uses vector to keep the ordering of the commands, and hashmap to have that key - value pair look | 39 | // uses vector to keep the ordering of the commands, and hashmap to have that key - value pair look |
| 40 | #[derive(Serialize, Deserialize, Clone)] | 40 | #[derive(Serialize, Deserialize, Clone)] |
| 41 | pub struct CommandsConfigSerde { | 41 | pub struct CommandsConfigSerde { |
| @@ -72,16 +72,16 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 72 | vec![ | 72 | vec![ |
| 73 | HashMap::from([( | 73 | HashMap::from([( |
| 74 | String::from("Play video"), | 74 | String::from("Play video"), |
| 75 | String::from("run ${video-player} ${embed-url}"), | 75 | String::from("run ${video-player} '${embed-url}'"), |
| 76 | )]), | 76 | )]), |
| 77 | HashMap::from([( | 77 | HashMap::from([( |
| 78 | String::from("Play audio"), | 78 | String::from("Play audio"), |
| 79 | String::from("run ${terminal-emulator} ${video-player} ${embed-url} --no-video"), | 79 | String::from("run ${terminal-emulator} ${video-player} '${embed-url}' --no-video"), |
| 80 | )]), | 80 | )]), |
| 81 | HashMap::from([( | 81 | HashMap::from([( |
| 82 | String::from("Play audio (loop)"), | 82 | String::from("Play audio (loop)"), |
| 83 | String::from( | 83 | String::from( |
| 84 | "run ${terminal-emulator} ${video-player} ${embed-url} --no-video --loop-file=inf", | 84 | "run ${terminal-emulator} ${video-player} '${embed-url}' --no-video --loop-file=inf", |
| 85 | ), | 85 | ), |
| 86 | )]), | 86 | )]), |
| 87 | HashMap::from([( | 87 | HashMap::from([( |
| @@ -90,18 +90,18 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 90 | )]), | 90 | )]), |
| 91 | HashMap::from([( | 91 | HashMap::from([( |
| 92 | String::from("Open in browser"), | 92 | String::from("Open in browser"), |
| 93 | String::from("run ${browser} ${url}"), | 93 | String::from("run ${browser} '${url}'"), |
| 94 | )]), | 94 | )]), |
| 95 | HashMap::from([( | 95 | HashMap::from([( |
| 96 | String::from("Download video (webm)"), | 96 | String::from("Download video (webm)"), |
| 97 | String::from( | 97 | String::from( |
| 98 | "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} ${embed-url}", | 98 | "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} '${embed-url}'", |
| 99 | ), | 99 | ), |
| 100 | )]), | 100 | )]), |
| 101 | HashMap::from([( | 101 | HashMap::from([( |
| 102 | String::from("Download audio (opus)"), | 102 | String::from("Download audio (opus)"), |
| 103 | String::from( | 103 | String::from( |
| 104 | "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} ${embed-url} -x", | 104 | "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} '${embed-url}' -x", |
| 105 | ), | 105 | ), |
| 106 | )]), | 106 | )]), |
| 107 | HashMap::from([( | 107 | HashMap::from([( |
| @@ -136,7 +136,7 @@ fn playlist_default() -> Vec<HashMap<String, String>> { | |||
| 136 | )]), | 136 | )]), |
| 137 | HashMap::from([( | 137 | HashMap::from([( |
| 138 | String::from("Open in browser"), | 138 | String::from("Open in browser"), |
| 139 | String::from("run ${browser} ${url}"), | 139 | String::from("run ${browser} '${url}'"), |
| 140 | )]), | 140 | )]), |
| 141 | HashMap::from([( | 141 | HashMap::from([( |
| 142 | String::from("Download all video (webm)"), | 142 | String::from("Download all video (webm)"), |
src/global/functions/mod.rs +2
| @@ -21,3 +21,5 @@ mod from_url; | |||
| 21 | pub use from_url::*; | 21 | pub use from_url::*; |
| 22 | mod envs; | 22 | mod envs; |
| 23 | pub use envs::*; | 23 | pub use envs::*; |
| 24 | mod update_provider; | ||
| 25 | pub use update_provider::*; | ||
src/global/functions/run_command.rs +6 −2
| @@ -11,7 +11,10 @@ use std::{env, io::Stdout, thread}; | |||
| 11 | use tui::{backend::CrosstermBackend, Terminal}; | 11 | use tui::{backend::CrosstermBackend, Terminal}; |
| 12 | use tui_additions::framework::Framework; | 12 | use tui_additions::framework::Framework; |
| 13 | 13 | ||
| 14 | use super::{fake_rand_range, from_channel_url, from_playlist_url, from_video_url, set_clipboard}; | 14 | use super::{ |
| 15 | fake_rand_range, from_channel_url, from_playlist_url, from_video_url, set_clipboard, | ||
| 16 | update_provider, | ||
| 17 | }; | ||
| 15 | 18 | ||
| 16 | /// runs text command - command from the command line (not TUI) which response is just a string | 19 | /// runs text command - command from the command line (not TUI) which response is just a string |
| 17 | pub fn text_command(command: &str) -> Option<String> { | 20 | pub fn text_command(command: &str) -> Option<String> { |
| @@ -67,7 +70,8 @@ pub fn run_single_command( | |||
| 67 | status.provider.rotate(); | 70 | status.provider.rotate(); |
| 68 | status.provider_updated = true; | 71 | status.provider_updated = true; |
| 69 | *framework.data.global.get_mut::<Message>().unwrap() = | 72 | *framework.data.global.get_mut::<Message>().unwrap() = |
| 70 | Message::Success(format!("Provider updated to {}", status.provider.as_str())) | 73 | Message::Success(format!("Provider updated to {}", status.provider.as_str())); |
| 74 | update_provider(&mut framework.data); | ||
| 71 | } | 75 | } |
| 72 | ["loadpage"] => { | 76 | ["loadpage"] => { |
| 73 | *framework.data.global.get_mut::<Message>().unwrap() = | 77 | *framework.data.global.get_mut::<Message>().unwrap() = |
src/global/functions/update_provider.rs added +162
| @@ -0,0 +1,162 @@ | |||
| 1 | use std::env; | ||
| 2 | use tui_additions::framework::FrameworkData; | ||
| 3 | |||
| 4 | use crate::{ | ||
| 5 | config::{MainConfig, Provider}, | ||
| 6 | global::structs::{ | ||
| 7 | ChannelDisplayPage, ChannelDisplayPageType, MainMenuPage, Page, SingleItemPage, StateEnvs, | ||
| 8 | Status, | ||
| 9 | }, | ||
| 10 | }; | ||
| 11 | |||
| 12 | use super::set_envs; | ||
| 13 | |||
| 14 | pub fn update_provider(data: &mut FrameworkData) { | ||
| 15 | let mainconfig = data.global.get::<MainConfig>().unwrap(); | ||
| 16 | let status = data.global.get::<Status>().unwrap(); | ||
| 17 | let page = data.state.get::<Page>().unwrap(); | ||
| 18 | |||
| 19 | let envs = match page { | ||
| 20 | Page::ChannelDisplay(ChannelDisplayPage { id, r#type }) => vec![( | ||
| 21 | String::from("url"), | ||
| 22 | format!( | ||
| 23 | "{}/channel/{id}{}", | ||
| 24 | match status.provider { | ||
| 25 | Provider::YouTube => "https://youtube.com", | ||
| 26 | Provider::Invidious => &mainconfig.invidious_instance, | ||
| 27 | }, | ||
| 28 | match r#type { | ||
| 29 | ChannelDisplayPageType::Main => "", | ||
| 30 | ChannelDisplayPageType::Videos => "/videos", | ||
| 31 | ChannelDisplayPageType::Playlists => "/playlists", | ||
| 32 | } | ||
| 33 | ), | ||
| 34 | )], | ||
| 35 | Page::Search(search) => vec![( | ||
| 36 | String::from("url"), | ||
| 37 | match status.provider { | ||
| 38 | Provider::YouTube => { | ||
| 39 | format!("https://youtube.com/results?{}", search.to_string()) | ||
| 40 | } | ||
| 41 | Provider::Invidious => format!( | ||
| 42 | "{}/search?{}", | ||
| 43 | mainconfig.invidious_instance, | ||
| 44 | search.to_string() | ||
| 45 | ), | ||
| 46 | }, | ||
| 47 | )], | ||
| 48 | Page::MainMenu(MainMenuPage::Popular) => vec![( | ||
| 49 | String::from("url"), | ||
| 50 | match status.provider { | ||
| 51 | Provider::YouTube => String::from("https://youtube.com"), | ||
| 52 | Provider::Invidious => { | ||
| 53 | format!("{}/feed/popular", mainconfig.invidious_instance) | ||
| 54 | } | ||
| 55 | }, | ||
| 56 | )], | ||
| 57 | Page::MainMenu(MainMenuPage::Trending) => vec![( | ||
| 58 | String::from("url"), | ||
| 59 | match status.provider { | ||
| 60 | Provider::YouTube => String::from("https://www.youtube.com/feed/trending"), | ||
| 61 | Provider::Invidious => { | ||
| 62 | format!("{}/feed/trending", mainconfig.invidious_instance) | ||
| 63 | } | ||
| 64 | }, | ||
| 65 | )], | ||
| 66 | Page::MainMenu(MainMenuPage::History) => vec![( | ||
| 67 | String::from("url"), | ||
| 68 | match status.provider { | ||
| 69 | Provider::YouTube => String::from("https://www.youtube.com/feed/history"), | ||
| 70 | Provider::Invidious => { | ||
| 71 | format!("{}/feed/history", mainconfig.invidious_instance) | ||
| 72 | } | ||
| 73 | }, | ||
| 74 | )], | ||
| 75 | Page::SingleItem(SingleItemPage::Video(id)) => vec![ | ||
| 76 | ( | ||
| 77 | String::from("url"), | ||
| 78 | match status.provider { | ||
| 79 | Provider::Invidious => { | ||
| 80 | format!("{}/watch?v={}", mainconfig.invidious_instance, id) | ||
| 81 | } | ||
| 82 | Provider::YouTube => format!("https://youtu.be/{}", id), | ||
| 83 | }, | ||
| 84 | ), | ||
| 85 | ( | ||
| 86 | String::from("embed-url"), | ||
| 87 | match status.provider { | ||
| 88 | Provider::Invidious => { | ||
| 89 | format!("{}/embed/{}", mainconfig.invidious_instance, id) | ||
| 90 | } | ||
| 91 | Provider::YouTube => format!("https://youtube.com/embed/{}", id), | ||
| 92 | }, | ||
| 93 | ), | ||
| 94 | ( | ||
| 95 | String::from("channel-url"), | ||
| 96 | match status.provider { | ||
| 97 | Provider::YouTube => { | ||
| 98 | format!( | ||
| 99 | "https://www.youtube.com/channel/{}", | ||
| 100 | env::var("channel-id").unwrap() | ||
| 101 | ) | ||
| 102 | } | ||
| 103 | Provider::Invidious => format!( | ||
| 104 | "{}/channel/{}", | ||
| 105 | mainconfig.invidious_instance, | ||
| 106 | env::var("channel-id").unwrap() | ||
| 107 | ), | ||
| 108 | }, | ||
| 109 | ), | ||
| 110 | ], | ||
| 111 | Page::SingleItem(SingleItemPage::Playlist(id)) => vec![ | ||
| 112 | ( | ||
| 113 | String::from("url"), | ||
| 114 | match status.provider { | ||
| 115 | Provider::YouTube => { | ||
| 116 | format!("https://www.youtube.com/playlist?list={}", id) | ||
| 117 | } | ||
| 118 | Provider::Invidious => { | ||
| 119 | format!("{}/playlist?list={}", mainconfig.invidious_instance, id) | ||
| 120 | } | ||
| 121 | }, | ||
| 122 | ), | ||
| 123 | ( | ||
| 124 | String::from("all-videos"), | ||
| 125 | match status.provider { | ||
| 126 | Provider::YouTube => env::var("all-ids") | ||
| 127 | .unwrap() | ||
| 128 | .split(' ') | ||
| 129 | .map(|id| format!("'https://youtu.be/{id}'")) | ||
| 130 | .collect::<Vec<_>>() | ||
| 131 | .join(" "), | ||
| 132 | Provider::Invidious => env::var("all-ids") | ||
| 133 | .unwrap() | ||
| 134 | .split(' ') | ||
| 135 | .map(|id| format!("'{}/watch?v={id}'", mainconfig.invidious_instance,)) | ||
| 136 | .collect::<Vec<_>>() | ||
| 137 | .join(" "), | ||
| 138 | }, | ||
| 139 | ), | ||
| 140 | ( | ||
| 141 | String::from("channel-url"), | ||
| 142 | match status.provider { | ||
| 143 | Provider::YouTube => format!( | ||
| 144 | "https://www.youtube.com/channel/{}", | ||
| 145 | env::var("channel-id").unwrap() | ||
| 146 | ), | ||
| 147 | Provider::Invidious => format!( | ||
| 148 | "{}/channel/{}", | ||
| 149 | mainconfig.invidious_instance, | ||
| 150 | env::var("channel-id").unwrap() | ||
| 151 | ), | ||
| 152 | }, | ||
| 153 | ), | ||
| 154 | ], | ||
| 155 | }; | ||
| 156 | |||
| 157 | data.global.get_mut::<Status>().unwrap().provider_updated = true; | ||
| 158 | set_envs( | ||
| 159 | envs.into_iter(), | ||
| 160 | &mut data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 161 | ); | ||
| 162 | } | ||
src/global/structs/item.rs +7
| @@ -192,6 +192,13 @@ impl Item { | |||
| 192 | _ => Err(Errors::StrError("not a mini channel")), | 192 | _ => Err(Errors::StrError("not a mini channel")), |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | |||
| 196 | pub fn fullchannel(&self) -> Result<&FullChannelItem, Errors> { | ||
| 197 | match self { | ||
| 198 | Self::FullChannel(fullchannel) => Ok(fullchannel), | ||
| 199 | _ => Err(Errors::StrError("not a full channel")), | ||
| 200 | } | ||
| 201 | } | ||
| 195 | } | 202 | } |
| 196 | 203 | ||
| 197 | impl Item { | 204 | impl Item { |
src/global/structs/tasks.rs +3 −1
| @@ -1,6 +1,6 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | config::{AppearanceConfig, MainConfig, MinDimentions}, | 2 | config::{AppearanceConfig, MainConfig, MinDimentions}, |
| 3 | global::functions::{clear_envs, run_command, set_envs}, | 3 | global::functions::{clear_envs, run_command, set_envs, update_provider}, |
| 4 | }; | 4 | }; |
| 5 | 5 | ||
| 6 | use super::{message::Message, page::Page, status::Status, StateEnvs}; | 6 | use super::{message::Message, page::Page, status::Status, StateEnvs}; |
| @@ -139,6 +139,7 @@ impl TaskQueue { | |||
| 139 | } else { | 139 | } else { |
| 140 | Message::None | 140 | Message::None |
| 141 | }; | 141 | }; |
| 142 | update_provider(&mut framework.data); | ||
| 142 | Self::render(framework, terminal)?; | 143 | Self::render(framework, terminal)?; |
| 143 | } | 144 | } |
| 144 | 145 | ||
| @@ -167,6 +168,7 @@ impl TaskQueue { | |||
| 167 | } else { | 168 | } else { |
| 168 | Message::None | 169 | Message::None |
| 169 | }; | 170 | }; |
| 171 | update_provider(&mut framework.data); | ||
| 170 | Self::render(framework, terminal)?; | 172 | Self::render(framework, terminal)?; |
| 171 | } | 173 | } |
| 172 | 174 | ||
src/init.rs +1
| @@ -76,6 +76,7 @@ pub fn init( | |||
| 76 | Ok(()) | 76 | Ok(()) |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /// reload all config files | ||
| 79 | pub fn load_configs(framework: &mut FrameworkClean) -> Result<(), Box<dyn Error>> { | 80 | pub fn load_configs(framework: &mut FrameworkClean) -> Result<(), Box<dyn Error>> { |
| 80 | let home_dir = home_dir().unwrap(); | 81 | let home_dir = home_dir().unwrap(); |
| 81 | let config_path = home_dir.join(".config/youtube-tui/"); | 82 | let config_path = home_dir.join(".config/youtube-tui/"); |
src/items/channeldisplay.rs +65 −6
| @@ -1,11 +1,11 @@ | |||
| 1 | use super::ItemInfo; | 1 | use super::ItemInfo; |
| 2 | use crate::{ | 2 | use crate::{ |
| 3 | config::{AppearanceConfig, KeyBindingsConfig, MainConfig}, | 3 | config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Provider}, |
| 4 | global::{ | 4 | global::{ |
| 5 | functions::download_all_images, | 5 | functions::{download_all_images, set_envs}, |
| 6 | structs::{ | 6 | structs::{ |
| 7 | ChannelDisplayPageType, InvidiousClient, Item, KeyAction, Message, Page, | 7 | ChannelDisplayPageType, InvidiousClient, Item, KeyAction, Message, Page, |
| 8 | SingleItemPage, Status, Task, Tasks, | 8 | SingleItemPage, StateEnvs, Status, Task, Tasks, |
| 9 | }, | 9 | }, |
| 10 | }, | 10 | }, |
| 11 | }; | 11 | }; |
| @@ -49,6 +49,43 @@ impl Default for ChannelDisplay { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | impl ChannelDisplay { | 51 | impl ChannelDisplay { |
| 52 | fn infalte_item_update( | ||
| 53 | &self, | ||
| 54 | mainconfig: &MainConfig, | ||
| 55 | status: &Status, | ||
| 56 | ) -> Vec<(String, String)> { | ||
| 57 | match self { | ||
| 58 | ChannelDisplay::Videos { | ||
| 59 | videos, textlist, .. | ||
| 60 | } => vec![( | ||
| 61 | String::from("hover-url"), | ||
| 62 | format!( | ||
| 63 | "{}/watch?v={}", | ||
| 64 | match status.provider { | ||
| 65 | Provider::YouTube => "https://youtube.com", | ||
| 66 | Provider::Invidious => &mainconfig.invidious_instance, | ||
| 67 | }, | ||
| 68 | videos[textlist.selected].id().unwrap_or_default() | ||
| 69 | ), | ||
| 70 | )], | ||
| 71 | ChannelDisplay::Playlists { | ||
| 72 | playlists, | ||
| 73 | textlist, | ||
| 74 | .. | ||
| 75 | } => vec![( | ||
| 76 | String::from("hover-url"), | ||
| 77 | format!( | ||
| 78 | "{}/playlist?list={}", | ||
| 79 | match status.provider { | ||
| 80 | Provider::YouTube => "https://youtube.com", | ||
| 81 | Provider::Invidious => &mainconfig.invidious_instance, | ||
| 82 | }, | ||
| 83 | playlists[textlist.selected].id().unwrap_or_default() | ||
| 84 | ), | ||
| 85 | )], | ||
| 86 | _ => Vec::new(), | ||
| 87 | } | ||
| 88 | } | ||
| 52 | /// update the style of the item (colours, etc), ran on ever render | 89 | /// update the style of the item (colours, etc), ran on ever render |
| 53 | fn update_appearance( | 90 | fn update_appearance( |
| 54 | &mut self, | 91 | &mut self, |
| @@ -302,6 +339,14 @@ impl FrameworkItem for ChannelDisplay { | |||
| 302 | .unwrap() | 339 | .unwrap() |
| 303 | .render_image = true; | 340 | .render_image = true; |
| 304 | iteminfo.item = Some(videos[textlist.selected].clone()); | 341 | iteminfo.item = Some(videos[textlist.selected].clone()); |
| 342 | set_envs( | ||
| 343 | self.infalte_item_update( | ||
| 344 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 345 | framework.data.global.get::<Status>().unwrap(), | ||
| 346 | ) | ||
| 347 | .into_iter(), | ||
| 348 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 349 | ); | ||
| 305 | } | 350 | } |
| 306 | } | 351 | } |
| 307 | Self::Playlists { | 352 | Self::Playlists { |
| @@ -430,6 +475,12 @@ impl FrameworkItem for ChannelDisplay { | |||
| 430 | } | 475 | } |
| 431 | } | 476 | } |
| 432 | 477 | ||
| 478 | set_envs( | ||
| 479 | self.infalte_item_update(mainconfig, framework.data.global.get::<Status>().unwrap()) | ||
| 480 | .into_iter(), | ||
| 481 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 482 | ); | ||
| 483 | |||
| 433 | Ok(()) | 484 | Ok(()) |
| 434 | } | 485 | } |
| 435 | 486 | ||
| @@ -442,7 +493,7 @@ impl FrameworkItem for ChannelDisplay { | |||
| 442 | _absolute_y: u16, | 493 | _absolute_y: u16, |
| 443 | ) -> bool { | 494 | ) -> bool { |
| 444 | match self { | 495 | match self { |
| 445 | Self::None | Self::Main { .. } => false, | 496 | Self::None | Self::Main { .. } => return false, |
| 446 | Self::Videos { textlist, grid, .. } | Self::Playlists { textlist, grid, .. } => { | 497 | Self::Videos { textlist, grid, .. } | Self::Playlists { textlist, grid, .. } => { |
| 447 | let chunk = grid | 498 | let chunk = grid |
| 448 | .chunks( | 499 | .chunks( |
| @@ -492,9 +543,17 @@ impl FrameworkItem for ChannelDisplay { | |||
| 492 | .get_mut::<Status>() | 543 | .get_mut::<Status>() |
| 493 | .unwrap() | 544 | .unwrap() |
| 494 | .render_image = true; | 545 | .render_image = true; |
| 495 | |||
| 496 | true | ||
| 497 | } | 546 | } |
| 498 | } | 547 | } |
| 548 | set_envs( | ||
| 549 | self.infalte_item_update( | ||
| 550 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 551 | framework.data.global.get::<Status>().unwrap(), | ||
| 552 | ) | ||
| 553 | .into_iter(), | ||
| 554 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 555 | ); | ||
| 556 | |||
| 557 | true | ||
| 499 | } | 558 | } |
| 500 | } | 559 | } |
src/items/itemlist.rs +70 −57
| @@ -13,7 +13,7 @@ use super::ItemInfo; | |||
| 13 | use crate::{ | 13 | use crate::{ |
| 14 | config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Provider, Search}, | 14 | config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Provider, Search}, |
| 15 | global::{ | 15 | global::{ |
| 16 | functions::{download_all_images, set_envs}, | 16 | functions::{download_all_images, set_envs, update_provider}, |
| 17 | structs::{ | 17 | structs::{ |
| 18 | ChannelDisplayPage, ChannelDisplayPageType, FullChannelItem, FullPlaylistItem, | 18 | ChannelDisplayPage, ChannelDisplayPageType, FullChannelItem, FullPlaylistItem, |
| 19 | FullVideoItem, InvidiousClient, Item, KeyAction, MainMenuPage, Message, | 19 | FullVideoItem, InvidiousClient, Item, KeyAction, MainMenuPage, Message, |
| @@ -34,45 +34,54 @@ pub struct ItemList { | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | impl ItemList { | 36 | impl ItemList { |
| 37 | pub fn inflate_provider_update( | 37 | pub fn infalte_item_update( |
| 38 | &self, | 38 | &self, |
| 39 | page: &Page, | ||
| 40 | mainconfig: &MainConfig, | 39 | mainconfig: &MainConfig, |
| 41 | status: &Status, | 40 | status: &Status, |
| 42 | ) -> Vec<(String, String)> { | 41 | ) -> Vec<(String, String)> { |
| 43 | match page { | 42 | match &self.items[self.textlist.selected] { |
| 44 | Page::Search(search) => vec![( | 43 | Item::MiniVideo(MiniVideoItem { id, .. }) |
| 45 | String::from("url"), | 44 | | Item::FullVideo(FullVideoItem { id, .. }) => { |
| 46 | match status.provider { | 45 | vec![( |
| 47 | Provider::YouTube => { | 46 | String::from("hover-url"), |
| 48 | format!("'https://youtube.com/results?{}'", search.to_string()) | 47 | format!( |
| 49 | } | 48 | "{}/watch?v={id}", |
| 50 | Provider::Invidious => format!( | 49 | match status.provider { |
| 51 | "'{}/search?{}'", | 50 | Provider::YouTube => "https://youtube.com", |
| 52 | mainconfig.invidious_instance, | 51 | Provider::Invidious => &mainconfig.invidious_instance, |
| 53 | search.to_string() | 52 | } |
| 54 | ), | 53 | ), |
| 55 | }, | 54 | )] |
| 56 | )], | 55 | } |
| 57 | Page::MainMenu(MainMenuPage::Popular) => vec![( | 56 | Item::MiniPlaylist(MiniPlaylistItem { id, .. }) |
| 58 | String::from("url"), | 57 | | Item::FullPlaylist(FullPlaylistItem { id, .. }) => { |
| 59 | match status.provider { | 58 | vec![( |
| 60 | Provider::YouTube => String::from("'https://youtube.com'"), | 59 | String::from("hover-url"), |
| 61 | Provider::Invidious => { | 60 | format!( |
| 62 | format!("'{}/feed/popular'", mainconfig.invidious_instance) | 61 | "{}/playlist?list={id}", |
| 63 | } | 62 | match status.provider { |
| 64 | }, | 63 | Provider::YouTube => "https://youtube.com", |
| 65 | )], | 64 | Provider::Invidious => &mainconfig.invidious_instance, |
| 66 | Page::MainMenu(MainMenuPage::Trending) => vec![( | 65 | } |
| 67 | String::from("url"), | 66 | ), |
| 68 | match status.provider { | 67 | )] |
| 69 | Provider::YouTube => String::from("'https://www.youtube.com/feed/trending'"), | 68 | } |
| 70 | Provider::Invidious => { | 69 | Item::MiniChannel(MiniChannelItem { id, .. }) |
| 71 | format!("{}/feed/trending'", mainconfig.invidious_instance) | 70 | | Item::FullChannel(FullChannelItem { id, .. }) => { |
| 72 | } | 71 | vec![( |
| 73 | }, | 72 | String::from("hover-url"), |
| 74 | )], | 73 | format!( |
| 75 | _ => Vec::new(), | 74 | "{}/channel/{id}", |
| 75 | match status.provider { | ||
| 76 | Provider::YouTube => "https://youtube.com", | ||
| 77 | Provider::Invidious => &mainconfig.invidious_instance, | ||
| 78 | } | ||
| 79 | ), | ||
| 80 | )] | ||
| 81 | } | ||
| 82 | Item::Page(_) | Item::Unknown(_) => { | ||
| 83 | vec![(String::from("hover-url"), String::from("not avaliable"))] | ||
| 84 | } | ||
| 76 | } | 85 | } |
| 77 | } | 86 | } |
| 78 | 87 | ||
| @@ -190,21 +199,16 @@ impl FrameworkItem for ItemList { | |||
| 190 | } | 199 | } |
| 191 | 200 | ||
| 192 | let status = framework.data.global.get::<Status>().unwrap(); | 201 | let status = framework.data.global.get::<Status>().unwrap(); |
| 202 | let appearance = framework.data.global.get::<AppearanceConfig>().unwrap(); | ||
| 203 | let mainconfig = framework.data.global.get::<MainConfig>().unwrap(); | ||
| 193 | 204 | ||
| 194 | if status.provider_updated { | 205 | if status.provider_updated { |
| 195 | set_envs( | 206 | set_envs( |
| 196 | self.inflate_provider_update( | 207 | self.infalte_item_update(mainconfig, status).into_iter(), |
| 197 | framework.data.state.get::<Page>().unwrap(), | ||
| 198 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 199 | status, | ||
| 200 | ) | ||
| 201 | .into_iter(), | ||
| 202 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | 208 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, |
| 203 | ); | 209 | ); |
| 204 | } | 210 | } |
| 205 | 211 | ||
| 206 | let appearance = framework.data.global.get::<AppearanceConfig>().unwrap(); | ||
| 207 | let mainconfig = framework.data.global.get::<MainConfig>().unwrap(); | ||
| 208 | self.update_appearance(appearance, mainconfig, &info); | 212 | self.update_appearance(appearance, mainconfig, &info); |
| 209 | 213 | ||
| 210 | // creates the grid | 214 | // creates the grid |
| @@ -299,14 +303,10 @@ impl FrameworkItem for ItemList { | |||
| 299 | _ => unreachable!("item `ItemList` cannot be used in `{page:?}`"), | 303 | _ => unreachable!("item `ItemList` cannot be used in `{page:?}`"), |
| 300 | } | 304 | } |
| 301 | 305 | ||
| 302 | if framework | 306 | let mainconfig = framework.data.global.get::<MainConfig>().unwrap(); |
| 303 | .data | 307 | let status = framework.data.global.get::<Status>().unwrap(); |
| 304 | .global | 308 | |
| 305 | .get::<MainConfig>() | 309 | if mainconfig.images.display() { |
| 306 | .unwrap() | ||
| 307 | .images | ||
| 308 | .display() | ||
| 309 | { | ||
| 310 | // download thumbnails of all videos in the list | 310 | // download thumbnails of all videos in the list |
| 311 | download_all_images(self.items.iter().map(|item| item.into()).collect()); | 311 | download_all_images(self.items.iter().map(|item| item.into()).collect()); |
| 312 | } | 312 | } |
| @@ -316,14 +316,10 @@ impl FrameworkItem for ItemList { | |||
| 316 | self.update(); | 316 | self.update(); |
| 317 | 317 | ||
| 318 | set_envs( | 318 | set_envs( |
| 319 | self.inflate_provider_update( | 319 | self.infalte_item_update(mainconfig, status).into_iter(), |
| 320 | framework.data.state.get::<Page>().unwrap(), | ||
| 321 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 322 | framework.data.global.get::<Status>().unwrap(), | ||
| 323 | ) | ||
| 324 | .into_iter(), | ||
| 325 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | 320 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, |
| 326 | ); | 321 | ); |
| 322 | update_provider(framework.data); | ||
| 327 | 323 | ||
| 328 | Ok(()) | 324 | Ok(()) |
| 329 | } | 325 | } |
| @@ -361,6 +357,15 @@ impl FrameworkItem for ItemList { | |||
| 361 | 357 | ||
| 362 | // only create a render task if the key event actually changed something | 358 | // only create a render task if the key event actually changed something |
| 363 | if updated { | 359 | if updated { |
| 360 | set_envs( | ||
| 361 | self.infalte_item_update( | ||
| 362 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 363 | framework.data.global.get::<Status>().unwrap(), | ||
| 364 | ) | ||
| 365 | .into_iter(), | ||
| 366 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 367 | ); | ||
| 368 | |||
| 364 | framework | 369 | framework |
| 365 | .data | 370 | .data |
| 366 | .global | 371 | .global |
| @@ -430,6 +435,14 @@ impl FrameworkItem for ItemList { | |||
| 430 | } | 435 | } |
| 431 | 436 | ||
| 432 | self.update(); | 437 | self.update(); |
| 438 | set_envs( | ||
| 439 | self.infalte_item_update( | ||
| 440 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 441 | framework.data.global.get::<Status>().unwrap(), | ||
| 442 | ) | ||
| 443 | .into_iter(), | ||
| 444 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 445 | ); | ||
| 433 | 446 | ||
| 434 | // render the new image | 447 | // render the new image |
| 435 | framework | 448 | framework |
src/items/singleitem.rs +149 −204
| @@ -132,7 +132,7 @@ impl SingleVideoItem { | |||
| 132 | String::from("url"), | 132 | String::from("url"), |
| 133 | match status.provider { | 133 | match status.provider { |
| 134 | Provider::Invidious => format!( | 134 | Provider::Invidious => format!( |
| 135 | "'{}/watch?v={}'", | 135 | "{}/watch?v={}", |
| 136 | mainconfig.invidious_instance, video_item.id | 136 | mainconfig.invidious_instance, video_item.id |
| 137 | ), | 137 | ), |
| 138 | Provider::YouTube => format!("'https://youtu.be/{}'", video_item.id), | 138 | Provider::YouTube => format!("'https://youtu.be/{}'", video_item.id), |
| @@ -142,55 +142,9 @@ impl SingleVideoItem { | |||
| 142 | ( | 142 | ( |
| 143 | String::from("embed-url"), | 143 | String::from("embed-url"), |
| 144 | match status.provider { | 144 | match status.provider { |
| 145 | Provider::Invidious => format!( | 145 | Provider::Invidious => { |
| 146 | "'{}/embed/{}'", | 146 | format!("{}/embed/{}", mainconfig.invidious_instance, video_item.id) |
| 147 | mainconfig.invidious_instance, video_item.id | ||
| 148 | ), | ||
| 149 | Provider::YouTube => format!("'https://youtube.com/embed/{}'", video_item.id), | ||
| 150 | }, | ||
| 151 | ), | ||
| 152 | (String::from("channel-id"), video_item.channel_id.clone()), | ||
| 153 | ( | ||
| 154 | String::from("channel-url"), | ||
| 155 | match status.provider { | ||
| 156 | Provider::YouTube => { | ||
| 157 | format!("https://www.youtube.com/channel/{}", video_item.channel_id) | ||
| 158 | } | 147 | } |
| 159 | Provider::Invidious => format!( | ||
| 160 | "{}/channel/{}", | ||
| 161 | mainconfig.invidious_instance, video_item.channel_id | ||
| 162 | ), | ||
| 163 | }, | ||
| 164 | ), | ||
| 165 | ] | ||
| 166 | } | ||
| 167 | |||
| 168 | pub fn inflate_provider_update( | ||
| 169 | &self, | ||
| 170 | mainconfig: &MainConfig, | ||
| 171 | status: &Status, | ||
| 172 | item: &Item, | ||
| 173 | ) -> Vec<(String, String)> { | ||
| 174 | let video_item = item.fullvideo().unwrap(); | ||
| 175 | |||
| 176 | vec![ | ||
| 177 | ( | ||
| 178 | String::from("url"), | ||
| 179 | match status.provider { | ||
| 180 | Provider::Invidious => format!( | ||
| 181 | "'{}/watch?v={}'", | ||
| 182 | mainconfig.invidious_instance, video_item.id | ||
| 183 | ), | ||
| 184 | Provider::YouTube => format!("'https://youtu.be/{}'", video_item.id), | ||
| 185 | }, | ||
| 186 | ), | ||
| 187 | ( | ||
| 188 | String::from("embed-url"), | ||
| 189 | match status.provider { | ||
| 190 | Provider::Invidious => format!( | ||
| 191 | "'{}/embed/{}'", | ||
| 192 | mainconfig.invidious_instance, video_item.id | ||
| 193 | ), | ||
| 194 | Provider::YouTube => format!("'https://youtube.com/embed/{}'", video_item.id), | 148 | Provider::YouTube => format!("'https://youtube.com/embed/{}'", video_item.id), |
| 195 | }, | 149 | }, |
| 196 | ), | 150 | ), |
| @@ -318,67 +272,14 @@ impl SinglePlaylistItem { | |||
| 318 | vec![ | 272 | vec![ |
| 319 | (String::from("id"), playlist_item.id.clone()), | 273 | (String::from("id"), playlist_item.id.clone()), |
| 320 | (String::from("channel-id"), playlist_item.channel_id.clone()), | 274 | (String::from("channel-id"), playlist_item.channel_id.clone()), |
| 321 | ] | ||
| 322 | } | ||
| 323 | |||
| 324 | pub fn inflate_provider_update( | ||
| 325 | &self, | ||
| 326 | mainconfig: &MainConfig, | ||
| 327 | status: &Status, | ||
| 328 | item: &Item, | ||
| 329 | ) -> Vec<(String, String)> { | ||
| 330 | let playlist_item = item.fullplaylist().unwrap(); | ||
| 331 | |||
| 332 | vec![ | ||
| 333 | ( | ||
| 334 | String::from("url"), | ||
| 335 | match status.provider { | ||
| 336 | Provider::YouTube => { | ||
| 337 | format!("https://www.youtube.com/playlist?list={}", playlist_item.id) | ||
| 338 | } | ||
| 339 | Provider::Invidious => format!( | ||
| 340 | "{}/playlist?list={}", | ||
| 341 | mainconfig.invidious_instance, playlist_item.id | ||
| 342 | ), | ||
| 343 | }, | ||
| 344 | ), | ||
| 345 | ( | 275 | ( |
| 346 | String::from("all-videos"), | 276 | String::from("all-ids"), |
| 347 | match status.provider { | 277 | playlist_item |
| 348 | Provider::YouTube => playlist_item | 278 | .videos |
| 349 | .videos | 279 | .iter() |
| 350 | .iter() | 280 | .map(|video| video.minivideo().unwrap().id.as_str()) |
| 351 | .map(|video| { | 281 | .collect::<Vec<&str>>() |
| 352 | format!("'https://youtu.be/{}'", video.minivideo().unwrap().id) | 282 | .join(" "), |
| 353 | }) | ||
| 354 | .collect::<Vec<_>>() | ||
| 355 | .join(" "), | ||
| 356 | Provider::Invidious => playlist_item | ||
| 357 | .videos | ||
| 358 | .iter() | ||
| 359 | .map(|video| { | ||
| 360 | format!( | ||
| 361 | "'{}/watch?v={}'", | ||
| 362 | mainconfig.invidious_instance, | ||
| 363 | video.minivideo().unwrap().id | ||
| 364 | ) | ||
| 365 | }) | ||
| 366 | .collect::<Vec<_>>() | ||
| 367 | .join(" "), | ||
| 368 | }, | ||
| 369 | ), | ||
| 370 | ( | ||
| 371 | String::from("channel-url"), | ||
| 372 | match status.provider { | ||
| 373 | Provider::YouTube => format!( | ||
| 374 | "https://www.youtube.com/channel/{}", | ||
| 375 | playlist_item.channel_id | ||
| 376 | ), | ||
| 377 | Provider::Invidious => format!( | ||
| 378 | "{}/channel/{}", | ||
| 379 | mainconfig.invidious_instance, playlist_item.channel_id | ||
| 380 | ), | ||
| 381 | }, | ||
| 382 | ), | 283 | ), |
| 383 | ] | 284 | ] |
| 384 | } | 285 | } |
| @@ -424,32 +325,40 @@ impl SingleItemType { | |||
| 424 | Self::None => Vec::new(), | 325 | Self::None => Vec::new(), |
| 425 | } | 326 | } |
| 426 | } | 327 | } |
| 328 | } | ||
| 427 | 329 | ||
| 428 | pub fn inflate_provider_update( | 330 | impl SingleItem { |
| 331 | fn infalte_item_update( | ||
| 429 | &self, | 332 | &self, |
| 430 | mainconfig: &MainConfig, | 333 | mainconfig: &MainConfig, |
| 431 | status: &Status, | 334 | status: &Status, |
| 432 | item: &Option<Item>, | ||
| 433 | ) -> Vec<(String, String)> { | 335 | ) -> Vec<(String, String)> { |
| 434 | let item = if let Some(item) = item.as_ref() { | 336 | if let SingleItemType::Playlist(singleplaylistitem) = &self.r#type { |
| 435 | item | 337 | if singleplaylistitem.videos_view.selected == 0 { |
| 436 | } else { | 338 | return vec![(String::from("hover-url"), String::from("not avaliable"))]; |
| 437 | return Vec::new(); | ||
| 438 | }; | ||
| 439 | |||
| 440 | match self { | ||
| 441 | Self::Video(singlevideoitem) => { | ||
| 442 | singlevideoitem.inflate_provider_update(mainconfig, status, item) | ||
| 443 | } | ||
| 444 | Self::Playlist(singleplaylistitem) => { | ||
| 445 | singleplaylistitem.inflate_provider_update(mainconfig, status, item) | ||
| 446 | } | 339 | } |
| 447 | Self::None => Vec::new(), | 340 | vec![( |
| 341 | String::from("hover-url"), | ||
| 342 | match &self.item { | ||
| 343 | Some(item) => format!( | ||
| 344 | "{}/watch?v={}", | ||
| 345 | match status.provider { | ||
| 346 | Provider::YouTube => "https://youtube.com", | ||
| 347 | Provider::Invidious => &mainconfig.invidious_instance, | ||
| 348 | }, | ||
| 349 | item.fullplaylist().unwrap().videos | ||
| 350 | [singleplaylistitem.videos_view.selected - 1] | ||
| 351 | .minivideo() | ||
| 352 | .unwrap() | ||
| 353 | .id | ||
| 354 | ), | ||
| 355 | None => String::from("not avaliable"), | ||
| 356 | }, | ||
| 357 | )] | ||
| 358 | } else { | ||
| 359 | vec![(String::from("hover-url"), String::from("not avaliable"))] | ||
| 448 | } | 360 | } |
| 449 | } | 361 | } |
| 450 | } | ||
| 451 | |||
| 452 | impl SingleItem { | ||
| 453 | /// update colours and layout every render | 362 | /// update colours and layout every render |
| 454 | fn update_appearance( | 363 | fn update_appearance( |
| 455 | &mut self, | 364 | &mut self, |
| @@ -573,25 +482,18 @@ impl FrameworkItem for SingleItem { | |||
| 573 | popup_render: bool, | 482 | popup_render: bool, |
| 574 | info: tui_additions::framework::ItemInfo, | 483 | info: tui_additions::framework::ItemInfo, |
| 575 | ) { | 484 | ) { |
| 485 | let status = framework.data.global.get::<Status>().unwrap(); | ||
| 576 | if popup_render { | 486 | if popup_render { |
| 577 | return; | 487 | return; |
| 578 | } | 488 | } |
| 579 | 489 | ||
| 580 | if framework | 490 | if status.provider_updated { |
| 581 | .data | ||
| 582 | .global | ||
| 583 | .get::<Status>() | ||
| 584 | .unwrap() | ||
| 585 | .provider_updated | ||
| 586 | { | ||
| 587 | set_envs( | 491 | set_envs( |
| 588 | self.r#type | 492 | self.infalte_item_update( |
| 589 | .inflate_provider_update( | 493 | framework.data.global.get::<MainConfig>().unwrap(), |
| 590 | framework.data.global.get::<MainConfig>().unwrap(), | 494 | status, |
| 591 | framework.data.global.get::<Status>().unwrap(), | 495 | ) |
| 592 | &self.item, | 496 | .into_iter(), |
| 593 | ) | ||
| 594 | .into_iter(), | ||
| 595 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | 497 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, |
| 596 | ); | 498 | ); |
| 597 | } | 499 | } |
| @@ -611,18 +513,20 @@ impl FrameworkItem for SingleItem { | |||
| 611 | match &mut self.r#type { | 513 | match &mut self.r#type { |
| 612 | SingleItemType::Video(typeinfo) => { | 514 | SingleItemType::Video(typeinfo) => { |
| 613 | // 2 by 1 grid, item info in the first cell and textlist at the second | 515 | // 2 by 1 grid, item info in the first cell and textlist at the second |
| 614 | typeinfo.update_provider().into_iter().for_each(|index| { | 516 | if status.provider_updated { |
| 615 | typeinfo.textlist.items[index] = typeinfo.commands[index].0.clone().replace( | 517 | typeinfo.update_provider().into_iter().for_each(|index| { |
| 616 | "${provider}", | 518 | typeinfo.textlist.items[index] = typeinfo.commands[index].0.clone().replace( |
| 617 | framework | 519 | "${provider}", |
| 618 | .data | 520 | framework |
| 619 | .global | 521 | .data |
| 620 | .get::<Status>() | 522 | .global |
| 621 | .unwrap() | 523 | .get::<Status>() |
| 622 | .provider | 524 | .unwrap() |
| 623 | .as_str(), | 525 | .provider |
| 624 | ) | 526 | .as_str(), |
| 625 | }); | 527 | ) |
| 528 | }); | ||
| 529 | } | ||
| 626 | self.iteminfo | 530 | self.iteminfo |
| 627 | .render(frame, framework, chunks[0], popup_render, info); | 531 | .render(frame, framework, chunks[0], popup_render, info); |
| 628 | typeinfo.textlist.set_height(chunks[1].height); | 532 | typeinfo.textlist.set_height(chunks[1].height); |
| @@ -634,22 +538,22 @@ impl FrameworkItem for SingleItem { | |||
| 634 | // | 538 | // |
| 635 | // item info in the first cell, textlists in the second, hovering video on 3rd (if | 539 | // item info in the first cell, textlists in the second, hovering video on 3rd (if |
| 636 | // present) | 540 | // present) |
| 637 | self.iteminfo | ||
| 638 | .render(frame, framework, chunks[0], popup_render, info); | ||
| 639 | if typeinfo.is_commands_view { | 541 | if typeinfo.is_commands_view { |
| 640 | typeinfo.update_provider().into_iter().for_each(|index| { | 542 | if status.provider_updated { |
| 641 | typeinfo.commands_view.items[index] = | 543 | typeinfo.update_provider().into_iter().for_each(|index| { |
| 642 | typeinfo.commands[index].0.clone().replace( | 544 | typeinfo.commands_view.items[index] = |
| 643 | "${provider}", | 545 | typeinfo.commands[index].0.clone().replace( |
| 644 | framework | 546 | "${provider}", |
| 645 | .data | 547 | framework |
| 646 | .global | 548 | .data |
| 647 | .get::<Status>() | 549 | .global |
| 648 | .unwrap() | 550 | .get::<Status>() |
| 649 | .provider | 551 | .unwrap() |
| 650 | .as_str(), | 552 | .provider |
| 651 | ) | 553 | .as_str(), |
| 652 | }); | 554 | ) |
| 555 | }); | ||
| 556 | } | ||
| 653 | typeinfo.commands_view.set_height(chunks[1].height); | 557 | typeinfo.commands_view.set_height(chunks[1].height); |
| 654 | frame.render_widget(typeinfo.commands_view.clone(), chunks[1]); | 558 | frame.render_widget(typeinfo.commands_view.clone(), chunks[1]); |
| 655 | } else { | 559 | } else { |
| @@ -666,6 +570,8 @@ impl FrameworkItem for SingleItem { | |||
| 666 | ); | 570 | ); |
| 667 | } | 571 | } |
| 668 | } | 572 | } |
| 573 | self.iteminfo | ||
| 574 | .render(frame, framework, chunks[0], popup_render, info); | ||
| 669 | } | 575 | } |
| 670 | SingleItemType::None => {} | 576 | SingleItemType::None => {} |
| 671 | } | 577 | } |
| @@ -726,28 +632,6 @@ impl FrameworkItem for SingleItem { | |||
| 726 | } | 632 | } |
| 727 | }; | 633 | }; |
| 728 | self.iteminfo.item = self.item.clone(); | 634 | self.iteminfo.item = self.item.clone(); |
| 729 | // need to update provider every time the item loads or else it will display `${provider}` | ||
| 730 | // instead of the actual provider (e.g. `YouTube`) | ||
| 731 | set_envs( | ||
| 732 | self.r#type | ||
| 733 | .inflate_load( | ||
| 734 | mainconfig, | ||
| 735 | framework.data.global.get::<Status>().unwrap(), | ||
| 736 | &self.item, | ||
| 737 | ) | ||
| 738 | .into_iter(), | ||
| 739 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 740 | ); | ||
| 741 | set_envs( | ||
| 742 | self.r#type | ||
| 743 | .inflate_provider_update( | ||
| 744 | mainconfig, | ||
| 745 | framework.data.global.get::<Status>().unwrap(), | ||
| 746 | &self.item, | ||
| 747 | ) | ||
| 748 | .into_iter(), | ||
| 749 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 750 | ); | ||
| 751 | 635 | ||
| 752 | if let Some(item) = &self.item { | 636 | if let Some(item) = &self.item { |
| 753 | if item.is_unknown() { | 637 | if item.is_unknown() { |
| @@ -768,6 +652,26 @@ impl FrameworkItem for SingleItem { | |||
| 768 | watch_history.save()?; | 652 | watch_history.save()?; |
| 769 | } | 653 | } |
| 770 | 654 | ||
| 655 | let mainconfig = framework.data.global.get::<MainConfig>().unwrap(); | ||
| 656 | // need to update provider every time the item loads or else it will display `${provider}` | ||
| 657 | // instead of the actual provider (e.g. `YouTube`) | ||
| 658 | set_envs( | ||
| 659 | self.r#type | ||
| 660 | .inflate_load( | ||
| 661 | mainconfig, | ||
| 662 | framework.data.global.get::<Status>().unwrap(), | ||
| 663 | &self.item, | ||
| 664 | ) | ||
| 665 | .into_iter(), | ||
| 666 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 667 | ); | ||
| 668 | |||
| 669 | set_envs( | ||
| 670 | self.infalte_item_update(mainconfig, framework.data.global.get::<Status>().unwrap()) | ||
| 671 | .into_iter(), | ||
| 672 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 673 | ); | ||
| 674 | |||
| 771 | Ok(()) | 675 | Ok(()) |
| 772 | } | 676 | } |
| 773 | 677 | ||
| @@ -823,7 +727,7 @@ impl FrameworkItem for SingleItem { | |||
| 823 | _ => false, | 727 | _ => false, |
| 824 | } | 728 | } |
| 825 | } else { | 729 | } else { |
| 826 | match action { | 730 | let updated = match action { |
| 827 | // checks if it is updated, if it is and selected is not 0 (is hovering on | 731 | // checks if it is updated, if it is and selected is not 0 (is hovering on |
| 828 | // a video), then also need to update the iteminfo | 732 | // a video), then also need to update the iteminfo |
| 829 | KeyAction::MoveUp => { | 733 | KeyAction::MoveUp => { |
| @@ -838,6 +742,8 @@ impl FrameworkItem for SingleItem { | |||
| 838 | .unwrap() | 742 | .unwrap() |
| 839 | .priority | 743 | .priority |
| 840 | .push(Task::ClearPage); | 744 | .push(Task::ClearPage); |
| 745 | } else if singleplaylistitem.videos_view.selected == 0 { | ||
| 746 | return Ok(()); | ||
| 841 | } | 747 | } |
| 842 | 748 | ||
| 843 | let updated = singleplaylistitem.videos_view.up().is_ok(); | 749 | let updated = singleplaylistitem.videos_view.up().is_ok(); |
| @@ -851,6 +757,12 @@ impl FrameworkItem for SingleItem { | |||
| 851 | updated | 757 | updated |
| 852 | } | 758 | } |
| 853 | KeyAction::MoveDown => { | 759 | KeyAction::MoveDown => { |
| 760 | if singleplaylistitem.videos_view.selected | ||
| 761 | == singleplaylistitem.videos_view.items.len() - 1 | ||
| 762 | { | ||
| 763 | return Ok(()); | ||
| 764 | } | ||
| 765 | |||
| 854 | let updated = singleplaylistitem.videos_view.down().is_ok(); | 766 | let updated = singleplaylistitem.videos_view.down().is_ok(); |
| 855 | if updated && singleplaylistitem.videos_view.selected != 0 { | 767 | if updated && singleplaylistitem.videos_view.selected != 0 { |
| 856 | singleplaylistitem.hovered_video.item = Some( | 768 | singleplaylistitem.hovered_video.item = Some( |
| @@ -862,17 +774,28 @@ impl FrameworkItem for SingleItem { | |||
| 862 | updated | 774 | updated |
| 863 | } | 775 | } |
| 864 | KeyAction::MoveLeft => { | 776 | KeyAction::MoveLeft => { |
| 865 | let updated = singleplaylistitem.videos_view.first().is_ok(); | 777 | if singleplaylistitem.videos_view.selected != 0 { |
| 866 | if updated && singleplaylistitem.videos_view.selected != 0 { | 778 | framework |
| 867 | singleplaylistitem.hovered_video.item = Some( | 779 | .data |
| 868 | self.item.as_ref().unwrap().fullplaylist()?.videos | 780 | .state |
| 869 | [singleplaylistitem.videos_view.selected - 1] | 781 | .get_mut::<Tasks>() |
| 870 | .clone(), | 782 | .unwrap() |
| 871 | ); | 783 | .priority |
| 784 | .push(Task::ClearPage); | ||
| 785 | } else if singleplaylistitem.videos_view.selected == 0 { | ||
| 786 | return Ok(()); | ||
| 872 | } | 787 | } |
| 788 | |||
| 789 | let updated = singleplaylistitem.videos_view.first().is_ok(); | ||
| 790 | singleplaylistitem.hovered_video.item = None; | ||
| 873 | updated | 791 | updated |
| 874 | } | 792 | } |
| 875 | KeyAction::MoveRight => { | 793 | KeyAction::MoveRight => { |
| 794 | if singleplaylistitem.videos_view.selected | ||
| 795 | == singleplaylistitem.videos_view.items.len() - 1 | ||
| 796 | { | ||
| 797 | return Ok(()); | ||
| 798 | } | ||
| 876 | let updated = singleplaylistitem.videos_view.last().is_ok(); | 799 | let updated = singleplaylistitem.videos_view.last().is_ok(); |
| 877 | if updated && singleplaylistitem.videos_view.selected != 0 { | 800 | if updated && singleplaylistitem.videos_view.selected != 0 { |
| 878 | singleplaylistitem.hovered_video.item = Some( | 801 | singleplaylistitem.hovered_video.item = Some( |
| @@ -912,19 +835,32 @@ impl FrameworkItem for SingleItem { | |||
| 912 | true | 835 | true |
| 913 | } | 836 | } |
| 914 | _ => false, | 837 | _ => false, |
| 838 | }; | ||
| 839 | |||
| 840 | if updated { | ||
| 841 | framework | ||
| 842 | .data | ||
| 843 | .global | ||
| 844 | .get_mut::<Status>() | ||
| 845 | .unwrap() | ||
| 846 | .render_image = true; | ||
| 847 | set_envs( | ||
| 848 | self.infalte_item_update( | ||
| 849 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 850 | framework.data.global.get::<Status>().unwrap(), | ||
| 851 | ) | ||
| 852 | .into_iter(), | ||
| 853 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 854 | ); | ||
| 915 | } | 855 | } |
| 856 | |||
| 857 | updated | ||
| 916 | } | 858 | } |
| 917 | } | 859 | } |
| 918 | SingleItemType::None => false, | 860 | SingleItemType::None => false, |
| 919 | }; | 861 | }; |
| 920 | 862 | ||
| 921 | if updated { | 863 | if updated { |
| 922 | framework | ||
| 923 | .data | ||
| 924 | .global | ||
| 925 | .get_mut::<Status>() | ||
| 926 | .unwrap() | ||
| 927 | .render_image = true; | ||
| 928 | framework | 864 | framework |
| 929 | .data | 865 | .data |
| 930 | .state | 866 | .state |
| @@ -1007,6 +943,15 @@ impl FrameworkItem for SingleItem { | |||
| 1007 | 943 | ||
| 1008 | self.update(); | 944 | self.update(); |
| 1009 | 945 | ||
| 946 | set_envs( | ||
| 947 | self.infalte_item_update( | ||
| 948 | framework.data.global.get::<MainConfig>().unwrap(), | ||
| 949 | framework.data.global.get::<Status>().unwrap(), | ||
| 950 | ) | ||
| 951 | .into_iter(), | ||
| 952 | &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0, | ||
| 953 | ); | ||
| 954 | |||
| 1010 | // render the new image | 955 | // render the new image |
| 1011 | framework | 956 | framework |
| 1012 | .data | 957 | .data |
src/run.rs +15 −12
| @@ -9,7 +9,9 @@ use tui_additions::{ | |||
| 9 | use crate::{ | 9 | use crate::{ |
| 10 | config::{CommandBindings, KeyBindingsConfig, MainConfig}, | 10 | config::{CommandBindings, KeyBindingsConfig, MainConfig}, |
| 11 | global::{ | 11 | global::{ |
| 12 | functions::{apply_envs, clear_envs, command_capture, run_command, set_envs}, | 12 | functions::{ |
| 13 | apply_envs, clear_envs, command_capture, run_command, set_envs, update_provider, | ||
| 14 | }, | ||
| 13 | structs::{KeyAction, Message, Page, StateEnvs, Status, Task, Tasks}, | 15 | structs::{KeyAction, Message, Page, StateEnvs, Status, Task, Tasks}, |
| 14 | }, | 16 | }, |
| 15 | }; | 17 | }; |
| @@ -96,16 +98,15 @@ pub fn run( | |||
| 96 | } | 98 | } |
| 97 | } | 99 | } |
| 98 | Event::Key(key) => { | 100 | Event::Key(key) => { |
| 99 | let command_to_run = apply_envs( | 101 | // check if key binds to any commands |
| 100 | framework | 102 | let command_to_run = framework |
| 101 | .data | 103 | .data |
| 102 | .global | 104 | .global |
| 103 | .get::<CommandBindings>() | 105 | .get::<CommandBindings>() |
| 104 | .unwrap() | 106 | .unwrap() |
| 105 | .get_command(&key, framework.data.state.get::<Page>().unwrap()), | 107 | .get_command(&key, framework.data.state.get::<Page>().unwrap()); |
| 106 | ); | ||
| 107 | if !command_to_run.is_empty() { | 108 | if !command_to_run.is_empty() { |
| 108 | run_command(&command_to_run, framework, terminal); | 109 | run_command(&apply_envs(command_to_run), framework, terminal); |
| 109 | framework | 110 | framework |
| 110 | .data | 111 | .data |
| 111 | .state | 112 | .state |
| @@ -215,7 +216,8 @@ pub fn run( | |||
| 215 | } else { | 216 | } else { |
| 216 | let status = framework.data.global.get_mut::<Status>().unwrap(); | 217 | let status = framework.data.global.get_mut::<Status>().unwrap(); |
| 217 | status.render_image = true; | 218 | status.render_image = true; |
| 218 | status.provider_updated = true; | 219 | |
| 220 | update_provider(&mut framework.data); | ||
| 219 | framework | 221 | framework |
| 220 | .data | 222 | .data |
| 221 | .state | 223 | .state |
| @@ -237,7 +239,8 @@ pub fn run( | |||
| 237 | } else { | 239 | } else { |
| 238 | let status = framework.data.global.get_mut::<Status>().unwrap(); | 240 | let status = framework.data.global.get_mut::<Status>().unwrap(); |
| 239 | status.render_image = true; | 241 | status.render_image = true; |
| 240 | status.provider_updated = true; | 242 | |
| 243 | update_provider(&mut framework.data); | ||
| 241 | framework | 244 | framework |
| 242 | .data | 245 | .data |
| 243 | .state | 246 | .state |