Commit 1006d44655

1006d44655e414f45910e4ec26c3030fddc96fa9

parent: 6b52ccce6c

Unsigned

Siriusmart <71584876+Siriusmart@users.noreply.github.com> · 2023-02-26 13:13 UTC

offline library

Layout: unified · split

Cargo.lock +184 −103
@@ -46,9 +46,9 @@ checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
4646
4747[[package]]
4848name = "bit_field"
49version = "0.10.1"
49version = "0.10.2"
5050source = "registry+https://github.com/rust-lang/crates.io-index"
51checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
51checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
5252
5353[[package]]
5454name = "bitflags"
@@ -82,9 +82,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
8282
8383[[package]]
8484name = "bytes"
85version = "1.3.0"
85version = "1.4.0"
8686source = "registry+https://github.com/rust-lang/crates.io-index"
87checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
87checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
8888
8989[[package]]
9090name = "cassowary"
@@ -163,7 +163,7 @@ dependencies = [
163163 "encode_unicode",
164164 "lazy_static",
165165 "libc",
166 "windows-sys",
166 "windows-sys 0.42.0",
167167]
168168
169169[[package]]
@@ -284,9 +284,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
284284
285285[[package]]
286286name = "cxx"
287version = "1.0.88"
287version = "1.0.91"
288288source = "registry+https://github.com/rust-lang/crates.io-index"
289checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8"
289checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
290290dependencies = [
291291 "cc",
292292 "cxxbridge-flags",
@@ -296,9 +296,9 @@ dependencies = [
296296
297297[[package]]
298298name = "cxx-build"
299version = "1.0.88"
299version = "1.0.91"
300300source = "registry+https://github.com/rust-lang/crates.io-index"
301checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8"
301checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
302302dependencies = [
303303 "cc",
304304 "codespan-reporting",
@@ -311,15 +311,15 @@ dependencies = [
311311
312312[[package]]
313313name = "cxxbridge-flags"
314version = "1.0.88"
314version = "1.0.91"
315315source = "registry+https://github.com/rust-lang/crates.io-index"
316checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971"
316checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
317317
318318[[package]]
319319name = "cxxbridge-macro"
320version = "1.0.88"
320version = "1.0.91"
321321source = "registry+https://github.com/rust-lang/crates.io-index"
322checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e"
322checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
323323dependencies = [
324324 "proc-macro2",
325325 "quote",
@@ -352,18 +352,39 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
352352
353353[[package]]
354354name = "encoding_rs"
355version = "0.8.31"
355version = "0.8.32"
356356source = "registry+https://github.com/rust-lang/crates.io-index"
357checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
357checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
358358dependencies = [
359359 "cfg-if",
360360]
361361
362[[package]]
363name = "errno"
364version = "0.2.8"
365source = "registry+https://github.com/rust-lang/crates.io-index"
366checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
367dependencies = [
368 "errno-dragonfly",
369 "libc",
370 "winapi",
371]
372
373[[package]]
374name = "errno-dragonfly"
375version = "0.1.2"
376source = "registry+https://github.com/rust-lang/crates.io-index"
377checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
378dependencies = [
379 "cc",
380 "libc",
381]
382
362383[[package]]
363384name = "exr"
364version = "1.5.2"
385version = "1.5.3"
365386source = "registry+https://github.com/rust-lang/crates.io-index"
366checksum = "8eb5f255b5980bb0c8cf676b675d1a99be40f316881444f44e0462eaf5df5ded"
387checksum = "e8af5ef47e2ed89d23d0ecbc1b681b30390069de70260937877514377fc24feb"
367388dependencies = [
368389 "bit_field",
369390 "flume",
@@ -372,13 +393,14 @@ dependencies = [
372393 "miniz_oxide",
373394 "smallvec",
374395 "threadpool",
396 "zune-inflate",
375397]
376398
377399[[package]]
378400name = "fastrand"
379version = "1.8.0"
401version = "1.9.0"
380402source = "registry+https://github.com/rust-lang/crates.io-index"
381checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
403checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
382404dependencies = [
383405 "instant",
384406]
@@ -448,9 +470,9 @@ dependencies = [
448470
449471[[package]]
450472name = "futures"
451version = "0.3.25"
473version = "0.3.26"
452474source = "registry+https://github.com/rust-lang/crates.io-index"
453checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
475checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
454476dependencies = [
455477 "futures-channel",
456478 "futures-core",
@@ -462,9 +484,9 @@ dependencies = [
462484
463485[[package]]
464486name = "futures-channel"
465version = "0.3.25"
487version = "0.3.26"
466488source = "registry+https://github.com/rust-lang/crates.io-index"
467checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
489checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
468490dependencies = [
469491 "futures-core",
470492 "futures-sink",
@@ -472,33 +494,33 @@ dependencies = [
472494
473495[[package]]
474496name = "futures-core"
475version = "0.3.25"
497version = "0.3.26"
476498source = "registry+https://github.com/rust-lang/crates.io-index"
477checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
499checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
478500
479501[[package]]
480502name = "futures-io"
481version = "0.3.25"
503version = "0.3.26"
482504source = "registry+https://github.com/rust-lang/crates.io-index"
483checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
505checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
484506
485507[[package]]
486508name = "futures-sink"
487version = "0.3.25"
509version = "0.3.26"
488510source = "registry+https://github.com/rust-lang/crates.io-index"
489checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
511checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
490512
491513[[package]]
492514name = "futures-task"
493version = "0.3.25"
515version = "0.3.26"
494516source = "registry+https://github.com/rust-lang/crates.io-index"
495checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
517checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
496518
497519[[package]]
498520name = "futures-util"
499version = "0.3.25"
521version = "0.3.26"
500522source = "registry+https://github.com/rust-lang/crates.io-index"
501checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
523checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
502524dependencies = [
503525 "futures-core",
504526 "futures-io",
@@ -587,9 +609,9 @@ dependencies = [
587609
588610[[package]]
589611name = "http"
590version = "0.2.8"
612version = "0.2.9"
591613source = "registry+https://github.com/rust-lang/crates.io-index"
592checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
614checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
593615dependencies = [
594616 "bytes",
595617 "fnv",
@@ -621,9 +643,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
621643
622644[[package]]
623645name = "hyper"
624version = "0.14.23"
646version = "0.14.24"
625647source = "registry+https://github.com/rust-lang/crates.io-index"
626checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"
648checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
627649dependencies = [
628650 "bytes",
629651 "futures-channel",
@@ -739,6 +761,16 @@ dependencies = [
739761 "serde_json",
740762]
741763
764[[package]]
765name = "io-lifetimes"
766version = "1.0.5"
767source = "registry+https://github.com/rust-lang/crates.io-index"
768checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
769dependencies = [
770 "libc",
771 "windows-sys 0.45.0",
772]
773
742774[[package]]
743775name = "ipnet"
744776version = "2.7.1"
@@ -762,9 +794,9 @@ dependencies = [
762794
763795[[package]]
764796name = "js-sys"
765version = "0.3.60"
797version = "0.3.61"
766798source = "registry+https://github.com/rust-lang/crates.io-index"
767checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
799checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
768800dependencies = [
769801 "wasm-bindgen",
770802]
@@ -796,6 +828,12 @@ dependencies = [
796828 "cc",
797829]
798830
831[[package]]
832name = "linux-raw-sys"
833version = "0.1.4"
834source = "registry+https://github.com/rust-lang/crates.io-index"
835checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
836
799837[[package]]
800838name = "lock_api"
801839version = "0.4.9"
@@ -862,14 +900,14 @@ dependencies = [
862900
863901[[package]]
864902name = "mio"
865version = "0.8.5"
903version = "0.8.6"
866904source = "registry+https://github.com/rust-lang/crates.io-index"
867checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
905checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
868906dependencies = [
869907 "libc",
870908 "log",
871909 "wasi",
872 "windows-sys",
910 "windows-sys 0.45.0",
873911]
874912
875913[[package]]
@@ -970,9 +1008,9 @@ dependencies = [
9701008
9711009[[package]]
9721010name = "once_cell"
973version = "1.17.0"
1011version = "1.17.1"
9741012source = "registry+https://github.com/rust-lang/crates.io-index"
975checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
1013checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
9761014
9771015[[package]]
9781016name = "openssl"
@@ -1031,15 +1069,15 @@ dependencies = [
10311069
10321070[[package]]
10331071name = "parking_lot_core"
1034version = "0.9.6"
1072version = "0.9.7"
10351073source = "registry+https://github.com/rust-lang/crates.io-index"
1036checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
1074checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
10371075dependencies = [
10381076 "cfg-if",
10391077 "libc",
10401078 "redox_syscall",
10411079 "smallvec",
1042 "windows-sys",
1080 "windows-sys 0.45.0",
10431081]
10441082
10451083[[package]]
@@ -1106,9 +1144,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
11061144
11071145[[package]]
11081146name = "proc-macro2"
1109version = "1.0.50"
1147version = "1.0.51"
11101148source = "registry+https://github.com/rust-lang/crates.io-index"
1111checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
1149checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
11121150dependencies = [
11131151 "unicode-ident",
11141152]
@@ -1183,15 +1221,6 @@ dependencies = [
11831221 "bitflags",
11841222]
11851223
1186[[package]]
1187name = "remove_dir_all"
1188version = "0.5.3"
1189source = "registry+https://github.com/rust-lang/crates.io-index"
1190checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
1191dependencies = [
1192 "winapi",
1193]
1194
11951224[[package]]
11961225name = "reqwest"
11971226version = "0.11.14"
@@ -1231,9 +1260,9 @@ dependencies = [
12311260
12321261[[package]]
12331262name = "rgb"
1234version = "0.8.34"
1263version = "0.8.36"
12351264source = "registry+https://github.com/rust-lang/crates.io-index"
1236checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3"
1265checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59"
12371266dependencies = [
12381267 "bytemuck",
12391268]
@@ -1247,6 +1276,20 @@ dependencies = [
12471276 "fsio",
12481277]
12491278
1279[[package]]
1280name = "rustix"
1281version = "0.36.8"
1282source = "registry+https://github.com/rust-lang/crates.io-index"
1283checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
1284dependencies = [
1285 "bitflags",
1286 "errno",
1287 "io-lifetimes",
1288 "libc",
1289 "linux-raw-sys",
1290 "windows-sys 0.45.0",
1291]
1292
12501293[[package]]
12511294name = "ryu"
12521295version = "1.0.12"
@@ -1259,7 +1302,7 @@ version = "0.1.21"
12591302source = "registry+https://github.com/rust-lang/crates.io-index"
12601303checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
12611304dependencies = [
1262 "windows-sys",
1305 "windows-sys 0.42.0",
12631306]
12641307
12651308[[package]]
@@ -1325,9 +1368,9 @@ dependencies = [
13251368
13261369[[package]]
13271370name = "serde_json"
1328version = "1.0.91"
1371version = "1.0.93"
13291372source = "registry+https://github.com/rust-lang/crates.io-index"
1330checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
1373checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
13311374dependencies = [
13321375 "itoa",
13331376 "ryu",
@@ -1361,9 +1404,9 @@ dependencies = [
13611404
13621405[[package]]
13631406name = "signal-hook"
1364version = "0.3.14"
1407version = "0.3.15"
13651408source = "registry+https://github.com/rust-lang/crates.io-index"
1366checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
1409checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
13671410dependencies = [
13681411 "libc",
13691412 "signal-hook-registry",
@@ -1382,13 +1425,19 @@ dependencies = [
13821425
13831426[[package]]
13841427name = "signal-hook-registry"
1385version = "1.4.0"
1428version = "1.4.1"
13861429source = "registry+https://github.com/rust-lang/crates.io-index"
1387checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
1430checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
13881431dependencies = [
13891432 "libc",
13901433]
13911434
1435[[package]]
1436name = "simd-adler32"
1437version = "0.3.4"
1438source = "registry+https://github.com/rust-lang/crates.io-index"
1439checksum = "14a5df39617d7c8558154693a1bb8157a4aab8179209540cc0b10e5dc24e0b18"
1440
13921441[[package]]
13931442name = "sixel-rs"
13941443version = "0.3.3"
@@ -1409,9 +1458,9 @@ dependencies = [
14091458
14101459[[package]]
14111460name = "slab"
1412version = "0.4.7"
1461version = "0.4.8"
14131462source = "registry+https://github.com/rust-lang/crates.io-index"
1414checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
1463checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
14151464dependencies = [
14161465 "autocfg",
14171466]
@@ -1434,18 +1483,18 @@ dependencies = [
14341483
14351484[[package]]
14361485name = "spin"
1437version = "0.9.4"
1486version = "0.9.5"
14381487source = "registry+https://github.com/rust-lang/crates.io-index"
1439checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
1488checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc"
14401489dependencies = [
14411490 "lock_api",
14421491]
14431492
14441493[[package]]
14451494name = "syn"
1446version = "1.0.107"
1495version = "1.0.109"
14471496source = "registry+https://github.com/rust-lang/crates.io-index"
1448checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
1497checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
14491498dependencies = [
14501499 "proc-macro2",
14511500 "quote",
@@ -1454,16 +1503,15 @@ dependencies = [
14541503
14551504[[package]]
14561505name = "tempfile"
1457version = "3.3.0"
1506version = "3.4.0"
14581507source = "registry+https://github.com/rust-lang/crates.io-index"
1459checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
1508checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
14601509dependencies = [
14611510 "cfg-if",
14621511 "fastrand",
1463 "libc",
14641512 "redox_syscall",
1465 "remove_dir_all",
1466 "winapi",
1513 "rustix",
1514 "windows-sys 0.42.0",
14671515]
14681516
14691517[[package]]
@@ -1506,15 +1554,15 @@ dependencies = [
15061554
15071555[[package]]
15081556name = "tinyvec_macros"
1509version = "0.1.0"
1557version = "0.1.1"
15101558source = "registry+https://github.com/rust-lang/crates.io-index"
1511checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
1559checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
15121560
15131561[[package]]
15141562name = "tokio"
1515version = "1.24.2"
1563version = "1.25.0"
15161564source = "registry+https://github.com/rust-lang/crates.io-index"
1517checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
1565checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
15181566dependencies = [
15191567 "autocfg",
15201568 "bytes",
@@ -1524,14 +1572,14 @@ dependencies = [
15241572 "num_cpus",
15251573 "pin-project-lite",
15261574 "socket2",
1527 "windows-sys",
1575 "windows-sys 0.42.0",
15281576]
15291577
15301578[[package]]
15311579name = "tokio-native-tls"
1532version = "0.3.0"
1580version = "0.3.1"
15331581source = "registry+https://github.com/rust-lang/crates.io-index"
1534checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
1582checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
15351583dependencies = [
15361584 "native-tls",
15371585 "tokio",
@@ -1539,9 +1587,9 @@ dependencies = [
15391587
15401588[[package]]
15411589name = "tokio-util"
1542version = "0.7.4"
1590version = "0.7.7"
15431591source = "registry+https://github.com/rust-lang/crates.io-index"
1544checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
1592checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
15451593dependencies = [
15461594 "bytes",
15471595 "futures-core",
@@ -1648,9 +1696,9 @@ dependencies = [
16481696
16491697[[package]]
16501698name = "unicode-segmentation"
1651version = "1.10.0"
1699version = "1.10.1"
16521700source = "registry+https://github.com/rust-lang/crates.io-index"
1653checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
1701checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
16541702
16551703[[package]]
16561704name = "unicode-width"
@@ -1725,9 +1773,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
17251773
17261774[[package]]
17271775name = "wasm-bindgen"
1728version = "0.2.83"
1776version = "0.2.84"
17291777source = "registry+https://github.com/rust-lang/crates.io-index"
1730checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
1778checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
17311779dependencies = [
17321780 "cfg-if",
17331781 "wasm-bindgen-macro",
@@ -1735,9 +1783,9 @@ dependencies = [
17351783
17361784[[package]]
17371785name = "wasm-bindgen-backend"
1738version = "0.2.83"
1786version = "0.2.84"
17391787source = "registry+https://github.com/rust-lang/crates.io-index"
1740checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
1788checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
17411789dependencies = [
17421790 "bumpalo",
17431791 "log",
@@ -1750,9 +1798,9 @@ dependencies = [
17501798
17511799[[package]]
17521800name = "wasm-bindgen-futures"
1753version = "0.4.33"
1801version = "0.4.34"
17541802source = "registry+https://github.com/rust-lang/crates.io-index"
1755checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
1803checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
17561804dependencies = [
17571805 "cfg-if",
17581806 "js-sys",
@@ -1762,9 +1810,9 @@ dependencies = [
17621810
17631811[[package]]
17641812name = "wasm-bindgen-macro"
1765version = "0.2.83"
1813version = "0.2.84"
17661814source = "registry+https://github.com/rust-lang/crates.io-index"
1767checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
1815checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
17681816dependencies = [
17691817 "quote",
17701818 "wasm-bindgen-macro-support",
@@ -1772,9 +1820,9 @@ dependencies = [
17721820
17731821[[package]]
17741822name = "wasm-bindgen-macro-support"
1775version = "0.2.83"
1823version = "0.2.84"
17761824source = "registry+https://github.com/rust-lang/crates.io-index"
1777checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
1825checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
17781826dependencies = [
17791827 "proc-macro2",
17801828 "quote",
@@ -1785,15 +1833,15 @@ dependencies = [
17851833
17861834[[package]]
17871835name = "wasm-bindgen-shared"
1788version = "0.2.83"
1836version = "0.2.84"
17891837source = "registry+https://github.com/rust-lang/crates.io-index"
1790checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
1838checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
17911839
17921840[[package]]
17931841name = "web-sys"
1794version = "0.3.60"
1842version = "0.3.61"
17951843source = "registry+https://github.com/rust-lang/crates.io-index"
1796checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
1844checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
17971845dependencies = [
17981846 "js-sys",
17991847 "wasm-bindgen",
@@ -1851,6 +1899,30 @@ dependencies = [
18511899 "windows_x86_64_msvc",
18521900]
18531901
1902[[package]]
1903name = "windows-sys"
1904version = "0.45.0"
1905source = "registry+https://github.com/rust-lang/crates.io-index"
1906checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
1907dependencies = [
1908 "windows-targets",
1909]
1910
1911[[package]]
1912name = "windows-targets"
1913version = "0.42.1"
1914source = "registry+https://github.com/rust-lang/crates.io-index"
1915checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
1916dependencies = [
1917 "windows_aarch64_gnullvm",
1918 "windows_aarch64_msvc",
1919 "windows_i686_gnu",
1920 "windows_i686_msvc",
1921 "windows_x86_64_gnu",
1922 "windows_x86_64_gnullvm",
1923 "windows_x86_64_msvc",
1924]
1925
18541926[[package]]
18551927name = "windows_aarch64_gnullvm"
18561928version = "0.42.1"
@@ -1943,3 +2015,12 @@ dependencies = [
19432015 "typemap",
19442016 "viuer",
19452017]
2018
2019[[package]]
2020name = "zune-inflate"
2021version = "0.2.50"
2022source = "registry+https://github.com/rust-lang/crates.io-index"
2023checksum = "589245df6230839c305984dcc0a8385cc72af1fd223f360ffd5d65efa4216d40"
2024dependencies = [
2025 "simd-adler32",
2026]
README.md +10 −15
@@ -1,20 +1,13 @@
1![](https://img.shields.io/github/languages/top/siriusmart/youtube-tui?label=rust)
2![](https://shields.io/github/license/siriusmart/youtube-tui)
3[![](https://img.shields.io/crates/d/youtube-tui?label=crates.io%20downloads)](https://crates.io/crates/youtube-tui)
4[![](https://img.shields.io/crates/v/youtube-tui?label=crates.io%20version)](https://crates.io/crates/youtube-tui)
5[![](https://img.shields.io/aur/version/youtube-tui)](https://aur.archlinux.org/packages/youtube-tui)
6![](https://shields.io/github/stars/siriusmart/youtube-tui?style=social)
7
8***Read more in the [user manual](https://siriusmart.github.io/youtube-tui) (including installation guide and documentation).***
9
101# Overview
112
123Written in Rust, the **YouTube TUI** is a lightweight and user friendly TUI for browsing YouTube content from the terminal.
134
14![](./docs/src/images/search-showcase.png)
5![](../images/search-showcase.png)
156
167It is like an _app launcher_, it launches other programs to do the heavy lifting (for example, `mpv` for playing videos).
178
9> Consider regenerating config files on updates to allow new features.
10
1811## Customisable
1912
2013The YouTube TUI can be customised through config files, they are located in `~/.config/youtube-tui` and are in the YAML format.
@@ -38,17 +31,19 @@ env:
3831
3932Anything from layouts to colours and keybindings can be customised, more on that later.
4033
41## Dependency-free
34## ~~Dependency-free~~
35
36> Clipboard need to be put as an optional feature before before calling dependency-free, for now `libxcb` is a required dependency.
4237
4338The YouTube TUI does not work on its own, it is instead like a _TUI frontend_ for programs like `mpv` or `yt-dlp`/`youtube-dl`.
4439
45However, the programs to launch can be changed, and therefore the YouTube TUI <u>does not rely on any specific dependencies</u> to run.
40However, the programs to launch can be changed, and therefore ~~the YouTube TUI <u>does not rely on any specific dependencies</u> to run~~.
4641
47![](./docs/src/images/custom-dependencies-showcase.png)
42![](../images/custom-dependencies-showcase.png)
4843
4944## Powerful
5045
51The YouTube TUI allows you to browse YouTube with (almost) all of its features, functions including:
46The YouTube TUI allows you to browse YouTube with (almost) all of it's features, functions including:
5247
5348- View popular/trending videos
5449- View information about channels, playlists and videos
@@ -60,11 +55,11 @@ It also includes features like:
6055- Vim-like commands
6156- Mouse support
6257- Extensible keybindings system
58- Offline library
6359
6460### What it doesn't have
6561
6662- Subscriptions (first priority)
67- Download library (will implement)
6863
6964## How to contribute
7065
docs/src/README.md +8 −4
@@ -6,6 +6,8 @@ Written in Rust, the **YouTube TUI** is a lightweight and user friendly TUI for
66
77It is like an _app launcher_, it launches other programs to do the heavy lifting (for example, `mpv` for playing videos).
88
9> Consider regenerating config files on updates to allow new features.
10
911## Customisable
1012
1113The YouTube TUI can be customised through config files, they are located in `~/.config/youtube-tui` and are in the YAML format.
@@ -29,11 +31,13 @@ env:
2931
3032Anything from layouts to colours and keybindings can be customised, more on that later.
3133
32## Dependency-free
34## ~~Dependency-free~~
35
36> Clipboard need to be put as an optional feature before before calling dependency-free, for now `libxcb` is a required dependency.
3337
3438The YouTube TUI does not work on its own, it is instead like a _TUI frontend_ for programs like `mpv` or `yt-dlp`/`youtube-dl`.
3539
36However, the programs to launch can be changed, and therefore the YouTube TUI <u>does not rely on any specific dependencies</u> to run.
40However, the programs to launch can be changed, and therefore ~~the YouTube TUI <u>does not rely on any specific dependencies</u> to run~~.
3741
3842![](./images/custom-dependencies-showcase.png)
3943
@@ -50,12 +54,12 @@ It also includes features like:
5054
5155- Vim-like commands
5256- Mouse support
53- Entensible keybindings system
57- Extensible keybindings system
58- Offline library
5459
5560### What it doesn't have
5661
5762- Subscriptions (first priority)
58- Download library (will implement)
5963
6064## How to contribute
6165
docs/src/SUMMARY.md +5 −6
@@ -18,12 +18,11 @@
1818
1919# Contributing
2020
21- [How it works](how_it_works.md)
22 - [Framework](framework.md)
23 - [Invidious API]()
24 - [Individual items]()
25
26- [Contribution guide]()
21- [How it works](explaination/how_it_works.md)
22 - [Framework](explaination/framework.md)
23 - [Event loop]()
24 - [Invidious and loading videos]()
25 - [Caching and library]()
2726
2827- [Changelogs](changelogs.md)
2928- [Contributors](contributors.md)
docs/src/basic_usage.md +8 −8
@@ -49,12 +49,6 @@ To apply search filters, select the button with 3 dots (`...`) to the right of t
4949
5050Press `Enter` to select a video or playlist from any lists, then move the cursor to the *bottom item* where you can play, download and open the webpage in browser.
5151
52### Playlist views
53
54The playlist page allows two different view modes, the first of which is *commands view* - similar to what the video page offers.
55
56The other one is *videos view*, which allows you to look at each videos in the playlist individually.
57
5852## Command mode
5953
6054Command mode is like that of Vim, it can be started by pressing `:` when nothing is selected.
@@ -63,11 +57,13 @@ More about commands in the [next chapter](commands.md).
6357
6458## Command bindings
6559
66Keys can be binded to a command, more about it in the next chapter.
60Keys can be bind to a command, more about it in the next chapter.
61
62For example `Ctrl + F` launches your web browser.
6763
6864## Buttons
6965
70Buttons have no use on their own, but allows you to navigate between pages.
66Buttons are similar to hyperlinks, it allows you to navigate between pages.
7167
7268## Mouse click control
7369
@@ -83,3 +79,7 @@ However, there are some downsides to not using your keyboard.
8379
84801. Cannot move up or down to items not on screen in a list (you can do that with `Up` or `Down arrow`)
85812. Cannot access function keys like `Backspace` or `Q`
82
83## Library
84
85Items can be bookmarked and saved to library, they can also be saved to be viewed offline.
docs/src/changelogs.md +19 −5
@@ -1,12 +1,26 @@
11# Changelogs
22
3## v0.7.0
4
5### Added
6
7- File system based caching
8- Bookmark library
9- Save video/playlists for offline viewing
10
11### Fixed
12
13- Empty ItemList crash (<a href="https://github.com/Siriusmart/youtube-tui/issues/26" target=_blank>issue 26</a>)
14
15<hr>
16
317## v0.6.2
418
5#### Added
19### Added
620
721- Command bindings
822
9#### Fixed
23### Fixed
1024
1125- Image not cleared when going back to "switch view"
1226
@@ -34,7 +48,7 @@
3448
3549## v0.5.3
3650
37#### Fixed
51### Fixed
3852
3953- Search bar could not handle non English characters (e.g. <a href="https://github.com/Siriusmart/youtube-tui/issues/14" target=_blank>Russian</a>)
4054
@@ -68,11 +82,11 @@
6882
6983## v0.4.4
7084
71#### Added
85### Added
7286
7387- Added default select item for each page (can be changed in `layouts.yml`)
7488
75#### Fixes
89### Fixes
7690
7791- Video list view in playlists not working
7892- Channel view scroll causes panic
docs/src/contributors.md +6 −2
@@ -4,10 +4,14 @@
44
55Creator and main developer of YouTube TUI.
66
7## <a href="https://github.com/LuckyTurtleDev" target=_blank>LuckyTurtleDev</a>
8
9Maintainer of the <a href="https://aur.archlinux.org/packages/youtube-tui" target=_blank>`youtube-tui`</a> package on AUR.
10
711## <a href="https://github.com/zaedus" target=_blank>Zaedus</a>
812
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>.
13Maintainer of the <a href="https://aur.archlinux.org/packages/youtube-tui-full-bin" target=_blank>`youtube-tui-full-bin`</a>, <a href="https://aur.archlinux.org/packages/youtube-tui-nodefaults-bin" target=_blank>`youtube-tui-nodefaults-bin`</a> and <a href="https://aur.archlinux.org/packages/youtube-tui-git" target=_blank>`youtube-tui-git`</a> package on AUR.
1014
11## <a href="https://github.com/fractal-tess" target=_blank>Fractal Tess</a>
15## <a href="https://github.com/fractal-tess" target=_blank>Fractal Tess</a>, <a href="https://github.com/msrd0" target=_blank>msrd0</a>
1216
1317Fixed typos in README.
docs/src/explaination/framework.md added +126
@@ -0,0 +1,126 @@
1# Framework
2
3At the core of this TUI, is the framework from the <a href="https://crates.io/crates/tui-additions" target=_blank>`tui-additions`</a> crate, it allows the program to *render* onto the screen, *take inputs* (mouse and keyboard) in an orderly fashion.
4
5A <a href="https://docs.rs/tui-additions/latest/tui_additions/framework/struct.Framework.html" target=_blank>Framework</a> holds a bunch of other structs, a simplified version would looks something like this.
6
7```rs
8struct Framework {
9 state: Vec<Vec<Item>>,
10 cursor: CursorState,
11 selectables: Vec<Vec<(usize, usize)>>,
12 data: FrameworkData,
13 history: FrameworkHistory,
14}
15```
16
17## State
18
19Holds a 2D array of items, but that is just the simplified version.
20
21The `State` struct also holds the width of the items, heigh of the rows, and other details such as *if the row should be centered or not*.
22
23## Cursor
24
25The cursor can be in one of these states.
26
27- Selected - where an item is selected.
28- Hover - when its being moved around.
29- None - when the page first loads, the cursor does not have a state.
30
31## Selectables
32
33This is an interesting one. As [mentioned below](#selectableself---bool), some items can be hovered when other cannot. Each `selectables[x][y]` maps to a selectable (hoverable) coordinate.
34
35Instead of using a `HashMap<(usize, usize)>`, using a 2D array ensures that all *x: 0..range* and *y: 0..range* are mapped to a selectable item. And moving the cursor left is as easy as increasing x by 1, without having to worry about selectability check and stuff.
36
37## Data
38
39There are 2 sets of data available - *global* and *state*.
40
41**Global data** are global across all pages, this is mainly used to store config structs, as they are meant to be applied globally.
42
43**State data** are exclusive to each page, this is done to ensure that each page will get the correct data.
44
45> For example, if state data is not used, the next page will overwrite data in the previous page, making going back in history impossible.
46
47## History
48
49This stores the past states and data of the struct, pretty self explanatory.
50
51<hr>
52
53## Items
54
55Items are placed across the screen *in rows*, each item is <u>individual</u> and changing of one should not affect others in anyway.
56
57![](../images/rows.svg)
58
59> Diagram showing that individual items arranged in rows on screen.
60
61Each item has a set of functions from the trait <a href="https://docs.rs/tui-additions/latest/tui_additions/framework/trait.FrameworkItem.html" target=_blank>FrameworkItem</a>:
62
63### .selectable(&self) -> bool
64
65The function is ran on page load, it determines whether *the item can be hovered by cursor or not*.
66
67Most item returns true, as they can be selected and hovered.
68
69However there are some exceptions, including MessageBar and the big info display in channel home page.
70
71> PageButtons returns true in this function, as they can be hovered by cursor. Instead, `.select()` is responsible for their special behaviour.
72
73### .select(&mut self, &mut Framework) -> bool
74
75This function is ran when an item is selected (pressed enter on), it allows the item to modify its own state and the framework state. The returned boolean also determines if the selecting item will *stay selected* and capture key input.
76
77Most items returns true in this function, for example SearchBar stays selected and captures key input after being selected, until deselect.
78
79PageButtons returns false, as they don't want to say selected. This does not mean the function does nothing, they are still able to modify their own states and <u>push a LoadPage task to queue</u>.
80
81### .deselect(&mut self, &mut Framework) -> bool
82
83This function is the exact opposite of the .select() function, it is called when the *deselect keybinding* (Esc) is pressed, or the mouse clicks somewhere outside the item.
84
85All items returns true on this function.
86
87> A fun fact is that items can actually return false, and refuse to get deselected. This can be useful when waiting for a condition to be met.
88
89### .load_item(&mut self, &mut Framework, ...) -> Result
90
91This is the function responsible for the loading of items. The YouTube TUI adds an empty item to the screen, then calls this function for the item to load itself.
92
93An item that heavily rely on this function is ItemList, it loads video according to the current page, whether it's Library, History or Search.
94
95> Currently, this function can be very inefficient as items are loaded one after another (sync). This will improve once Rust implements async traits.
96
97Errors will be displayed in MessageBar in the next frame.
98
99### .render(&mut self, &mut Framework, &mut Frame, area)
100
101Items should be able to render itself within `area` of `Frame`, the area is different for each item, and should not overlap.
102
103Each frame is rendered 2 times.
104
1051. Render all normal items.
1062. Render all popups, as they need to be above normal items.
107
108Normal items should not render in the popup render, for example:
109
110```rs
111if popup_render {
112 return;
113}
114```
115
116### .key_event(&mut self, &mut Framework, KeyEvent) -> Result
117
118Pretty self explanatory, selected item takes in a key event and do some modification to itself and/or the Framework state.
119
120Errors will be displayed in MessageBar in the next frame.
121
122### .mouse_event(&mut self, &mut Framework, x, y) -> bool
123
124Similar to key\_event, this function takes in the relative `x` and `y` of the mouse click on the item.
125
126The return boolean indicates if the item has been modified by the mouse click, if true then the screen will rerender.
docs/src/explaination/how_it_works.md added +7
@@ -0,0 +1,7 @@
1# How it works
2
3This sections talks about roughly how this TUI works, *crates*, *important structs* and their location, and the *main event loop* will be mentioned.
4
5## Table of contents
6
7- [Framework](./framework.md) talks about how a *single frame* is rendered, and how a *single input* is handled.
docs/src/framework.md deleted −20
@@ -1,20 +0,0 @@
1# Framework
2
3At the core of this TUI, is the framework from the <a href="https://crates.io/crates/tui-additions" target=_blank>`tui-additions`</a> crate, it allows the program to *render* onto the screen, *take inputs* (mouse and keyboard) in an orderly fashion.
4
5## Items
6
7Items are placed across the screen *in rows*, each item is <u>individual</u> and changing of one should not affect others in anyway.
8
9Each item has a set of funcitons (from the trait `FrameworkItem`), or handlers.
10
11|Function|Return type|Purpose|
12|---|---|---|
13|`selectable`|Boolean|Check if the item can be selected, and should the user be able to hover the cursor over the item.<br><br>(E.g. Message bar is not selectable)|
14|`render`|None|The item renders itself within a given area of the screen.|
15|`key_event`|Result|The item handles the keyboard input when it is selected, if an `Err(_)` is returned then the error will be displayed in the message bar.|
16|`mouse_event`|Boolean|The selected item handles the mouse click event when being clicked on.|
17
18Todo...
19
20![](./images/rows.svg)
docs/src/how_it_works.md deleted −10
@@ -1,10 +0,0 @@
1# How it works
2
3This sections talks about roughly how this TUI works, *crates*, *important structs* and their location, and the *main event loop* will be mentioned.
4
5## Table of contents
6
7- [Framework](framework.md) talks about how a *single frame* is rendered, and how a *single input* is handled.
8- [Invidious]() talks about how information from YouTube is retrieved.
9- [Important struct]() talks about how variables are stored across the program.
10- [The main event loop]() talks about how different parts of the program are chained together to function as is.
docs/src/installation.md +8 −9
@@ -1,12 +1,12 @@
11# Installation
22
3It's about download (or building) the binary and putting them in an easily accessible location (like `/bin/`).
3> Currently YouTube TUI requires `libxcb`, which should come preinstalled in most Linux system.
44
5The YouTube TUI is not tested for Windows.
5The YouTube TUI is *not* tested for Windows.
66
77## Install from Crates.io (recommended)
88
9Crates.io is a repository for programs written in Rust, and the YouTube TUI is avaliable <a href="https://crates.io/crates/youtube-tui" target=_blank>*there*</a>.
9Crates.io is a repository for programs written in Rust, and the YouTube TUI is available <a href="https://crates.io/crates/youtube-tui" target=_blank>*there*</a>.
1010
1111To install using this method, you will need `rustc` and `cargo` present. <a href="https://www.rust-lang.org/tools/install" target=_blank>*Here*</a>'s a tutorial on how to get them.
1212
@@ -20,14 +20,15 @@ cargo install youtube-tui
2020
2121## AUR for Arch Linux (recommended)
2222
23The YouTube TUI is avaliable in the AUR <a href="https://aur.archlinux.org/packages/youtube-tui-git" target=_blank>*here*</a>.
23The YouTube TUI is available in the AUR <a href="https://aur.archlinux.org/packages/youtube-tui-git" target=_blank>*here*</a>.
2424
2525Use an <a href="https://aur.archlinux.org" target=_blank>AUR</a> helper like <a href="https://aur.archlinux.org/packages/yay" target=_blank>`yay`</a> to install.
2626
2727```sh
28yay -S youtube-tui-git # replace `yay` with your AUR helper
29yay -S youtube-tui-full-bin # requires libsixel
30yay -S youtube-tui-nodefaults-bin
28yay -S youtube-tui # lastest crates.io release, recommended
29yay -S youtube-tui-git # latest git version, potentially untested
30yay -S youtube-tui-full-bin # default binary (out of date)
31yay -S youtube-tui-nodefaults-bin # minimal binary (out of date)
3132```
3233
3334## Build from source
@@ -71,5 +72,3 @@ Display images with Sixels, allows the display of images at full definition. Not
7172Enabling this will also enable `halfblock`.
7273
7374Requires <a href="https://github.com/saitoha/libsixel" target=_blank>`libsixel`</a>.
74
75> `sixel` and `halfblock` does not compile on Windows.
src/config/commandbindings.rs +7 −7
@@ -45,12 +45,8 @@ impl CommandBindings {
4545 Page::MainMenu(MainMenuPage::History) => get_command(key, &self.watchhistory),
4646 Page::MainMenu(MainMenuPage::Subscriptions) => get_command(key, &self.subscriptions),
4747 Page::MainMenu(MainMenuPage::Library) => get_command(key, &self.libray),
48 Page::SingleItem(SingleItemPage::Video(_))
49 | Page::SingleItem(SingleItemPage::LocalVideo(_)) => get_command(key, &self.video),
50 Page::SingleItem(SingleItemPage::Playlist(_))
51 | Page::SingleItem(SingleItemPage::LocalPlaylist(_)) => {
52 get_command(key, &self.playlist)
53 }
48 Page::SingleItem(SingleItemPage::Video(_)) => get_command(key, &self.video),
49 Page::SingleItem(SingleItemPage::Playlist(_)) => get_command(key, &self.playlist),
5450 Page::ChannelDisplay(ChannelDisplayPage {
5551 r#type: ChannelDisplayPageType::Main,
5652 ..
@@ -250,5 +246,9 @@ fn subscriptions_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
250246}
251247
252248fn library_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> {
253 HashMap::default()
249 HashMap::from([
250 (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video"))])),
251 (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("run ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])),
252 (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("run mpv '${hover-url}'"))]))
253 ])
254254}
src/config/commands.rs +71 −61
@@ -10,9 +10,9 @@ use crate::global::traits::ConfigTrait;
1010pub struct CommandsConfig {
1111 pub launch_command: String,
1212 pub video: Vec<(String, String)>,
13 pub saved_video: Vec<(String, String)>,
1314 pub playlist: Vec<(String, String)>,
14 pub local_video: Vec<(String, String)>,
15 pub local_playlist: Vec<(String, String)>,
15 pub saved_playlist: Vec<(String, String)>,
1616}
1717
1818impl Key for CommandsConfig {
@@ -28,18 +28,18 @@ impl From<CommandsConfigSerde> for CommandsConfig {
2828 .into_iter()
2929 .map(|hashmap| hashmap.into_iter().last().unwrap())
3030 .collect(),
31 playlist: original
32 .playlist
31 saved_video: original
32 .saved_video
3333 .into_iter()
3434 .map(|hashmap| hashmap.into_iter().last().unwrap())
3535 .collect(),
36 local_video: original
37 .local_video
36 playlist: original
37 .playlist
3838 .into_iter()
3939 .map(|hashmap| hashmap.into_iter().last().unwrap())
4040 .collect(),
41 local_playlist: original
42 .local_playlist
41 saved_playlist: original
42 .saved_playlist
4343 .into_iter()
4444 .map(|hashmap| hashmap.into_iter().last().unwrap())
4545 .collect(),
@@ -55,12 +55,12 @@ pub struct CommandsConfigSerde {
5555 pub launch_command: String,
5656 #[serde(default = "video_default")]
5757 pub video: Vec<HashMap<String, String>>,
58 #[serde(default = "saved_video_default")]
59 pub saved_video: Vec<HashMap<String, String>>,
5860 #[serde(default = "playlist_default")]
5961 pub playlist: Vec<HashMap<String, String>>,
60 #[serde(default = "local_video_default")]
61 pub local_video: Vec<HashMap<String, String>>,
62 #[serde(default = "local_playlist_default")]
63 pub local_playlist: Vec<HashMap<String, String>>,
62 #[serde(default = "saved_playlist_default")]
63 pub saved_playlist: Vec<HashMap<String, String>>,
6464}
6565
6666impl ConfigTrait for CommandsConfigSerde {
@@ -72,9 +72,9 @@ impl Default for CommandsConfigSerde {
7272 Self {
7373 launch_command: launch_command_default(),
7474 video: video_default(),
75 saved_video: saved_video_default(),
7576 playlist: playlist_default(),
76 local_video: local_video_default(),
77 local_playlist: local_playlist_default(),
77 saved_playlist: saved_playlist_default(),
7878 }
7979 }
8080}
@@ -83,11 +83,15 @@ impl Default for CommandsConfigSerde {
8383// Different pages may contain different `env`s (for example `url` is different in each page)
8484
8585fn launch_command_default() -> String {
86 String::from("loadpage watchhistory ;; flush ;; history clear")
86 String::from("loadpage library ;; flush ;; history clear")
8787}
8888
8989fn video_default() -> Vec<HashMap<String, String>> {
9090 vec![
91 HashMap::from([(
92 String::from("Reload updated video"),
93 String::from("run rm '~/.cache/youtube-tui/info/${id}.json' ;; video ${id}"),
94 )]),
9195 HashMap::from([(
9296 String::from("Play video"),
9397 String::from("run ${video-player} '${embed-url}'"),
@@ -115,12 +119,12 @@ fn video_default() -> Vec<HashMap<String, String>> {
115119 String::from("togglemark ${id}")
116120 )]),
117121 HashMap::from([(
118 String::from("Save video"),
119 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -o '${save-path}${id}/%(id)s'")
122 String::from("Save video to library"),
123 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}.*' ;; run ${terminal-emulator} ${youtube-downloader} '${embed-url}' -o '${save-path}%(title)s[%(id)s].%(ext)s'")
120124 )]),
121125 HashMap::from([(
122 String::from("Save audio"),
123 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o '${save-path}${id}/%(id)s'")
126 String::from("Save audio to library"),
127 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}.*' ;; run ${terminal-emulator} ${youtube-downloader} '${embed-url}' -x -o '${save-path}%(title)s[%(id)s].%(ext)s'")
124128 )]),
125129 HashMap::from([(
126130 String::from("Mode: ${provider}"),
@@ -129,24 +133,23 @@ fn video_default() -> Vec<HashMap<String, String>> {
129133 ]
130134}
131135
132fn playlist_default() -> Vec<HashMap<String, String>> {
136fn saved_video_default() -> Vec<HashMap<String, String>> {
133137 vec![
134 HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]),
135138 HashMap::from([(
136 String::from("Reload as online mode"),
137 String::from("playlist ${id}"),
139 String::from("Reload updated video"),
140 String::from("run rm '~/.cache/youtube-tui/info/${id}.json' ;; video ${id}"),
138141 )]),
139142 HashMap::from([(
140 String::from("Play all videos"),
141 String::from("run ${video-player} ${all-videos}"),
143 String::from("[Offline] Play saved file"),
144 String::from("run find ${save-path} | grep ${id} | ${video-player} --playlist=- --force-window"),
142145 )]),
143146 HashMap::from([(
144 String::from("Play all audio"),
145 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video"),
147 String::from("[Offline] Play saved file (audio)"),
148 String::from("run ${terminal-emulator} bash -c 'find ${save-path} | grep ${id} | ${video-player} --playlist=- --no-video'"),
146149 )]),
147150 HashMap::from([(
148 String::from("Shuffle play all audio (loop)"),
149 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video --shuffle --loop-playlist=inf"),
151 String::from("[Offline] Play saved file (audio loop)"),
152 String::from("run ${terminal-emulator} bash -c 'find ${save-path} | grep ${id} | ${video-player} --playlist=- --no-video --loop'"),
150153 )]),
151154 HashMap::from([(
152155 String::from("View channel"),
@@ -161,35 +164,38 @@ fn playlist_default() -> Vec<HashMap<String, String>> {
161164 String::from("togglemark ${id}")
162165 )]),
163166 HashMap::from([(
164 String::from("Save all audio"),
165 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run mkdir '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o '${save-path}${id}/%(id)s'")
167 String::from("Redownload video to library"),
168 String::from("bookmark ${id} ;; run rm ${save-path}*${id}*.* ;; run ${terminal-emulator} ${youtube-downloader} ${embed-url} -o '${save-path}%(title)s[%(id)s].%(ext)s'"),
166169 )]),
167170 HashMap::from([(
168 String::from("Mode: ${provider}"),
169 String::from("switchprovider"),
171 String::from("Redownload audio to library"),
172 String::from("bookmark ${id} ;; run rm ${save-path}*${id}*.* ;; run ${terminal-emulator} ${youtube-downloader} ${embed-url} -x -o '${save-path}%(title)s[%(id)s].%(ext)s'")
173 )]),
174 HashMap::from([(
175 String::from("Delete saved file"),
176 String::from("run rm ${save-path}*${id}*.*")
170177 )]),
171178 ]
172179}
173180
174fn local_video_default() -> Vec<HashMap<String, String>> {
181fn playlist_default() -> Vec<HashMap<String, String>> {
175182 vec![
183 HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]),
176184 HashMap::from([(
177 String::from("Reload as online mode"),
178 String::from("video ${id}"),
185 String::from("Reload updated playlist"),
186 String::from("run rm ~/.cache/youtube-tui/info/${id}.json ;; reload"),
179187 )]),
180188 HashMap::from([(
181 String::from("Play video"),
182 String::from("run ${video-player} '${embed-url}'"),
189 String::from("Play all (videos)"),
190 String::from("run ${video-player} ${all-videos}"),
183191 )]),
184192 HashMap::from([(
185 String::from("Play audio"),
186 String::from("run ${terminal-emulator} ${video-player} '${embed-url}' --no-video"),
193 String::from("Play all (audio)"),
194 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video"),
187195 )]),
188196 HashMap::from([(
189 String::from("Play audio (loop)"),
190 String::from(
191 "run ${terminal-emulator} ${video-player} '${embed-url}' --no-video --loop-file=inf",
192 ),
197 String::from("Shuffle play all (audio loop)"),
198 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video --shuffle --loop-playlist=inf"),
193199 )]),
194200 HashMap::from([(
195201 String::from("View channel"),
@@ -204,12 +210,12 @@ fn local_video_default() -> Vec<HashMap<String, String>> {
204210 String::from("togglemark ${id}")
205211 )]),
206212 HashMap::from([(
207 String::from("Save video"),
208 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -o '${save-path}${id}/%(id)s'")
213 String::from("Save playlist videos to library"),
214 String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; run ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"")
209215 )]),
210216 HashMap::from([(
211 String::from("Save audio"),
212 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o '${save-path}${id}/%(id)s'")
217 String::from("Save playlist audio to library"),
218 String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; run ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"")
213219 )]),
214220 HashMap::from([(
215221 String::from("Mode: ${provider}"),
@@ -218,24 +224,24 @@ fn local_video_default() -> Vec<HashMap<String, String>> {
218224 ]
219225}
220226
221fn local_playlist_default() -> Vec<HashMap<String, String>> {
227fn saved_playlist_default() -> Vec<HashMap<String, String>> {
222228 vec![
223229 HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]),
224230 HashMap::from([(
225 String::from("Reload as online mode"),
226 String::from("playlist ${id}"),
231 String::from("Reload updated playlist"),
232 String::from("run rm ~/.cache/youtube-tui/info/${id}.json ;; reload"),
227233 )]),
228234 HashMap::from([(
229 String::from("Play all videos"),
230 String::from("run ${video-player} ${all-videos}"),
235 String::from("[Offline] Play all (videos)"),
236 String::from("run find ${save-path} | grep ${id} | ${video-player} --playlist=- --force-window"),
231237 )]),
232238 HashMap::from([(
233 String::from("Play all audio"),
234 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video"),
239 String::from("[Offline] Play all (audio)"),
240 String::from("run ${terminal-emulator} bash -c 'find ${save-path} | grep ${id} | ${video-player} --playlist=- --no-video'"),
235241 )]),
236242 HashMap::from([(
237 String::from("Shuffle play all audio (loop)"),
238 String::from("run ${terminal-emulator} ${video-player} ${all-videos} --no-video --shuffle --loop-playlist=inf"),
243 String::from("[Offline] Shuffle play all (audio loop)"),
244 String::from("run ${terminal-emulator} bash -c 'find ${save-path} | grep ${id} | ${video-player} --playlist=- --no-video --loop-playlist=inf'"),
239245 )]),
240246 HashMap::from([(
241247 String::from("View channel"),
@@ -250,12 +256,16 @@ fn local_playlist_default() -> Vec<HashMap<String, String>> {
250256 String::from("togglemark ${id}")
251257 )]),
252258 HashMap::from([(
253 String::from("Save all audio"),
254 String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}' ;; run mkdir '${save-path}${id}' ;; run ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o '${save-path}${id}/%(id)s'")
259 String::from("Redownload playlist videos to library"),
260 String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; run ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"")
255261 )]),
256262 HashMap::from([(
257 String::from("Mode: ${provider}"),
258 String::from("switchprovider"),
263 String::from("Redownload playlist audio to library"),
264 String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; run ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"")
265 )]),
266 HashMap::from([(
267 String::from("Delete saved files"),
268 String::from("run rm -rf ${save-path}*${id}*")
259269 )]),
260270 ]
261271}
src/global/functions/mod.rs +2
@@ -25,3 +25,5 @@ mod update_provider;
2525pub use update_provider::*;
2626mod init_move;
2727pub use init_move::*;
28mod singleitem_load;
29pub use singleitem_load::*;
src/global/functions/run_command.rs +1 −1
@@ -76,7 +76,7 @@ pub fn run_single_command(
7676 let _ = library.push(item, None);
7777 let _ = library.save();
7878 *framework.data.global.get_mut::<Message>().unwrap() =
79 Message::Success(String::from("Item bookmarked"))
79 Message::Success(String::from("Bookmark added"))
8080 }
8181 Err(e) => {
8282 *framework.data.global.get_mut::<Message>().unwrap() =
src/global/functions/singleitem_load.rs added +39
@@ -0,0 +1,39 @@
1use std::error::Error;
2
3use invidious::reqwest::blocking::Client;
4
5use crate::{config::MainConfig, global::structs::Item};
6
7use super::download_all_images;
8
9pub fn load_playlist(
10 client: &Client,
11 id: &str,
12 mainconfig: &MainConfig,
13) -> Result<Item, Box<dyn Error>> {
14 let playlist = Item::from_full_playlist(client.playlist(id, None)?, mainconfig.image_index);
15 let videos = &playlist.fullplaylist()?.videos;
16
17 if mainconfig.images.display() {
18 download_all_images({
19 let mut items = videos.iter().map(|item| item.into()).collect::<Vec<_>>();
20 items.extend([(&playlist).into()].into_iter());
21 items
22 });
23 }
24
25 Ok(playlist)
26}
27
28pub fn load_video(
29 client: &Client,
30 id: &str,
31 mainconfig: &MainConfig,
32) -> Result<Item, Box<dyn Error>> {
33 let video = Item::from_full_video(client.video(id, None)?, mainconfig.image_index);
34 if mainconfig.images.display() {
35 download_all_images(vec![(&video).into()]);
36 }
37
38 Ok(video)
39}
src/global/functions/update_provider.rs +2 −4
@@ -90,8 +90,7 @@ pub fn update_provider(data: &mut FrameworkData) {
9090 }
9191 },
9292 )],
93 Page::SingleItem(SingleItemPage::Video(id))
94 | Page::SingleItem(SingleItemPage::LocalVideo(id)) => vec![
93 Page::SingleItem(SingleItemPage::Video(id)) => vec![
9594 (
9695 String::from("url"),
9796 match status.provider {
@@ -127,8 +126,7 @@ pub fn update_provider(data: &mut FrameworkData) {
127126 },
128127 ),
129128 ],
130 Page::SingleItem(SingleItemPage::Playlist(id))
131 | Page::SingleItem(SingleItemPage::LocalPlaylist(id)) => vec![
129 Page::SingleItem(SingleItemPage::Playlist(id)) => vec![
132130 (
133131 String::from("url"),
134132 match status.provider {
src/global/structs/message.rs +5 −1
@@ -2,7 +2,7 @@ use typemap::Key;
22
33/// Messages in the message bar
44// is stored in `data.global`
5#[derive(Clone)]
5#[derive(Clone, PartialEq, Eq)]
66pub enum Message {
77 Message(String),
88 Error(String),
@@ -22,4 +22,8 @@ impl Message {
2222 Self::None => default.to_string(),
2323 }
2424 }
25
26 pub fn is_none(&self) -> bool {
27 self == &Self::None
28 }
2529}
src/global/structs/page.rs −2
@@ -81,8 +81,6 @@ pub enum ChannelDisplayPageType {
8181/// Different items to be displayed on a single item page
8282#[derive(Clone, PartialEq, Eq)]
8383pub enum SingleItemPage {
84 LocalVideo(String),
85 LocalPlaylist(String),
8684 Video(String),
8785 Playlist(String),
8886}
src/global/structs/tasks.rs +13 −5
@@ -76,7 +76,7 @@ impl TaskQueue {
7676
7777 /// runs all tasks in a task queue
7878 pub fn run(
79 self,
79 mut self,
8080 framework: &mut Framework,
8181 terminal: &mut Terminal<CrosstermBackend<Stdout>>,
8282 ) -> Result<(), Box<dyn Error>> {
@@ -139,8 +139,10 @@ impl TaskQueue {
139139 } else {
140140 Message::None
141141 };
142 update_provider(&mut framework.data);
143 Self::render(framework, terminal)?;
142 let status = framework.data.global.get_mut::<Status>().unwrap();
143 status.provider_updated = true;
144 status.render_image = true;
145 self.render = RenderTask::All;
144146 }
145147
146148 if self.reload {
@@ -168,8 +170,10 @@ impl TaskQueue {
168170 } else {
169171 Message::None
170172 };
171 update_provider(&mut framework.data);
172 Self::render(framework, terminal)?;
173 let status = framework.data.global.get_mut::<Status>().unwrap();
174 status.provider_updated = true;
175 status.render_image = true;
176 self.render = RenderTask::All;
173177 }
174178
175179 match self.render {
@@ -183,6 +187,10 @@ impl TaskQueue {
183187 RenderTask::None => {}
184188 }
185189
190 if framework.data.global.get::<Status>().unwrap().provider_updated {
191 update_provider(&mut framework.data);
192 }
193
186194 Ok(())
187195 }
188196
src/items/itemlist.rs +2 −2
@@ -137,11 +137,11 @@ impl ItemList {
137137 match &self.items[self.textlist.selected] {
138138 Item::MiniVideo(MiniVideoItem { id, .. })
139139 | Item::FullVideo(FullVideoItem { id, .. }) => {
140 Some(Page::SingleItem(SingleItemPage::LocalVideo(id.clone())))
140 Some(Page::SingleItem(SingleItemPage::Video(id.clone())))
141141 }
142142 Item::MiniPlaylist(MiniPlaylistItem { id, .. })
143143 | Item::FullPlaylist(FullPlaylistItem { id, .. }) => {
144 Some(Page::SingleItem(SingleItemPage::LocalPlaylist(id.clone())))
144 Some(Page::SingleItem(SingleItemPage::Playlist(id.clone())))
145145 }
146146 Item::MiniChannel(MiniChannelItem { id: _id, .. })
147147 | Item::FullChannel(FullChannelItem { id: _id, .. }) => todo!(),
src/items/pagebutton.rs +7 −7
@@ -55,11 +55,11 @@ impl PageButton {
5555 _ => {}
5656 }
5757 } else if *self == Self::Subscriptions || *self == Self::Library {
58 match page {
59 Page::MainMenu(MainMenuPage::Subscriptions) => *self = Self::Subscriptions,
60 Page::MainMenu(MainMenuPage::Library) => *self = Self::Library,
61 _ => {}
62 }
58 // match page {
59 // Page::MainMenu(MainMenuPage::Subscriptions) => *self = Self::Subscriptions,
60 // Page::MainMenu(MainMenuPage::Library) => *self = Self::Library,
61 // _ => {}
62 // }
6363 }
6464 }
6565}
@@ -131,8 +131,8 @@ impl FrameworkItem for PageButton {
131131 match self {
132132 Self::Trending => *self = Self::Popular,
133133 Self::Popular => *self = Self::Trending,
134 Self::Subscriptions => *self = Self::Library,
135 Self::Library => *self = Self::Subscriptions,
134 // Self::Subscriptions => *self = Self::Library,
135 // Self::Library => *self = Self::Subscriptions,
136136 _ => {
137137 *framework.data.global.get_mut::<Message>().unwrap() =
138138 Message::Message(String::from("You are already on this page"));
src/items/singleitem.rs +116 −106
@@ -4,7 +4,7 @@ use super::ItemInfo;
44use crate::{
55 config::{AppearanceConfig, CommandsConfig, KeyBindingsConfig, MainConfig, Provider},
66 global::{
7 functions::{apply_envs, download_all_images, set_envs},
7 functions::{apply_envs, load_playlist, load_video, set_envs},
88 structs::{
99 InvidiousClient, Item, KeyAction, Message, Page, SingleItemPage, StateEnvs, Status,
1010 Task, Tasks, WatchHistory,
@@ -16,6 +16,7 @@ use home::home_dir;
1616use tui::{
1717 layout::{Constraint, Rect},
1818 style::Style,
19 widgets::{Block, Borders},
1920};
2021use tui_additions::{
2122 framework::{FrameworkClean, FrameworkItem},
@@ -70,26 +71,34 @@ pub struct SinglePlaylistItem {
7071}
7172
7273impl SingleVideoItem {
73 pub fn new(commands: &CommandsConfig) -> Self {
74 Self::new_with_map(
75 commands
76 .video
77 .clone()
78 .into_iter()
79 .map(|(display, command)| (display, command))
80 .collect(),
81 )
82 }
83
84 pub fn new_local(commands: &CommandsConfig) -> Self {
85 Self::new_with_map(
86 commands
87 .local_video
88 .clone()
89 .into_iter()
90 .map(|(display, command)| (display, command))
91 .collect(),
92 )
74 pub fn new(commands: &CommandsConfig, mainconfig: &MainConfig, id: &str) -> Self {
75 let saved = (|| -> Option<()> {
76 fs::read_dir(home_dir().unwrap().join(mainconfig.env.get("save-path")?.replacen("~/", "", 1)))
77 .ok()?
78 .filter_map(|entry| Some(entry.ok()?.path().file_stem()?.to_os_string()))
79 .find(|stem| stem.as_os_str().to_str().unwrap_or_default().contains(id))?;
80 Some(())
81 })()
82 .is_some();
83 if saved {
84 Self::new_with_map(
85 commands
86 .saved_video
87 .clone()
88 .into_iter()
89 .map(|(display, command)| (display, command))
90 .collect(),
91 )
92 } else {
93 Self::new_with_map(
94 commands
95 .video
96 .clone()
97 .into_iter()
98 .map(|(display, command)| (display, command))
99 .collect(),
100 )
101 }
93102 }
94103
95104 pub fn new_with_map(commands: Vec<(String, String)>) -> Self {
@@ -169,6 +178,7 @@ impl SingleVideoItem {
169178 },
170179 ),
171180 (String::from("channel-id"), video_item.channel_id.clone()),
181 (String::from("title"), video_item.title.clone()),
172182 (
173183 String::from("channel-url"),
174184 match status.provider {
@@ -186,28 +196,36 @@ impl SingleVideoItem {
186196}
187197
188198impl SinglePlaylistItem {
189 pub fn new(commands: &CommandsConfig, playlist_items: &[Item]) -> Self {
190 Self::new_with_map(
191 commands
192 .playlist
193 .clone()
194 .into_iter()
195 .map(|(display, command)| (display, command))
196 .collect(),
197 playlist_items,
198 )
199 }
200
201 pub fn new_local(commands: &CommandsConfig, playlist_items: &[Item]) -> Self {
202 Self::new_with_map(
203 commands
204 .local_playlist
205 .clone()
206 .into_iter()
207 .map(|(display, command)| (display, command))
208 .collect(),
209 playlist_items,
210 )
199 pub fn new(commands: &CommandsConfig, mainconfig: &MainConfig ,id: &str, playlist_items: &[Item]) -> Self {
200 let saved = (|| -> Option<()> {
201 fs::read_dir(home_dir().unwrap().join(mainconfig.env.get("save-path")?.replacen("~/", "", 1)))
202 .ok()?
203 .filter_map(|entry| Some(entry.ok()?.path().file_stem()?.to_os_string()))
204 .find(|stem| stem.as_os_str().to_str().unwrap_or_default().contains(id))?;
205 Some(())
206 })()
207 .is_some();
208 if saved {
209 Self::new_with_map(
210 commands
211 .saved_playlist
212 .clone()
213 .into_iter()
214 .map(|(display, command)| (display, command))
215 .collect(),
216 playlist_items,
217 )
218 } else {
219 Self::new_with_map(
220 commands
221 .playlist
222 .clone()
223 .into_iter()
224 .map(|(display, command)| (display, command))
225 .collect(),
226 playlist_items,
227 )
228 }
211229 }
212230
213231 pub fn new_with_map(commands: Vec<(String, String)>, playlist_items: &[Item]) -> Self {
@@ -311,6 +329,7 @@ impl SinglePlaylistItem {
311329 vec![
312330 (String::from("id"), playlist_item.id.clone()),
313331 (String::from("channel-id"), playlist_item.channel_id.clone()),
332 (String::from("title"), playlist_item.title.clone()),
314333 (
315334 String::from("all-ids"),
316335 playlist_item
@@ -526,6 +545,18 @@ impl FrameworkItem for SingleItem {
526545 return;
527546 }
528547
548 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
549
550 if self.item.is_none() {
551 frame.render_widget(
552 Block::default()
553 .borders(Borders::ALL)
554 .border_type(appearance.borders),
555 area,
556 );
557 return;
558 }
559
529560 if status.provider_updated {
530561 set_envs(
531562 self.infalte_item_update(
@@ -537,18 +568,12 @@ impl FrameworkItem for SingleItem {
537568 );
538569 }
539570
540 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
541571 self.update_appearance(appearance, &info);
542572
543573 let chunks = self.grid.chunks(area).unwrap()[0].clone();
544574
545575 frame.render_widget(self.grid.clone(), area);
546576
547 // only continue if `self.item` is Some
548 if self.item.is_none() {
549 return;
550 }
551
552577 match &mut self.r#type {
553578 SingleItemType::Video(typeinfo) => {
554579 // 2 by 1 grid, item info in the first cell and textlist at the second
@@ -634,74 +659,59 @@ impl FrameworkItem for SingleItem {
634659 let mainconfig = framework.data.global.get::<MainConfig>().unwrap();
635660 // load items using the invidious api
636661 // gets the item that it needs to load from `data.state.Page`
637 self.item = match r#type {
662 let (item, r#type) = match r#type {
638663 SingleItemPage::Video(id) => {
639 let client = &framework.data.global.get::<InvidiousClient>().unwrap().0;
640 self.r#type = SingleItemType::Video(SingleVideoItem::new(
641 framework.data.global.get::<CommandsConfig>().unwrap(),
642 ));
643 let video = Item::from_full_video(client.video(id, None)?, mainconfig.image_index);
644 if mainconfig.images.display() {
645 download_all_images(vec![(&video).into()]);
646 }
647 Some(video)
648 }
649 SingleItemPage::Playlist(id) => {
650 let client = &framework.data.global.get::<InvidiousClient>().unwrap().0;
651 let playlist =
652 Item::from_full_playlist(client.playlist(id, None)?, mainconfig.image_index);
653 let videos = &playlist.fullplaylist()?.videos;
654 self.r#type = SingleItemType::Playlist(
655 SinglePlaylistItem::new(
656 framework.data.global.get::<CommandsConfig>().unwrap(),
657 videos,
658 )
659 .into(),
660 );
661
662 if mainconfig.images.display() {
663 download_all_images({
664 let mut items = videos.iter().map(|item| item.into()).collect::<Vec<_>>();
665 items.extend([(&playlist).into()].into_iter());
666 items
667 });
668 }
664 let home_dir = home_dir().unwrap();
665 let path = home_dir.join(format!(".cache/youtube-tui/info/{id}.json"));
669666
670 Some(playlist)
671 }
672 SingleItemPage::LocalVideo(id) => {
673 let s = fs::read_to_string(
674 home_dir()
675 .unwrap()
676 .join(format!(".cache/youtube-tui/info/{id}.json")),
677 )?;
678 self.r#type = SingleItemType::Video(SingleVideoItem::new_local(
679 framework.data.global.get::<CommandsConfig>().unwrap(),
680 ));
681
682 Some(serde_json::from_str(&s)?)
667 let video = if path.exists() {
668 serde_json::from_str(&fs::read_to_string(path)?)?
669 } else {
670 load_video(
671 &framework.data.global.get::<InvidiousClient>().unwrap().0,
672 id,
673 mainconfig,
674 )?
675 };
676 (
677 video,
678 SingleItemType::Video(SingleVideoItem::new(
679 framework.data.global.get::<CommandsConfig>().unwrap(),
680 mainconfig,
681 id,
682 )),
683 )
683684 }
685 SingleItemPage::Playlist(id) => {
686 let path = home_dir()
687 .unwrap()
688 .join(format!(".cache/youtube-tui/info/{id}.json"));
684689
685 SingleItemPage::LocalPlaylist(id) => {
686 let s = fs::read_to_string(
687 home_dir()
688 .unwrap()
689 .join(format!(".cache/youtube-tui/info/{id}.json")),
690 )?;
691
692 let playlist: Item = serde_json::from_str(&s)?;
693 let videos = &playlist.fullplaylist()?.videos;
694 self.r#type = SingleItemType::Playlist(
695 SinglePlaylistItem::new_local(
690 let playlist = if path.exists() {
691 serde_json::from_str(&fs::read_to_string(path)?)?
692 } else {
693 load_playlist(
694 &framework.data.global.get::<InvidiousClient>().unwrap().0,
695 id,
696 mainconfig,
697 )?
698 };
699 let r#type = SingleItemType::Playlist(
700 SinglePlaylistItem::new(
696701 framework.data.global.get::<CommandsConfig>().unwrap(),
697 videos,
702 mainconfig,
703 id,
704 &playlist.fullplaylist().unwrap().videos,
698705 )
699706 .into(),
700707 );
701708
702 Some(playlist)
709 (playlist, r#type)
703710 }
704711 };
712
713 self.item = Some(item);
714 self.r#type = r#type;
705715 self.iteminfo.item = self.item.clone();
706716
707717 if let Some(item) = &self.item {