Commit 7b5aa671fe

7b5aa671fe144bb7e696b9ccdde6a9205c54fdb4

parent: c819601c03

Unsigned

Siriusmart <71584876+Siriusmart@users.noreply.github.com> · 2023-01-29 20:49 UTC

0.6.2

Layout: unified · split

Cargo.lock +101 −123
@@ -38,6 +38,12 @@ version = "0.13.1"
3838source = "registry+https://github.com/rust-lang/crates.io-index"
3939checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
4040
41[[package]]
42name = "base64"
43version = "0.21.0"
44source = "registry+https://github.com/rust-lang/crates.io-index"
45checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
46
4147[[package]]
4248name = "bit_field"
4349version = "0.10.1"
@@ -58,15 +64,15 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
5864
5965[[package]]
6066name = "bumpalo"
61version = "3.11.1"
67version = "3.12.0"
6268source = "registry+https://github.com/rust-lang/crates.io-index"
63checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
69checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
6470
6571[[package]]
6672name = "bytemuck"
67version = "1.12.3"
73version = "1.13.0"
6874source = "registry+https://github.com/rust-lang/crates.io-index"
69checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f"
75checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393"
7076
7177[[package]]
7278name = "byteorder"
@@ -88,9 +94,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
8894
8995[[package]]
9096name = "cc"
91version = "1.0.78"
97version = "1.0.79"
9298source = "registry+https://github.com/rust-lang/crates.io-index"
93checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
99checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
94100
95101[[package]]
96102name = "cfg-if"
@@ -150,14 +156,14 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
150156
151157[[package]]
152158name = "console"
153version = "0.15.4"
159version = "0.15.5"
154160source = "registry+https://github.com/rust-lang/crates.io-index"
155checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a"
161checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60"
156162dependencies = [
157163 "encode_unicode",
158164 "lazy_static",
159165 "libc",
160 "windows-sys 0.42.0",
166 "windows-sys",
161167]
162168
163169[[package]]
@@ -233,6 +239,22 @@ name = "crossterm"
233239version = "0.25.0"
234240source = "registry+https://github.com/rust-lang/crates.io-index"
235241checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
242dependencies = [
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]]
254name = "crossterm"
255version = "0.26.0"
256source = "registry+https://github.com/rust-lang/crates.io-index"
257checksum = "77f67c7faacd4db07a939f55d66a983a5355358a1f17d32cc9a8d01d1266b9ce"
236258dependencies = [
237259 "bitflags",
238260 "crossterm_winapi",
@@ -262,9 +284,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
262284
263285[[package]]
264286name = "cxx"
265version = "1.0.85"
287version = "1.0.88"
266288source = "registry+https://github.com/rust-lang/crates.io-index"
267checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd"
289checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8"
268290dependencies = [
269291 "cc",
270292 "cxxbridge-flags",
@@ -274,9 +296,9 @@ dependencies = [
274296
275297[[package]]
276298name = "cxx-build"
277version = "1.0.85"
299version = "1.0.88"
278300source = "registry+https://github.com/rust-lang/crates.io-index"
279checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0"
301checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8"
280302dependencies = [
281303 "cc",
282304 "codespan-reporting",
@@ -289,15 +311,15 @@ dependencies = [
289311
290312[[package]]
291313name = "cxxbridge-flags"
292version = "1.0.85"
314version = "1.0.88"
293315source = "registry+https://github.com/rust-lang/crates.io-index"
294checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59"
316checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971"
295317
296318[[package]]
297319name = "cxxbridge-macro"
298version = "1.0.85"
320version = "1.0.88"
299321source = "registry+https://github.com/rust-lang/crates.io-index"
300checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6"
322checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e"
301323dependencies = [
302324 "proc-macro2",
303325 "quote",
@@ -318,9 +340,9 @@ checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60"
318340
319341[[package]]
320342name = "either"
321version = "1.8.0"
343version = "1.8.1"
322344source = "registry+https://github.com/rust-lang/crates.io-index"
323checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
345checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
324346
325347[[package]]
326348name = "encode_unicode"
@@ -532,9 +554,9 @@ dependencies = [
532554
533555[[package]]
534556name = "half"
535version = "2.2.0"
557version = "2.2.1"
536558source = "registry+https://github.com/rust-lang/crates.io-index"
537checksum = "6c467d36af040b7b2681f5fddd27427f6da8d3d072f575a265e181d2f8e8d157"
559checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0"
538560dependencies = [
539561 "crunchy",
540562]
@@ -719,9 +741,9 @@ dependencies = [
719741
720742[[package]]
721743name = "ipnet"
722version = "2.7.0"
744version = "2.7.1"
723745source = "registry+https://github.com/rust-lang/crates.io-index"
724checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e"
746checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
725747
726748[[package]]
727749name = "itoa"
@@ -847,7 +869,7 @@ dependencies = [
847869 "libc",
848870 "log",
849871 "wasi",
850 "windows-sys 0.42.0",
872 "windows-sys",
851873]
852874
853875[[package]]
@@ -1009,15 +1031,15 @@ dependencies = [
10091031
10101032[[package]]
10111033name = "parking_lot_core"
1012version = "0.9.5"
1034version = "0.9.6"
10131035source = "registry+https://github.com/rust-lang/crates.io-index"
1014checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
1036checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
10151037dependencies = [
10161038 "cfg-if",
10171039 "libc",
10181040 "redox_syscall",
10191041 "smallvec",
1020 "windows-sys 0.42.0",
1042 "windows-sys",
10211043]
10221044
10231045[[package]]
@@ -1084,9 +1106,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
10841106
10851107[[package]]
10861108name = "proc-macro2"
1087version = "1.0.49"
1109version = "1.0.50"
10881110source = "registry+https://github.com/rust-lang/crates.io-index"
1089checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
1111checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
10901112dependencies = [
10911113 "unicode-ident",
10921114]
@@ -1142,9 +1164,9 @@ dependencies = [
11421164
11431165[[package]]
11441166name = "rayon-core"
1145version = "1.10.1"
1167version = "1.10.2"
11461168source = "registry+https://github.com/rust-lang/crates.io-index"
1147checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3"
1169checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b"
11481170dependencies = [
11491171 "crossbeam-channel",
11501172 "crossbeam-deque",
@@ -1172,11 +1194,11 @@ dependencies = [
11721194
11731195[[package]]
11741196name = "reqwest"
1175version = "0.11.13"
1197version = "0.11.14"
11761198source = "registry+https://github.com/rust-lang/crates.io-index"
1177checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
1199checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9"
11781200dependencies = [
1179 "base64",
1201 "base64 0.21.0",
11801202 "bytes",
11811203 "encoding_rs",
11821204 "futures-core",
@@ -1233,12 +1255,11 @@ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
12331255
12341256[[package]]
12351257name = "schannel"
1236version = "0.1.20"
1258version = "0.1.21"
12371259source = "registry+https://github.com/rust-lang/crates.io-index"
1238checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
1260checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
12391261dependencies = [
1240 "lazy_static",
1241 "windows-sys 0.36.1",
1262 "windows-sys",
12421263]
12431264
12441265[[package]]
@@ -1261,9 +1282,9 @@ checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
12611282
12621283[[package]]
12631284name = "security-framework"
1264version = "2.7.0"
1285version = "2.8.2"
12651286source = "registry+https://github.com/rust-lang/crates.io-index"
1266checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
1287checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
12671288dependencies = [
12681289 "bitflags",
12691290 "core-foundation",
@@ -1274,9 +1295,9 @@ dependencies = [
12741295
12751296[[package]]
12761297name = "security-framework-sys"
1277version = "2.6.1"
1298version = "2.8.0"
12781299source = "registry+https://github.com/rust-lang/crates.io-index"
1279checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
1300checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
12801301dependencies = [
12811302 "core-foundation-sys",
12821303 "libc",
@@ -1327,9 +1348,9 @@ dependencies = [
13271348
13281349[[package]]
13291350name = "serde_yaml"
1330version = "0.9.16"
1351version = "0.9.17"
13311352source = "registry+https://github.com/rust-lang/crates.io-index"
1332checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834"
1353checksum = "8fb06d4b6cdaef0e0c51fa881acb721bed3c924cfaa71d9c94a3b771dfdf6567"
13331354dependencies = [
13341355 "indexmap",
13351356 "itoa",
@@ -1447,9 +1468,9 @@ dependencies = [
14471468
14481469[[package]]
14491470name = "termcolor"
1450version = "1.1.3"
1471version = "1.2.0"
14511472source = "registry+https://github.com/rust-lang/crates.io-index"
1452checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
1473checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
14531474dependencies = [
14541475 "winapi-util",
14551476]
@@ -1491,9 +1512,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
14911512
14921513[[package]]
14931514name = "tokio"
1494version = "1.24.0"
1515version = "1.24.2"
14951516source = "registry+https://github.com/rust-lang/crates.io-index"
1496checksum = "7125661431c26622a80ca5051a2f936c9a678318e0351007b0cc313143024e5c"
1517checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
14971518dependencies = [
14981519 "autocfg",
14991520 "bytes",
@@ -1503,7 +1524,7 @@ dependencies = [
15031524 "num_cpus",
15041525 "pin-project-lite",
15051526 "socket2",
1506 "windows-sys 0.42.0",
1527 "windows-sys",
15071528]
15081529
15091530[[package]]
@@ -1564,9 +1585,9 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
15641585
15651586[[package]]
15661587name = "try-lock"
1567version = "0.2.3"
1588version = "0.2.4"
15681589source = "registry+https://github.com/rust-lang/crates.io-index"
1569checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
1590checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
15701591
15711592[[package]]
15721593name = "tui"
@@ -1576,7 +1597,7 @@ checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1"
15761597dependencies = [
15771598 "bitflags",
15781599 "cassowary",
1579 "crossterm",
1600 "crossterm 0.25.0",
15801601 "serde",
15811602 "unicode-segmentation",
15821603 "unicode-width",
@@ -1584,11 +1605,11 @@ dependencies = [
15841605
15851606[[package]]
15861607name = "tui-additions"
1587version = "0.1.12"
1608version = "0.1.13"
15881609source = "registry+https://github.com/rust-lang/crates.io-index"
1589checksum = "3bfce9dd63be9026ffd15ea51ee0afb2fe386263decb04e2bcc0c23556a79a1f"
1610checksum = "37ad46291f8753853eb83c3e47c34c67a59f61129a13a93ba11907ca458bd72b"
15901611dependencies = [
1591 "crossterm",
1612 "crossterm 0.26.0",
15921613 "dyn-clone",
15931614 "tui",
15941615 "typemap",
@@ -1606,9 +1627,9 @@ dependencies = [
16061627
16071628[[package]]
16081629name = "unicode-bidi"
1609version = "0.3.8"
1630version = "0.3.10"
16101631source = "registry+https://github.com/rust-lang/crates.io-index"
1611checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
1632checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
16121633
16131634[[package]]
16141635name = "unicode-ident"
@@ -1676,9 +1697,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
16761697checksum = "b511f7e9ae27b5750f12ca50c353a1179bd4cc964a47294eb0d2cdad40cb41c0"
16771698dependencies = [
16781699 "ansi_colours",
1679 "base64",
1700 "base64 0.13.1",
16801701 "console",
1681 "crossterm",
1702 "crossterm 0.25.0",
16821703 "image",
16831704 "lazy_static",
16841705 "sixel-rs",
@@ -1815,19 +1836,6 @@ version = "0.4.0"
18151836source = "registry+https://github.com/rust-lang/crates.io-index"
18161837checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
18171838
1818[[package]]
1819name = "windows-sys"
1820version = "0.36.1"
1821source = "registry+https://github.com/rust-lang/crates.io-index"
1822checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
1823dependencies = [
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
18311839[[package]]
18321840name = "windows-sys"
18331841version = "0.42.0"
@@ -1835,85 +1843,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
18351843checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
18361844dependencies = [
18371845 "windows_aarch64_gnullvm",
1838 "windows_aarch64_msvc 0.42.0",
1839 "windows_i686_gnu 0.42.0",
1840 "windows_i686_msvc 0.42.0",
1841 "windows_x86_64_gnu 0.42.0",
1846 "windows_aarch64_msvc",
1847 "windows_i686_gnu",
1848 "windows_i686_msvc",
1849 "windows_x86_64_gnu",
18421850 "windows_x86_64_gnullvm",
1843 "windows_x86_64_msvc 0.42.0",
1851 "windows_x86_64_msvc",
18441852]
18451853
18461854[[package]]
18471855name = "windows_aarch64_gnullvm"
1848version = "0.42.0"
1849source = "registry+https://github.com/rust-lang/crates.io-index"
1850checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
1851
1852[[package]]
1853name = "windows_aarch64_msvc"
1854version = "0.36.1"
1856version = "0.42.1"
18551857source = "registry+https://github.com/rust-lang/crates.io-index"
1856checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
1858checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
18571859
18581860[[package]]
18591861name = "windows_aarch64_msvc"
1860version = "0.42.0"
1862version = "0.42.1"
18611863source = "registry+https://github.com/rust-lang/crates.io-index"
1862checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
1864checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
18631865
18641866[[package]]
18651867name = "windows_i686_gnu"
1866version = "0.36.1"
1868version = "0.42.1"
18671869source = "registry+https://github.com/rust-lang/crates.io-index"
1868checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
1869
1870[[package]]
1871name = "windows_i686_gnu"
1872version = "0.42.0"
1873source = "registry+https://github.com/rust-lang/crates.io-index"
1874checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
1870checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
18751871
18761872[[package]]
18771873name = "windows_i686_msvc"
1878version = "0.36.1"
1874version = "0.42.1"
18791875source = "registry+https://github.com/rust-lang/crates.io-index"
1880checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
1881
1882[[package]]
1883name = "windows_i686_msvc"
1884version = "0.42.0"
1885source = "registry+https://github.com/rust-lang/crates.io-index"
1886checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
1876checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
18871877
18881878[[package]]
18891879name = "windows_x86_64_gnu"
1890version = "0.36.1"
1891source = "registry+https://github.com/rust-lang/crates.io-index"
1892checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
1893
1894[[package]]
1895name = "windows_x86_64_gnu"
1896version = "0.42.0"
1880version = "0.42.1"
18971881source = "registry+https://github.com/rust-lang/crates.io-index"
1898checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
1882checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
18991883
19001884[[package]]
19011885name = "windows_x86_64_gnullvm"
1902version = "0.42.0"
1886version = "0.42.1"
19031887source = "registry+https://github.com/rust-lang/crates.io-index"
1904checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
1888checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
19051889
19061890[[package]]
19071891name = "windows_x86_64_msvc"
1908version = "0.36.1"
1892version = "0.42.1"
19091893source = "registry+https://github.com/rust-lang/crates.io-index"
1910checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
1911
1912[[package]]
1913name = "windows_x86_64_msvc"
1914version = "0.42.0"
1915source = "registry+https://github.com/rust-lang/crates.io-index"
1916checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
1894checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
19171895
19181896[[package]]
19191897name = "winreg"
@@ -1945,11 +1923,11 @@ dependencies = [
19451923
19461924[[package]]
19471925name = "youtube-tui"
1948version = "0.6.1"
1926version = "0.6.2"
19491927dependencies = [
19501928 "chrono",
19511929 "clipboard",
1952 "crossterm",
1930 "crossterm 0.26.0",
19531931 "dyn-clone",
19541932 "futures",
19551933 "home",
Cargo.toml +5 −5
@@ -1,6 +1,6 @@
11[package]
22name = "youtube-tui"
3version = "0.6.1"
3version = "0.6.2"
44authors = ["Siriusmart <siriusmart@tuta.io>"]
55edition = "2021"
66description = "An aesthetically pleasing YouTube TUI written in Rust"
@@ -8,10 +8,10 @@ documentation = "https://docs.rs/youtube-tui"
88readme = "README.md"
99homepage = "https://siriusmart.github.io/youtube-tui"
1010repository = "https://github.com/siriusmart/youtube-tui"
11license = "GPL-3.0"
11license = "GPL-3.0-or-later"
1212keywords = ["cli", "terminal", "youtube", "tui"]
1313categories =["command-line-interface", "command-line-utilities"]
14exclude = ["/docs"]
14exclude = ["/docs", "/LICENSE"]
1515
1616# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717
@@ -23,12 +23,12 @@ halfblock = ["viuer"]
2323[dependencies]
2424serde = {version = "1.0", default-features = false, features = ["derive"]}
2525tui = {version = "0.19", default-features = false, features = ["serde"]}
26crossterm = {version = "0.25", default-features = false, features = ["serde"]}
26crossterm = {version = "0.26", default-features = false, features = ["serde"]}
2727viuer = {version = "0.6", default-features = false, optional = true}
2828home = "0.5"
2929chrono = {version = "0.4", default-features = false, features = ["clock"]}
3030typemap = {version = "0.3", default-features = false}
31tui-additions = {version = "0.1", default-features = false, features = ["framework", "widgets"]}
31tui-additions = {version = "0.1.13", default-features = false, features = ["framework", "widgets"]}
3232invidious = {version = "0.4", default-features = false, features = ["reqwest"]}
3333serde_yaml = {version = "0.9", default-features = false}
3434dyn-clone = {version = "1.0", default-features = false}
README.md +3 −3
@@ -58,12 +58,12 @@ It also includes features like:
5858
5959- Vim-like commands
6060- Mouse support
61- Entensible keybindings system
6162
6263### What it doesn't have
6364
64- Binding commands to keys (first priority)
65- Channel search (will implement)
66- Subscriptions (will implement)
65- Subscriptions (first priority)
66- Download library (will implement)
6767
6868## How to contribute
6969
docs/src/README.md +3 −3
@@ -50,12 +50,12 @@ It also includes features like:
5050
5151- Vim-like commands
5252- Mouse support
53- Entensible keybindings system
5354
5455### What it doesn't have
5556
56- Binding commands to keys (first priority)
57- Channel search (will implement)
58- Subscriptions (will implement)
57- Subscriptions (first priority)
58- Download library (will implement)
5959
6060## How to contribute
6161
docs/src/SUMMARY.md +1
@@ -11,6 +11,7 @@
1111 - [main](config/main.md)
1212 - [commands](config/commands.md)
1313 - [keybindings](config/keybindings.md)
14 - [commandbindings](config/commandbindings.md)
1415 - [pages](config/pages.md)
1516 - [appearance](config/appearance.md)
1617 - [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
6161
6262More about commands in the [next chapter](commands.md).
6363
64## Command bindings
65
66Keys can be binded to a command, more about it in the next chapter.
67
6468## Buttons
6569
6670Buttons have no use on their own, but allows you to navigate between pages.
docs/src/changelogs.md +13 −3
@@ -1,14 +1,24 @@
11# Changelogs
22
3## v0.6.1
3## v0.6.2
44
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
616
717- Rework of the env system, now using environment variables provided by the OS as opposed to implmenting own version of env
818- Ability to use envs in command mode
919- Launch commands (including `youtube-tui help`)
1020
11### Fixed
21#### Fixed
1222
1323- Screen blinking when pressing up arrow on the first item in playlist page, videos view
1424
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.
66
77**Loadpage commands** can also be used when launching, for example `youtube-tui loadpage popular` or `youtube-tui popular`.
88
9> Commands can be joined together using `;;`.
10
911Below are the avaliable commands:
1012
1113## Loadpage
@@ -53,3 +55,15 @@ Text commands generates a *text only response* without launching the TUI.
5355help
5456version
5557```
58
59## Command bindings
60
61Commands 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
3Commands 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
8global:
9 'f':
10 2: run ${browser} '${url}'
11 'c':
12 2: cp ${url}
13video: {}
14search:
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}'
21watchhistory:
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
33Specifications are same as [`comamnds.yml`](commands.md), the exact same envs can be used.
34
35Default 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
55## Example commands config
66
77```yaml
8launch_command: loadpage popular ;; flush ;; history clear # suggested to set page to watchhistory if you don't want to wait for popular to load
89video:
910- Play video: ${video-player} ${embed-url}
1011- 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
3435Replacing all these with known values it might look something like this:
3536
3637```yaml
38launch_command: loadpage popular ;; flush ;; history clear
3739video:
3840- Play video: mpv 'https://youtube.com/embed/dQw4w9WgXcQ'
3941- Play audio: konsole -e mpv 'https://youtube.com/embed/dQw4w9WgXcQ' --no-video
@@ -53,14 +55,6 @@ playlist:
5355
5456> Global commands can also be used here. (Ones that start with an `:`).
5557
56## Item commands
57
58(will be replaced by global vim-like commands in the next major version)
59
60Notice 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
62For instance `%switch-provider%` toggles the provider between `YouTube` and `Invidious`.
63
6458<hr>
6559
6660Below are the description of each of the fields:
@@ -83,15 +77,10 @@ Does not include custom env set in `main.yml`.
8377
8478|Name|Page|Value|
8579|---|---|---|
86|`url`|video & playlist|String url to the web page|
87|`id`|video & playlist|String id of the video or playlist|
88|`channel-id`|video & playlist|String id of the channel|
80|`url`|search, popular, trending, video, playlist|String url to the web page|
81|`id`|video, playlist|String id of the video or playlist|
82|`channel-id`|video, playlist|String id of the channel|
8983|`embed-url`|video|String url to the embed video (required to play video using mpv from Invidious)|
9084|`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|
92
93## Item command reference
94
95|Name|Page|Use|
96|---|---|---|
97|`swtich-provider`|video & playlist|Toggles the provider between `YouTube` and `Invidious`|
85|`hover-url`|trending, popular, search|Url of the currenly hovering item.|
86|`all-ids`|playlist|IDs of all videos in a playlist, separated with space.|
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
9191
9292### Provider
9393
94This changes the `${url}` and `${embed_url}` of videos, allowing you to watch videos from Invidious if it is restricted on YouTube.
94This changes the `${url}` and `${embed-url}` of videos, allowing you to watch videos from Invidious if it is restricted on YouTube.
9595
9696(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)
9797
docs/src/contributors.md +1 −1
@@ -6,7 +6,7 @@ Creator and main developer of YouTube TUI.
66
77## <a href="https://github.com/zaedus" target=_blank>Zaedus</a>
88
9Made 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>.
9Made 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>.
1010
1111## <a href="https://github.com/fractal-tess" target=_blank>Fractal Tess</a>
1212
src/config/commandbindings.rs +48 −12
@@ -58,7 +58,9 @@ impl CommandBindings {
5858 };
5959
6060 if let Some(command) = command {
61 out.push_str("&&");
61 if !out.is_empty() {
62 out.push_str("&&");
63 }
6264 out.push_str(command);
6365 }
6466
@@ -151,14 +153,24 @@ fn get_command<'a>(
151153// default functions
152154
153155fn 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 ])
155166}
156167
157168fn search_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
158 HashMap::from([(
159 KeyCodeSerde::Char('f'),
160 HashMap::from([(2, String::from("run ${browser} ${url}"))]),
161 )])
169 HashMap::from([
170 (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])),
171 (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])),
172 (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))])),
173 ])
162174}
163175
164176fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
@@ -166,23 +178,43 @@ fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
166178}
167179
168180fn 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 ])
170186}
171187
172188fn 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 ])
174194}
175195
176196fn 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 ])
178202}
179203
180204fn 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 ])
182210}
183211
184212fn 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 ])
186218}
187219
188220fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
@@ -190,5 +222,9 @@ fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
190222}
191223
192224fn 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 ])
194230}
src/config/commands.rs +8 −8
@@ -35,7 +35,7 @@ impl From<CommandsConfigSerde> for CommandsConfig {
3535 }
3636}
3737
38/// Hashmaps are better formatted in YAML, impls Into<CommandsConfig>
38/// Hashmaps are better formatted in YAML, impls `Into<CommandsConfig>`
3939// uses vector to keep the ordering of the commands, and hashmap to have that key - value pair look
4040#[derive(Serialize, Deserialize, Clone)]
4141pub struct CommandsConfigSerde {
@@ -72,16 +72,16 @@ fn video_default() -> Vec<HashMap<String, String>> {
7272 vec![
7373 HashMap::from([(
7474 String::from("Play video"),
75 String::from("run ${video-player} ${embed-url}"),
75 String::from("run ${video-player} '${embed-url}'"),
7676 )]),
7777 HashMap::from([(
7878 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"),
8080 )]),
8181 HashMap::from([(
8282 String::from("Play audio (loop)"),
8383 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",
8585 ),
8686 )]),
8787 HashMap::from([(
@@ -90,18 +90,18 @@ fn video_default() -> Vec<HashMap<String, String>> {
9090 )]),
9191 HashMap::from([(
9292 String::from("Open in browser"),
93 String::from("run ${browser} ${url}"),
93 String::from("run ${browser} '${url}'"),
9494 )]),
9595 HashMap::from([(
9696 String::from("Download video (webm)"),
9797 String::from(
98 "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} ${embed-url}",
98 "run ${terminal-emulator} ${youtube-downloader} -o ${download-path} '${embed-url}'",
9999 ),
100100 )]),
101101 HashMap::from([(
102102 String::from("Download audio (opus)"),
103103 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",
105105 ),
106106 )]),
107107 HashMap::from([(
@@ -136,7 +136,7 @@ fn playlist_default() -> Vec<HashMap<String, String>> {
136136 )]),
137137 HashMap::from([(
138138 String::from("Open in browser"),
139 String::from("run ${browser} ${url}"),
139 String::from("run ${browser} '${url}'"),
140140 )]),
141141 HashMap::from([(
142142 String::from("Download all video (webm)"),
src/global/functions/mod.rs +2
@@ -21,3 +21,5 @@ mod from_url;
2121pub use from_url::*;
2222mod envs;
2323pub use envs::*;
24mod update_provider;
25pub use update_provider::*;
src/global/functions/run_command.rs +6 −2
@@ -11,7 +11,10 @@ use std::{env, io::Stdout, thread};
1111use tui::{backend::CrosstermBackend, Terminal};
1212use tui_additions::framework::Framework;
1313
14use super::{fake_rand_range, from_channel_url, from_playlist_url, from_video_url, set_clipboard};
14use super::{
15 fake_rand_range, from_channel_url, from_playlist_url, from_video_url, set_clipboard,
16 update_provider,
17};
1518
1619/// runs text command - command from the command line (not TUI) which response is just a string
1720pub fn text_command(command: &str) -> Option<String> {
@@ -67,7 +70,8 @@ pub fn run_single_command(
6770 status.provider.rotate();
6871 status.provider_updated = true;
6972 *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);
7175 }
7276 ["loadpage"] => {
7377 *framework.data.global.get_mut::<Message>().unwrap() =
src/global/functions/update_provider.rs added +162
@@ -0,0 +1,162 @@
1use std::env;
2use tui_additions::framework::FrameworkData;
3
4use crate::{
5 config::{MainConfig, Provider},
6 global::structs::{
7 ChannelDisplayPage, ChannelDisplayPageType, MainMenuPage, Page, SingleItemPage, StateEnvs,
8 Status,
9 },
10};
11
12use super::set_envs;
13
14pub 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 {
192192 _ => Err(Errors::StrError("not a mini channel")),
193193 }
194194 }
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 }
195202}
196203
197204impl Item {
src/global/structs/tasks.rs +3 −1
@@ -1,6 +1,6 @@
11use crate::{
22 config::{AppearanceConfig, MainConfig, MinDimentions},
3 global::functions::{clear_envs, run_command, set_envs},
3 global::functions::{clear_envs, run_command, set_envs, update_provider},
44};
55
66use super::{message::Message, page::Page, status::Status, StateEnvs};
@@ -139,6 +139,7 @@ impl TaskQueue {
139139 } else {
140140 Message::None
141141 };
142 update_provider(&mut framework.data);
142143 Self::render(framework, terminal)?;
143144 }
144145
@@ -167,6 +168,7 @@ impl TaskQueue {
167168 } else {
168169 Message::None
169170 };
171 update_provider(&mut framework.data);
170172 Self::render(framework, terminal)?;
171173 }
172174
src/init.rs +1
@@ -76,6 +76,7 @@ pub fn init(
7676 Ok(())
7777}
7878
79/// reload all config files
7980pub fn load_configs(framework: &mut FrameworkClean) -> Result<(), Box<dyn Error>> {
8081 let home_dir = home_dir().unwrap();
8182 let config_path = home_dir.join(".config/youtube-tui/");
src/items/channeldisplay.rs +65 −6
@@ -1,11 +1,11 @@
11use super::ItemInfo;
22use crate::{
3 config::{AppearanceConfig, KeyBindingsConfig, MainConfig},
3 config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Provider},
44 global::{
5 functions::download_all_images,
5 functions::{download_all_images, set_envs},
66 structs::{
77 ChannelDisplayPageType, InvidiousClient, Item, KeyAction, Message, Page,
8 SingleItemPage, Status, Task, Tasks,
8 SingleItemPage, StateEnvs, Status, Task, Tasks,
99 },
1010 },
1111};
@@ -49,6 +49,43 @@ impl Default for ChannelDisplay {
4949}
5050
5151impl 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 }
5289 /// update the style of the item (colours, etc), ran on ever render
5390 fn update_appearance(
5491 &mut self,
@@ -302,6 +339,14 @@ impl FrameworkItem for ChannelDisplay {
302339 .unwrap()
303340 .render_image = true;
304341 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 );
305350 }
306351 }
307352 Self::Playlists {
@@ -430,6 +475,12 @@ impl FrameworkItem for ChannelDisplay {
430475 }
431476 }
432477
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
433484 Ok(())
434485 }
435486
@@ -442,7 +493,7 @@ impl FrameworkItem for ChannelDisplay {
442493 _absolute_y: u16,
443494 ) -> bool {
444495 match self {
445 Self::None | Self::Main { .. } => false,
496 Self::None | Self::Main { .. } => return false,
446497 Self::Videos { textlist, grid, .. } | Self::Playlists { textlist, grid, .. } => {
447498 let chunk = grid
448499 .chunks(
@@ -492,9 +543,17 @@ impl FrameworkItem for ChannelDisplay {
492543 .get_mut::<Status>()
493544 .unwrap()
494545 .render_image = true;
495
496 true
497546 }
498547 }
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
499558 }
500559}
src/items/itemlist.rs +70 −57
@@ -13,7 +13,7 @@ use super::ItemInfo;
1313use crate::{
1414 config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Provider, Search},
1515 global::{
16 functions::{download_all_images, set_envs},
16 functions::{download_all_images, set_envs, update_provider},
1717 structs::{
1818 ChannelDisplayPage, ChannelDisplayPageType, FullChannelItem, FullPlaylistItem,
1919 FullVideoItem, InvidiousClient, Item, KeyAction, MainMenuPage, Message,
@@ -34,45 +34,54 @@ pub struct ItemList {
3434}
3535
3636impl ItemList {
37 pub fn inflate_provider_update(
37 pub fn infalte_item_update(
3838 &self,
39 page: &Page,
4039 mainconfig: &MainConfig,
4140 status: &Status,
4241 ) -> Vec<(String, String)> {
43 match page {
44 Page::Search(search) => vec![(
45 String::from("url"),
46 match status.provider {
47 Provider::YouTube => {
48 format!("'https://youtube.com/results?{}'", search.to_string())
49 }
50 Provider::Invidious => format!(
51 "'{}/search?{}'",
52 mainconfig.invidious_instance,
53 search.to_string()
42 match &self.items[self.textlist.selected] {
43 Item::MiniVideo(MiniVideoItem { id, .. })
44 | Item::FullVideo(FullVideoItem { id, .. }) => {
45 vec![(
46 String::from("hover-url"),
47 format!(
48 "{}/watch?v={id}",
49 match status.provider {
50 Provider::YouTube => "https://youtube.com",
51 Provider::Invidious => &mainconfig.invidious_instance,
52 }
5453 ),
55 },
56 )],
57 Page::MainMenu(MainMenuPage::Popular) => vec![(
58 String::from("url"),
59 match status.provider {
60 Provider::YouTube => String::from("'https://youtube.com'"),
61 Provider::Invidious => {
62 format!("'{}/feed/popular'", mainconfig.invidious_instance)
63 }
64 },
65 )],
66 Page::MainMenu(MainMenuPage::Trending) => vec![(
67 String::from("url"),
68 match status.provider {
69 Provider::YouTube => String::from("'https://www.youtube.com/feed/trending'"),
70 Provider::Invidious => {
71 format!("{}/feed/trending'", mainconfig.invidious_instance)
72 }
73 },
74 )],
75 _ => Vec::new(),
54 )]
55 }
56 Item::MiniPlaylist(MiniPlaylistItem { id, .. })
57 | Item::FullPlaylist(FullPlaylistItem { id, .. }) => {
58 vec![(
59 String::from("hover-url"),
60 format!(
61 "{}/playlist?list={id}",
62 match status.provider {
63 Provider::YouTube => "https://youtube.com",
64 Provider::Invidious => &mainconfig.invidious_instance,
65 }
66 ),
67 )]
68 }
69 Item::MiniChannel(MiniChannelItem { id, .. })
70 | Item::FullChannel(FullChannelItem { id, .. }) => {
71 vec![(
72 String::from("hover-url"),
73 format!(
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 }
7685 }
7786 }
7887
@@ -190,21 +199,16 @@ impl FrameworkItem for ItemList {
190199 }
191200
192201 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();
193204
194205 if status.provider_updated {
195206 set_envs(
196 self.inflate_provider_update(
197 framework.data.state.get::<Page>().unwrap(),
198 framework.data.global.get::<MainConfig>().unwrap(),
199 status,
200 )
201 .into_iter(),
207 self.infalte_item_update(mainconfig, status).into_iter(),
202208 &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0,
203209 );
204210 }
205211
206 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
207 let mainconfig = framework.data.global.get::<MainConfig>().unwrap();
208212 self.update_appearance(appearance, mainconfig, &info);
209213
210214 // creates the grid
@@ -299,14 +303,10 @@ impl FrameworkItem for ItemList {
299303 _ => unreachable!("item `ItemList` cannot be used in `{page:?}`"),
300304 }
301305
302 if framework
303 .data
304 .global
305 .get::<MainConfig>()
306 .unwrap()
307 .images
308 .display()
309 {
306 let mainconfig = framework.data.global.get::<MainConfig>().unwrap();
307 let status = framework.data.global.get::<Status>().unwrap();
308
309 if mainconfig.images.display() {
310310 // download thumbnails of all videos in the list
311311 download_all_images(self.items.iter().map(|item| item.into()).collect());
312312 }
@@ -316,14 +316,10 @@ impl FrameworkItem for ItemList {
316316 self.update();
317317
318318 set_envs(
319 self.inflate_provider_update(
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(),
319 self.infalte_item_update(mainconfig, status).into_iter(),
325320 &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0,
326321 );
322 update_provider(framework.data);
327323
328324 Ok(())
329325 }
@@ -361,6 +357,15 @@ impl FrameworkItem for ItemList {
361357
362358 // only create a render task if the key event actually changed something
363359 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
364369 framework
365370 .data
366371 .global
@@ -430,6 +435,14 @@ impl FrameworkItem for ItemList {
430435 }
431436
432437 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 );
433446
434447 // render the new image
435448 framework
src/items/singleitem.rs +149 −204
@@ -132,7 +132,7 @@ impl SingleVideoItem {
132132 String::from("url"),
133133 match status.provider {
134134 Provider::Invidious => format!(
135 "'{}/watch?v={}'",
135 "{}/watch?v={}",
136136 mainconfig.invidious_instance, video_item.id
137137 ),
138138 Provider::YouTube => format!("'https://youtu.be/{}'", video_item.id),
@@ -142,55 +142,9 @@ impl SingleVideoItem {
142142 (
143143 String::from("embed-url"),
144144 match status.provider {
145 Provider::Invidious => format!(
146 "'{}/embed/{}'",
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)
145 Provider::Invidious => {
146 format!("{}/embed/{}", mainconfig.invidious_instance, video_item.id)
158147 }
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 ),
194148 Provider::YouTube => format!("'https://youtube.com/embed/{}'", video_item.id),
195149 },
196150 ),
@@ -318,67 +272,14 @@ impl SinglePlaylistItem {
318272 vec![
319273 (String::from("id"), playlist_item.id.clone()),
320274 (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 ),
345275 (
346 String::from("all-videos"),
347 match status.provider {
348 Provider::YouTube => playlist_item
349 .videos
350 .iter()
351 .map(|video| {
352 format!("'https://youtu.be/{}'", video.minivideo().unwrap().id)
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 },
276 String::from("all-ids"),
277 playlist_item
278 .videos
279 .iter()
280 .map(|video| video.minivideo().unwrap().id.as_str())
281 .collect::<Vec<&str>>()
282 .join(" "),
382283 ),
383284 ]
384285 }
@@ -424,32 +325,40 @@ impl SingleItemType {
424325 Self::None => Vec::new(),
425326 }
426327 }
328}
427329
428 pub fn inflate_provider_update(
330impl SingleItem {
331 fn infalte_item_update(
429332 &self,
430333 mainconfig: &MainConfig,
431334 status: &Status,
432 item: &Option<Item>,
433335 ) -> Vec<(String, String)> {
434 let item = if let Some(item) = item.as_ref() {
435 item
436 } else {
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)
336 if let SingleItemType::Playlist(singleplaylistitem) = &self.r#type {
337 if singleplaylistitem.videos_view.selected == 0 {
338 return vec![(String::from("hover-url"), String::from("not avaliable"))];
446339 }
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"))]
448360 }
449361 }
450}
451
452impl SingleItem {
453362 /// update colours and layout every render
454363 fn update_appearance(
455364 &mut self,
@@ -573,25 +482,18 @@ impl FrameworkItem for SingleItem {
573482 popup_render: bool,
574483 info: tui_additions::framework::ItemInfo,
575484 ) {
485 let status = framework.data.global.get::<Status>().unwrap();
576486 if popup_render {
577487 return;
578488 }
579489
580 if framework
581 .data
582 .global
583 .get::<Status>()
584 .unwrap()
585 .provider_updated
586 {
490 if status.provider_updated {
587491 set_envs(
588 self.r#type
589 .inflate_provider_update(
590 framework.data.global.get::<MainConfig>().unwrap(),
591 framework.data.global.get::<Status>().unwrap(),
592 &self.item,
593 )
594 .into_iter(),
492 self.infalte_item_update(
493 framework.data.global.get::<MainConfig>().unwrap(),
494 status,
495 )
496 .into_iter(),
595497 &mut framework.data.state.get_mut::<StateEnvs>().unwrap().0,
596498 );
597499 }
@@ -611,18 +513,20 @@ impl FrameworkItem for SingleItem {
611513 match &mut self.r#type {
612514 SingleItemType::Video(typeinfo) => {
613515 // 2 by 1 grid, item info in the first cell and textlist at the second
614 typeinfo.update_provider().into_iter().for_each(|index| {
615 typeinfo.textlist.items[index] = typeinfo.commands[index].0.clone().replace(
616 "${provider}",
617 framework
618 .data
619 .global
620 .get::<Status>()
621 .unwrap()
622 .provider
623 .as_str(),
624 )
625 });
516 if status.provider_updated {
517 typeinfo.update_provider().into_iter().for_each(|index| {
518 typeinfo.textlist.items[index] = typeinfo.commands[index].0.clone().replace(
519 "${provider}",
520 framework
521 .data
522 .global
523 .get::<Status>()
524 .unwrap()
525 .provider
526 .as_str(),
527 )
528 });
529 }
626530 self.iteminfo
627531 .render(frame, framework, chunks[0], popup_render, info);
628532 typeinfo.textlist.set_height(chunks[1].height);
@@ -634,22 +538,22 @@ impl FrameworkItem for SingleItem {
634538 //
635539 // item info in the first cell, textlists in the second, hovering video on 3rd (if
636540 // present)
637 self.iteminfo
638 .render(frame, framework, chunks[0], popup_render, info);
639541 if typeinfo.is_commands_view {
640 typeinfo.update_provider().into_iter().for_each(|index| {
641 typeinfo.commands_view.items[index] =
642 typeinfo.commands[index].0.clone().replace(
643 "${provider}",
644 framework
645 .data
646 .global
647 .get::<Status>()
648 .unwrap()
649 .provider
650 .as_str(),
651 )
652 });
542 if status.provider_updated {
543 typeinfo.update_provider().into_iter().for_each(|index| {
544 typeinfo.commands_view.items[index] =
545 typeinfo.commands[index].0.clone().replace(
546 "${provider}",
547 framework
548 .data
549 .global
550 .get::<Status>()
551 .unwrap()
552 .provider
553 .as_str(),
554 )
555 });
556 }
653557 typeinfo.commands_view.set_height(chunks[1].height);
654558 frame.render_widget(typeinfo.commands_view.clone(), chunks[1]);
655559 } else {
@@ -666,6 +570,8 @@ impl FrameworkItem for SingleItem {
666570 );
667571 }
668572 }
573 self.iteminfo
574 .render(frame, framework, chunks[0], popup_render, info);
669575 }
670576 SingleItemType::None => {}
671577 }
@@ -726,28 +632,6 @@ impl FrameworkItem for SingleItem {
726632 }
727633 };
728634 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 );
751635
752636 if let Some(item) = &self.item {
753637 if item.is_unknown() {
@@ -768,6 +652,26 @@ impl FrameworkItem for SingleItem {
768652 watch_history.save()?;
769653 }
770654
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
771675 Ok(())
772676 }
773677
@@ -823,7 +727,7 @@ impl FrameworkItem for SingleItem {
823727 _ => false,
824728 }
825729 } else {
826 match action {
730 let updated = match action {
827731 // checks if it is updated, if it is and selected is not 0 (is hovering on
828732 // a video), then also need to update the iteminfo
829733 KeyAction::MoveUp => {
@@ -838,6 +742,8 @@ impl FrameworkItem for SingleItem {
838742 .unwrap()
839743 .priority
840744 .push(Task::ClearPage);
745 } else if singleplaylistitem.videos_view.selected == 0 {
746 return Ok(());
841747 }
842748
843749 let updated = singleplaylistitem.videos_view.up().is_ok();
@@ -851,6 +757,12 @@ impl FrameworkItem for SingleItem {
851757 updated
852758 }
853759 KeyAction::MoveDown => {
760 if singleplaylistitem.videos_view.selected
761 == singleplaylistitem.videos_view.items.len() - 1
762 {
763 return Ok(());
764 }
765
854766 let updated = singleplaylistitem.videos_view.down().is_ok();
855767 if updated && singleplaylistitem.videos_view.selected != 0 {
856768 singleplaylistitem.hovered_video.item = Some(
@@ -862,17 +774,28 @@ impl FrameworkItem for SingleItem {
862774 updated
863775 }
864776 KeyAction::MoveLeft => {
865 let updated = singleplaylistitem.videos_view.first().is_ok();
866 if updated && singleplaylistitem.videos_view.selected != 0 {
867 singleplaylistitem.hovered_video.item = Some(
868 self.item.as_ref().unwrap().fullplaylist()?.videos
869 [singleplaylistitem.videos_view.selected - 1]
870 .clone(),
871 );
777 if singleplaylistitem.videos_view.selected != 0 {
778 framework
779 .data
780 .state
781 .get_mut::<Tasks>()
782 .unwrap()
783 .priority
784 .push(Task::ClearPage);
785 } else if singleplaylistitem.videos_view.selected == 0 {
786 return Ok(());
872787 }
788
789 let updated = singleplaylistitem.videos_view.first().is_ok();
790 singleplaylistitem.hovered_video.item = None;
873791 updated
874792 }
875793 KeyAction::MoveRight => {
794 if singleplaylistitem.videos_view.selected
795 == singleplaylistitem.videos_view.items.len() - 1
796 {
797 return Ok(());
798 }
876799 let updated = singleplaylistitem.videos_view.last().is_ok();
877800 if updated && singleplaylistitem.videos_view.selected != 0 {
878801 singleplaylistitem.hovered_video.item = Some(
@@ -912,19 +835,32 @@ impl FrameworkItem for SingleItem {
912835 true
913836 }
914837 _ => 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 );
915855 }
856
857 updated
916858 }
917859 }
918860 SingleItemType::None => false,
919861 };
920862
921863 if updated {
922 framework
923 .data
924 .global
925 .get_mut::<Status>()
926 .unwrap()
927 .render_image = true;
928864 framework
929865 .data
930866 .state
@@ -1007,6 +943,15 @@ impl FrameworkItem for SingleItem {
1007943
1008944 self.update();
1009945
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
1010955 // render the new image
1011956 framework
1012957 .data
src/run.rs +15 −12
@@ -9,7 +9,9 @@ use tui_additions::{
99use crate::{
1010 config::{CommandBindings, KeyBindingsConfig, MainConfig},
1111 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 },
1315 structs::{KeyAction, Message, Page, StateEnvs, Status, Task, Tasks},
1416 },
1517};
@@ -96,16 +98,15 @@ pub fn run(
9698 }
9799 }
98100 Event::Key(key) => {
99 let command_to_run = apply_envs(
100 framework
101 .data
102 .global
103 .get::<CommandBindings>()
104 .unwrap()
105 .get_command(&key, framework.data.state.get::<Page>().unwrap()),
106 );
101 // check if key binds to any commands
102 let command_to_run = framework
103 .data
104 .global
105 .get::<CommandBindings>()
106 .unwrap()
107 .get_command(&key, framework.data.state.get::<Page>().unwrap());
107108 if !command_to_run.is_empty() {
108 run_command(&command_to_run, framework, terminal);
109 run_command(&apply_envs(command_to_run), framework, terminal);
109110 framework
110111 .data
111112 .state
@@ -215,7 +216,8 @@ pub fn run(
215216 } else {
216217 let status = framework.data.global.get_mut::<Status>().unwrap();
217218 status.render_image = true;
218 status.provider_updated = true;
219
220 update_provider(&mut framework.data);
219221 framework
220222 .data
221223 .state
@@ -237,7 +239,8 @@ pub fn run(
237239 } else {
238240 let status = framework.data.global.get_mut::<Status>().unwrap();
239241 status.render_image = true;
240 status.provider_updated = true;
242
243 update_provider(&mut framework.data);
241244 framework
242245 .data
243246 .state