Commit 05e733814a

05e733814a2b6d4636fc6fed63ce4b1544b8310b

parent: f7dc24b611

Unsigned

Siriusmart <71584876+Siriusmart@users.noreply.github.com> · 2022-10-22 19:48 UTC

Bug fixes & slight progress on video and playlist info page

Fixed Grid incorrect width (cause panicks and misalignments)
Fixed first history is blank issue
Using updated invidious api
Slight progress on video/playlist page

Layout: unified · split

Cargo.lock +272 −237
@@ -8,15 +8,6 @@ version = "1.0.2"
8source = "registry+https://github.com/rust-lang/crates.io-index" 8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 9checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
10 10
11[[package]]
12name = "aho-corasick"
13version = "0.5.3"
14source = "registry+https://github.com/rust-lang/crates.io-index"
15checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
16dependencies = [
17 "memchr 0.1.11",
18]
19
20[[package]] 11[[package]]
21name = "android_system_properties" 12name = "android_system_properties"
22version = "0.1.5" 13version = "0.1.5"
@@ -43,9 +34,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
43 34
44[[package]] 35[[package]]
45name = "base64" 36name = "base64"
46version = "0.13.0" 37version = "0.13.1"
47source = "registry+https://github.com/rust-lang/crates.io-index" 38source = "registry+https://github.com/rust-lang/crates.io-index"
48checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 39checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
49 40
50[[package]] 41[[package]]
51name = "bit_field" 42name = "bit_field"
@@ -61,9 +52,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
61 52
62[[package]] 53[[package]]
63name = "bumpalo" 54name = "bumpalo"
64version = "3.11.0" 55version = "3.11.1"
65source = "registry+https://github.com/rust-lang/crates.io-index" 56source = "registry+https://github.com/rust-lang/crates.io-index"
66checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" 57checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
67 58
68[[package]] 59[[package]]
69name = "bytemuck" 60name = "bytemuck"
@@ -110,7 +101,17 @@ dependencies = [
110 "iana-time-zone", 101 "iana-time-zone",
111 "num-integer", 102 "num-integer",
112 "num-traits", 103 "num-traits",
113 "winapi 0.3.9", 104 "winapi",
105]
106
107[[package]]
108name = "codespan-reporting"
109version = "0.11.1"
110source = "registry+https://github.com/rust-lang/crates.io-index"
111checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
112dependencies = [
113 "termcolor",
114 "unicode-width",
114] 115]
115 116
116[[package]] 117[[package]]
@@ -121,15 +122,15 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
121 122
122[[package]] 123[[package]]
123name = "console" 124name = "console"
124version = "0.15.1" 125version = "0.15.2"
125source = "registry+https://github.com/rust-lang/crates.io-index" 126source = "registry+https://github.com/rust-lang/crates.io-index"
126checksum = "89eab4d20ce20cea182308bca13088fecea9c05f6776cf287205d41a0ed3c847" 127checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c"
127dependencies = [ 128dependencies = [
128 "encode_unicode", 129 "encode_unicode",
130 "lazy_static",
129 "libc", 131 "libc",
130 "once_cell",
131 "terminal_size", 132 "terminal_size",
132 "winapi 0.3.9", 133 "winapi",
133] 134]
134 135
135[[package]] 136[[package]]
@@ -180,42 +181,24 @@ dependencies = [
180 181
181[[package]] 182[[package]]
182name = "crossbeam-epoch" 183name = "crossbeam-epoch"
183version = "0.9.10" 184version = "0.9.11"
184source = "registry+https://github.com/rust-lang/crates.io-index" 185source = "registry+https://github.com/rust-lang/crates.io-index"
185checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" 186checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348"
186dependencies = [ 187dependencies = [
187 "autocfg", 188 "autocfg",
188 "cfg-if", 189 "cfg-if",
189 "crossbeam-utils", 190 "crossbeam-utils",
190 "memoffset", 191 "memoffset",
191 "once_cell",
192 "scopeguard", 192 "scopeguard",
193] 193]
194 194
195[[package]] 195[[package]]
196name = "crossbeam-utils" 196name = "crossbeam-utils"
197version = "0.8.11" 197version = "0.8.12"
198source = "registry+https://github.com/rust-lang/crates.io-index" 198source = "registry+https://github.com/rust-lang/crates.io-index"
199checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" 199checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
200dependencies = [ 200dependencies = [
201 "cfg-if", 201 "cfg-if",
202 "once_cell",
203]
204
205[[package]]
206name = "crossterm"
207version = "0.23.2"
208source = "registry+https://github.com/rust-lang/crates.io-index"
209checksum = "a2102ea4f781910f8a5b98dd061f4c2023f479ce7bb1236330099ceb5a93cf17"
210dependencies = [
211 "bitflags",
212 "crossterm_winapi",
213 "libc",
214 "mio",
215 "parking_lot",
216 "signal-hook",
217 "signal-hook-mio",
218 "winapi 0.3.9",
219] 202]
220 203
221[[package]] 204[[package]]
@@ -232,7 +215,7 @@ dependencies = [
232 "serde", 215 "serde",
233 "signal-hook", 216 "signal-hook",
234 "signal-hook-mio", 217 "signal-hook-mio",
235 "winapi 0.3.9", 218 "winapi",
236] 219]
237 220
238[[package]] 221[[package]]
@@ -241,7 +224,57 @@ version = "0.9.0"
241source = "registry+https://github.com/rust-lang/crates.io-index" 224source = "registry+https://github.com/rust-lang/crates.io-index"
242checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" 225checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
243dependencies = [ 226dependencies = [
244 "winapi 0.3.9", 227 "winapi",
228]
229
230[[package]]
231name = "crunchy"
232version = "0.2.2"
233source = "registry+https://github.com/rust-lang/crates.io-index"
234checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
235
236[[package]]
237name = "cxx"
238version = "1.0.80"
239source = "registry+https://github.com/rust-lang/crates.io-index"
240checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a"
241dependencies = [
242 "cc",
243 "cxxbridge-flags",
244 "cxxbridge-macro",
245 "link-cplusplus",
246]
247
248[[package]]
249name = "cxx-build"
250version = "1.0.80"
251source = "registry+https://github.com/rust-lang/crates.io-index"
252checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827"
253dependencies = [
254 "cc",
255 "codespan-reporting",
256 "once_cell",
257 "proc-macro2",
258 "quote",
259 "scratch",
260 "syn",
261]
262
263[[package]]
264name = "cxxbridge-flags"
265version = "1.0.80"
266source = "registry+https://github.com/rust-lang/crates.io-index"
267checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a"
268
269[[package]]
270name = "cxxbridge-macro"
271version = "1.0.80"
272source = "registry+https://github.com/rust-lang/crates.io-index"
273checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7"
274dependencies = [
275 "proc-macro2",
276 "quote",
277 "syn",
245] 278]
246 279
247[[package]] 280[[package]]
@@ -273,15 +306,15 @@ dependencies = [
273 306
274[[package]] 307[[package]]
275name = "exr" 308name = "exr"
276version = "1.5.1" 309version = "1.5.2"
277source = "registry+https://github.com/rust-lang/crates.io-index" 310source = "registry+https://github.com/rust-lang/crates.io-index"
278checksum = "c9a7880199e74c6d3fe45579df2f436c5913a71405494cb89d59234d86b47dc5" 311checksum = "8eb5f255b5980bb0c8cf676b675d1a99be40f316881444f44e0462eaf5df5ded"
279dependencies = [ 312dependencies = [
280 "bit_field", 313 "bit_field",
281 "flume", 314 "flume",
282 "half", 315 "half",
283 "lebe", 316 "lebe",
284 "miniz_oxide", 317 "miniz_oxide 0.6.2",
285 "smallvec", 318 "smallvec",
286 "threadpool", 319 "threadpool",
287] 320]
@@ -302,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
302checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" 335checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
303dependencies = [ 336dependencies = [
304 "crc32fast", 337 "crc32fast",
305 "miniz_oxide", 338 "miniz_oxide 0.5.4",
306] 339]
307 340
308[[package]] 341[[package]]
@@ -350,9 +383,9 @@ dependencies = [
350 383
351[[package]] 384[[package]]
352name = "futures" 385name = "futures"
353version = "0.3.24" 386version = "0.3.25"
354source = "registry+https://github.com/rust-lang/crates.io-index" 387source = "registry+https://github.com/rust-lang/crates.io-index"
355checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" 388checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
356dependencies = [ 389dependencies = [
357 "futures-channel", 390 "futures-channel",
358 "futures-core", 391 "futures-core",
@@ -365,9 +398,9 @@ dependencies = [
365 398
366[[package]] 399[[package]]
367name = "futures-channel" 400name = "futures-channel"
368version = "0.3.24" 401version = "0.3.25"
369source = "registry+https://github.com/rust-lang/crates.io-index" 402source = "registry+https://github.com/rust-lang/crates.io-index"
370checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" 403checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
371dependencies = [ 404dependencies = [
372 "futures-core", 405 "futures-core",
373 "futures-sink", 406 "futures-sink",
@@ -375,15 +408,15 @@ dependencies = [
375 408
376[[package]] 409[[package]]
377name = "futures-core" 410name = "futures-core"
378version = "0.3.24" 411version = "0.3.25"
379source = "registry+https://github.com/rust-lang/crates.io-index" 412source = "registry+https://github.com/rust-lang/crates.io-index"
380checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" 413checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
381 414
382[[package]] 415[[package]]
383name = "futures-executor" 416name = "futures-executor"
384version = "0.3.24" 417version = "0.3.25"
385source = "registry+https://github.com/rust-lang/crates.io-index" 418source = "registry+https://github.com/rust-lang/crates.io-index"
386checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" 419checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
387dependencies = [ 420dependencies = [
388 "futures-core", 421 "futures-core",
389 "futures-task", 422 "futures-task",
@@ -392,15 +425,15 @@ dependencies = [
392 425
393[[package]] 426[[package]]
394name = "futures-io" 427name = "futures-io"
395version = "0.3.24" 428version = "0.3.25"
396source = "registry+https://github.com/rust-lang/crates.io-index" 429source = "registry+https://github.com/rust-lang/crates.io-index"
397checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" 430checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
398 431
399[[package]] 432[[package]]
400name = "futures-macro" 433name = "futures-macro"
401version = "0.3.24" 434version = "0.3.25"
402source = "registry+https://github.com/rust-lang/crates.io-index" 435source = "registry+https://github.com/rust-lang/crates.io-index"
403checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" 436checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
404dependencies = [ 437dependencies = [
405 "proc-macro2", 438 "proc-macro2",
406 "quote", 439 "quote",
@@ -409,21 +442,21 @@ dependencies = [
409 442
410[[package]] 443[[package]]
411name = "futures-sink" 444name = "futures-sink"
412version = "0.3.24" 445version = "0.3.25"
413source = "registry+https://github.com/rust-lang/crates.io-index" 446source = "registry+https://github.com/rust-lang/crates.io-index"
414checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" 447checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
415 448
416[[package]] 449[[package]]
417name = "futures-task" 450name = "futures-task"
418version = "0.3.24" 451version = "0.3.25"
419source = "registry+https://github.com/rust-lang/crates.io-index" 452source = "registry+https://github.com/rust-lang/crates.io-index"
420checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" 453checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
421 454
422[[package]] 455[[package]]
423name = "futures-util" 456name = "futures-util"
424version = "0.3.24" 457version = "0.3.25"
425source = "registry+https://github.com/rust-lang/crates.io-index" 458source = "registry+https://github.com/rust-lang/crates.io-index"
426checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" 459checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
427dependencies = [ 460dependencies = [
428 "futures-channel", 461 "futures-channel",
429 "futures-core", 462 "futures-core",
@@ -431,7 +464,7 @@ dependencies = [
431 "futures-macro", 464 "futures-macro",
432 "futures-sink", 465 "futures-sink",
433 "futures-task", 466 "futures-task",
434 "memchr 2.5.0", 467 "memchr",
435 "pin-project-lite", 468 "pin-project-lite",
436 "pin-utils", 469 "pin-utils",
437 "slab", 470 "slab",
@@ -439,9 +472,9 @@ dependencies = [
439 472
440[[package]] 473[[package]]
441name = "getrandom" 474name = "getrandom"
442version = "0.2.7" 475version = "0.2.8"
443source = "registry+https://github.com/rust-lang/crates.io-index" 476source = "registry+https://github.com/rust-lang/crates.io-index"
444checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" 477checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
445dependencies = [ 478dependencies = [
446 "cfg-if", 479 "cfg-if",
447 "js-sys", 480 "js-sys",
@@ -481,9 +514,12 @@ dependencies = [
481 514
482[[package]] 515[[package]]
483name = "half" 516name = "half"
484version = "1.8.2" 517version = "2.1.0"
485source = "registry+https://github.com/rust-lang/crates.io-index" 518source = "registry+https://github.com/rust-lang/crates.io-index"
486checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" 519checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554"
520dependencies = [
521 "crunchy",
522]
487 523
488[[package]] 524[[package]]
489name = "hashbrown" 525name = "hashbrown"
@@ -502,11 +538,11 @@ dependencies = [
502 538
503[[package]] 539[[package]]
504name = "home" 540name = "home"
505version = "0.5.3" 541version = "0.5.4"
506source = "registry+https://github.com/rust-lang/crates.io-index" 542source = "registry+https://github.com/rust-lang/crates.io-index"
507checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" 543checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
508dependencies = [ 544dependencies = [
509 "winapi 0.3.9", 545 "winapi",
510] 546]
511 547
512[[package]] 548[[package]]
@@ -582,15 +618,26 @@ dependencies = [
582 618
583[[package]] 619[[package]]
584name = "iana-time-zone" 620name = "iana-time-zone"
585version = "0.1.50" 621version = "0.1.51"
586source = "registry+https://github.com/rust-lang/crates.io-index" 622source = "registry+https://github.com/rust-lang/crates.io-index"
587checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" 623checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
588dependencies = [ 624dependencies = [
589 "android_system_properties", 625 "android_system_properties",
590 "core-foundation-sys", 626 "core-foundation-sys",
627 "iana-time-zone-haiku",
591 "js-sys", 628 "js-sys",
592 "wasm-bindgen", 629 "wasm-bindgen",
593 "winapi 0.3.9", 630 "winapi",
631]
632
633[[package]]
634name = "iana-time-zone-haiku"
635version = "0.1.1"
636source = "registry+https://github.com/rust-lang/crates.io-index"
637checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
638dependencies = [
639 "cxx",
640 "cxx-build",
594] 641]
595 642
596[[package]] 643[[package]]
@@ -605,9 +652,9 @@ dependencies = [
605 652
606[[package]] 653[[package]]
607name = "image" 654name = "image"
608version = "0.24.3" 655version = "0.24.4"
609source = "registry+https://github.com/rust-lang/crates.io-index" 656source = "registry+https://github.com/rust-lang/crates.io-index"
610checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964" 657checksum = "bd8e4fb07cf672b1642304e731ef8a6a4c7891d67bb4fd4f5ce58cd6ed86803c"
611dependencies = [ 658dependencies = [
612 "bytemuck", 659 "bytemuck",
613 "byteorder", 660 "byteorder",
@@ -643,9 +690,9 @@ dependencies = [
643 690
644[[package]] 691[[package]]
645name = "invidious" 692name = "invidious"
646version = "0.3.2" 693version = "0.4.0"
647source = "registry+https://github.com/rust-lang/crates.io-index" 694source = "registry+https://github.com/rust-lang/crates.io-index"
648checksum = "c0768e9ab3b6d2f3ce235e6c85167d3e78cde11fb08c0811c5f320c6f5a4834e" 695checksum = "f6a0c87f44203986f9b402ef0409c1c776c5229d09be2a85cda5b53a23ba0757"
649dependencies = [ 696dependencies = [
650 "reqwest", 697 "reqwest",
651 "serde", 698 "serde",
@@ -660,9 +707,9 @@ checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
660 707
661[[package]] 708[[package]]
662name = "itoa" 709name = "itoa"
663version = "1.0.3" 710version = "1.0.4"
664source = "registry+https://github.com/rust-lang/crates.io-index" 711source = "registry+https://github.com/rust-lang/crates.io-index"
665checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" 712checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
666 713
667[[package]] 714[[package]]
668name = "jpeg-decoder" 715name = "jpeg-decoder"
@@ -682,22 +729,6 @@ dependencies = [
682 "wasm-bindgen", 729 "wasm-bindgen",
683] 730]
684 731
685[[package]]
686name = "kernel32-sys"
687version = "0.2.2"
688source = "registry+https://github.com/rust-lang/crates.io-index"
689checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
690dependencies = [
691 "winapi 0.2.8",
692 "winapi-build",
693]
694
695[[package]]
696name = "lazy_static"
697version = "0.2.11"
698source = "registry+https://github.com/rust-lang/crates.io-index"
699checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
700
701[[package]] 732[[package]]
702name = "lazy_static" 733name = "lazy_static"
703version = "1.4.0" 734version = "1.4.0"
@@ -712,9 +743,18 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
712 743
713[[package]] 744[[package]]
714name = "libc" 745name = "libc"
715version = "0.2.133" 746version = "0.2.135"
747source = "registry+https://github.com/rust-lang/crates.io-index"
748checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
749
750[[package]]
751name = "link-cplusplus"
752version = "1.0.7"
716source = "registry+https://github.com/rust-lang/crates.io-index" 753source = "registry+https://github.com/rust-lang/crates.io-index"
717checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" 754checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369"
755dependencies = [
756 "cc",
757]
718 758
719[[package]] 759[[package]]
720name = "lock_api" 760name = "lock_api"
@@ -741,15 +781,6 @@ version = "0.1.0"
741source = "registry+https://github.com/rust-lang/crates.io-index" 781source = "registry+https://github.com/rust-lang/crates.io-index"
742checksum = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3" 782checksum = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3"
743 783
744[[package]]
745name = "memchr"
746version = "0.1.11"
747source = "registry+https://github.com/rust-lang/crates.io-index"
748checksum = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
749dependencies = [
750 "libc",
751]
752
753[[package]] 784[[package]]
754name = "memchr" 785name = "memchr"
755version = "2.5.0" 786version = "2.5.0"
@@ -780,6 +811,15 @@ dependencies = [
780 "adler", 811 "adler",
781] 812]
782 813
814[[package]]
815name = "miniz_oxide"
816version = "0.6.2"
817source = "registry+https://github.com/rust-lang/crates.io-index"
818checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
819dependencies = [
820 "adler",
821]
822
783[[package]] 823[[package]]
784name = "mio" 824name = "mio"
785version = "0.8.4" 825version = "0.8.4"
@@ -789,7 +829,7 @@ dependencies = [
789 "libc", 829 "libc",
790 "log", 830 "log",
791 "wasi", 831 "wasi",
792 "windows-sys", 832 "windows-sys 0.36.1",
793] 833]
794 834
795[[package]] 835[[package]]
@@ -807,7 +847,7 @@ version = "0.2.10"
807source = "registry+https://github.com/rust-lang/crates.io-index" 847source = "registry+https://github.com/rust-lang/crates.io-index"
808checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" 848checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9"
809dependencies = [ 849dependencies = [
810 "lazy_static 1.4.0", 850 "lazy_static",
811 "libc", 851 "libc",
812 "log", 852 "log",
813 "openssl", 853 "openssl",
@@ -867,9 +907,9 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
867 907
868[[package]] 908[[package]]
869name = "openssl" 909name = "openssl"
870version = "0.10.41" 910version = "0.10.42"
871source = "registry+https://github.com/rust-lang/crates.io-index" 911source = "registry+https://github.com/rust-lang/crates.io-index"
872checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" 912checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13"
873dependencies = [ 913dependencies = [
874 "bitflags", 914 "bitflags",
875 "cfg-if", 915 "cfg-if",
@@ -899,9 +939,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
899 939
900[[package]] 940[[package]]
901name = "openssl-sys" 941name = "openssl-sys"
902version = "0.9.75" 942version = "0.9.77"
903source = "registry+https://github.com/rust-lang/crates.io-index" 943source = "registry+https://github.com/rust-lang/crates.io-index"
904checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" 944checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a"
905dependencies = [ 945dependencies = [
906 "autocfg", 946 "autocfg",
907 "cc", 947 "cc",
@@ -922,15 +962,15 @@ dependencies = [
922 962
923[[package]] 963[[package]]
924name = "parking_lot_core" 964name = "parking_lot_core"
925version = "0.9.3" 965version = "0.9.4"
926source = "registry+https://github.com/rust-lang/crates.io-index" 966source = "registry+https://github.com/rust-lang/crates.io-index"
927checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" 967checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
928dependencies = [ 968dependencies = [
929 "cfg-if", 969 "cfg-if",
930 "libc", 970 "libc",
931 "redox_syscall", 971 "redox_syscall",
932 "smallvec", 972 "smallvec",
933 "windows-sys", 973 "windows-sys 0.42.0",
934] 974]
935 975
936[[package]] 976[[package]]
@@ -986,14 +1026,14 @@ dependencies = [
986 "bitflags", 1026 "bitflags",
987 "crc32fast", 1027 "crc32fast",
988 "flate2", 1028 "flate2",
989 "miniz_oxide", 1029 "miniz_oxide 0.5.4",
990] 1030]
991 1031
992[[package]] 1032[[package]]
993name = "proc-macro2" 1033name = "proc-macro2"
994version = "1.0.44" 1034version = "1.0.47"
995source = "registry+https://github.com/rust-lang/crates.io-index" 1035source = "registry+https://github.com/rust-lang/crates.io-index"
996checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" 1036checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
997dependencies = [ 1037dependencies = [
998 "unicode-ident", 1038 "unicode-ident",
999] 1039]
@@ -1040,32 +1080,13 @@ dependencies = [
1040 "bitflags", 1080 "bitflags",
1041] 1081]
1042 1082
1043[[package]]
1044name = "regex"
1045version = "0.1.80"
1046source = "registry+https://github.com/rust-lang/crates.io-index"
1047checksum = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
1048dependencies = [
1049 "aho-corasick",
1050 "memchr 0.1.11",
1051 "regex-syntax",
1052 "thread_local",
1053 "utf8-ranges",
1054]
1055
1056[[package]]
1057name = "regex-syntax"
1058version = "0.3.9"
1059source = "registry+https://github.com/rust-lang/crates.io-index"
1060checksum = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
1061
1062[[package]] 1083[[package]]
1063name = "remove_dir_all" 1084name = "remove_dir_all"
1064version = "0.5.3" 1085version = "0.5.3"
1065source = "registry+https://github.com/rust-lang/crates.io-index" 1086source = "registry+https://github.com/rust-lang/crates.io-index"
1066checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1087checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
1067dependencies = [ 1088dependencies = [
1068 "winapi 0.3.9", 1089 "winapi",
1069] 1090]
1070 1091
1071[[package]] 1092[[package]]
@@ -1126,8 +1147,8 @@ version = "0.1.20"
1126source = "registry+https://github.com/rust-lang/crates.io-index" 1147source = "registry+https://github.com/rust-lang/crates.io-index"
1127checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" 1148checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
1128dependencies = [ 1149dependencies = [
1129 "lazy_static 1.4.0", 1150 "lazy_static",
1130 "windows-sys", 1151 "windows-sys 0.36.1",
1131] 1152]
1132 1153
1133[[package]] 1154[[package]]
@@ -1142,6 +1163,12 @@ version = "1.1.0"
1142source = "registry+https://github.com/rust-lang/crates.io-index" 1163source = "registry+https://github.com/rust-lang/crates.io-index"
1143checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1164checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
1144 1165
1166[[package]]
1167name = "scratch"
1168version = "1.0.2"
1169source = "registry+https://github.com/rust-lang/crates.io-index"
1170checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
1171
1145[[package]] 1172[[package]]
1146name = "security-framework" 1173name = "security-framework"
1147version = "2.7.0" 1174version = "2.7.0"
@@ -1165,30 +1192,20 @@ dependencies = [
1165 "libc", 1192 "libc",
1166] 1193]
1167 1194
1168[[package]]
1169name = "semver-parser"
1170version = "0.6.2"
1171source = "registry+https://github.com/rust-lang/crates.io-index"
1172checksum = "d8fff3c9c5a54636ab95acd8c1349926e04cb1eb8cd70b5adced8a1d1f703a67"
1173dependencies = [
1174 "lazy_static 0.2.11",
1175 "regex",
1176]
1177
1178[[package]] 1195[[package]]
1179name = "serde" 1196name = "serde"
1180version = "1.0.145" 1197version = "1.0.147"
1181source = "registry+https://github.com/rust-lang/crates.io-index" 1198source = "registry+https://github.com/rust-lang/crates.io-index"
1182checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" 1199checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
1183dependencies = [ 1200dependencies = [
1184 "serde_derive", 1201 "serde_derive",
1185] 1202]
1186 1203
1187[[package]] 1204[[package]]
1188name = "serde_derive" 1205name = "serde_derive"
1189version = "1.0.145" 1206version = "1.0.147"
1190source = "registry+https://github.com/rust-lang/crates.io-index" 1207source = "registry+https://github.com/rust-lang/crates.io-index"
1191checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" 1208checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
1192dependencies = [ 1209dependencies = [
1193 "proc-macro2", 1210 "proc-macro2",
1194 "quote", 1211 "quote",
@@ -1197,9 +1214,9 @@ dependencies = [
1197 1214
1198[[package]] 1215[[package]]
1199name = "serde_json" 1216name = "serde_json"
1200version = "1.0.85" 1217version = "1.0.87"
1201source = "registry+https://github.com/rust-lang/crates.io-index" 1218source = "registry+https://github.com/rust-lang/crates.io-index"
1202checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" 1219checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
1203dependencies = [ 1220dependencies = [
1204 "itoa", 1221 "itoa",
1205 "ryu", 1222 "ryu",
@@ -1220,9 +1237,9 @@ dependencies = [
1220 1237
1221[[package]] 1238[[package]]
1222name = "serde_yaml" 1239name = "serde_yaml"
1223version = "0.9.13" 1240version = "0.9.14"
1224source = "registry+https://github.com/rust-lang/crates.io-index" 1241source = "registry+https://github.com/rust-lang/crates.io-index"
1225checksum = "8613d593412a0deb7bbd8de9d908efff5a0cb9ccd8f62c641e7b2ed2f57291d1" 1242checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da"
1226dependencies = [ 1243dependencies = [
1227 "indexmap", 1244 "indexmap",
1228 "itoa", 1245 "itoa",
@@ -1262,13 +1279,11 @@ dependencies = [
1262] 1279]
1263 1280
1264[[package]] 1281[[package]]
1265name = "sixel" 1282name = "sixel-rs"
1266version = "0.3.2" 1283version = "0.3.3"
1267source = "registry+https://github.com/rust-lang/crates.io-index" 1284source = "registry+https://github.com/rust-lang/crates.io-index"
1268checksum = "51e4bcd2d65122138405b83d3f7777df6b04b0dd5222c85972ed1fb0119aeaaa" 1285checksum = "cfa95c014543113a192d906e5971d0c8d1e8b4cc1e61026539687a7016644ce5"
1269dependencies = [ 1286dependencies = [
1270 "lazy_static 0.2.11",
1271 "semver-parser",
1272 "sixel-sys", 1287 "sixel-sys",
1273] 1288]
1274 1289
@@ -1292,9 +1307,9 @@ dependencies = [
1292 1307
1293[[package]] 1308[[package]]
1294name = "smallvec" 1309name = "smallvec"
1295version = "1.9.0" 1310version = "1.10.0"
1296source = "registry+https://github.com/rust-lang/crates.io-index" 1311source = "registry+https://github.com/rust-lang/crates.io-index"
1297checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" 1312checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
1298 1313
1299[[package]] 1314[[package]]
1300name = "socket2" 1315name = "socket2"
@@ -1303,7 +1318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1303checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" 1318checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
1304dependencies = [ 1319dependencies = [
1305 "libc", 1320 "libc",
1306 "winapi 0.3.9", 1321 "winapi",
1307] 1322]
1308 1323
1309[[package]] 1324[[package]]
@@ -1317,9 +1332,9 @@ dependencies = [
1317 1332
1318[[package]] 1333[[package]]
1319name = "syn" 1334name = "syn"
1320version = "1.0.100" 1335version = "1.0.103"
1321source = "registry+https://github.com/rust-lang/crates.io-index" 1336source = "registry+https://github.com/rust-lang/crates.io-index"
1322checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e" 1337checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
1323dependencies = [ 1338dependencies = [
1324 "proc-macro2", 1339 "proc-macro2",
1325 "quote", 1340 "quote",
@@ -1337,7 +1352,7 @@ dependencies = [
1337 "libc", 1352 "libc",
1338 "redox_syscall", 1353 "redox_syscall",
1339 "remove_dir_all", 1354 "remove_dir_all",
1340 "winapi 0.3.9", 1355 "winapi",
1341] 1356]
1342 1357
1343[[package]] 1358[[package]]
@@ -1356,26 +1371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1356checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" 1371checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
1357dependencies = [ 1372dependencies = [
1358 "libc", 1373 "libc",
1359 "winapi 0.3.9", 1374 "winapi",
1360]
1361
1362[[package]]
1363name = "thread-id"
1364version = "2.0.0"
1365source = "registry+https://github.com/rust-lang/crates.io-index"
1366checksum = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
1367dependencies = [
1368 "kernel32-sys",
1369 "libc",
1370]
1371
1372[[package]]
1373name = "thread_local"
1374version = "0.2.7"
1375source = "registry+https://github.com/rust-lang/crates.io-index"
1376checksum = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
1377dependencies = [
1378 "thread-id",
1379] 1375]
1380 1376
1381[[package]] 1377[[package]]
@@ -1415,20 +1411,19 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
1415 1411
1416[[package]] 1412[[package]]
1417name = "tokio" 1413name = "tokio"
1418version = "1.21.1" 1414version = "1.21.2"
1419source = "registry+https://github.com/rust-lang/crates.io-index" 1415source = "registry+https://github.com/rust-lang/crates.io-index"
1420checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95" 1416checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
1421dependencies = [ 1417dependencies = [
1422 "autocfg", 1418 "autocfg",
1423 "bytes", 1419 "bytes",
1424 "libc", 1420 "libc",
1425 "memchr 2.5.0", 1421 "memchr",
1426 "mio", 1422 "mio",
1427 "num_cpus", 1423 "num_cpus",
1428 "once_cell",
1429 "pin-project-lite", 1424 "pin-project-lite",
1430 "socket2", 1425 "socket2",
1431 "winapi 0.3.9", 1426 "winapi",
1432] 1427]
1433 1428
1434[[package]] 1429[[package]]
@@ -1463,9 +1458,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
1463 1458
1464[[package]] 1459[[package]]
1465name = "tracing" 1460name = "tracing"
1466version = "0.1.36" 1461version = "0.1.37"
1467source = "registry+https://github.com/rust-lang/crates.io-index" 1462source = "registry+https://github.com/rust-lang/crates.io-index"
1468checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" 1463checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
1469dependencies = [ 1464dependencies = [
1470 "cfg-if", 1465 "cfg-if",
1471 "pin-project-lite", 1466 "pin-project-lite",
@@ -1474,9 +1469,9 @@ dependencies = [
1474 1469
1475[[package]] 1470[[package]]
1476name = "tracing-core" 1471name = "tracing-core"
1477version = "0.1.29" 1472version = "0.1.30"
1478source = "registry+https://github.com/rust-lang/crates.io-index" 1473source = "registry+https://github.com/rust-lang/crates.io-index"
1479checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" 1474checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
1480dependencies = [ 1475dependencies = [
1481 "once_cell", 1476 "once_cell",
1482] 1477]
@@ -1501,7 +1496,7 @@ checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1"
1501dependencies = [ 1496dependencies = [
1502 "bitflags", 1497 "bitflags",
1503 "cassowary", 1498 "cassowary",
1504 "crossterm 0.25.0", 1499 "crossterm",
1505 "serde", 1500 "serde",
1506 "unicode-segmentation", 1501 "unicode-segmentation",
1507 "unicode-width", 1502 "unicode-width",
@@ -1509,9 +1504,11 @@ dependencies = [
1509 1504
1510[[package]] 1505[[package]]
1511name = "tui-additions" 1506name = "tui-additions"
1512version = "0.1.8" 1507version = "0.1.9"
1508source = "registry+https://github.com/rust-lang/crates.io-index"
1509checksum = "19170ef3d86a5223daaa0bb449e71bdefe74676f5651ce8981e308915af64fa4"
1513dependencies = [ 1510dependencies = [
1514 "crossterm 0.25.0", 1511 "crossterm",
1515 "dyn-clone", 1512 "dyn-clone",
1516 "tui", 1513 "tui",
1517 "typemap", 1514 "typemap",
@@ -1535,9 +1532,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
1535 1532
1536[[package]] 1533[[package]]
1537name = "unicode-ident" 1534name = "unicode-ident"
1538version = "1.0.4" 1535version = "1.0.5"
1539source = "registry+https://github.com/rust-lang/crates.io-index" 1536source = "registry+https://github.com/rust-lang/crates.io-index"
1540checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" 1537checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
1541 1538
1542[[package]] 1539[[package]]
1543name = "unicode-normalization" 1540name = "unicode-normalization"
@@ -1586,12 +1583,6 @@ dependencies = [
1586 "percent-encoding", 1583 "percent-encoding",
1587] 1584]
1588 1585
1589[[package]]
1590name = "utf8-ranges"
1591version = "0.1.3"
1592source = "registry+https://github.com/rust-lang/crates.io-index"
1593checksum = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
1594
1595[[package]] 1586[[package]]
1596name = "vcpkg" 1587name = "vcpkg"
1597version = "0.2.15" 1588version = "0.2.15"
@@ -1600,18 +1591,17 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
1600 1591
1601[[package]] 1592[[package]]
1602name = "viuer" 1593name = "viuer"
1603version = "0.6.1" 1594version = "0.6.2"
1604source = "registry+https://github.com/rust-lang/crates.io-index" 1595source = "registry+https://github.com/rust-lang/crates.io-index"
1605checksum = "9db8b59a46844025fa705f65ba7d0a9ebf3369cb5fa2f10c532f1d41e0a56fa4" 1596checksum = "b511f7e9ae27b5750f12ca50c353a1179bd4cc964a47294eb0d2cdad40cb41c0"
1606dependencies = [ 1597dependencies = [
1607 "ansi_colours", 1598 "ansi_colours",
1608 "base64", 1599 "base64",
1609 "console", 1600 "console",
1610 "crossterm 0.23.2", 1601 "crossterm",
1611 "image", 1602 "image",
1612 "lazy_static 1.4.0", 1603 "lazy_static",
1613 "sixel", 1604 "sixel-rs",
1614 "sixel-sys",
1615 "tempfile", 1605 "tempfile",
1616 "termcolor", 1606 "termcolor",
1617] 1607]
@@ -1714,12 +1704,6 @@ version = "0.1.7"
1714source = "registry+https://github.com/rust-lang/crates.io-index" 1704source = "registry+https://github.com/rust-lang/crates.io-index"
1715checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" 1705checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
1716 1706
1717[[package]]
1718name = "winapi"
1719version = "0.2.8"
1720source = "registry+https://github.com/rust-lang/crates.io-index"
1721checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
1722
1723[[package]] 1707[[package]]
1724name = "winapi" 1708name = "winapi"
1725version = "0.3.9" 1709version = "0.3.9"
@@ -1730,12 +1714,6 @@ dependencies = [
1730 "winapi-x86_64-pc-windows-gnu", 1714 "winapi-x86_64-pc-windows-gnu",
1731] 1715]
1732 1716
1733[[package]]
1734name = "winapi-build"
1735version = "0.1.1"
1736source = "registry+https://github.com/rust-lang/crates.io-index"
1737checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
1738
1739[[package]] 1717[[package]]
1740name = "winapi-i686-pc-windows-gnu" 1718name = "winapi-i686-pc-windows-gnu"
1741version = "0.4.0" 1719version = "0.4.0"
@@ -1748,7 +1726,7 @@ version = "0.1.5"
1748source = "registry+https://github.com/rust-lang/crates.io-index" 1726source = "registry+https://github.com/rust-lang/crates.io-index"
1749checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1727checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1750dependencies = [ 1728dependencies = [
1751 "winapi 0.3.9", 1729 "winapi",
1752] 1730]
1753 1731
1754[[package]] 1732[[package]]
@@ -1763,50 +1741,107 @@ version = "0.36.1"
1763source = "registry+https://github.com/rust-lang/crates.io-index" 1741source = "registry+https://github.com/rust-lang/crates.io-index"
1764checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 1742checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
1765dependencies = [ 1743dependencies = [
1766 "windows_aarch64_msvc", 1744 "windows_aarch64_msvc 0.36.1",
1767 "windows_i686_gnu", 1745 "windows_i686_gnu 0.36.1",
1768 "windows_i686_msvc", 1746 "windows_i686_msvc 0.36.1",
1769 "windows_x86_64_gnu", 1747 "windows_x86_64_gnu 0.36.1",
1770 "windows_x86_64_msvc", 1748 "windows_x86_64_msvc 0.36.1",
1749]
1750
1751[[package]]
1752name = "windows-sys"
1753version = "0.42.0"
1754source = "registry+https://github.com/rust-lang/crates.io-index"
1755checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
1756dependencies = [
1757 "windows_aarch64_gnullvm",
1758 "windows_aarch64_msvc 0.42.0",
1759 "windows_i686_gnu 0.42.0",
1760 "windows_i686_msvc 0.42.0",
1761 "windows_x86_64_gnu 0.42.0",
1762 "windows_x86_64_gnullvm",
1763 "windows_x86_64_msvc 0.42.0",
1771] 1764]
1772 1765
1766[[package]]
1767name = "windows_aarch64_gnullvm"
1768version = "0.42.0"
1769source = "registry+https://github.com/rust-lang/crates.io-index"
1770checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
1771
1773[[package]] 1772[[package]]
1774name = "windows_aarch64_msvc" 1773name = "windows_aarch64_msvc"
1775version = "0.36.1" 1774version = "0.36.1"
1776source = "registry+https://github.com/rust-lang/crates.io-index" 1775source = "registry+https://github.com/rust-lang/crates.io-index"
1777checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 1776checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
1778 1777
1778[[package]]
1779name = "windows_aarch64_msvc"
1780version = "0.42.0"
1781source = "registry+https://github.com/rust-lang/crates.io-index"
1782checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
1783
1779[[package]] 1784[[package]]
1780name = "windows_i686_gnu" 1785name = "windows_i686_gnu"
1781version = "0.36.1" 1786version = "0.36.1"
1782source = "registry+https://github.com/rust-lang/crates.io-index" 1787source = "registry+https://github.com/rust-lang/crates.io-index"
1783checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 1788checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
1784 1789
1790[[package]]
1791name = "windows_i686_gnu"
1792version = "0.42.0"
1793source = "registry+https://github.com/rust-lang/crates.io-index"
1794checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
1795
1785[[package]] 1796[[package]]
1786name = "windows_i686_msvc" 1797name = "windows_i686_msvc"
1787version = "0.36.1" 1798version = "0.36.1"
1788source = "registry+https://github.com/rust-lang/crates.io-index" 1799source = "registry+https://github.com/rust-lang/crates.io-index"
1789checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 1800checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
1790 1801
1802[[package]]
1803name = "windows_i686_msvc"
1804version = "0.42.0"
1805source = "registry+https://github.com/rust-lang/crates.io-index"
1806checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
1807
1791[[package]] 1808[[package]]
1792name = "windows_x86_64_gnu" 1809name = "windows_x86_64_gnu"
1793version = "0.36.1" 1810version = "0.36.1"
1794source = "registry+https://github.com/rust-lang/crates.io-index" 1811source = "registry+https://github.com/rust-lang/crates.io-index"
1795checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 1812checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
1796 1813
1814[[package]]
1815name = "windows_x86_64_gnu"
1816version = "0.42.0"
1817source = "registry+https://github.com/rust-lang/crates.io-index"
1818checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
1819
1820[[package]]
1821name = "windows_x86_64_gnullvm"
1822version = "0.42.0"
1823source = "registry+https://github.com/rust-lang/crates.io-index"
1824checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
1825
1797[[package]] 1826[[package]]
1798name = "windows_x86_64_msvc" 1827name = "windows_x86_64_msvc"
1799version = "0.36.1" 1828version = "0.36.1"
1800source = "registry+https://github.com/rust-lang/crates.io-index" 1829source = "registry+https://github.com/rust-lang/crates.io-index"
1801checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 1830checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
1802 1831
1832[[package]]
1833name = "windows_x86_64_msvc"
1834version = "0.42.0"
1835source = "registry+https://github.com/rust-lang/crates.io-index"
1836checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
1837
1803[[package]] 1838[[package]]
1804name = "winreg" 1839name = "winreg"
1805version = "0.10.1" 1840version = "0.10.1"
1806source = "registry+https://github.com/rust-lang/crates.io-index" 1841source = "registry+https://github.com/rust-lang/crates.io-index"
1807checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 1842checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
1808dependencies = [ 1843dependencies = [
1809 "winapi 0.3.9", 1844 "winapi",
1810] 1845]
1811 1846
1812[[package]] 1847[[package]]
@@ -1814,7 +1849,7 @@ name = "youtube-tui"
1814version = "0.5.0" 1849version = "0.5.0"
1815dependencies = [ 1850dependencies = [
1816 "chrono", 1851 "chrono",
1817 "crossterm 0.25.0", 1852 "crossterm",
1818 "dyn-clone", 1853 "dyn-clone",
1819 "futures", 1854 "futures",
1820 "home", 1855 "home",
Cargo.toml +5 −3
@@ -19,13 +19,15 @@ crossterm = {version = "0.25", features = ["serde"]}
19viuer = {version = "0.6", features = ["sixel"]} 19viuer = {version = "0.6", features = ["sixel"]}
20home = "0.5" 20home = "0.5"
21chrono = {version = "0.4", default-features = false, features = ["clock"]} 21chrono = {version = "0.4", default-features = false, features = ["clock"]}
22# tui-additions = {version = "0.1", default-features = false, features = ["framework", "widgets"]} 22tui-additions = {version = "0.1", default-features = false, features = ["framework", "widgets"]}
23typemap = "0.3" 23typemap = "0.3"
24invidious = {version = "0.3", default-features = false, features = ["reqwest"]} 24invidious = {version = "0.4", default-features = false, features = ["reqwest"]}
25serde_yaml = "0.9" 25serde_yaml = "0.9"
26dyn-clone = "1.0" 26dyn-clone = "1.0"
27tokio = "1.21" 27tokio = "1.21"
28futures = "0.3" 28futures = "0.3"
29reqwest = "0.11" 29reqwest = "0.11"
30serde_json = "1.0" 30serde_json = "1.0"
31tui-additions = {path = "../../Rust/Packages/tui-additions", default-features = false, features = ["framework", "widgets"]} 31
32# tui-additions = {path = "../../Rust/Packages/tui-additions", default-features = false, features = ["framework", "widgets"]}
33# invidious = {path = "../../Rust/Packages/invidious", default-features = false, features = ["reqwest"]}
README.md +2 −2
@@ -39,13 +39,13 @@ An aesthetically pleasing YouTube TUI written in Rust.
39> 39>
40> #### Done 40> #### Done
41> 41>
42> - Config files (mostly, more options will be added when I get to that part) 42> - Config files
43> - Home and search page 43> - Home and search page
44> - Search fully functional 44> - Search fully functional
45> 45>
46> #### To do before release 46> #### To do before release
47> 47>
48> - Item info, channels page 48> - Item info (WIP), channels page
49> - Watch history 49> - Watch history
50> - Basically back to where it is before the rewrite 50> - Basically back to where it is before the rewrite
51 51
src/config/appearance.rs +39 −4
@@ -23,6 +23,14 @@ pub struct AppearanceConfig {
23/// Includes all configurable colors 23/// Includes all configurable colors
24#[derive(Clone, Copy, Serialize, Deserialize)] 24#[derive(Clone, Copy, Serialize, Deserialize)]
25pub struct ColorsConfig { 25pub struct ColorsConfig {
26 #[serde(default = "text_default")]
27 pub text: Color,
28 #[serde(default = "text_special_default")]
29 pub text_special: Color,
30 #[serde(default = "text_secondary_default")]
31 pub text_secondary: Color,
32 #[serde(default = "text_error_default")]
33 pub text_error: Color,
26 #[serde(default = "outline_default")] 34 #[serde(default = "outline_default")]
27 pub outline: Color, 35 pub outline: Color,
28 #[serde(default = "outline_selected_default")] 36 #[serde(default = "outline_selected_default")]
@@ -37,8 +45,6 @@ pub struct ColorsConfig {
37 pub message_error_outline: Color, 45 pub message_error_outline: Color,
38 #[serde(default = "message_success_outline_default")] 46 #[serde(default = "message_success_outline_default")]
39 pub message_success_outline: Color, 47 pub message_success_outline: Color,
40 #[serde(default = "error_text_default")]
41 pub error_text: Color,
42 #[serde(default)] 48 #[serde(default)]
43 pub item_info: ItemInfoColors, 49 pub item_info: ItemInfoColors,
44} 50}
@@ -64,11 +70,18 @@ pub struct ItemInfoColors {
64 pub video_count: Color, 70 pub video_count: Color,
65 #[serde(default = "sub_count_default")] 71 #[serde(default = "sub_count_default")]
66 pub sub_count: Color, 72 pub sub_count: Color,
73 #[serde(default = "likes_default")]
74 pub likes: Color,
75 #[serde(default = "genre_default")]
76 pub genre: Color,
67} 77}
68 78
69impl Default for ColorsConfig { 79impl Default for ColorsConfig {
70 fn default() -> Self { 80 fn default() -> Self {
71 Self { 81 Self {
82 text: text_default(),
83 text_special: text_special_default(),
84 text_secondary: text_secondary_default(),
72 outline: outline_default(), 85 outline: outline_default(),
73 outline_selected: outline_selected_default(), 86 outline_selected: outline_selected_default(),
74 outline_hover: outline_hover_default(), 87 outline_hover: outline_hover_default(),
@@ -76,7 +89,7 @@ impl Default for ColorsConfig {
76 message_outline: message_outline_default(), 89 message_outline: message_outline_default(),
77 message_error_outline: message_error_outline_default(), 90 message_error_outline: message_error_outline_default(),
78 message_success_outline: message_success_outline_default(), 91 message_success_outline: message_success_outline_default(),
79 error_text: error_text_default(), 92 text_error: text_error_default(),
80 item_info: ItemInfoColors::default(), 93 item_info: ItemInfoColors::default(),
81 } 94 }
82 } 95 }
@@ -94,6 +107,8 @@ impl Default for ItemInfoColors {
94 published: published_default(), 107 published: published_default(),
95 video_count: video_count_default(), 108 video_count: video_count_default(),
96 sub_count: sub_count_default(), 109 sub_count: sub_count_default(),
110 likes: likes_default(),
111 genre: genre_default(),
97 } 112 }
98 } 113 }
99} 114}
@@ -117,6 +132,18 @@ impl Key for AppearanceConfig {
117 132
118// defaults 133// defaults
119 134
135fn text_default() -> Color {
136 Color::Reset
137}
138
139fn text_special_default() -> Color {
140 Color::Reset
141}
142
143fn text_secondary_default() -> Color {
144 Color::Reset
145}
146
120fn outline_default() -> Color { 147fn outline_default() -> Color {
121 Color::Reset 148 Color::Reset
122} 149}
@@ -145,7 +172,7 @@ fn message_success_outline_default() -> Color {
145 Color::LightGreen 172 Color::LightGreen
146} 173}
147 174
148fn error_text_default() -> Color { 175fn text_error_default() -> Color {
149 Color::LightRed 176 Color::LightRed
150} 177}
151 178
@@ -184,3 +211,11 @@ fn video_count_default() -> Color {
184fn sub_count_default() -> Color { 211fn sub_count_default() -> Color {
185 Color::LightYellow 212 Color::LightYellow
186} 213}
214
215fn likes_default() -> Color {
216 Color::Rgb(200, 255, 129)
217}
218
219fn genre_default() -> Color {
220 Color::Rgb(255, 121, 215)
221}
src/config/commands.rs added +64
@@ -0,0 +1,64 @@
1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4use typemap::Key;
5
6use crate::global::traits::ConfigTrait;
7
8#[derive(Clone)]
9pub struct CommandsConfig {
10 pub video: HashMap<String, String>,
11 pub playlist: HashMap<String, String>,
12}
13
14impl Key for CommandsConfig {
15 type Value = Self;
16}
17
18impl From<CommandsConfigSerde> for CommandsConfig {
19 fn from(original: CommandsConfigSerde) -> Self {
20 Self {
21 video: HashMap::from_iter(original.video.into_iter().map(|item| item.into_iter().last().unwrap())),
22 playlist: HashMap::from_iter(original.playlist.into_iter().map(|item| item.into_iter().last().unwrap())),
23 }
24 }
25}
26
27#[derive(Serialize, Deserialize, Clone)]
28pub struct CommandsConfigSerde {
29 #[serde(default = "video_default")]
30 pub video: Vec<HashMap<String, String>>,
31 #[serde(default = "playlist_default")]
32 pub playlist: Vec<HashMap<String, String>>,
33}
34
35impl ConfigTrait for CommandsConfigSerde {
36 const LABEL: &'static str = "commands";
37}
38
39impl Default for CommandsConfigSerde {
40 fn default() -> Self {
41 Self {
42 video: video_default(),
43 playlist: playlist_default(),
44 }
45 }
46}
47
48fn video_default() -> Vec<HashMap<String, String>> {
49 vec![HashMap::from(
50 [(
51 String::from("Play video"),
52 String::from("${video-player} ${embed-url}"),
53 )])]
54}
55
56fn playlist_default() -> Vec<HashMap<String, String>> {
57 vec![
58 HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]),
59 HashMap::from([(
60 String::from("Play entire playlist"),
61 String::from("${video-player} ${embed-url}"),
62 )]),
63 ]
64}
src/config/main.rs +8
@@ -14,6 +14,8 @@ pub struct MainConfig {
14 pub message_bar_default: String, 14 pub message_bar_default: String,
15 #[serde(default = "images_default")] 15 #[serde(default = "images_default")]
16 pub images: Images, 16 pub images: Images,
17 #[serde(default = "refresh_after_modifying_search_filters_default")]
18 pub refresh_after_modifying_search_filters: bool,
17 #[serde(default = "image_index_default")] 19 #[serde(default = "image_index_default")]
18 // The image to download from the array of images provided by the invidious api 20 // The image to download from the array of images provided by the invidious api
19 // 0 is usually `maxres` and 3 (default) is good enough for normal uses without having huge files sizes 21 // 0 is usually `maxres` and 3 (default) is good enough for normal uses without having huge files sizes
@@ -35,6 +37,8 @@ impl Default for MainConfig {
35 message_bar_default: message_bar_default_default(), 37 message_bar_default: message_bar_default_default(),
36 images: images_default(), 38 images: images_default(),
37 image_index: image_index_default(), 39 image_index: image_index_default(),
40 refresh_after_modifying_search_filters: refresh_after_modifying_search_filters_default(
41 ),
38 42
39 env: HashMap::default(), 43 env: HashMap::default(),
40 } 44 }
@@ -83,3 +87,7 @@ const fn image_index_default() -> usize {
83const fn allow_unicode_default() -> bool { 87const fn allow_unicode_default() -> bool {
84 false 88 false
85} 89}
90
91const fn refresh_after_modifying_search_filters_default() -> bool {
92 true
93}
src/config/mod.rs +2
@@ -9,5 +9,7 @@ mod pages;
9pub use pages::*; 9pub use pages::*;
10mod keybindings; 10mod keybindings;
11pub use keybindings::*; 11pub use keybindings::*;
12mod commands;
13pub use commands::*;
12 14
13pub mod serde; 15pub mod serde;
src/config/pages.rs +21 −14
@@ -1,6 +1,6 @@
1use crate::{ 1use crate::{
2 global::traits::ConfigTrait, 2 global::traits::ConfigTrait,
3 items::{ItemList, MessageBar, PageButton, SearchBar, SearchFilter}, 3 items::{ItemList, MessageBar, PageButton, SearchBar, SearchFilter, SingleItem},
4}; 4};
5use serde::{Deserialize, Serialize}; 5use serde::{Deserialize, Serialize};
6use std::slice; 6use std::slice;
@@ -10,7 +10,7 @@ use typemap::Key;
10 10
11/// Minimum screen dimention for the tui to display without panicking, stored in `data.state` 11/// Minimum screen dimention for the tui to display without panicking, stored in `data.state`
12// is automatically generated from PageConfig 12// is automatically generated from PageConfig
13#[derive(Clone, Copy)] 13#[derive(Clone, Copy, Default)]
14pub struct MinDimentions { 14pub struct MinDimentions {
15 pub width: u16, 15 pub width: u16,
16 pub height: u16, 16 pub height: u16,
@@ -22,15 +22,6 @@ impl MinDimentions {
22 } 22 }
23} 23}
24 24
25impl Default for MinDimentions {
26 fn default() -> Self {
27 Self {
28 width: 0,
29 height: 0,
30 }
31 }
32}
33
34impl Key for MinDimentions { 25impl Key for MinDimentions {
35 type Value = Self; 26 type Value = Self;
36} 27}
@@ -42,6 +33,8 @@ pub struct PagesConfig {
42 pub main_menu: PageConfig, 33 pub main_menu: PageConfig,
43 #[serde(default = "search_default")] 34 #[serde(default = "search_default")]
44 pub search: PageConfig, 35 pub search: PageConfig,
36 #[serde(default = "singleitem_default")]
37 pub singleitem: PageConfig,
45} 38}
46 39
47impl Key for PagesConfig { 40impl Key for PagesConfig {
@@ -57,6 +50,7 @@ impl Default for PagesConfig {
57 Self { 50 Self {
58 main_menu: main_menu_default(), 51 main_menu: main_menu_default(),
59 search: search_default(), 52 search: search_default(),
53 singleitem: singleitem_default(),
60 } 54 }
61 } 55 }
62} 56}
@@ -163,6 +157,7 @@ pub enum PageItems {
163 Trending, 157 Trending,
164 Popular, 158 Popular,
165 SearchFilters, 159 SearchFilters,
160 SingleItemInfo,
166} 161}
167 162
168impl PageItems { 163impl PageItems {
@@ -175,6 +170,7 @@ impl PageItems {
175 Self::MessageBar => Box::new(MessageBar::default()), 170 Self::MessageBar => Box::new(MessageBar::default()),
176 Self::ItemList => Box::new(ItemList::default()), 171 Self::ItemList => Box::new(ItemList::default()),
177 Self::SearchFilters => Box::new(SearchFilter::default()), 172 Self::SearchFilters => Box::new(SearchFilter::default()),
173 Self::SingleItemInfo => Box::new(SingleItem::default()),
178 } 174 }
179 } 175 }
180 176
@@ -183,7 +179,7 @@ impl PageItems {
183 Self::Popular | Self::Trending => Constraint::Length(15), 179 Self::Popular | Self::Trending => Constraint::Length(15),
184 Self::SearchBar => Constraint::Min(16), 180 Self::SearchBar => Constraint::Min(16),
185 Self::MessageBar => Constraint::Min(3), 181 Self::MessageBar => Constraint::Min(3),
186 Self::ItemList => Constraint::Min(9), 182 Self::ItemList | Self::SingleItemInfo => Constraint::Min(9),
187 Self::SearchFilters => Constraint::Length(5), 183 Self::SearchFilters => Constraint::Length(5),
188 } 184 }
189 } 185 }
@@ -195,7 +191,7 @@ impl PageItems {
195 | Self::MessageBar 191 | Self::MessageBar
196 | Self::SearchBar 192 | Self::SearchBar
197 | Self::SearchFilters => Constraint::Length(3), 193 | Self::SearchFilters => Constraint::Length(3),
198 Self::ItemList => Constraint::Min(6), 194 Self::ItemList | Self::SingleItemInfo => Constraint::Min(6),
199 } 195 }
200 } 196 }
201} 197}
@@ -203,7 +199,7 @@ impl PageItems {
203fn constraint_to_u16(constraint: &Constraint) -> u16 { 199fn constraint_to_u16(constraint: &Constraint) -> u16 {
204 match constraint { 200 match constraint {
205 Constraint::Max(length) | Constraint::Min(length) | Constraint::Length(length) => *length, 201 Constraint::Max(length) | Constraint::Min(length) | Constraint::Length(length) => *length,
206 _ => unreachable!(), 202 _ => unreachable!("only `Max`, `Min`, `Length` can be used as item length"),
207 } 203 }
208} 204}
209 205
@@ -246,3 +242,14 @@ fn search_default() -> PageConfig {
246 message: String::from("Loading search results..."), 242 message: String::from("Loading search results..."),
247 } 243 }
248} 244}
245
246fn singleitem_default() -> PageConfig {
247 PageConfig {
248 layout: vec![
249 PageRow::from_vec(vec![PageItems::SearchBar, PageItems::SearchFilters], false),
250 PageRow::from_vec(vec![PageItems::SingleItemInfo], false),
251 PageRow::from_vec(vec![PageItems::MessageBar], false),
252 ],
253 message: String::from("Loading item details..."),
254 }
255}
src/config/search.rs +9 −9
@@ -7,7 +7,7 @@ use typemap::Key;
7 7
8// can be turned into URL Params for the search term with filters 8// can be turned into URL Params for the search term with filters
9/// Search query & filters 9/// Search query & filters
10#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq)] 10#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
11pub struct Search { 11pub struct Search {
12 pub query: String, 12 pub query: String,
13 pub filters: SearchFilters, 13 pub filters: SearchFilters,
@@ -35,7 +35,7 @@ impl ToString for Search {
35} 35}
36 36
37/// Search filters, read comments for function docs 37/// Search filters, read comments for function docs
38#[derive(Default, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] 38#[derive(Default, Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
39pub struct SearchFilters { 39pub struct SearchFilters {
40 pub sort: SearchFilterSort, 40 pub sort: SearchFilterSort,
41 pub date: SearchFilterDate, 41 pub date: SearchFilterDate,
@@ -68,7 +68,7 @@ impl SearchFilters {
68 2 => self.duration.selected_index(), 68 2 => self.duration.selected_index(),
69 3 => self.r#type.selected_index(), 69 3 => self.r#type.selected_index(),
70 4 => 0, 70 4 => 0,
71 _ => unreachable!(), 71 _ => unreachable!("`{index}` is not a valid index"),
72 } 72 }
73 } 73 }
74 74
@@ -84,10 +84,10 @@ impl SearchFilters {
84 if set_index == 0 { 84 if set_index == 0 {
85 self.reset(message) 85 self.reset(message)
86 } else { 86 } else {
87 unreachable!() 87 unreachable!("index can only be `0` for option `4` (reset all)")
88 } 88 }
89 } 89 }
90 _ => unreachable!(), 90 _ => unreachable!("`{index_at}` is not a valid index"),
91 } 91 }
92 } 92 }
93 93
@@ -97,7 +97,7 @@ impl SearchFilters {
97 } 97 }
98} 98}
99 99
100#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] 100#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
101pub enum SearchFilterSort { 101pub enum SearchFilterSort {
102 Relevance, 102 Relevance,
103 Rating, 103 Rating,
@@ -105,7 +105,7 @@ pub enum SearchFilterSort {
105 Views, 105 Views,
106} 106}
107 107
108#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] 108#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
109pub enum SearchFilterDate { 109pub enum SearchFilterDate {
110 None, 110 None,
111 Hour, 111 Hour,
@@ -115,7 +115,7 @@ pub enum SearchFilterDate {
115 Year, 115 Year,
116} 116}
117 117
118#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] 118#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
119pub enum SearchFilterDuration { 119pub enum SearchFilterDuration {
120 None, 120 None,
121 Short, 121 Short,
@@ -123,7 +123,7 @@ pub enum SearchFilterDuration {
123 Long, 123 Long,
124} 124}
125 125
126#[derive(Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] 126#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
127pub enum SearchFilterType { 127pub enum SearchFilterType {
128 All, 128 All,
129 Video, 129 Video,
src/config/serde.rs +7 −7
@@ -18,13 +18,13 @@ impl Default for BorderTypeSerde {
18 } 18 }
19} 19}
20 20
21impl Into<BorderType> for BorderTypeSerde { 21impl From<BorderTypeSerde> for BorderType {
22 fn into(self) -> BorderType { 22 fn from(origianl: BorderTypeSerde) -> BorderType {
23 match self { 23 match origianl {
24 Self::Plain => BorderType::Plain, 24 BorderTypeSerde::Plain => BorderType::Plain,
25 Self::Rounded => BorderType::Rounded, 25 BorderTypeSerde::Rounded => BorderType::Rounded,
26 Self::Thick => BorderType::Thick, 26 BorderTypeSerde::Thick => BorderType::Thick,
27 Self::Double => BorderType::Double, 27 BorderTypeSerde::Double => BorderType::Double,
28 } 28 }
29 } 29 }
30} 30}
src/global/functions/download_all_images.rs +13 −12
@@ -15,17 +15,22 @@ impl From<&Item> for Option<DownloadRequest> {
15 url: minivideo.thumbnail_url.clone(), 15 url: minivideo.thumbnail_url.clone(),
16 id: minivideo.id.clone(), 16 id: minivideo.id.clone(),
17 }, 17 },
18 Item::MiniPlaylist(miniplaylist) => match &miniplaylist.thumbnail { 18 Item::MiniPlaylist(miniplaylist) => DownloadRequest {
19 Some((id, url)) => DownloadRequest { 19 url: miniplaylist.thumbnail_url.clone(),
20 url: url.clone(), 20 id: miniplaylist.id.clone(),
21 id: id.clone(),
22 },
23 None => return None,
24 }, 21 },
25 Item::MiniChannel(minichannel) => DownloadRequest { 22 Item::MiniChannel(minichannel) => DownloadRequest {
26 url: minichannel.thumbnail_url.clone(), 23 url: minichannel.thumbnail_url.clone(),
27 id: minichannel.id.clone(), 24 id: minichannel.id.clone(),
28 }, 25 },
26 Item::FullVideo(fullvideo) => DownloadRequest {
27 url: fullvideo.thumbnail_url.clone(),
28 id: fullvideo.id.clone(),
29 },
30 Item::FullPlaylist(fullplaylist) => DownloadRequest {
31 url: fullplaylist.thumbnail_url.clone(),
32 id: fullplaylist.id.clone(),
33 },
29 Item::Unknown(_) => return None, 34 Item::Unknown(_) => return None,
30 }) 35 })
31 } 36 }
@@ -37,11 +42,7 @@ pub fn download_all_images(downloads: Vec<Option<DownloadRequest>>) {
37 let rt: Runtime = tokio::runtime::Runtime::new().unwrap(); 42 let rt: Runtime = tokio::runtime::Runtime::new().unwrap();
38 43
39 let _ = rt.block_on(download_all_images_async( 44 let _ = rt.block_on(download_all_images_async(
40 downloads 45 downloads.into_iter().flatten().collect(),
41 .into_iter()
42 .filter(|request| request.is_some())
43 .map(|request| request.unwrap())
44 .collect(),
45 )); 46 ));
46 }); 47 });
47} 48}
@@ -61,7 +62,7 @@ async fn download_all_images_async(downloads: Vec<DownloadRequest>) {
61 if !path.exists() { 62 if !path.exists() {
62 actions.push(download_single( 63 actions.push(download_single(
63 download.url, 64 download.url,
64 path.clone().into_os_string().into_string().unwrap(), 65 path.to_owned().into_os_string().into_string().unwrap(),
65 )); 66 ));
66 } 67 }
67 68
src/global/functions/secs_display_string.rs +2 −2
@@ -15,11 +15,11 @@ pub fn secs_display_string(mut secs: u32) -> String {
15 let minutes = secs / SECS_IN_MINUTE; 15 let minutes = secs / SECS_IN_MINUTE;
16 secs -= minutes * SECS_IN_MINUTE; 16 secs -= minutes * SECS_IN_MINUTE;
17 out.push(two_digit_num(minutes)); 17 out.push(two_digit_num(minutes));
18 } else if out.len() != 0 { 18 } else if !out.is_empty() {
19 out.push(String::from("00")); 19 out.push(String::from("00"));
20 } 20 }
21 21
22 if out.len() == 0 { 22 if out.is_empty() {
23 out.push(String::from("00")); 23 out.push(String::from("00"));
24 } 24 }
25 out.push(two_digit_num(secs)); 25 out.push(two_digit_num(secs));
src/global/functions/viewcount_text.rs +1 −1
@@ -1,4 +1,4 @@
1const UNITS: &[(&'static str, f64)] = &[ 1const UNITS: &[(&str, f64)] = &[
2 ("B", 1_000_000_000_f64), 2 ("B", 1_000_000_000_f64),
3 ("M", 1_000_000_f64), 3 ("M", 1_000_000_f64),
4 ("K", 1_000_f64), 4 ("K", 1_000_f64),
src/global/structs/errors.rs +1 −1
@@ -12,7 +12,7 @@ impl Display for Errors {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 match self { 13 match self {
14 Self::BlankError => f.write_str("Is a blank error ¯\\_(ツ)_/¯"), 14 Self::BlankError => f.write_str("Is a blank error ¯\\_(ツ)_/¯"),
15 Self::StringError(e) => f.write_str(&e), 15 Self::StringError(e) => f.write_str(e),
16 Self::StrError(e) => f.write_str(e), 16 Self::StrError(e) => f.write_str(e),
17 } 17 }
18 } 18 }
src/global/structs/item.rs +108 −44
@@ -1,6 +1,10 @@
1use crate::global::functions::{date_text, secs_display_string, viewcount_text}; 1use crate::global::functions::{date_text, secs_display_string, viewcount_text};
2use invidious::structs::hidden::{ 2use invidious::structs::{
3 Playlist, PopularItem, SearchItem, SearchItemTransition, TrendingVideo, 3 hidden::{
4 Playlist, PlaylistItem, PopularItem, SearchItem, SearchItemTransition, TrendingVideo,
5 },
6 universal::Playlist as FullPlaylist,
7 video::Video,
4}; 8};
5use std::fmt::Display; 9use std::fmt::Display;
6 10
@@ -12,10 +16,11 @@ pub enum Item {
12 MiniVideo(MiniVideoItem), 16 MiniVideo(MiniVideoItem),
13 MiniPlaylist(MiniPlaylistItem), 17 MiniPlaylist(MiniPlaylistItem),
14 MiniChannel(MiniChannelItem), 18 MiniChannel(MiniChannelItem),
19 FullVideo(FullVideoItem),
20 FullPlaylist(FullPlaylistItem),
15 Unknown(SearchItemTransition), 21 Unknown(SearchItemTransition),
16} 22}
17 23
18/// info from a video from search, trending and popular page
19#[derive(Clone)] 24#[derive(Clone)]
20pub struct MiniVideoItem { 25pub struct MiniVideoItem {
21 pub title: String, 26 pub title: String,
@@ -25,7 +30,7 @@ pub struct MiniVideoItem {
25 pub views: Option<String>, 30 pub views: Option<String>,
26 pub channel: String, 31 pub channel: String,
27 pub channel_id: String, 32 pub channel_id: String,
28 pub published: String, 33 pub published: Option<String>,
29 pub description: Option<String>, 34 pub description: Option<String>,
30} 35}
31 36
@@ -36,8 +41,7 @@ pub struct MiniPlaylistItem {
36 pub channel: String, 41 pub channel: String,
37 pub channel_id: String, 42 pub channel_id: String,
38 pub video_count: u32, 43 pub video_count: u32,
39 // (id, url) 44 pub thumbnail_url: String,
40 pub thumbnail: Option<(String, String)>,
41} 45}
42 46
43#[derive(Clone)] 47#[derive(Clone)]
@@ -51,12 +55,44 @@ pub struct MiniChannelItem {
51 pub description: String, 55 pub description: String,
52} 56}
53 57
58#[derive(Clone)]
59pub struct FullVideoItem {
60 pub title: String,
61 pub id: String,
62 pub thumbnail_url: String,
63 pub length: String,
64 pub views: String,
65 pub channel: String,
66 pub channel_id: String,
67 pub sub_count: String,
68 pub published: String,
69 pub description: String,
70 pub likes: String,
71 // pub dislikes: Option<String>, TODO
72 pub genre: String,
73}
74
75#[derive(Clone)]
76pub struct FullPlaylistItem {
77 pub title: String,
78 pub id: String,
79 pub channel: String,
80 pub channel_id: String,
81 pub video_count: u32,
82 pub description: String,
83 pub views: String,
84 pub thumbnail_url: String,
85 pub videos: Vec<Item>,
86}
87
54impl Display for Item { 88impl Display for Item {
55 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 89 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56 f.write_str(match self { 90 f.write_str(match self {
57 Self::MiniVideo(video) => &video.title, 91 Self::MiniVideo(video) => &video.title,
58 Self::MiniPlaylist(playlist) => &playlist.title, 92 Self::MiniPlaylist(playlist) => &playlist.title,
59 Self::MiniChannel(channel) => &channel.name, 93 Self::MiniChannel(channel) => &channel.name,
94 Self::FullVideo(video) => &video.title,
95 Self::FullPlaylist(playlist) => &playlist.title,
60 Self::Unknown(_) => "Unknown item", 96 Self::Unknown(_) => "Unknown item",
61 }) 97 })
62 } 98 }
@@ -67,11 +103,10 @@ impl Item {
67 pub fn thumbnail_id(&self) -> &str { 103 pub fn thumbnail_id(&self) -> &str {
68 match self { 104 match self {
69 Self::MiniVideo(video) => &video.id, 105 Self::MiniVideo(video) => &video.id,
70 Self::MiniPlaylist(playlist) => match &playlist.thumbnail { 106 Self::MiniPlaylist(playlist) => &playlist.id,
71 Some((id, _)) => &id,
72 None => "invalid",
73 },
74 Self::MiniChannel(channel) => &channel.id, 107 Self::MiniChannel(channel) => &channel.id,
108 Self::FullVideo(video) => &video.id,
109 Self::FullPlaylist(playlist) => &playlist.id,
75 Self::Unknown(_) => "invalid", 110 Self::Unknown(_) => "invalid",
76 } 111 }
77 } 112 }
@@ -86,11 +121,11 @@ impl Item {
86 views: Some(viewcount_text(original.views)), 121 views: Some(viewcount_text(original.views)),
87 channel: original.author, 122 channel: original.author,
88 channel_id: original.author_id, 123 channel_id: original.author_id,
89 published: format!( 124 published: Some(format!(
90 "{} [{}]", 125 "{} [{}]",
91 original.published_text, 126 original.published_text,
92 date_text(original.published) 127 date_text(original.published)
93 ), 128 )),
94 description: Some(original.description), 129 description: Some(original.description),
95 }) 130 })
96 } 131 }
@@ -104,30 +139,23 @@ impl Item {
104 views: Some(viewcount_text(original.views)), 139 views: Some(viewcount_text(original.views)),
105 channel: original.author, 140 channel: original.author,
106 channel_id: original.author_id, 141 channel_id: original.author_id,
107 published: format!( 142 published: Some(format!(
108 "{} [{}]", 143 "{} [{}]",
109 original.published_text, 144 original.published_text,
110 date_text(original.published) 145 date_text(original.published)
111 ), 146 )),
112 description: None, 147 description: None,
113 }) 148 })
114 } 149 }
115 150
116 pub fn from_mini_playlist(original: Playlist, image_index: usize) -> Self { 151 pub fn from_mini_playlist(original: Playlist) -> Self {
117 Self::MiniPlaylist(MiniPlaylistItem { 152 Self::MiniPlaylist(MiniPlaylistItem {
118 title: original.title, 153 title: original.title,
119 id: original.id, 154 id: original.id,
120 channel: original.author, 155 channel: original.author,
121 channel_id: original.author_id, 156 channel_id: original.author_id,
122 video_count: original.video_count, 157 video_count: original.video_count,
123 thumbnail: if original.videos.len() == 0 { 158 thumbnail_url: original.thumbnail,
124 None
125 } else {
126 Some((
127 original.videos[0].id.clone(),
128 original.videos[0].thumbnails[image_index].url.clone(),
129 ))
130 },
131 }) 159 })
132 } 160 }
133 161
@@ -138,17 +166,13 @@ impl Item {
138 id, 166 id,
139 author, 167 author,
140 author_id, 168 author_id,
141 author_url: _,
142 length, 169 length,
143 thumbnails, 170 thumbnails,
144 description, 171 description,
145 description_html: _,
146 views, 172 views,
147 published, 173 published,
148 published_text, 174 published_text,
149 live: _, 175 ..
150 paid: _,
151 premium: _,
152 } => Self::MiniVideo(MiniVideoItem { 176 } => Self::MiniVideo(MiniVideoItem {
153 title, 177 title,
154 id, 178 id,
@@ -157,7 +181,7 @@ impl Item {
157 views: Some(viewcount_text(views)), 181 views: Some(viewcount_text(views)),
158 channel: author, 182 channel: author,
159 channel_id: author_id, 183 channel_id: author_id,
160 published: format!("{} [{}]", published_text, date_text(published)), 184 published: Some(format!("{} [{}]", published_text, date_text(published))),
161 description: Some(description), 185 description: Some(description),
162 }), 186 }),
163 SearchItem::Playlist { 187 SearchItem::Playlist {
@@ -165,35 +189,26 @@ impl Item {
165 id, 189 id,
166 author, 190 author,
167 author_id, 191 author_id,
168 author_url: _,
169 video_count, 192 video_count,
170 videos, 193 thumbnail,
194 ..
171 } => Self::MiniPlaylist(MiniPlaylistItem { 195 } => Self::MiniPlaylist(MiniPlaylistItem {
172 title, 196 title,
173 id, 197 id,
174 channel: author, 198 channel: author,
175 channel_id: author_id, 199 channel_id: author_id,
176 video_count, 200 video_count,
177 thumbnail: if videos.len() == 0 { 201 thumbnail_url: thumbnail,
178 None
179 } else {
180 Some((
181 videos[0].id.clone(),
182 videos[0].thumbnails[image_index].url.clone(),
183 ))
184 },
185 }), 202 }),
186 SearchItem::Channel { 203 SearchItem::Channel {
187 name, 204 name,
188 id, 205 id,
189 url: _,
190 thumbnails, 206 thumbnails,
191 subscribers, 207 subscribers,
192 video_count, 208 video_count,
193 description, 209 description,
194 description_html: _, 210 ..
195 } => { 211 } => Self::MiniChannel(MiniChannelItem {
196 Self::MiniChannel(MiniChannelItem {
197 name, 212 name,
198 id, 213 id,
199 thumbnail_url: format!("https://{}", thumbnails[image_index].url), 214 thumbnail_url: format!("https://{}", thumbnails[image_index].url),
@@ -201,8 +216,57 @@ impl Item {
201 sub_count: subscribers, 216 sub_count: subscribers,
202 sub_count_text: viewcount_text(subscribers as u64), 217 sub_count_text: viewcount_text(subscribers as u64),
203 description, 218 description,
204 })}, 219 }),
205 SearchItem::Unknown(searchitem_transitional) => Self::Unknown(searchitem_transitional), 220 SearchItem::Unknown(searchitem_transitional) => Self::Unknown(searchitem_transitional),
206 } 221 }
207 } 222 }
223
224 pub fn from_full_video(original: Video, image_index: usize) -> Self {
225 Self::FullVideo(FullVideoItem {
226 title: original.title,
227 id: original.id,
228 thumbnail_url: original.thumbnails[image_index].url.clone(),
229 length: secs_display_string(original.length as u32),
230 views: viewcount_text(original.views),
231 channel: original.author,
232 channel_id: original.author_id,
233 sub_count: original.sub_count_text,
234 published: original.published_text,
235 description: original.description,
236 likes: viewcount_text(original.likes as u64),
237 genre: original.genre,
238 })
239 }
240
241 pub fn from_full_playlist(original: FullPlaylist, image_index: usize) -> Self {
242 Self::FullPlaylist(FullPlaylistItem {
243 title: original.title,
244 id: original.id,
245 channel: original.author,
246 channel_id: original.author_id,
247 video_count: original.video_count,
248 description: original.description,
249 views: viewcount_text(original.views),
250 thumbnail_url: original.thumbnail,
251 videos: original
252 .videos
253 .into_iter()
254 .map(|video| Self::from_playlist_item(video, image_index))
255 .collect(),
256 })
257 }
258
259 pub fn from_playlist_item(original: PlaylistItem, image_index: usize) -> Self {
260 Self::MiniVideo(MiniVideoItem {
261 title: original.title,
262 id: original.id,
263 thumbnail_url: original.thumbnails[image_index].url.to_owned(),
264 length: secs_display_string(original.length),
265 views: None,
266 channel: original.author,
267 channel_id: original.author_id,
268 published: None,
269 description: None,
270 })
271 }
208} 272}
src/global/structs/page.rs +26 −1
@@ -1,3 +1,5 @@
1use std::fmt::Debug;
2
1use crate::config::{PageConfig, PagesConfig, Search}; 3use crate::config::{PageConfig, PagesConfig, Search};
2use tui_additions::framework::Framework; 4use tui_additions::framework::Framework;
3use typemap::Key; 5use typemap::Key;
@@ -8,6 +10,20 @@ use typemap::Key;
8pub enum Page { 10pub enum Page {
9 MainMenu(MainMenuPage), 11 MainMenu(MainMenuPage),
10 Search(Search), 12 Search(Search),
13 SingleItem(SingleItemPage),
14}
15
16impl Debug for Page {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 f.write_fmt(format_args!(
19 "{}(_)",
20 match self {
21 Self::MainMenu(_) => "MainMenu",
22 Self::Search(_) => "Search",
23 Self::SingleItem(_) => "SingleItem",
24 }
25 ))
26 }
11} 27}
12 28
13impl Default for Page { 29impl Default for Page {
@@ -33,12 +49,20 @@ impl Default for MainMenuPage {
33 } 49 }
34} 50}
35 51
52/// Different items to be displayed on a single item page
53#[derive(Clone, PartialEq, Eq)]
54pub enum SingleItemPage {
55 Video(String),
56 Playlist(String),
57}
58
36impl Page { 59impl Page {
37 pub fn to_page_config(&self, framework: &Framework) -> PageConfig { 60 pub fn to_page_config(&self, framework: &Framework) -> PageConfig {
38 let pages_config = framework.data.global.get::<PagesConfig>().unwrap(); 61 let pages_config = framework.data.global.get::<PagesConfig>().unwrap();
39 match self { 62 match self {
40 Self::MainMenu(_) => pages_config.main_menu.clone(), 63 Self::MainMenu(_) => pages_config.main_menu.clone(),
41 Self::Search(_) => pages_config.search.clone(), 64 Self::Search(_) => pages_config.search.clone(),
65 Self::SingleItem(_) => pages_config.singleitem.clone(),
42 } 66 }
43 } 67 }
44 68
@@ -47,7 +71,8 @@ impl Page {
47 let pages_config = framework.data.global.get::<PagesConfig>().unwrap(); 71 let pages_config = framework.data.global.get::<PagesConfig>().unwrap();
48 match self { 72 match self {
49 Self::MainMenu(_) => pages_config.main_menu.message.clone(), 73 Self::MainMenu(_) => pages_config.main_menu.message.clone(),
50 Self::Search(_) => pages_config.main_menu.message.clone(), 74 Self::Search(_) => pages_config.search.message.clone(),
75 Self::SingleItem(_) => pages_config.singleitem.message.clone(),
51 } 76 }
52 } 77 }
53} 78}
src/global/structs/tasks.rs +7 −7
@@ -52,7 +52,7 @@ impl TaskQueue {
52 } 52 }
53 } 53 }
54 RenderTask::None => self.render = RenderTask::Only(vec![(x, y)]), 54 RenderTask::None => self.render = RenderTask::Only(vec![(x, y)]),
55 _ => return, 55 _ => {}
56 }, 56 },
57 Task::LoadPage(page) => self.load_page = Some(page), 57 Task::LoadPage(page) => self.load_page = Some(page),
58 Task::ClearPage => self.clear_all = true, 58 Task::ClearPage => self.clear_all = true,
@@ -80,7 +80,7 @@ impl TaskQueue {
80 } 80 }
81 RenderTask::Only(_locations) => { 81 RenderTask::Only(_locations) => {
82 // need to file an issue to tui-rs suggesting this as a feature 82 // need to file an issue to tui-rs suggesting this as a feature
83 unimplemented!(); 83 unimplemented!("tui-rs does not support partial re-rendering");
84 } 84 }
85 RenderTask::None => {} 85 RenderTask::None => {}
86 } 86 }
@@ -104,8 +104,9 @@ impl TaskQueue {
104 *framework.data.global.get_mut::<Message>().unwrap() = 104 *framework.data.global.get_mut::<Message>().unwrap() =
105 Message::Message(page.load_msg(framework)); 105 Message::Message(page.load_msg(framework));
106 framework.push_history(); 106 framework.push_history();
107 framework.cursor = CursorState::default();
107 108
108 let page_config = page.to_page_config(&framework); 109 let page_config = page.to_page_config(framework);
109 *framework.data.state.get_mut::<MinDimentions>().unwrap() = 110 *framework.data.state.get_mut::<MinDimentions>().unwrap() =
110 MinDimentions::new(page_config.min_width(), page_config.min_height()); 111 MinDimentions::new(page_config.min_width(), page_config.min_height());
111 112
@@ -116,7 +117,6 @@ impl TaskQueue {
116 Self::render_force_clear(framework, terminal)?; 117 Self::render_force_clear(framework, terminal)?;
117 *framework.data.global.get_mut::<Message>().unwrap() = Message::None; 118 *framework.data.global.get_mut::<Message>().unwrap() = Message::None;
118 119
119 framework.cursor = CursorState::default();
120 *framework.data.global.get_mut::<Message>().unwrap() = if let Err(e) = framework.load() 120 *framework.data.global.get_mut::<Message>().unwrap() = if let Err(e) = framework.load()
121 { 121 {
122 Message::Error(format!("{}", e)) 122 Message::Error(format!("{}", e))
@@ -179,7 +179,7 @@ impl TaskQueue {
179 .get::<AppearanceConfig>() 179 .get::<AppearanceConfig>()
180 .unwrap() 180 .unwrap()
181 .colors 181 .colors
182 .error_text), 182 .text_error),
183 ); 183 );
184 frame.render_widget(paragraph, area); 184 frame.render_widget(paragraph, area);
185 return; 185 return;
@@ -207,11 +207,11 @@ impl Tasks {
207 // clears and returns the `priority` task queue, if it is already cleared then returns the `last` task queue 207 // clears and returns the `priority` task queue, if it is already cleared then returns the `last` task queue
208 pub fn pop(&mut self) -> Option<TaskQueue> { 208 pub fn pop(&mut self) -> Option<TaskQueue> {
209 if !self.priority.is_empty() { 209 if !self.priority.is_empty() {
210 return Some(mem::replace(&mut self.priority, TaskQueue::default())); 210 return Some(mem::take(&mut self.priority));
211 } 211 }
212 212
213 if !self.last.is_empty() { 213 if !self.last.is_empty() {
214 return Some(mem::replace(&mut self.last, TaskQueue::default())); 214 return Some(mem::take(&mut self.last));
215 } 215 }
216 216
217 None 217 None
src/global/traits/configtrait.rs +2 −2
@@ -5,7 +5,7 @@ use std::{
5 io::Write, 5 io::Write,
6}; 6};
7 7
8const EXTENSION: &'static str = "yml"; 8const EXTENSION: &str = "yml";
9 9
10/// Trait for loading, saving config files 10/// Trait for loading, saving config files
11pub trait ConfigTrait { 11pub trait ConfigTrait {
@@ -57,7 +57,7 @@ pub trait ConfigTrait {
57 .truncate(true) 57 .truncate(true)
58 .open(&config_path)?; 58 .open(&config_path)?;
59 59
60 file.write(serde_yaml::to_string(&config)?.as_bytes())?; 60 file.write_all(serde_yaml::to_string(&config)?.as_bytes())?;
61 61
62 Ok(Box::new(config)) 62 Ok(Box::new(config))
63 } 63 }
src/init.rs +6 −2
@@ -1,7 +1,7 @@
1use crate::{ 1use crate::{
2 config::{ 2 config::{
3 AppearanceConfig, AppearanceConfigSerde, KeyBindingsConfig, MainConfig, MinDimentions, 3 AppearanceConfig, AppearanceConfigSerde, CommandsConfig, KeyBindingsConfig, MainConfig,
4 PagesConfig, Search, 4 MinDimentions, PagesConfig, Search, CommandsConfigSerde,
5 }, 5 },
6 global::{ 6 global::{
7 structs::{InvidiousClient, Message, Page, Status, Tasks}, 7 structs::{InvidiousClient, Message, Page, Status, Tasks},
@@ -52,6 +52,10 @@ pub fn init(framework: &mut Framework) -> Result<(), Box<dyn Error>> {
52 .global 52 .global
53 .insert::<KeyBindingsConfig>(*KeyBindingsConfig::load()?); 53 .insert::<KeyBindingsConfig>(*KeyBindingsConfig::load()?);
54 framework.data.global.insert::<Message>(Message::None); 54 framework.data.global.insert::<Message>(Message::None);
55 framework
56 .data
57 .global
58 .insert::<CommandsConfig>(CommandsConfig::from(*CommandsConfigSerde::load()?));
55 59
56 framework.data.state.insert::<Tasks>(Tasks::default()); 60 framework.data.state.insert::<Tasks>(Tasks::default());
57 framework.data.state.insert::<Page>(Page::default()); 61 framework.data.state.insert::<Page>(Page::default());
src/items/iteminfo.rs +102 −35
@@ -82,22 +82,16 @@ impl FrameworkItem for ItemInfo {
82 Style::default().fg(appearance.colors.item_info.tag), 82 Style::default().fg(appearance.colors.item_info.tag),
83 ), 83 ),
84 ( 84 (
85 minivideo.title.clone(), 85 minivideo.title.to_owned(),
86 Style::default().fg(appearance.colors.item_info.title), 86 Style::default().fg(appearance.colors.item_info.title),
87 ), 87 ),
88 ],
89 minivideo.description.as_ref().map(|description| {
88 ( 90 (
89 format!("Uploaded by {}", minivideo.channel), 91 description.to_owned(),
90 Style::default().fg(appearance.colors.item_info.author),
91 ),
92 ],
93 if let Some(description) = &minivideo.description {
94 Some((
95 description.clone(),
96 Style::default().fg(appearance.colors.item_info.description), 92 Style::default().fg(appearance.colors.item_info.description),
97 )) 93 )
98 } else { 94 }),
99 None
100 },
101 ); 95 );
102 if let Some(views) = &minivideo.views { 96 if let Some(views) = &minivideo.views {
103 out.0.push(( 97 out.0.push((
@@ -105,19 +99,21 @@ impl FrameworkItem for ItemInfo {
105 Style::default().fg(appearance.colors.item_info.viewcount), 99 Style::default().fg(appearance.colors.item_info.viewcount),
106 )); 100 ));
107 } 101 }
108 out.0.extend( 102 out.0.push((
109 vec![ 103 format!("Length: {}", minivideo.length),
110 ( 104 Style::default().fg(appearance.colors.item_info.length),
111 format!("Length: {}", minivideo.length), 105 ));
112 Style::default().fg(appearance.colors.item_info.length), 106 out.0.push((
113 ), 107 format!("Uploaded by {}", minivideo.channel),
114 ( 108 Style::default().fg(appearance.colors.item_info.author),
115 format!("Published {}", minivideo.published), 109 ));
116 Style::default().fg(appearance.colors.item_info.published), 110 if let Some(published) = &minivideo.published {
117 ), 111 out.0.push((
118 ] 112 format!("Published {}", published),
119 .into_iter(), 113 Style::default().fg(appearance.colors.item_info.published),
120 ); 114 ));
115 }
116
121 out 117 out
122 } 118 }
123 Item::MiniPlaylist(miniplaylist) => ( 119 Item::MiniPlaylist(miniplaylist) => (
@@ -127,7 +123,7 @@ impl FrameworkItem for ItemInfo {
127 Style::default().fg(appearance.colors.item_info.tag), 123 Style::default().fg(appearance.colors.item_info.tag),
128 ), 124 ),
129 ( 125 (
130 miniplaylist.title.clone(), 126 miniplaylist.title.to_owned(),
131 Style::default().fg(appearance.colors.item_info.title), 127 Style::default().fg(appearance.colors.item_info.title),
132 ), 128 ),
133 ( 129 (
@@ -156,15 +152,15 @@ impl FrameworkItem for ItemInfo {
156 Style::default().fg(appearance.colors.item_info.tag), 152 Style::default().fg(appearance.colors.item_info.tag),
157 ), 153 ),
158 ( 154 (
159 minichannel.name.clone(), 155 minichannel.name.to_owned(),
160 Style::default().fg(appearance.colors.item_info.title), 156 Style::default().fg(appearance.colors.item_info.title),
161 ), 157 ),
162 ( 158 (
163 format!("{} subscriber{}", minichannel.sub_count_text, if minichannel.sub_count <= 1 { 159 format!(
164 "" 160 "{} subscriber{}",
165 } else { 161 minichannel.sub_count_text,
166 "s" 162 if minichannel.sub_count <= 1 { "" } else { "s" }
167 }), 163 ),
168 Style::default().fg(appearance.colors.item_info.sub_count), 164 Style::default().fg(appearance.colors.item_info.sub_count),
169 ), 165 ),
170 ( 166 (
@@ -181,14 +177,85 @@ impl FrameworkItem for ItemInfo {
181 ), 177 ),
182 ], 178 ],
183 Some(( 179 Some((
184 minichannel.description.clone(), 180 minichannel.description.to_owned(),
181 Style::default().fg(appearance.colors.item_info.description),
182 )),
183 ),
184 Item::FullVideo(fullvideo) => (
185 vec![
186 (
187 String::from("[Video]"),
188 Style::default().fg(appearance.colors.item_info.tag),
189 ),
190 (
191 fullvideo.title.to_owned(),
192 Style::default().fg(appearance.colors.item_info.title),
193 ),
194 (
195 format!("{} views", fullvideo.views),
196 Style::default().fg(appearance.colors.item_info.viewcount),
197 ),
198 (
199 format!("{} likes", fullvideo.likes),
200 Style::default().fg(appearance.colors.item_info.likes),
201 ),
202 (
203 format!("Length: {}", fullvideo.length),
204 Style::default().fg(appearance.colors.item_info.length),
205 ),
206 (
207 format!(
208 "Uploaded by {} ({} subscribers)",
209 fullvideo.channel, fullvideo.sub_count
210 ),
211 Style::default().fg(appearance.colors.item_info.author),
212 ),
213 (
214 format!("Published {}", fullvideo.published),
215 Style::default().fg(appearance.colors.item_info.published),
216 ),
217 ],
218 Some((
219 fullvideo.description.to_owned(),
220 Style::default().fg(appearance.colors.item_info.description),
221 )),
222 ),
223 Item::FullPlaylist(fullplaylist) => (
224 vec![
225 (
226 String::from("[Playlist]"),
227 Style::default().fg(appearance.colors.item_info.tag),
228 ),
229 (
230 fullplaylist.title.to_owned(),
231 Style::default().fg(appearance.colors.item_info.title),
232 ),
233 (
234 format!("Created by by {}", fullplaylist.channel),
235 Style::default().fg(appearance.colors.item_info.author),
236 ),
237 (
238 format!(
239 "{} video{}",
240 fullplaylist.video_count,
241 if fullplaylist.video_count <= 1 {
242 ""
243 } else {
244 "s"
245 }
246 ),
247 Style::default().fg(appearance.colors.item_info.video_count),
248 ),
249 ],
250 Some((
251 fullplaylist.description.to_owned(),
185 Style::default().fg(appearance.colors.item_info.description), 252 Style::default().fg(appearance.colors.item_info.description),
186 )), 253 )),
187 ), 254 ),
188 Item::Unknown(searchitem_transitional) => ( 255 Item::Unknown(searchitem_transitional) => (
189 vec![( 256 vec![(
190 format!("Unknown type `{}`", searchitem_transitional.r#type), 257 format!("Unknown type `{}`", searchitem_transitional.r#type),
191 Style::default().fg(appearance.colors.error_text), 258 Style::default().fg(appearance.colors.text_error),
192 )], 259 )],
193 Some(( 260 Some((
194 serde_json::to_string(&searchitem_transitional).unwrap(), 261 serde_json::to_string(&searchitem_transitional).unwrap(),
@@ -220,7 +287,7 @@ impl FrameworkItem for ItemInfo {
220 287
221 // renders the "text" 288 // renders the "text"
222 let (text, style) = text.unwrap(); 289 let (text, style) = text.unwrap();
223 if text.len() == 0 { 290 if text.is_empty() {
224 return; 291 return;
225 } 292 }
226 let paragraph = Paragraph::new(format!("Description:\n{}", text)) 293 let paragraph = Paragraph::new(format!("Description:\n{}", text))
src/items/itemlist.rs +63 −25
@@ -11,7 +11,9 @@ use crate::{
11 config::{AppearanceConfig, KeyBindingsConfig, MainConfig}, 11 config::{AppearanceConfig, KeyBindingsConfig, MainConfig},
12 global::{ 12 global::{
13 functions::download_all_images, 13 functions::download_all_images,
14 structs::{InvidiousClient, Item, KeyAction, MainMenuPage, Page, Task, Tasks}, 14 structs::{
15 InvidiousClient, Item, KeyAction, MainMenuPage, Page, SingleItemPage, Task, Tasks,
16 },
15 }, 17 },
16}; 18};
17 19
@@ -25,6 +27,42 @@ pub struct ItemList {
25 pub grid: Grid, 27 pub grid: Grid,
26} 28}
27 29
30impl ItemList {
31 fn update_appearance(
32 &mut self,
33 appearance: &AppearanceConfig,
34 mainconfig: &MainConfig,
35 iteminfo: &tui_additions::framework::ItemInfo,
36 ) {
37 self.textlist.set_ascii_only(!mainconfig.allow_unicode);
38 self.grid.set_border_type(appearance.borders);
39 self.textlist.set_border_type(appearance.borders);
40 self.textlist
41 .set_style(Style::default().fg(appearance.colors.text));
42
43 if iteminfo.selected {
44 self.grid
45 .set_border_style(Style::default().fg(appearance.colors.outline_selected));
46 self.textlist
47 .set_cursor_style(Style::default().fg(appearance.colors.outline_hover));
48 self.textlist
49 .set_selected_style(Style::default().fg(appearance.colors.text_special));
50 } else {
51 self.textlist
52 .set_cursor_style(Style::default().fg(appearance.colors.outline_secondary));
53 self.textlist
54 .set_selected_style(Style::default().fg(appearance.colors.text_secondary));
55 if iteminfo.hover {
56 self.grid
57 .set_border_style(Style::default().fg(appearance.colors.outline_hover));
58 } else {
59 self.grid
60 .set_border_style(Style::default().fg(appearance.colors.outline));
61 }
62 }
63 }
64}
65
28impl Default for ItemList { 66impl Default for ItemList {
29 fn default() -> Self { 67 fn default() -> Self {
30 Self { 68 Self {
@@ -54,19 +92,12 @@ impl FrameworkItem for ItemList {
54 } 92 }
55 93
56 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap(); 94 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
95 let mainconfig = framework.data.global.get::<MainConfig>().unwrap();
96 self.update_appearance(appearance, mainconfig, &info);
57 97
58 // creates the grid 98 // creates the grid
59 self.grid
60 .set_border_style(Style::default().fg(if info.hover {
61 appearance.colors.outline_hover
62 } else if info.selected {
63 appearance.colors.outline_selected
64 } else {
65 appearance.colors.outline
66 }));
67
68 let grid = self.grid.clone(); 99 let grid = self.grid.clone();
69 let chunks = &grid.chunks(area).unwrap()[0]; 100 let chunks = grid.chunks(area).unwrap()[0].to_owned();
70 101
71 // creates the text list in cell (0, 1) 102 // creates the text list in cell (0, 1)
72 self.textlist.set_height(chunks[0].height); 103 self.textlist.set_height(chunks[0].height);
@@ -96,19 +127,6 @@ impl FrameworkItem for ItemList {
96 framework: &mut tui_additions::framework::FrameworkClean, 127 framework: &mut tui_additions::framework::FrameworkClean,
97 _info: tui_additions::framework::ItemInfo, 128 _info: tui_additions::framework::ItemInfo,
98 ) -> Result<(), Box<dyn Error>> { 129 ) -> Result<(), Box<dyn Error>> {
99 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
100
101 self.grid.set_border_type(appearance.borders);
102 self.textlist.set_border_type(appearance.borders);
103 self.textlist.set_ascii_only(
104 !framework
105 .data
106 .global
107 .get::<MainConfig>()
108 .unwrap()
109 .allow_unicode,
110 );
111
112 let page = framework.data.state.get::<Page>().unwrap(); 130 let page = framework.data.state.get::<Page>().unwrap();
113 let image_index = framework 131 let image_index = framework
114 .data 132 .data
@@ -144,6 +162,7 @@ impl FrameworkItem for ItemList {
144 .map(|item| Item::from_search_item(item, image_index)) 162 .map(|item| Item::from_search_item(item, image_index))
145 .collect(); 163 .collect();
146 } 164 }
165 _ => unreachable!("item `ItemList` cannot be used in `{page:?}`"),
147 } 166 }
148 167
149 if framework 168 if framework
@@ -194,6 +213,25 @@ impl FrameworkItem for ItemList {
194 KeyAction::MoveDown => self.textlist.down().is_ok(), 213 KeyAction::MoveDown => self.textlist.down().is_ok(),
195 KeyAction::MoveLeft => self.textlist.first().is_ok(), 214 KeyAction::MoveLeft => self.textlist.first().is_ok(),
196 KeyAction::MoveRight => self.textlist.last().is_ok(), 215 KeyAction::MoveRight => self.textlist.last().is_ok(),
216 KeyAction::Select => {
217 let page_to_load = match &self.items[self.textlist.selected] {
218 Item::MiniVideo(video) => {
219 Page::SingleItem(SingleItemPage::Video(video.id.clone()))
220 }
221 Item::MiniPlaylist(playlist) => {
222 Page::SingleItem(SingleItemPage::Playlist(playlist.id.clone()))
223 }
224 _ => unimplemented!(),
225 };
226 framework
227 .data
228 .state
229 .get_mut::<Tasks>()
230 .unwrap()
231 .priority
232 .push(Task::LoadPage(page_to_load));
233 false
234 }
197 _ => false, 235 _ => false,
198 }; 236 };
199 237
@@ -216,7 +254,7 @@ impl FrameworkItem for ItemList {
216impl ItemList { 254impl ItemList {
217 // change `self.item` to the currently selected item 255 // change `self.item` to the currently selected item
218 pub fn update(&mut self) { 256 pub fn update(&mut self) {
219 if self.items.len() == 0 { 257 if self.items.is_empty() {
220 self.info.item = None; 258 self.info.item = None;
221 return; 259 return;
222 } 260 }
src/items/mod.rs +2
@@ -11,3 +11,5 @@ mod pagebutton;
11pub use pagebutton::*; 11pub use pagebutton::*;
12mod searchfilters; 12mod searchfilters;
13pub use searchfilters::*; 13pub use searchfilters::*;
14mod singleitem;
15pub use singleitem::*;
src/items/searchfilters.rs +48 −4
@@ -1,8 +1,8 @@
1use crate::{ 1use crate::{
2 config::{AppearanceConfig, KeyBindingsConfig, Search, SearchFilters}, 2 config::{AppearanceConfig, KeyBindingsConfig, MainConfig, Search, SearchFilters},
3 global::{ 3 global::{
4 functions::popup_area, 4 functions::popup_area,
5 structs::{KeyAction, Message, Status, Task, Tasks}, 5 structs::{KeyAction, Message, Page, Status, Task, Tasks},
6 }, 6 },
7}; 7};
8use tui::{ 8use tui::{
@@ -29,6 +29,7 @@ pub struct SearchFilter {
29 pub left_options: Vec<&'static str>, 29 pub left_options: Vec<&'static str>,
30 pub current_hover: bool, 30 pub current_hover: bool,
31 pub grid: Grid, 31 pub grid: Grid,
32 pub previous_state: Option<SearchFilters>,
32} 33}
33 34
34impl Default for SearchFilter { 35impl Default for SearchFilter {
@@ -45,6 +46,7 @@ impl Default for SearchFilter {
45 vec![Constraint::Percentage(100)], 46 vec![Constraint::Percentage(100)],
46 ) 47 )
47 .unwrap(), 48 .unwrap(),
49 previous_state: None,
48 } 50 }
49 } 51 }
50} 52}
@@ -116,7 +118,7 @@ impl FrameworkItem for SearchFilter {
116 POPUP_MIN_HEIGHT, 118 POPUP_MIN_HEIGHT,
117 )) 119 ))
118 .alignment(Alignment::Center) 120 .alignment(Alignment::Center)
119 .style(Style::default().fg(appearance.colors.error_text)) 121 .style(Style::default().fg(appearance.colors.text_error))
120 .block(block); 122 .block(block);
121 123
122 frame.render_widget(paragraph, area); 124 frame.render_widget(paragraph, area);
@@ -172,7 +174,7 @@ impl FrameworkItem for SearchFilter {
172 self.right_textlist.set_border_type(appearance.borders); 174 self.right_textlist.set_border_type(appearance.borders);
173 self.grid.set_border_type(appearance.borders); 175 self.grid.set_border_type(appearance.borders);
174 176
175 self.update(&framework); 177 self.update(framework);
176 178
177 self.left_textlist.set_items(&self.left_options)?; 179 self.left_textlist.set_items(&self.left_options)?;
178 self.right_textlist 180 self.right_textlist
@@ -198,6 +200,22 @@ impl FrameworkItem for SearchFilter {
198 .priority 200 .priority
199 .push(Task::ClearPage); 201 .push(Task::ClearPage);
200 self.update(framework); 202 self.update(framework);
203
204 // create a clone of search options only if `refresh_after_modifying_search_filters` is true
205 // and is a search page
206 if !framework
207 .data
208 .global
209 .get::<MainConfig>()
210 .unwrap()
211 .refresh_after_modifying_search_filters
212 {
213 return true;
214 }
215
216 if let Page::Search(search_options) = framework.data.state.get::<Page>().unwrap() {
217 self.previous_state = Some(search_options.filters);
218 }
201 true 219 true
202 } 220 }
203 221
@@ -208,6 +226,32 @@ impl FrameworkItem for SearchFilter {
208 .get_mut::<Status>() 226 .get_mut::<Status>()
209 .unwrap() 227 .unwrap()
210 .popup_opened = false; 228 .popup_opened = false;
229
230 // refresh page only if changed and enabled in options
231 let search_options = framework.data.state.get::<Search>().unwrap().clone();
232 if self.previous_state.is_none()
233 || !framework
234 .data
235 .global
236 .get::<MainConfig>()
237 .unwrap()
238 .refresh_after_modifying_search_filters
239 || self.previous_state.unwrap() == search_options.filters
240 {
241 return true;
242 }
243
244 let page = framework.data.state.get_mut::<Page>().unwrap();
245 if let Page::Search(search) = page {
246 *search = search_options;
247 framework
248 .data
249 .state
250 .get_mut::<Tasks>()
251 .unwrap()
252 .priority
253 .push(Task::Reload);
254 }
211 true 255 true
212 } 256 }
213 257
src/items/singleitem.rs added +283
@@ -0,0 +1,283 @@
1use std::collections::HashMap;
2use tui::{layout::Constraint, style::Style};
3use tui_additions::{
4 framework::FrameworkItem,
5 widgets::{Grid, TextList},
6};
7use super::ItemInfo;
8use crate::{
9 config::{AppearanceConfig, MainConfig, CommandsConfig},
10 global::{structs::{InvidiousClient, Item, Message, Page, SingleItemPage}, functions::download_all_images}
11};
12
13impl Default for SingleItem {
14 fn default() -> Self {
15 Self {
16 item: None,
17 iteminfo: ItemInfo::default(),
18 grid: Grid::new(
19 vec![Constraint::Percentage(30), Constraint::Percentage(70)],
20 vec![Constraint::Percentage(100)],
21 )
22 .unwrap(),
23 r#type: SingleItemType::None,
24 }
25 }
26}
27
28/// main item in the `SingleItem(_)` page
29#[derive(Clone)]
30pub struct SingleItem {
31 pub item: Option<Item>,
32 pub iteminfo: ItemInfo,
33 pub grid: Grid,
34 pub r#type: SingleItemType,
35}
36
37#[derive(Clone)]
38pub enum SingleItemType {
39 None,
40 Video(SingleVideoItem),
41 Playlist(SinglePlaylistItem),
42}
43
44#[derive(Clone)]
45pub struct SingleVideoItem {
46 pub textlist: TextList,
47 pub commands: HashMap<String, String>,
48}
49
50#[derive(Clone)]
51pub struct SinglePlaylistItem {
52 pub commands_view: TextList,
53 pub videos_view: TextList,
54 pub commands: HashMap<String, String>,
55 pub is_commands_view: bool,
56 pub hovered_video: ItemInfo,
57}
58
59impl SingleVideoItem {
60 pub fn new(commands: &CommandsConfig) -> Self {
61 Self {
62 textlist: TextList::default().items(&commands.video.keys().collect()).unwrap(),
63 commands: commands.video.clone(),
64 }
65 }
66
67 pub fn update_appearance(&mut self, appearance: &AppearanceConfig, iteminfo: &tui_additions::framework::ItemInfo) {
68 self.textlist.set_border_type(appearance.borders);
69 self.textlist
70 .set_style(Style::default().fg(appearance.colors.text));
71
72 if iteminfo.selected {
73 self.textlist
74 .set_cursor_style(Style::default().fg(appearance.colors.outline_hover));
75 self.textlist
76 .set_selected_style(Style::default().fg(appearance.colors.text_special));
77 } else {
78 self.textlist
79 .set_cursor_style(Style::default().fg(appearance.colors.outline_secondary));
80 self.textlist
81 .set_selected_style(Style::default().fg(appearance.colors.text_secondary));
82 }
83 }
84}
85
86impl SinglePlaylistItem {
87 pub fn new(commands: &CommandsConfig, playlist_items: &Vec<Item>) -> Self {
88 let mut hovered_video = ItemInfo::default();
89 hovered_video.item = if playlist_items.is_empty() {
90 None
91 } else {
92 Some(playlist_items[0].clone())
93 };
94 Self {
95 commands_view: TextList::default().items(&commands.playlist.keys().collect()).unwrap(),
96 videos_view: TextList::default().items(&playlist_items).unwrap(),
97 commands: commands.playlist.clone(),
98 hovered_video,
99 is_commands_view: true,
100 }
101 }
102
103 pub fn update_appearance(&mut self, appearance: &AppearanceConfig, iteminfo: &tui_additions::framework::ItemInfo, grid: &mut Grid) {
104 if self.is_commands_view {
105 grid.widths = vec![Constraint::Percentage(30), Constraint::Percentage(70)];
106 self.commands_view.set_border_type(appearance.borders);
107 self.commands_view.set_style(Style::default().fg(appearance.colors.text));
108
109 if iteminfo.selected {
110 self.commands_view
111 .set_cursor_style(Style::default().fg(appearance.colors.outline_hover));
112 self.commands_view
113 .set_selected_style(Style::default().fg(appearance.colors.text_special));
114 } else {
115 self.commands_view
116 .set_cursor_style(Style::default().fg(appearance.colors.outline_secondary));
117 self.commands_view
118 .set_selected_style(Style::default().fg(appearance.colors.text_secondary));
119 }
120 } else {
121 grid.widths = vec![Constraint::Percentage(30), Constraint::Percentage(40), Constraint::Percentage(30)];
122 self.videos_view.set_border_type(appearance.borders);
123 self.videos_view.set_style(Style::default().fg(appearance.colors.text));
124
125 if iteminfo.selected {
126 self.videos_view
127 .set_cursor_style(Style::default().fg(appearance.colors.outline_hover));
128 self.videos_view
129 .set_selected_style(Style::default().fg(appearance.colors.text_special));
130 } else {
131 self.videos_view
132 .set_cursor_style(Style::default().fg(appearance.colors.outline_secondary));
133 self.videos_view
134 .set_selected_style(Style::default().fg(appearance.colors.text_secondary));
135 }
136 }
137 }
138}
139
140impl SingleItemType {
141 pub fn update_appearance(&mut self, appearance: &AppearanceConfig, iteminfo: &tui_additions::framework::ItemInfo, grid: &mut Grid) {
142 match self {
143 Self::None => {},
144 Self::Playlist(playlistitem) => playlistitem.update_appearance(appearance, iteminfo, grid),
145 Self::Video(videoitem) => videoitem.update_appearance(appearance, iteminfo)
146 }
147 }
148}
149
150impl SingleItem {
151 fn update_appearance(
152 &mut self,
153 appearance: &AppearanceConfig,
154 iteminfo: &tui_additions::framework::ItemInfo,
155 ) {
156 self.grid.set_border_type(appearance.borders);
157
158 if iteminfo.selected {
159 self.grid
160 .set_border_style(Style::default().fg(appearance.colors.outline_selected));
161 } else {
162 if iteminfo.hover {
163 self.grid
164 .set_border_style(Style::default().fg(appearance.colors.outline_hover));
165 } else {
166 self.grid
167 .set_border_style(Style::default().fg(appearance.colors.outline));
168 }
169 }
170
171 self.r#type.update_appearance(appearance, iteminfo, &mut self.grid);
172 }
173}
174
175impl FrameworkItem for SingleItem {
176 fn render(
177 &mut self,
178 frame: &mut tui::Frame<tui::backend::CrosstermBackend<std::io::Stdout>>,
179 framework: &mut tui_additions::framework::FrameworkClean,
180 area: tui::layout::Rect,
181 popup_render: bool,
182 info: tui_additions::framework::ItemInfo,
183 ) {
184 if popup_render {
185 return;
186 }
187
188 let appearance = framework.data.global.get::<AppearanceConfig>().unwrap();
189 self.update_appearance(appearance, &info);
190
191 let chunks = self.grid.chunks(area).unwrap()[0].to_owned();
192
193 frame.render_widget(self.grid.clone(), area);
194
195 // only continue if `self.item` is Some
196 if self.item.is_none() {
197 return;
198 }
199
200 match &mut self.r#type {
201 SingleItemType::Video(typeinfo) => {
202 self.iteminfo
203 .render(frame, framework, chunks[0], popup_render, info);
204 typeinfo.textlist.set_height(chunks[1].height);
205 frame.render_widget(typeinfo.textlist.clone(), chunks[1]);
206 }
207 SingleItemType::Playlist(typeinfo) => {
208 self.iteminfo
209 .render(frame, framework, chunks[0], popup_render, info);
210 if typeinfo.is_commands_view {
211 typeinfo.commands_view.set_height(chunks[1].height);
212 frame.render_widget(typeinfo.commands_view.clone(), chunks[1]);
213 } else {
214 typeinfo.videos_view.set_height(chunks[1].height);
215 frame.render_widget(typeinfo.videos_view.clone(), chunks[1]);
216 typeinfo.hovered_video.render(frame, framework, chunks[2], popup_render, info);
217 }
218 }
219 SingleItemType::None => {}
220 }
221 }
222
223 fn load_item(
224 &mut self,
225 framework: &mut tui_additions::framework::FrameworkClean,
226 _info: tui_additions::framework::ItemInfo,
227 ) -> Result<(), Box<dyn std::error::Error>> {
228 let page = framework.data.state.get::<Page>().unwrap();
229
230 let r#type = if let Page::SingleItem(r#type) = page {
231 r#type
232 } else {
233 unreachable!("item `SingleItem` cannot be used in {page:?}")
234 };
235
236 let client = &framework.data.global.get::<InvidiousClient>().unwrap().0;
237 let mainconfig = framework.data.global.get::<MainConfig>().unwrap();
238
239 self.item = match r#type {
240 SingleItemPage::Video(id) => match client.video(id, None) {
241 Ok(video) => {
242 self.r#type = SingleItemType::Video(SingleVideoItem::new(framework.data.global.get::<CommandsConfig>().unwrap()));
243 let video = Item::from_full_video(video, mainconfig.image_index);
244 if mainconfig.images.display() {
245 download_all_images(vec![(&video).into()]);
246 }
247 Some(video)
248 },
249 Err(e) => {
250 *self = Self::default();
251 *framework.data.global.get_mut::<Message>().unwrap() =
252 Message::Error(e.to_string());
253 None
254 }
255 },
256 SingleItemPage::Playlist(id) => match client.playlist(id, None) {
257 Ok(playlist) => {
258 let playlist = Item::from_full_playlist(playlist, mainconfig.image_index);
259 let videos = if let Item::FullPlaylist(playlist) = &playlist {
260 &playlist.videos
261 } else {
262 unreachable!();
263 };
264 self.r#type = SingleItemType::Playlist(SinglePlaylistItem::new(framework.data.global.get::<CommandsConfig>().unwrap(), videos));
265 if mainconfig.images.display() {
266 download_all_images(vec![(&playlist).into()]);
267 }
268
269 Some(playlist)
270 },
271 Err(e) => {
272 *self = Self::default();
273 *framework.data.global.get_mut::<Message>().unwrap() =
274 Message::Error(e.to_string());
275 None
276 }
277 }
278 };
279 self.iteminfo.item = self.item.clone();
280
281 Ok(())
282 }
283}
src/run.rs +13 −8
@@ -14,13 +14,15 @@ pub fn run(
14 mut framework: Framework, 14 mut framework: Framework,
15) -> Result<(), Box<dyn Error>> { 15) -> Result<(), Box<dyn Error>> {
16 // push the initial page load 16 // push the initial page load
17 framework 17 let tasks = framework
18 .data 18 .data
19 .state 19 .state
20 .get_mut::<Tasks>() 20 .get_mut::<Tasks>()
21 .unwrap() 21 .unwrap();
22 .priority 22 tasks.priority
23 .push(Task::LoadPage(Page::MainMenu(MainMenuPage::Trending))); 23 .push(Task::LoadPage(Page::MainMenu(MainMenuPage::Trending)));
24 tasks.pop().unwrap().run(&mut framework, terminal)?;
25 framework.clear_history();
24 26
25 loop { 27 loop {
26 // repeat forever until all tasks are ran (and Tasks is cleared) 28 // repeat forever until all tasks are ran (and Tasks is cleared)
@@ -44,11 +46,7 @@ pub fn run(
44 .0 46 .0
45 .get(&key.code) 47 .get(&key.code)
46 { 48 {
47 if let Some(action) = keyactions.get(&key.modifiers.bits()) { 49 keyactions.get(&key.modifiers.bits()).copied()
48 Some(*action)
49 } else {
50 None
51 }
52 } else { 50 } else {
53 None 51 None
54 }; 52 };
@@ -77,6 +75,13 @@ pub fn run(
77 KeyAction::MoveDown => framework.r#move(FrameworkDirection::Down)?, 75 KeyAction::MoveDown => framework.r#move(FrameworkDirection::Down)?,
78 KeyAction::MoveLeft => framework.r#move(FrameworkDirection::Left)?, 76 KeyAction::MoveLeft => framework.r#move(FrameworkDirection::Left)?,
79 KeyAction::MoveRight => framework.r#move(FrameworkDirection::Right)?, 77 KeyAction::MoveRight => framework.r#move(FrameworkDirection::Right)?,
78 KeyAction::Reload => framework
79 .data
80 .state
81 .get_mut::<Tasks>()
82 .unwrap()
83 .priority
84 .push(Task::Reload),
80 KeyAction::Back => { 85 KeyAction::Back => {
81 if framework.revert_last_history().is_err() { 86 if framework.revert_last_history().is_err() {
82 *framework.data.global.get_mut::<Message>().unwrap() = 87 *framework.data.global.get_mut::<Message>().unwrap() =