├── .gitignore
├── Cargo.lock
├── Cargo.toml
├── LICENSE.mb
├── README.org
└── src
├── anime
├── anime.rs
├── mod.rs
├── player.rs
├── scraper.rs
└── trackers.rs
├── helpers
├── fixing_text.rs
├── mod.rs
└── take_input.rs
├── ln
├── ln.rs
├── mod.rs
├── open_text.rs
├── scraper.rs
└── tracker.rs
└── main.rs
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "adler"
7 | version = "1.0.2"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
10 |
11 | [[package]]
12 | name = "aho-corasick"
13 | version = "0.7.18"
14 | source = "registry+https://github.com/rust-lang/crates.io-index"
15 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
16 | dependencies = [
17 | "memchr",
18 | ]
19 |
20 | [[package]]
21 | name = "ansi_colours"
22 | version = "1.2.1"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | checksum = "7db9d9767fde724f83933a716ee182539788f293828244e9d999695ce0f7ba1e"
25 | dependencies = [
26 | "rgb",
27 | ]
28 |
29 | [[package]]
30 | name = "async-channel"
31 | version = "1.6.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 | checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
34 | dependencies = [
35 | "concurrent-queue",
36 | "event-listener",
37 | "futures-core",
38 | ]
39 |
40 | [[package]]
41 | name = "atty"
42 | version = "0.2.14"
43 | source = "registry+https://github.com/rust-lang/crates.io-index"
44 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
45 | dependencies = [
46 | "hermit-abi 0.1.19",
47 | "libc",
48 | "winapi 0.3.9",
49 | ]
50 |
51 | [[package]]
52 | name = "autocfg"
53 | version = "1.1.0"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
56 |
57 | [[package]]
58 | name = "base64"
59 | version = "0.13.0"
60 | source = "registry+https://github.com/rust-lang/crates.io-index"
61 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
62 |
63 | [[package]]
64 | name = "bit_field"
65 | version = "0.10.1"
66 | source = "registry+https://github.com/rust-lang/crates.io-index"
67 | checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
68 |
69 | [[package]]
70 | name = "bitflags"
71 | version = "1.3.2"
72 | source = "registry+https://github.com/rust-lang/crates.io-index"
73 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
74 |
75 | [[package]]
76 | name = "bumpalo"
77 | version = "3.11.1"
78 | source = "registry+https://github.com/rust-lang/crates.io-index"
79 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
80 |
81 | [[package]]
82 | name = "bytemuck"
83 | version = "1.12.3"
84 | source = "registry+https://github.com/rust-lang/crates.io-index"
85 | checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f"
86 |
87 | [[package]]
88 | name = "byteorder"
89 | version = "1.4.3"
90 | source = "registry+https://github.com/rust-lang/crates.io-index"
91 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
92 |
93 | [[package]]
94 | name = "bytes"
95 | version = "1.1.0"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
98 |
99 | [[package]]
100 | name = "cache-padded"
101 | version = "1.2.0"
102 | source = "registry+https://github.com/rust-lang/crates.io-index"
103 | checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
104 |
105 | [[package]]
106 | name = "cassowary"
107 | version = "0.3.0"
108 | source = "registry+https://github.com/rust-lang/crates.io-index"
109 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
110 |
111 | [[package]]
112 | name = "castaway"
113 | version = "0.1.2"
114 | source = "registry+https://github.com/rust-lang/crates.io-index"
115 | checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6"
116 |
117 | [[package]]
118 | name = "cc"
119 | version = "1.0.73"
120 | source = "registry+https://github.com/rust-lang/crates.io-index"
121 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
122 |
123 | [[package]]
124 | name = "cfg-if"
125 | version = "1.0.0"
126 | source = "registry+https://github.com/rust-lang/crates.io-index"
127 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
128 |
129 | [[package]]
130 | name = "color_quant"
131 | version = "1.1.0"
132 | source = "registry+https://github.com/rust-lang/crates.io-index"
133 | checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
134 |
135 | [[package]]
136 | name = "colored"
137 | version = "2.0.0"
138 | source = "registry+https://github.com/rust-lang/crates.io-index"
139 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"
140 | dependencies = [
141 | "atty",
142 | "lazy_static",
143 | "winapi 0.3.9",
144 | ]
145 |
146 | [[package]]
147 | name = "concurrent-queue"
148 | version = "1.2.2"
149 | source = "registry+https://github.com/rust-lang/crates.io-index"
150 | checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
151 | dependencies = [
152 | "cache-padded",
153 | ]
154 |
155 | [[package]]
156 | name = "console"
157 | version = "0.15.4"
158 | source = "registry+https://github.com/rust-lang/crates.io-index"
159 | checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a"
160 | dependencies = [
161 | "encode_unicode",
162 | "lazy_static",
163 | "libc",
164 | "windows-sys 0.42.0",
165 | ]
166 |
167 | [[package]]
168 | name = "crc32fast"
169 | version = "1.3.2"
170 | source = "registry+https://github.com/rust-lang/crates.io-index"
171 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
172 | dependencies = [
173 | "cfg-if",
174 | ]
175 |
176 | [[package]]
177 | name = "crossbeam-channel"
178 | version = "0.5.6"
179 | source = "registry+https://github.com/rust-lang/crates.io-index"
180 | checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
181 | dependencies = [
182 | "cfg-if",
183 | "crossbeam-utils",
184 | ]
185 |
186 | [[package]]
187 | name = "crossbeam-deque"
188 | version = "0.8.2"
189 | source = "registry+https://github.com/rust-lang/crates.io-index"
190 | checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
191 | dependencies = [
192 | "cfg-if",
193 | "crossbeam-epoch",
194 | "crossbeam-utils",
195 | ]
196 |
197 | [[package]]
198 | name = "crossbeam-epoch"
199 | version = "0.9.13"
200 | source = "registry+https://github.com/rust-lang/crates.io-index"
201 | checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"
202 | dependencies = [
203 | "autocfg",
204 | "cfg-if",
205 | "crossbeam-utils",
206 | "memoffset",
207 | "scopeguard",
208 | ]
209 |
210 | [[package]]
211 | name = "crossbeam-utils"
212 | version = "0.8.8"
213 | source = "registry+https://github.com/rust-lang/crates.io-index"
214 | checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
215 | dependencies = [
216 | "cfg-if",
217 | "lazy_static",
218 | ]
219 |
220 | [[package]]
221 | name = "crossterm"
222 | version = "0.23.2"
223 | source = "registry+https://github.com/rust-lang/crates.io-index"
224 | checksum = "a2102ea4f781910f8a5b98dd061f4c2023f479ce7bb1236330099ceb5a93cf17"
225 | dependencies = [
226 | "bitflags",
227 | "crossterm_winapi",
228 | "libc",
229 | "mio",
230 | "parking_lot",
231 | "signal-hook",
232 | "signal-hook-mio",
233 | "winapi 0.3.9",
234 | ]
235 |
236 | [[package]]
237 | name = "crossterm"
238 | version = "0.24.0"
239 | source = "registry+https://github.com/rust-lang/crates.io-index"
240 | checksum = "ab9f7409c70a38a56216480fba371ee460207dd8926ccf5b4160591759559170"
241 | dependencies = [
242 | "bitflags",
243 | "crossterm_winapi",
244 | "libc",
245 | "mio",
246 | "parking_lot",
247 | "signal-hook",
248 | "signal-hook-mio",
249 | "winapi 0.3.9",
250 | ]
251 |
252 | [[package]]
253 | name = "crossterm"
254 | version = "0.25.0"
255 | source = "registry+https://github.com/rust-lang/crates.io-index"
256 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
257 | dependencies = [
258 | "bitflags",
259 | "crossterm_winapi",
260 | "libc",
261 | "mio",
262 | "parking_lot",
263 | "signal-hook",
264 | "signal-hook-mio",
265 | "winapi 0.3.9",
266 | ]
267 |
268 | [[package]]
269 | name = "crossterm_winapi"
270 | version = "0.9.0"
271 | source = "registry+https://github.com/rust-lang/crates.io-index"
272 | checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
273 | dependencies = [
274 | "winapi 0.3.9",
275 | ]
276 |
277 | [[package]]
278 | name = "crunchy"
279 | version = "0.2.2"
280 | source = "registry+https://github.com/rust-lang/crates.io-index"
281 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
282 |
283 | [[package]]
284 | name = "curl"
285 | version = "0.4.43"
286 | source = "registry+https://github.com/rust-lang/crates.io-index"
287 | checksum = "37d855aeef205b43f65a5001e0997d81f8efca7badad4fad7d897aa7f0d0651f"
288 | dependencies = [
289 | "curl-sys",
290 | "libc",
291 | "openssl-probe",
292 | "openssl-sys",
293 | "schannel",
294 | "socket2",
295 | "winapi 0.3.9",
296 | ]
297 |
298 | [[package]]
299 | name = "curl-sys"
300 | version = "0.4.55+curl-7.83.1"
301 | source = "registry+https://github.com/rust-lang/crates.io-index"
302 | checksum = "23734ec77368ec583c2e61dd3f0b0e5c98b93abe6d2a004ca06b91dd7e3e2762"
303 | dependencies = [
304 | "cc",
305 | "libc",
306 | "libnghttp2-sys",
307 | "libz-sys",
308 | "openssl-sys",
309 | "pkg-config",
310 | "vcpkg",
311 | "winapi 0.3.9",
312 | ]
313 |
314 | [[package]]
315 | name = "dirs"
316 | version = "4.0.0"
317 | source = "registry+https://github.com/rust-lang/crates.io-index"
318 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
319 | dependencies = [
320 | "dirs-sys",
321 | ]
322 |
323 | [[package]]
324 | name = "dirs-sys"
325 | version = "0.3.7"
326 | source = "registry+https://github.com/rust-lang/crates.io-index"
327 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
328 | dependencies = [
329 | "libc",
330 | "redox_users",
331 | "winapi 0.3.9",
332 | ]
333 |
334 | [[package]]
335 | name = "either"
336 | version = "1.8.0"
337 | source = "registry+https://github.com/rust-lang/crates.io-index"
338 | checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
339 |
340 | [[package]]
341 | name = "encode_unicode"
342 | version = "0.3.6"
343 | source = "registry+https://github.com/rust-lang/crates.io-index"
344 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
345 |
346 | [[package]]
347 | name = "encoding_rs"
348 | version = "0.8.31"
349 | source = "registry+https://github.com/rust-lang/crates.io-index"
350 | checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
351 | dependencies = [
352 | "cfg-if",
353 | ]
354 |
355 | [[package]]
356 | name = "event-listener"
357 | version = "2.5.2"
358 | source = "registry+https://github.com/rust-lang/crates.io-index"
359 | checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
360 |
361 | [[package]]
362 | name = "exr"
363 | version = "1.5.2"
364 | source = "registry+https://github.com/rust-lang/crates.io-index"
365 | checksum = "8eb5f255b5980bb0c8cf676b675d1a99be40f316881444f44e0462eaf5df5ded"
366 | dependencies = [
367 | "bit_field",
368 | "flume",
369 | "half",
370 | "lebe",
371 | "miniz_oxide",
372 | "smallvec",
373 | "threadpool",
374 | ]
375 |
376 | [[package]]
377 | name = "fastrand"
378 | version = "1.7.0"
379 | source = "registry+https://github.com/rust-lang/crates.io-index"
380 | checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
381 | dependencies = [
382 | "instant",
383 | ]
384 |
385 | [[package]]
386 | name = "flate2"
387 | version = "1.0.25"
388 | source = "registry+https://github.com/rust-lang/crates.io-index"
389 | checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
390 | dependencies = [
391 | "crc32fast",
392 | "miniz_oxide",
393 | ]
394 |
395 | [[package]]
396 | name = "flume"
397 | version = "0.10.14"
398 | source = "registry+https://github.com/rust-lang/crates.io-index"
399 | checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
400 | dependencies = [
401 | "futures-core",
402 | "futures-sink",
403 | "nanorand",
404 | "pin-project",
405 | "spin",
406 | ]
407 |
408 | [[package]]
409 | name = "fnv"
410 | version = "1.0.7"
411 | source = "registry+https://github.com/rust-lang/crates.io-index"
412 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
413 |
414 | [[package]]
415 | name = "foreign-types"
416 | version = "0.3.2"
417 | source = "registry+https://github.com/rust-lang/crates.io-index"
418 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
419 | dependencies = [
420 | "foreign-types-shared",
421 | ]
422 |
423 | [[package]]
424 | name = "foreign-types-shared"
425 | version = "0.1.1"
426 | source = "registry+https://github.com/rust-lang/crates.io-index"
427 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
428 |
429 | [[package]]
430 | name = "form_urlencoded"
431 | version = "1.0.1"
432 | source = "registry+https://github.com/rust-lang/crates.io-index"
433 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
434 | dependencies = [
435 | "matches",
436 | "percent-encoding",
437 | ]
438 |
439 | [[package]]
440 | name = "futures-core"
441 | version = "0.3.21"
442 | source = "registry+https://github.com/rust-lang/crates.io-index"
443 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
444 |
445 | [[package]]
446 | name = "futures-io"
447 | version = "0.3.21"
448 | source = "registry+https://github.com/rust-lang/crates.io-index"
449 | checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
450 |
451 | [[package]]
452 | name = "futures-lite"
453 | version = "1.12.0"
454 | source = "registry+https://github.com/rust-lang/crates.io-index"
455 | checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
456 | dependencies = [
457 | "fastrand",
458 | "futures-core",
459 | "futures-io",
460 | "memchr",
461 | "parking",
462 | "pin-project-lite",
463 | "waker-fn",
464 | ]
465 |
466 | [[package]]
467 | name = "futures-sink"
468 | version = "0.3.25"
469 | source = "registry+https://github.com/rust-lang/crates.io-index"
470 | checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
471 |
472 | [[package]]
473 | name = "getrandom"
474 | version = "0.2.7"
475 | source = "registry+https://github.com/rust-lang/crates.io-index"
476 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
477 | dependencies = [
478 | "cfg-if",
479 | "js-sys",
480 | "libc",
481 | "wasi",
482 | "wasm-bindgen",
483 | ]
484 |
485 | [[package]]
486 | name = "gif"
487 | version = "0.11.4"
488 | source = "registry+https://github.com/rust-lang/crates.io-index"
489 | checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
490 | dependencies = [
491 | "color_quant",
492 | "weezl",
493 | ]
494 |
495 | [[package]]
496 | name = "half"
497 | version = "2.2.1"
498 | source = "registry+https://github.com/rust-lang/crates.io-index"
499 | checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0"
500 | dependencies = [
501 | "crunchy",
502 | ]
503 |
504 | [[package]]
505 | name = "hermit-abi"
506 | version = "0.1.19"
507 | source = "registry+https://github.com/rust-lang/crates.io-index"
508 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
509 | dependencies = [
510 | "libc",
511 | ]
512 |
513 | [[package]]
514 | name = "hermit-abi"
515 | version = "0.2.6"
516 | source = "registry+https://github.com/rust-lang/crates.io-index"
517 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
518 | dependencies = [
519 | "libc",
520 | ]
521 |
522 | [[package]]
523 | name = "http"
524 | version = "0.2.8"
525 | source = "registry+https://github.com/rust-lang/crates.io-index"
526 | checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
527 | dependencies = [
528 | "bytes",
529 | "fnv",
530 | "itoa",
531 | ]
532 |
533 | [[package]]
534 | name = "idna"
535 | version = "0.2.3"
536 | source = "registry+https://github.com/rust-lang/crates.io-index"
537 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
538 | dependencies = [
539 | "matches",
540 | "unicode-bidi",
541 | "unicode-normalization",
542 | ]
543 |
544 | [[package]]
545 | name = "image"
546 | version = "0.24.5"
547 | source = "registry+https://github.com/rust-lang/crates.io-index"
548 | checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945"
549 | dependencies = [
550 | "bytemuck",
551 | "byteorder",
552 | "color_quant",
553 | "exr",
554 | "gif",
555 | "jpeg-decoder",
556 | "num-rational",
557 | "num-traits",
558 | "png",
559 | "scoped_threadpool",
560 | "tiff",
561 | ]
562 |
563 | [[package]]
564 | name = "instant"
565 | version = "0.1.12"
566 | source = "registry+https://github.com/rust-lang/crates.io-index"
567 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
568 | dependencies = [
569 | "cfg-if",
570 | ]
571 |
572 | [[package]]
573 | name = "isahc"
574 | version = "1.7.2"
575 | source = "registry+https://github.com/rust-lang/crates.io-index"
576 | checksum = "334e04b4d781f436dc315cb1e7515bd96826426345d498149e4bde36b67f8ee9"
577 | dependencies = [
578 | "async-channel",
579 | "castaway",
580 | "crossbeam-utils",
581 | "curl",
582 | "curl-sys",
583 | "encoding_rs",
584 | "event-listener",
585 | "futures-lite",
586 | "http",
587 | "log",
588 | "mime",
589 | "once_cell",
590 | "polling",
591 | "slab",
592 | "sluice",
593 | "tracing",
594 | "tracing-futures",
595 | "url",
596 | "waker-fn",
597 | ]
598 |
599 | [[package]]
600 | name = "itoa"
601 | version = "1.0.2"
602 | source = "registry+https://github.com/rust-lang/crates.io-index"
603 | checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
604 |
605 | [[package]]
606 | name = "jpeg-decoder"
607 | version = "0.3.0"
608 | source = "registry+https://github.com/rust-lang/crates.io-index"
609 | checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
610 | dependencies = [
611 | "rayon",
612 | ]
613 |
614 | [[package]]
615 | name = "js-sys"
616 | version = "0.3.60"
617 | source = "registry+https://github.com/rust-lang/crates.io-index"
618 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
619 | dependencies = [
620 | "wasm-bindgen",
621 | ]
622 |
623 | [[package]]
624 | name = "kami"
625 | version = "0.6.0"
626 | dependencies = [
627 | "base64",
628 | "colored",
629 | "crossterm 0.24.0",
630 | "dirs",
631 | "isahc",
632 | "regex",
633 | "rust_cast",
634 | "serde_json",
635 | "termsize",
636 | "tui",
637 | "unicode-width",
638 | "viuer",
639 | ]
640 |
641 | [[package]]
642 | name = "kernel32-sys"
643 | version = "0.2.2"
644 | source = "registry+https://github.com/rust-lang/crates.io-index"
645 | checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
646 | dependencies = [
647 | "winapi 0.2.8",
648 | "winapi-build",
649 | ]
650 |
651 | [[package]]
652 | name = "lazy_static"
653 | version = "1.4.0"
654 | source = "registry+https://github.com/rust-lang/crates.io-index"
655 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
656 |
657 | [[package]]
658 | name = "lebe"
659 | version = "0.5.2"
660 | source = "registry+https://github.com/rust-lang/crates.io-index"
661 | checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
662 |
663 | [[package]]
664 | name = "libc"
665 | version = "0.2.126"
666 | source = "registry+https://github.com/rust-lang/crates.io-index"
667 | checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
668 |
669 | [[package]]
670 | name = "libnghttp2-sys"
671 | version = "0.1.7+1.45.0"
672 | source = "registry+https://github.com/rust-lang/crates.io-index"
673 | checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f"
674 | dependencies = [
675 | "cc",
676 | "libc",
677 | ]
678 |
679 | [[package]]
680 | name = "libz-sys"
681 | version = "1.1.8"
682 | source = "registry+https://github.com/rust-lang/crates.io-index"
683 | checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
684 | dependencies = [
685 | "cc",
686 | "libc",
687 | "pkg-config",
688 | "vcpkg",
689 | ]
690 |
691 | [[package]]
692 | name = "lock_api"
693 | version = "0.4.7"
694 | source = "registry+https://github.com/rust-lang/crates.io-index"
695 | checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
696 | dependencies = [
697 | "autocfg",
698 | "scopeguard",
699 | ]
700 |
701 | [[package]]
702 | name = "log"
703 | version = "0.4.17"
704 | source = "registry+https://github.com/rust-lang/crates.io-index"
705 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
706 | dependencies = [
707 | "cfg-if",
708 | ]
709 |
710 | [[package]]
711 | name = "make-cmd"
712 | version = "0.1.0"
713 | source = "registry+https://github.com/rust-lang/crates.io-index"
714 | checksum = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3"
715 |
716 | [[package]]
717 | name = "matches"
718 | version = "0.1.9"
719 | source = "registry+https://github.com/rust-lang/crates.io-index"
720 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
721 |
722 | [[package]]
723 | name = "memchr"
724 | version = "2.5.0"
725 | source = "registry+https://github.com/rust-lang/crates.io-index"
726 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
727 |
728 | [[package]]
729 | name = "memoffset"
730 | version = "0.7.1"
731 | source = "registry+https://github.com/rust-lang/crates.io-index"
732 | checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
733 | dependencies = [
734 | "autocfg",
735 | ]
736 |
737 | [[package]]
738 | name = "mime"
739 | version = "0.3.16"
740 | source = "registry+https://github.com/rust-lang/crates.io-index"
741 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
742 |
743 | [[package]]
744 | name = "miniz_oxide"
745 | version = "0.6.2"
746 | source = "registry+https://github.com/rust-lang/crates.io-index"
747 | checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
748 | dependencies = [
749 | "adler",
750 | ]
751 |
752 | [[package]]
753 | name = "mio"
754 | version = "0.8.4"
755 | source = "registry+https://github.com/rust-lang/crates.io-index"
756 | checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
757 | dependencies = [
758 | "libc",
759 | "log",
760 | "wasi",
761 | "windows-sys 0.36.1",
762 | ]
763 |
764 | [[package]]
765 | name = "nanorand"
766 | version = "0.7.0"
767 | source = "registry+https://github.com/rust-lang/crates.io-index"
768 | checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
769 | dependencies = [
770 | "getrandom",
771 | ]
772 |
773 | [[package]]
774 | name = "num-integer"
775 | version = "0.1.45"
776 | source = "registry+https://github.com/rust-lang/crates.io-index"
777 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
778 | dependencies = [
779 | "autocfg",
780 | "num-traits",
781 | ]
782 |
783 | [[package]]
784 | name = "num-rational"
785 | version = "0.4.1"
786 | source = "registry+https://github.com/rust-lang/crates.io-index"
787 | checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
788 | dependencies = [
789 | "autocfg",
790 | "num-integer",
791 | "num-traits",
792 | ]
793 |
794 | [[package]]
795 | name = "num-traits"
796 | version = "0.2.15"
797 | source = "registry+https://github.com/rust-lang/crates.io-index"
798 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
799 | dependencies = [
800 | "autocfg",
801 | ]
802 |
803 | [[package]]
804 | name = "num_cpus"
805 | version = "1.15.0"
806 | source = "registry+https://github.com/rust-lang/crates.io-index"
807 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
808 | dependencies = [
809 | "hermit-abi 0.2.6",
810 | "libc",
811 | ]
812 |
813 | [[package]]
814 | name = "numtoa"
815 | version = "0.1.0"
816 | source = "registry+https://github.com/rust-lang/crates.io-index"
817 | checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
818 |
819 | [[package]]
820 | name = "once_cell"
821 | version = "1.12.0"
822 | source = "registry+https://github.com/rust-lang/crates.io-index"
823 | checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
824 |
825 | [[package]]
826 | name = "openssl"
827 | version = "0.10.42"
828 | source = "registry+https://github.com/rust-lang/crates.io-index"
829 | checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13"
830 | dependencies = [
831 | "bitflags",
832 | "cfg-if",
833 | "foreign-types",
834 | "libc",
835 | "once_cell",
836 | "openssl-macros",
837 | "openssl-sys",
838 | ]
839 |
840 | [[package]]
841 | name = "openssl-macros"
842 | version = "0.1.0"
843 | source = "registry+https://github.com/rust-lang/crates.io-index"
844 | checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
845 | dependencies = [
846 | "proc-macro2",
847 | "quote",
848 | "syn",
849 | ]
850 |
851 | [[package]]
852 | name = "openssl-probe"
853 | version = "0.1.5"
854 | source = "registry+https://github.com/rust-lang/crates.io-index"
855 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
856 |
857 | [[package]]
858 | name = "openssl-sys"
859 | version = "0.9.77"
860 | source = "registry+https://github.com/rust-lang/crates.io-index"
861 | checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a"
862 | dependencies = [
863 | "autocfg",
864 | "cc",
865 | "libc",
866 | "pkg-config",
867 | "vcpkg",
868 | ]
869 |
870 | [[package]]
871 | name = "parking"
872 | version = "2.0.0"
873 | source = "registry+https://github.com/rust-lang/crates.io-index"
874 | checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
875 |
876 | [[package]]
877 | name = "parking_lot"
878 | version = "0.12.1"
879 | source = "registry+https://github.com/rust-lang/crates.io-index"
880 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
881 | dependencies = [
882 | "lock_api",
883 | "parking_lot_core",
884 | ]
885 |
886 | [[package]]
887 | name = "parking_lot_core"
888 | version = "0.9.3"
889 | source = "registry+https://github.com/rust-lang/crates.io-index"
890 | checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
891 | dependencies = [
892 | "cfg-if",
893 | "libc",
894 | "redox_syscall",
895 | "smallvec",
896 | "windows-sys 0.36.1",
897 | ]
898 |
899 | [[package]]
900 | name = "percent-encoding"
901 | version = "2.1.0"
902 | source = "registry+https://github.com/rust-lang/crates.io-index"
903 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
904 |
905 | [[package]]
906 | name = "pin-project"
907 | version = "1.0.10"
908 | source = "registry+https://github.com/rust-lang/crates.io-index"
909 | checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e"
910 | dependencies = [
911 | "pin-project-internal",
912 | ]
913 |
914 | [[package]]
915 | name = "pin-project-internal"
916 | version = "1.0.10"
917 | source = "registry+https://github.com/rust-lang/crates.io-index"
918 | checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb"
919 | dependencies = [
920 | "proc-macro2",
921 | "quote",
922 | "syn",
923 | ]
924 |
925 | [[package]]
926 | name = "pin-project-lite"
927 | version = "0.2.9"
928 | source = "registry+https://github.com/rust-lang/crates.io-index"
929 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
930 |
931 | [[package]]
932 | name = "pkg-config"
933 | version = "0.3.25"
934 | source = "registry+https://github.com/rust-lang/crates.io-index"
935 | checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
936 |
937 | [[package]]
938 | name = "png"
939 | version = "0.17.7"
940 | source = "registry+https://github.com/rust-lang/crates.io-index"
941 | checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638"
942 | dependencies = [
943 | "bitflags",
944 | "crc32fast",
945 | "flate2",
946 | "miniz_oxide",
947 | ]
948 |
949 | [[package]]
950 | name = "polling"
951 | version = "2.2.0"
952 | source = "registry+https://github.com/rust-lang/crates.io-index"
953 | checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
954 | dependencies = [
955 | "cfg-if",
956 | "libc",
957 | "log",
958 | "wepoll-ffi",
959 | "winapi 0.3.9",
960 | ]
961 |
962 | [[package]]
963 | name = "proc-macro2"
964 | version = "1.0.39"
965 | source = "registry+https://github.com/rust-lang/crates.io-index"
966 | checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
967 | dependencies = [
968 | "unicode-ident",
969 | ]
970 |
971 | [[package]]
972 | name = "protobuf"
973 | version = "2.27.1"
974 | source = "registry+https://github.com/rust-lang/crates.io-index"
975 | checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
976 |
977 | [[package]]
978 | name = "protobuf-codegen"
979 | version = "2.27.1"
980 | source = "registry+https://github.com/rust-lang/crates.io-index"
981 | checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707"
982 | dependencies = [
983 | "protobuf",
984 | ]
985 |
986 | [[package]]
987 | name = "protoc"
988 | version = "2.27.1"
989 | source = "registry+https://github.com/rust-lang/crates.io-index"
990 | checksum = "c2ef1dc036942fac2470fdb8a911f125404ee9129e9e807f3d12d8589001a38f"
991 | dependencies = [
992 | "log",
993 | "which",
994 | ]
995 |
996 | [[package]]
997 | name = "protoc-rust"
998 | version = "2.27.1"
999 | source = "registry+https://github.com/rust-lang/crates.io-index"
1000 | checksum = "1a9e315121c8e7e21396e940a3d27f92280a6d28e3931213bf6cbfea76c5cc94"
1001 | dependencies = [
1002 | "protobuf",
1003 | "protobuf-codegen",
1004 | "protoc",
1005 | "tempfile",
1006 | ]
1007 |
1008 | [[package]]
1009 | name = "quote"
1010 | version = "1.0.18"
1011 | source = "registry+https://github.com/rust-lang/crates.io-index"
1012 | checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
1013 | dependencies = [
1014 | "proc-macro2",
1015 | ]
1016 |
1017 | [[package]]
1018 | name = "rayon"
1019 | version = "1.6.1"
1020 | source = "registry+https://github.com/rust-lang/crates.io-index"
1021 | checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
1022 | dependencies = [
1023 | "either",
1024 | "rayon-core",
1025 | ]
1026 |
1027 | [[package]]
1028 | name = "rayon-core"
1029 | version = "1.10.1"
1030 | source = "registry+https://github.com/rust-lang/crates.io-index"
1031 | checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3"
1032 | dependencies = [
1033 | "crossbeam-channel",
1034 | "crossbeam-deque",
1035 | "crossbeam-utils",
1036 | "num_cpus",
1037 | ]
1038 |
1039 | [[package]]
1040 | name = "redox_syscall"
1041 | version = "0.2.13"
1042 | source = "registry+https://github.com/rust-lang/crates.io-index"
1043 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
1044 | dependencies = [
1045 | "bitflags",
1046 | ]
1047 |
1048 | [[package]]
1049 | name = "redox_termios"
1050 | version = "0.1.2"
1051 | source = "registry+https://github.com/rust-lang/crates.io-index"
1052 | checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
1053 | dependencies = [
1054 | "redox_syscall",
1055 | ]
1056 |
1057 | [[package]]
1058 | name = "redox_users"
1059 | version = "0.4.3"
1060 | source = "registry+https://github.com/rust-lang/crates.io-index"
1061 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
1062 | dependencies = [
1063 | "getrandom",
1064 | "redox_syscall",
1065 | "thiserror",
1066 | ]
1067 |
1068 | [[package]]
1069 | name = "regex"
1070 | version = "1.5.6"
1071 | source = "registry+https://github.com/rust-lang/crates.io-index"
1072 | checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
1073 | dependencies = [
1074 | "aho-corasick",
1075 | "memchr",
1076 | "regex-syntax",
1077 | ]
1078 |
1079 | [[package]]
1080 | name = "regex-syntax"
1081 | version = "0.6.26"
1082 | source = "registry+https://github.com/rust-lang/crates.io-index"
1083 | checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
1084 |
1085 | [[package]]
1086 | name = "remove_dir_all"
1087 | version = "0.5.3"
1088 | source = "registry+https://github.com/rust-lang/crates.io-index"
1089 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
1090 | dependencies = [
1091 | "winapi 0.3.9",
1092 | ]
1093 |
1094 | [[package]]
1095 | name = "rgb"
1096 | version = "0.8.34"
1097 | source = "registry+https://github.com/rust-lang/crates.io-index"
1098 | checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3"
1099 | dependencies = [
1100 | "bytemuck",
1101 | ]
1102 |
1103 | [[package]]
1104 | name = "rust_cast"
1105 | version = "0.17.0"
1106 | source = "registry+https://github.com/rust-lang/crates.io-index"
1107 | checksum = "1ae2f46d9800706b729d86ef2f4c78e5920b56f56e720b440b311115081f413d"
1108 | dependencies = [
1109 | "byteorder",
1110 | "log",
1111 | "openssl",
1112 | "protobuf",
1113 | "protoc-rust",
1114 | "serde",
1115 | "serde_derive",
1116 | "serde_json",
1117 | ]
1118 |
1119 | [[package]]
1120 | name = "ryu"
1121 | version = "1.0.11"
1122 | source = "registry+https://github.com/rust-lang/crates.io-index"
1123 | checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
1124 |
1125 | [[package]]
1126 | name = "schannel"
1127 | version = "0.1.20"
1128 | source = "registry+https://github.com/rust-lang/crates.io-index"
1129 | checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
1130 | dependencies = [
1131 | "lazy_static",
1132 | "windows-sys 0.36.1",
1133 | ]
1134 |
1135 | [[package]]
1136 | name = "scoped_threadpool"
1137 | version = "0.1.9"
1138 | source = "registry+https://github.com/rust-lang/crates.io-index"
1139 | checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
1140 |
1141 | [[package]]
1142 | name = "scopeguard"
1143 | version = "1.1.0"
1144 | source = "registry+https://github.com/rust-lang/crates.io-index"
1145 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
1146 |
1147 | [[package]]
1148 | name = "serde"
1149 | version = "1.0.142"
1150 | source = "registry+https://github.com/rust-lang/crates.io-index"
1151 | checksum = "e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2"
1152 |
1153 | [[package]]
1154 | name = "serde_derive"
1155 | version = "1.0.147"
1156 | source = "registry+https://github.com/rust-lang/crates.io-index"
1157 | checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
1158 | dependencies = [
1159 | "proc-macro2",
1160 | "quote",
1161 | "syn",
1162 | ]
1163 |
1164 | [[package]]
1165 | name = "serde_json"
1166 | version = "1.0.83"
1167 | source = "registry+https://github.com/rust-lang/crates.io-index"
1168 | checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
1169 | dependencies = [
1170 | "itoa",
1171 | "ryu",
1172 | "serde",
1173 | ]
1174 |
1175 | [[package]]
1176 | name = "signal-hook"
1177 | version = "0.3.14"
1178 | source = "registry+https://github.com/rust-lang/crates.io-index"
1179 | checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
1180 | dependencies = [
1181 | "libc",
1182 | "signal-hook-registry",
1183 | ]
1184 |
1185 | [[package]]
1186 | name = "signal-hook-mio"
1187 | version = "0.2.3"
1188 | source = "registry+https://github.com/rust-lang/crates.io-index"
1189 | checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
1190 | dependencies = [
1191 | "libc",
1192 | "mio",
1193 | "signal-hook",
1194 | ]
1195 |
1196 | [[package]]
1197 | name = "signal-hook-registry"
1198 | version = "1.4.0"
1199 | source = "registry+https://github.com/rust-lang/crates.io-index"
1200 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
1201 | dependencies = [
1202 | "libc",
1203 | ]
1204 |
1205 | [[package]]
1206 | name = "sixel-rs"
1207 | version = "0.3.3"
1208 | source = "registry+https://github.com/rust-lang/crates.io-index"
1209 | checksum = "cfa95c014543113a192d906e5971d0c8d1e8b4cc1e61026539687a7016644ce5"
1210 | dependencies = [
1211 | "sixel-sys",
1212 | ]
1213 |
1214 | [[package]]
1215 | name = "sixel-sys"
1216 | version = "0.3.1"
1217 | source = "registry+https://github.com/rust-lang/crates.io-index"
1218 | checksum = "fb46e0cd5569bf910390844174a5a99d52dd40681fff92228d221d9f8bf87dea"
1219 | dependencies = [
1220 | "make-cmd",
1221 | ]
1222 |
1223 | [[package]]
1224 | name = "slab"
1225 | version = "0.4.6"
1226 | source = "registry+https://github.com/rust-lang/crates.io-index"
1227 | checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
1228 |
1229 | [[package]]
1230 | name = "sluice"
1231 | version = "0.5.5"
1232 | source = "registry+https://github.com/rust-lang/crates.io-index"
1233 | checksum = "6d7400c0eff44aa2fcb5e31a5f24ba9716ed90138769e4977a2ba6014ae63eb5"
1234 | dependencies = [
1235 | "async-channel",
1236 | "futures-core",
1237 | "futures-io",
1238 | ]
1239 |
1240 | [[package]]
1241 | name = "smallvec"
1242 | version = "1.9.0"
1243 | source = "registry+https://github.com/rust-lang/crates.io-index"
1244 | checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
1245 |
1246 | [[package]]
1247 | name = "socket2"
1248 | version = "0.4.4"
1249 | source = "registry+https://github.com/rust-lang/crates.io-index"
1250 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
1251 | dependencies = [
1252 | "libc",
1253 | "winapi 0.3.9",
1254 | ]
1255 |
1256 | [[package]]
1257 | name = "spin"
1258 | version = "0.9.4"
1259 | source = "registry+https://github.com/rust-lang/crates.io-index"
1260 | checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
1261 | dependencies = [
1262 | "lock_api",
1263 | ]
1264 |
1265 | [[package]]
1266 | name = "syn"
1267 | version = "1.0.96"
1268 | source = "registry+https://github.com/rust-lang/crates.io-index"
1269 | checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
1270 | dependencies = [
1271 | "proc-macro2",
1272 | "quote",
1273 | "unicode-ident",
1274 | ]
1275 |
1276 | [[package]]
1277 | name = "tempfile"
1278 | version = "3.3.0"
1279 | source = "registry+https://github.com/rust-lang/crates.io-index"
1280 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
1281 | dependencies = [
1282 | "cfg-if",
1283 | "fastrand",
1284 | "libc",
1285 | "redox_syscall",
1286 | "remove_dir_all",
1287 | "winapi 0.3.9",
1288 | ]
1289 |
1290 | [[package]]
1291 | name = "termcolor"
1292 | version = "1.1.3"
1293 | source = "registry+https://github.com/rust-lang/crates.io-index"
1294 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
1295 | dependencies = [
1296 | "winapi-util",
1297 | ]
1298 |
1299 | [[package]]
1300 | name = "termion"
1301 | version = "1.5.6"
1302 | source = "registry+https://github.com/rust-lang/crates.io-index"
1303 | checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
1304 | dependencies = [
1305 | "libc",
1306 | "numtoa",
1307 | "redox_syscall",
1308 | "redox_termios",
1309 | ]
1310 |
1311 | [[package]]
1312 | name = "termsize"
1313 | version = "0.1.6"
1314 | source = "registry+https://github.com/rust-lang/crates.io-index"
1315 | checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517"
1316 | dependencies = [
1317 | "atty",
1318 | "kernel32-sys",
1319 | "libc",
1320 | "termion",
1321 | "winapi 0.2.8",
1322 | ]
1323 |
1324 | [[package]]
1325 | name = "thiserror"
1326 | version = "1.0.31"
1327 | source = "registry+https://github.com/rust-lang/crates.io-index"
1328 | checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
1329 | dependencies = [
1330 | "thiserror-impl",
1331 | ]
1332 |
1333 | [[package]]
1334 | name = "thiserror-impl"
1335 | version = "1.0.31"
1336 | source = "registry+https://github.com/rust-lang/crates.io-index"
1337 | checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
1338 | dependencies = [
1339 | "proc-macro2",
1340 | "quote",
1341 | "syn",
1342 | ]
1343 |
1344 | [[package]]
1345 | name = "threadpool"
1346 | version = "1.8.1"
1347 | source = "registry+https://github.com/rust-lang/crates.io-index"
1348 | checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
1349 | dependencies = [
1350 | "num_cpus",
1351 | ]
1352 |
1353 | [[package]]
1354 | name = "tiff"
1355 | version = "0.8.1"
1356 | source = "registry+https://github.com/rust-lang/crates.io-index"
1357 | checksum = "7449334f9ff2baf290d55d73983a7d6fa15e01198faef72af07e2a8db851e471"
1358 | dependencies = [
1359 | "flate2",
1360 | "jpeg-decoder",
1361 | "weezl",
1362 | ]
1363 |
1364 | [[package]]
1365 | name = "tinyvec"
1366 | version = "1.6.0"
1367 | source = "registry+https://github.com/rust-lang/crates.io-index"
1368 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
1369 | dependencies = [
1370 | "tinyvec_macros",
1371 | ]
1372 |
1373 | [[package]]
1374 | name = "tinyvec_macros"
1375 | version = "0.1.0"
1376 | source = "registry+https://github.com/rust-lang/crates.io-index"
1377 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
1378 |
1379 | [[package]]
1380 | name = "tracing"
1381 | version = "0.1.34"
1382 | source = "registry+https://github.com/rust-lang/crates.io-index"
1383 | checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
1384 | dependencies = [
1385 | "cfg-if",
1386 | "log",
1387 | "pin-project-lite",
1388 | "tracing-attributes",
1389 | "tracing-core",
1390 | ]
1391 |
1392 | [[package]]
1393 | name = "tracing-attributes"
1394 | version = "0.1.21"
1395 | source = "registry+https://github.com/rust-lang/crates.io-index"
1396 | checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c"
1397 | dependencies = [
1398 | "proc-macro2",
1399 | "quote",
1400 | "syn",
1401 | ]
1402 |
1403 | [[package]]
1404 | name = "tracing-core"
1405 | version = "0.1.27"
1406 | source = "registry+https://github.com/rust-lang/crates.io-index"
1407 | checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921"
1408 | dependencies = [
1409 | "once_cell",
1410 | ]
1411 |
1412 | [[package]]
1413 | name = "tracing-futures"
1414 | version = "0.2.5"
1415 | source = "registry+https://github.com/rust-lang/crates.io-index"
1416 | checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
1417 | dependencies = [
1418 | "pin-project",
1419 | "tracing",
1420 | ]
1421 |
1422 | [[package]]
1423 | name = "tui"
1424 | version = "0.18.0"
1425 | source = "registry+https://github.com/rust-lang/crates.io-index"
1426 | checksum = "96fe69244ec2af261bced1d9046a6fee6c8c2a6b0228e59e5ba39bc8ba4ed729"
1427 | dependencies = [
1428 | "bitflags",
1429 | "cassowary",
1430 | "crossterm 0.23.2",
1431 | "unicode-segmentation",
1432 | "unicode-width",
1433 | ]
1434 |
1435 | [[package]]
1436 | name = "unicode-bidi"
1437 | version = "0.3.8"
1438 | source = "registry+https://github.com/rust-lang/crates.io-index"
1439 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
1440 |
1441 | [[package]]
1442 | name = "unicode-ident"
1443 | version = "1.0.0"
1444 | source = "registry+https://github.com/rust-lang/crates.io-index"
1445 | checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
1446 |
1447 | [[package]]
1448 | name = "unicode-normalization"
1449 | version = "0.1.19"
1450 | source = "registry+https://github.com/rust-lang/crates.io-index"
1451 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
1452 | dependencies = [
1453 | "tinyvec",
1454 | ]
1455 |
1456 | [[package]]
1457 | name = "unicode-segmentation"
1458 | version = "1.9.0"
1459 | source = "registry+https://github.com/rust-lang/crates.io-index"
1460 | checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
1461 |
1462 | [[package]]
1463 | name = "unicode-width"
1464 | version = "0.1.9"
1465 | source = "registry+https://github.com/rust-lang/crates.io-index"
1466 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
1467 |
1468 | [[package]]
1469 | name = "url"
1470 | version = "2.2.2"
1471 | source = "registry+https://github.com/rust-lang/crates.io-index"
1472 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
1473 | dependencies = [
1474 | "form_urlencoded",
1475 | "idna",
1476 | "matches",
1477 | "percent-encoding",
1478 | ]
1479 |
1480 | [[package]]
1481 | name = "vcpkg"
1482 | version = "0.2.15"
1483 | source = "registry+https://github.com/rust-lang/crates.io-index"
1484 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
1485 |
1486 | [[package]]
1487 | name = "viuer"
1488 | version = "0.6.2"
1489 | source = "registry+https://github.com/rust-lang/crates.io-index"
1490 | checksum = "b511f7e9ae27b5750f12ca50c353a1179bd4cc964a47294eb0d2cdad40cb41c0"
1491 | dependencies = [
1492 | "ansi_colours",
1493 | "base64",
1494 | "console",
1495 | "crossterm 0.25.0",
1496 | "image",
1497 | "lazy_static",
1498 | "sixel-rs",
1499 | "tempfile",
1500 | "termcolor",
1501 | ]
1502 |
1503 | [[package]]
1504 | name = "waker-fn"
1505 | version = "1.1.0"
1506 | source = "registry+https://github.com/rust-lang/crates.io-index"
1507 | checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
1508 |
1509 | [[package]]
1510 | name = "wasi"
1511 | version = "0.11.0+wasi-snapshot-preview1"
1512 | source = "registry+https://github.com/rust-lang/crates.io-index"
1513 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
1514 |
1515 | [[package]]
1516 | name = "wasm-bindgen"
1517 | version = "0.2.83"
1518 | source = "registry+https://github.com/rust-lang/crates.io-index"
1519 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
1520 | dependencies = [
1521 | "cfg-if",
1522 | "wasm-bindgen-macro",
1523 | ]
1524 |
1525 | [[package]]
1526 | name = "wasm-bindgen-backend"
1527 | version = "0.2.83"
1528 | source = "registry+https://github.com/rust-lang/crates.io-index"
1529 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
1530 | dependencies = [
1531 | "bumpalo",
1532 | "log",
1533 | "once_cell",
1534 | "proc-macro2",
1535 | "quote",
1536 | "syn",
1537 | "wasm-bindgen-shared",
1538 | ]
1539 |
1540 | [[package]]
1541 | name = "wasm-bindgen-macro"
1542 | version = "0.2.83"
1543 | source = "registry+https://github.com/rust-lang/crates.io-index"
1544 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
1545 | dependencies = [
1546 | "quote",
1547 | "wasm-bindgen-macro-support",
1548 | ]
1549 |
1550 | [[package]]
1551 | name = "wasm-bindgen-macro-support"
1552 | version = "0.2.83"
1553 | source = "registry+https://github.com/rust-lang/crates.io-index"
1554 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
1555 | dependencies = [
1556 | "proc-macro2",
1557 | "quote",
1558 | "syn",
1559 | "wasm-bindgen-backend",
1560 | "wasm-bindgen-shared",
1561 | ]
1562 |
1563 | [[package]]
1564 | name = "wasm-bindgen-shared"
1565 | version = "0.2.83"
1566 | source = "registry+https://github.com/rust-lang/crates.io-index"
1567 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
1568 |
1569 | [[package]]
1570 | name = "weezl"
1571 | version = "0.1.7"
1572 | source = "registry+https://github.com/rust-lang/crates.io-index"
1573 | checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
1574 |
1575 | [[package]]
1576 | name = "wepoll-ffi"
1577 | version = "0.1.2"
1578 | source = "registry+https://github.com/rust-lang/crates.io-index"
1579 | checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
1580 | dependencies = [
1581 | "cc",
1582 | ]
1583 |
1584 | [[package]]
1585 | name = "which"
1586 | version = "4.3.0"
1587 | source = "registry+https://github.com/rust-lang/crates.io-index"
1588 | checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
1589 | dependencies = [
1590 | "either",
1591 | "libc",
1592 | "once_cell",
1593 | ]
1594 |
1595 | [[package]]
1596 | name = "winapi"
1597 | version = "0.2.8"
1598 | source = "registry+https://github.com/rust-lang/crates.io-index"
1599 | checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
1600 |
1601 | [[package]]
1602 | name = "winapi"
1603 | version = "0.3.9"
1604 | source = "registry+https://github.com/rust-lang/crates.io-index"
1605 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
1606 | dependencies = [
1607 | "winapi-i686-pc-windows-gnu",
1608 | "winapi-x86_64-pc-windows-gnu",
1609 | ]
1610 |
1611 | [[package]]
1612 | name = "winapi-build"
1613 | version = "0.1.1"
1614 | source = "registry+https://github.com/rust-lang/crates.io-index"
1615 | checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
1616 |
1617 | [[package]]
1618 | name = "winapi-i686-pc-windows-gnu"
1619 | version = "0.4.0"
1620 | source = "registry+https://github.com/rust-lang/crates.io-index"
1621 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
1622 |
1623 | [[package]]
1624 | name = "winapi-util"
1625 | version = "0.1.5"
1626 | source = "registry+https://github.com/rust-lang/crates.io-index"
1627 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
1628 | dependencies = [
1629 | "winapi 0.3.9",
1630 | ]
1631 |
1632 | [[package]]
1633 | name = "winapi-x86_64-pc-windows-gnu"
1634 | version = "0.4.0"
1635 | source = "registry+https://github.com/rust-lang/crates.io-index"
1636 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1637 |
1638 | [[package]]
1639 | name = "windows-sys"
1640 | version = "0.36.1"
1641 | source = "registry+https://github.com/rust-lang/crates.io-index"
1642 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
1643 | dependencies = [
1644 | "windows_aarch64_msvc 0.36.1",
1645 | "windows_i686_gnu 0.36.1",
1646 | "windows_i686_msvc 0.36.1",
1647 | "windows_x86_64_gnu 0.36.1",
1648 | "windows_x86_64_msvc 0.36.1",
1649 | ]
1650 |
1651 | [[package]]
1652 | name = "windows-sys"
1653 | version = "0.42.0"
1654 | source = "registry+https://github.com/rust-lang/crates.io-index"
1655 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
1656 | dependencies = [
1657 | "windows_aarch64_gnullvm",
1658 | "windows_aarch64_msvc 0.42.0",
1659 | "windows_i686_gnu 0.42.0",
1660 | "windows_i686_msvc 0.42.0",
1661 | "windows_x86_64_gnu 0.42.0",
1662 | "windows_x86_64_gnullvm",
1663 | "windows_x86_64_msvc 0.42.0",
1664 | ]
1665 |
1666 | [[package]]
1667 | name = "windows_aarch64_gnullvm"
1668 | version = "0.42.0"
1669 | source = "registry+https://github.com/rust-lang/crates.io-index"
1670 | checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
1671 |
1672 | [[package]]
1673 | name = "windows_aarch64_msvc"
1674 | version = "0.36.1"
1675 | source = "registry+https://github.com/rust-lang/crates.io-index"
1676 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
1677 |
1678 | [[package]]
1679 | name = "windows_aarch64_msvc"
1680 | version = "0.42.0"
1681 | source = "registry+https://github.com/rust-lang/crates.io-index"
1682 | checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
1683 |
1684 | [[package]]
1685 | name = "windows_i686_gnu"
1686 | version = "0.36.1"
1687 | source = "registry+https://github.com/rust-lang/crates.io-index"
1688 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
1689 |
1690 | [[package]]
1691 | name = "windows_i686_gnu"
1692 | version = "0.42.0"
1693 | source = "registry+https://github.com/rust-lang/crates.io-index"
1694 | checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
1695 |
1696 | [[package]]
1697 | name = "windows_i686_msvc"
1698 | version = "0.36.1"
1699 | source = "registry+https://github.com/rust-lang/crates.io-index"
1700 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
1701 |
1702 | [[package]]
1703 | name = "windows_i686_msvc"
1704 | version = "0.42.0"
1705 | source = "registry+https://github.com/rust-lang/crates.io-index"
1706 | checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
1707 |
1708 | [[package]]
1709 | name = "windows_x86_64_gnu"
1710 | version = "0.36.1"
1711 | source = "registry+https://github.com/rust-lang/crates.io-index"
1712 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
1713 |
1714 | [[package]]
1715 | name = "windows_x86_64_gnu"
1716 | version = "0.42.0"
1717 | source = "registry+https://github.com/rust-lang/crates.io-index"
1718 | checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
1719 |
1720 | [[package]]
1721 | name = "windows_x86_64_gnullvm"
1722 | version = "0.42.0"
1723 | source = "registry+https://github.com/rust-lang/crates.io-index"
1724 | checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
1725 |
1726 | [[package]]
1727 | name = "windows_x86_64_msvc"
1728 | version = "0.36.1"
1729 | source = "registry+https://github.com/rust-lang/crates.io-index"
1730 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
1731 |
1732 | [[package]]
1733 | name = "windows_x86_64_msvc"
1734 | version = "0.42.0"
1735 | source = "registry+https://github.com/rust-lang/crates.io-index"
1736 | checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
1737 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "kami"
3 | author = "mrfluffy-dev"
4 | license = "GPL-3.0"
5 | version = "0.6.0"
6 | edition = "2021"
7 |
8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9 |
10 | [dependencies]
11 | regex = "1.5.6"
12 | colored = "2.0.0"
13 | isahc = "1.7.2"
14 | base64 = "0.13"
15 | termsize = "0.1.6"
16 | dirs = "4.0"
17 | serde_json = "1.0.83"
18 | tui = "0.18.0"
19 | crossterm = "0.24.0"
20 | unicode-width = "0.1.9"
21 | rust_cast = "0.17.0"
22 | viuer = { version = "0.6", features = ["sixel"] }
23 |
--------------------------------------------------------------------------------
/LICENSE.mb:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.org:
--------------------------------------------------------------------------------
1 | #+title: Readme
2 | #+OPTIONS: toc:2
3 | * Table of content
4 | 1. [[#IMPORTANT][IMPORTANT]]
5 | 2. [[#Why-use-kami][Why use kami]]
6 | 3. [[#Dependencies][Dependencies]]
7 | 4. [[#Install][Install]]
8 | - [[#LinuxMac][Linux/mac]]
9 | - [[#Windows][Windows]]
10 | 5. [[#Honorable-mentions][Honorable mentions]]
11 | * IMPORTANT
12 | remove all contents of ~$HOME/.config/kami/an_progress.json~ new version is not compatibal with old progress file.
13 | * Why use kami
14 | Well its a fast and easy way to watch anime and read light novels right in your terminal no need to open a browser.
15 | Also rust is fast as fuck boiiiii.
16 | It can keep your anime tracking up to date with anilist.
17 | * Dependencies
18 | 1. [[https://github.com/sharkdp/bat][bat]]
19 | 2. [[https://mpv.io/][mpv]]
20 | 3. [[https://git-scm.com/][gitbash]](if on windows)
21 | I will be explaining how to install them.
22 |
23 | * Install
24 | ** Linux/Mac
25 | 1. install bat and mpv with your package manager(homebrew if on mac)
26 | 2. Clone the repo for kami.
27 | #+begin_src shell
28 | git clone https://github.com/mrfluffy-dev/kami.git && cd kami
29 | #+end_src
30 | 4. install [[https://www.rust-lang.org/tools/install][Rust]]
31 | 5. Build kami using cargo.
32 | #+begin_src shell
33 | cargo build --release
34 | #+end_src
35 | 6. Copy kami to your path.
36 | #+begin_src shell
37 | cp target/release/kami /usr/local/bin/kami
38 | #+end_src
39 | ** Windows
40 | 1. install scoop
41 | #+begin_src shell
42 | Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
43 | irm get.scoop.sh | iex
44 | #+end_src
45 | 2. install git
46 | #+begin_src shell
47 | scoop install git
48 | #+end_src
49 | 1. install mpv
50 | #+begin_src shell
51 | scoop bucket add extras
52 | scoop install mpv
53 | #+end_src
54 | 2. install bat
55 | #+begin_src shell
56 | scoop install bat
57 | #+end_src
58 | 3. install [[https://www.rust-lang.org/tools/install][Rust]]
59 | 4. (Optional but I highly recommend it) adding bash to windows terminal.
60 | 1. install windows terminal from the Microsoft store.
61 | 2. open the terminal.
62 | 3. open settings.
63 | 4. click "Add a new profile"
64 | 5. click "New empty profile"
65 | 6. Click on "name" and rename it to "Git Bash"
66 | 7. Click on "Command line" and click "Browse..."
67 | 8. if you installed git using scoop then follow this(else the steps are mostly the same just a different path)
68 | navigate to ~C:\User\USERNAME\scoop\apps\git\2.37.1.windows.1\bin\bash.exe~
69 | Where USERNAME is your username
70 | note that the name ~2.37.1.windows.1~ might be slightly different on your system
71 | 9. click "Open"
72 | 10. Click "Starting directory" and uncheck "Use parent process directory"
73 | 11. Click "Save"
74 | 12. now you can open gitbash from windows terminal
75 | 5. Clone the repo for kami
76 | #+begin_src shell
77 | git clone https://github.com/mrfluffy-dev/kami.git && cd kami
78 | #+end_src
79 | 6. Build kami using cargo
80 | #+begin_src shell
81 | cargo build --release
82 | #+end_src
83 | 7. copy kami to path (for this to work, you need to use git bash and you need to run git bash in administrator mode0
84 | #+begin_src
85 | cp target/release/kami.exe /usr/bin/kami
86 | #+end_src
87 | 8. open kami by using ~kami~
88 | * Honorable mentions
89 | - [[https://github.com/pystardust/ani-cli][ani-cli]] Just a bunch of fucking nice people.
90 | - [[https://docs.rs/][rust docs]] Honestly its just so useful.
91 | - [[https://github.com/DemonKingSwarn/flix-cli][flix-cli]] For forcing me to make a release.
92 |
--------------------------------------------------------------------------------
/src/anime/anime.rs:
--------------------------------------------------------------------------------
1 | use crate::{
2 | get_an_history, get_an_progress, get_anime_id, get_user_anime_progress, update_anime_progress,
3 | write_an_progress,
4 | };
5 | use crate::{get_anime_link, get_animes, get_image};
6 | use crate::{open_cast, open_video};
7 |
8 | use crossterm::{
9 | event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
10 | execute,
11 | terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
12 | };
13 | use std::{error::Error, io};
14 | use tui::{
15 | backend::{Backend, CrosstermBackend},
16 | layout::{Constraint, Direction, Layout},
17 | style::{Color, Modifier, Style},
18 | text::{Span, Spans, Text},
19 | widgets::{Block, BorderType, Borders, List, ListItem, ListState, Paragraph},
20 | Frame, Terminal,
21 | };
22 | use unicode_width::UnicodeWidthStr;
23 | use viuer::{print_from_file, terminal_size, Config};
24 |
25 | use super::scraper::get_anime_info;
26 |
27 | enum InputMode {
28 | Normal,
29 | Editing,
30 | }
31 |
32 | struct StatefulList {
33 | state: ListState,
34 | items: Vec,
35 | }
36 |
37 | impl StatefulList {
38 | fn with_items(items: Vec) -> StatefulList {
39 | StatefulList {
40 | state: ListState::default(),
41 | items,
42 | }
43 | }
44 |
45 | fn next(&mut self) {
46 | let i = match self.state.selected() {
47 | Some(i) => {
48 | if i >= self.items.len() - 1 {
49 | 0
50 | } else {
51 | i + 1
52 | }
53 | }
54 | None => 0,
55 | };
56 | self.state.select(Some(i));
57 | }
58 |
59 | fn previous(&mut self) {
60 | let i = match self.state.selected() {
61 | Some(i) => {
62 | if i == 0 {
63 | self.items.len() - 1
64 | } else {
65 | i - 1
66 | }
67 | }
68 | None => 0,
69 | };
70 | self.state.select(Some(i));
71 | }
72 |
73 | fn unselect(&mut self) {
74 | self.state.select(None);
75 | }
76 | fn push(&mut self, item: T) {
77 | self.items.push(item);
78 | }
79 | fn iter(&self) -> impl Iterator {
80 | self.items.iter()
81 | }
82 | }
83 |
84 | struct App {
85 | /// Current value of the input box
86 | input: String,
87 | animes: (Vec, Vec, Vec),
88 | image: String,
89 | /// Current input mode
90 | input_mode: InputMode,
91 | /// History of recorded messages
92 | messages: StatefulList,
93 | title: String,
94 | link: String,
95 | ep: u64,
96 | progress: i32,
97 | anime_id: i32,
98 | token: String,
99 | provider: String,
100 | cast: (bool, String),
101 | }
102 |
103 | impl<'a> App {
104 | fn default() -> App {
105 | App {
106 | input: String::new(),
107 | animes: get_an_history(),
108 | image: String::new(),
109 | input_mode: InputMode::Normal,
110 | messages: StatefulList::with_items(Vec::new()),
111 | title: String::new(),
112 | link: String::new(),
113 | ep: 0,
114 | progress: 0,
115 | anime_id: 0,
116 | token: String::new(),
117 | provider: String::new(),
118 | cast: (false, "0".to_string()),
119 | }
120 | }
121 | }
122 |
123 | pub fn anime_ui(
124 | token: String,
125 | provider: String,
126 | cast: (bool, String),
127 | ) -> Result<(), Box> {
128 | // setup terminal
129 | enable_raw_mode()?;
130 | let mut stdout = io::stdout();
131 | execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
132 | let backend = CrosstermBackend::new(stdout);
133 | let mut terminal = Terminal::new(backend)?;
134 |
135 | // create app and run it
136 | let mut app = App::default();
137 | app.token = token;
138 | app.provider = provider;
139 | app.cast = cast;
140 | let res = run_app(&mut terminal, app);
141 |
142 | // restore terminal
143 | disable_raw_mode()?;
144 | execute!(
145 | terminal.backend_mut(),
146 | LeaveAlternateScreen,
147 | DisableMouseCapture
148 | )?;
149 | terminal.show_cursor()?;
150 |
151 | if let Err(err) = res {
152 | println!("{:?}", err)
153 | }
154 |
155 | Ok(())
156 | }
157 |
158 | fn run_app(terminal: &mut Terminal, mut app: App) -> io::Result<()> {
159 | let mut ep_select = false;
160 | fn change_image(app: &App) {
161 | //save as f32
162 | let (width, height) = terminal_size().to_owned();
163 | let width = width as f32;
164 | let height = height as f32;
165 | let sixel_support = viuer::is_sixel_supported();
166 | let config = match sixel_support {
167 | true => Config {
168 | x: ((width / 2.0) + 1.0).round() as u16,
169 | y: 2,
170 | width: Some((width / 1.3).round() as u32),
171 | height: Some((height * 1.5) as u32),
172 | restore_cursor: true,
173 | ..Default::default()
174 | },
175 | false => Config {
176 | x: ((width / 2.0) + 1.0).round() as u16,
177 | y: 2,
178 | width: Some(((width / 2.0) - 4.0).round() as u32),
179 | height: Some((height / 1.3).round() as u32),
180 | restore_cursor: true,
181 | ..Default::default()
182 | },
183 | };
184 |
185 | let config_path = dirs::config_dir().unwrap().join("kami");
186 | let image_path = config_path.join("tmp.jpg");
187 | get_image(&app.image, &image_path.to_str().unwrap());
188 | print_from_file(image_path, &config).expect("Image printing failed.");
189 | }
190 | app.messages.items.clear();
191 | for anime in &app.animes.1 {
192 | app.messages.push(anime.to_string());
193 | }
194 | app.input_mode = InputMode::Normal;
195 |
196 | loop {
197 | terminal.draw(|f| ui(f, &mut app))?;
198 |
199 | if let Event::Key(key) = event::read()? {
200 | match app.input_mode {
201 | InputMode::Normal => match key.code {
202 | KeyCode::Char('i') => {
203 | app.input_mode = InputMode::Editing;
204 | }
205 | KeyCode::Char('q') => {
206 | return Ok(());
207 | }
208 | KeyCode::Left => app.messages.unselect(),
209 | KeyCode::Char('h') => app.messages.unselect(),
210 | KeyCode::Down => match ep_select {
211 | true => {
212 | app.messages.next();
213 | }
214 | false => {
215 | app.messages.next();
216 | let selected = app.messages.state.selected();
217 | app.image = app.animes.2[selected.unwrap()].clone();
218 | change_image(&app);
219 | }
220 | },
221 | KeyCode::Char('j') => match ep_select {
222 | true => {
223 | app.messages.next();
224 | }
225 | false => {
226 | app.messages.next();
227 | let selected = app.messages.state.selected();
228 | app.image = app.animes.2[selected.unwrap()].clone();
229 | change_image(&app);
230 | }
231 | },
232 | KeyCode::Up => match ep_select {
233 | true => {
234 | app.messages.previous();
235 | }
236 | false => {
237 | app.messages.previous();
238 | let selected = app.messages.state.selected();
239 | app.image = app.animes.2[selected.unwrap()].clone();
240 | change_image(&app);
241 | }
242 | },
243 | KeyCode::Char('k') => match ep_select {
244 | true => {
245 | app.messages.previous();
246 | }
247 | false => {
248 | app.messages.previous();
249 | let selected = app.messages.state.selected();
250 | app.image = app.animes.2[selected.unwrap()].clone();
251 | change_image(&app);
252 | }
253 | },
254 | //if KeyCode::Enter => {
255 | KeyCode::Enter => {
256 | if ep_select == false {
257 | app.progress = 0;
258 | let selected = app.messages.state.selected();
259 | app.title = app.messages.items[selected.unwrap()].clone();
260 | app.link = app.animes.0[selected.unwrap()].clone();
261 | let anime_info = get_anime_info(&app.animes.0[selected.unwrap()]);
262 | app.anime_id = get_anime_id(anime_info.0);
263 | app.messages.items.clear();
264 | if app.token == "local" || app.anime_id == 0 {
265 | app.progress = get_an_progress(&app.title) as i32;
266 | app.messages.state.select(Some(app.progress as usize));
267 | } else {
268 | app.progress =
269 | get_user_anime_progress(app.anime_id, app.token.as_str());
270 | app.messages.state.select(Some(app.progress as usize));
271 | }
272 | if anime_info.1 == 1 {
273 | let link = get_anime_link(&app.link, 1);
274 | if !app.cast.0 {
275 | open_video((link, format!("{} Episode 1", &app.title)));
276 | } else {
277 | open_cast(
278 | (link, format!("{} Episode 1", &app.title)),
279 | &app.cast.1,
280 | )
281 | }
282 | let selected = app.messages.state.selected();
283 | let image_url = app.animes.2[selected.unwrap()].clone();
284 | if app.token == "local" || app.anime_id == 0 {
285 | write_an_progress((&app.title, &app.link, &image_url), &1);
286 | } else {
287 | update_anime_progress(app.anime_id, 1, app.token.as_str());
288 | write_an_progress((&app.title, &app.link, &image_url), &1);
289 | }
290 | } else {
291 | for ep in 1..anime_info.1 + 1 {
292 | app.messages.push(format!("Episode {}", ep));
293 | }
294 | ep_select = true;
295 | }
296 | } else {
297 | let selected = app.messages.state.selected();
298 | app.ep = app
299 | .messages
300 | .iter()
301 | .nth(selected.unwrap())
302 | .unwrap()
303 | .replace("Episode ", "")
304 | .parse::()
305 | .unwrap();
306 | let link = get_anime_link(&app.link, app.ep);
307 | if !app.cast.0 {
308 | open_video((link, format!("{} Episode {}", &app.title, app.ep)));
309 | } else {
310 | open_cast(
311 | (link, format!("{} Episode {}", &app.title, app.ep)),
312 | &app.cast.1,
313 | )
314 | }
315 | let image_url = &app.image;
316 | if app.ep > app.progress as u64 {
317 | if app.token == "local" || app.anime_id == 0 {
318 | write_an_progress((&app.title, &app.link, &image_url), &app.ep);
319 | } else {
320 | update_anime_progress(
321 | app.anime_id,
322 | app.ep as usize,
323 | app.token.as_str(),
324 | );
325 | write_an_progress((&app.title, &app.link, &image_url), &app.ep);
326 | }
327 | app.progress = app.ep as i32;
328 | }
329 | }
330 | }
331 | _ => {}
332 | },
333 | InputMode::Editing => match key.code {
334 | KeyCode::Enter => {
335 | //push app.input into app.messages with '
336 | app.animes = get_animes(app.input.drain(..).collect());
337 | app.messages.items.clear();
338 | for anime in &app.animes.1 {
339 | app.messages.push(anime.to_string());
340 | }
341 | ep_select = false;
342 | app.input_mode = InputMode::Normal;
343 | }
344 | KeyCode::Char(c) => {
345 | app.input.push(c);
346 | }
347 | KeyCode::Backspace => {
348 | app.input.pop();
349 | }
350 | KeyCode::Esc => {
351 | app.input_mode = InputMode::Normal;
352 | }
353 | _ => {}
354 | },
355 | }
356 | }
357 | }
358 | }
359 |
360 | fn ui(f: &mut Frame, app: &mut App) {
361 | let chunks = Layout::default()
362 | .direction(Direction::Vertical)
363 | .margin(1)
364 | .constraints(
365 | [
366 | Constraint::Min(1),
367 | Constraint::Length(1),
368 | Constraint::Length(3),
369 | ]
370 | .as_ref(),
371 | )
372 | .split(f.size());
373 |
374 | let block = Block::default()
375 | .borders(Borders::ALL)
376 | .title("kami")
377 | .border_type(BorderType::Rounded);
378 | f.render_widget(block, f.size());
379 |
380 | let top_chunks = Layout::default()
381 | .direction(Direction::Horizontal)
382 | .constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref())
383 | .split(chunks[0]);
384 |
385 | let (msg, style) = match app.input_mode {
386 | InputMode::Normal => (
387 | vec![
388 | Span::raw("Press "),
389 | Span::styled("q", Style::default().add_modifier(Modifier::BOLD)),
390 | Span::raw(" to exit, "),
391 | Span::styled("i", Style::default().add_modifier(Modifier::BOLD)),
392 | Span::raw(" to search."),
393 | ],
394 | Style::default().add_modifier(Modifier::RAPID_BLINK),
395 | ),
396 | InputMode::Editing => (
397 | vec![
398 | Span::raw("Press "),
399 | Span::styled("Esc", Style::default().add_modifier(Modifier::BOLD)),
400 | Span::raw(" to stop editing, "),
401 | Span::styled("Enter", Style::default().add_modifier(Modifier::BOLD)),
402 | Span::raw(" to select."),
403 | ],
404 | Style::default(),
405 | ),
406 | };
407 |
408 | let messages: Vec = app
409 | .messages
410 | .iter()
411 | .enumerate()
412 | .map(|(i, m)| {
413 | let content = vec![Spans::from(Span::raw(format!("{}: {}", i, m)))];
414 | ListItem::new(content)
415 | })
416 | .collect();
417 | let messages = List::new(messages)
418 | .block(
419 | Block::default()
420 | .borders(Borders::ALL)
421 | .title("list")
422 | .border_type(BorderType::Rounded),
423 | )
424 | .style(Style::default().fg(Color::White))
425 | .highlight_style(
426 | Style::default()
427 | .bg(Color::Rgb(183, 142, 241))
428 | .add_modifier(Modifier::BOLD),
429 | )
430 | .highlight_symbol(">>");
431 | f.render_stateful_widget(messages, top_chunks[0], &mut app.messages.state);
432 | let block = Block::default()
433 | .borders(Borders::ALL)
434 | .title("info")
435 | .border_type(BorderType::Rounded);
436 | f.render_widget(block, top_chunks[1]);
437 |
438 | let mut text = Text::from(Spans::from(msg));
439 | text.patch_style(style);
440 | let help_message = Paragraph::new(text);
441 | f.render_widget(help_message, chunks[1]);
442 |
443 | let input = Paragraph::new(app.input.as_ref())
444 | .style(match app.input_mode {
445 | InputMode::Normal => Style::default(),
446 | InputMode::Editing => Style::default().fg(Color::Rgb(183, 142, 241)),
447 | })
448 | .block(Block::default().borders(Borders::all()).title("Input"));
449 | f.render_widget(input, chunks[2]);
450 | match app.input_mode {
451 | InputMode::Normal =>
452 | // Hide the cursor. `Frame` does this by default, so we don't need to do anything here
453 | {}
454 |
455 | InputMode::Editing => {
456 | // Make the cursor visible and ask tui-rs to put it at the specified coordinates after rendering
457 | f.set_cursor(
458 | // Put cursor past the end of the input text
459 | chunks[2].x + app.input.width() as u16 + 1,
460 | // Move one line down, from the border to the input line
461 | chunks[2].y + 1,
462 | )
463 | }
464 | }
465 | }
466 |
--------------------------------------------------------------------------------
/src/anime/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod anime;
2 | pub mod player;
3 | pub mod scraper;
4 | pub mod trackers;
5 |
--------------------------------------------------------------------------------
/src/anime/player.rs:
--------------------------------------------------------------------------------
1 | extern crate rust_cast;
2 | use rust_cast::{
3 | channels::{
4 | media::{Media, StreamType},
5 | receiver::CastDeviceApp,
6 | },
7 | CastDevice,
8 | };
9 | use std::str::FromStr;
10 |
11 | pub fn open_video(link: (String, String)) {
12 | let title = link.1;
13 | let title = title.replace("-", " ");
14 | let arg: String = format!("--force-media-title={}", title);
15 | let _ = std::process::Command::new("mpv")
16 | .arg(link.0)
17 | .arg(arg)
18 | .output()
19 | .expect("failed to open mpv");
20 |
21 | // clear terminal
22 | }
23 |
24 | const DEFAULT_DESTINATION_ID: &str = "receiver-0";
25 | fn play_media(
26 | device: &CastDevice,
27 | app_to_run: &CastDeviceApp,
28 | media: String,
29 | media_type: String,
30 | media_stream_type: StreamType,
31 | ) {
32 | let app = device.receiver.launch_app(app_to_run).unwrap();
33 |
34 | device
35 | .connection
36 | .connect(app.transport_id.as_str())
37 | .unwrap();
38 |
39 | let _status = device
40 | .media
41 | .load(
42 | app.transport_id.as_str(),
43 | app.session_id.as_str(),
44 | &Media {
45 | content_id: media,
46 | content_type: media_type,
47 | stream_type: media_stream_type,
48 | duration: None,
49 | metadata: None,
50 | },
51 | )
52 | .unwrap();
53 | }
54 |
55 | pub fn open_cast(link: (String, String), ip: &str) {
56 | let cast_device = match CastDevice::connect_without_host_verification(ip, 8009) {
57 | Ok(cast_device) => cast_device,
58 | Err(err) => panic!("Could not establish connection with Cast Device: {:?}", err),
59 | };
60 |
61 | cast_device
62 | .connection
63 | .connect(DEFAULT_DESTINATION_ID.to_string())
64 | .unwrap();
65 | cast_device.heartbeat.ping().unwrap();
66 |
67 | // Play media and keep connection.
68 |
69 | let media_stream_type = match "none" {
70 | value @ "buffered" | value @ "live" | value @ "none" => {
71 | StreamType::from_str(value).unwrap()
72 | }
73 | _ => panic!("Unsupported stream type!"),
74 | };
75 | play_media(
76 | &cast_device,
77 | &CastDeviceApp::from_str("default").unwrap(),
78 | link.0.to_string(),
79 | "".to_string(),
80 | media_stream_type,
81 | );
82 | }
83 |
--------------------------------------------------------------------------------
/src/anime/scraper.rs:
--------------------------------------------------------------------------------
1 | use isahc::config::Configurable;
2 | use isahc::{ReadResponseExt, Request, RequestExt};
3 | use regex::Regex;
4 | use std::fs::File;
5 | use std::io::prelude::*;
6 |
7 | //use serde_json::json;
8 |
9 | pub fn get_anime_html(url: &str) -> String {
10 | let req = Request::builder()
11 | .uri(url)
12 | .redirect_policy(isahc::config::RedirectPolicy::Follow)
13 | .header(
14 | "user-agent",
15 | "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0",
16 | )
17 | .body(())
18 | .unwrap();
19 | req.send().unwrap().text().unwrap()
20 | }
21 |
22 | pub fn get_post(id: &str) -> String {
23 | let resp = Request::builder()
24 | .method("POST")
25 | .uri("https://yugenanime.ro/api/embed/")
26 | .header("x-requested-with", "XMLHttpRequest")
27 | .body(id)
28 | .unwrap()
29 | .send()
30 | .unwrap()
31 | .text();
32 | let resp: String = resp.as_ref().unwrap().to_string();
33 | resp
34 | }
35 |
36 | pub fn get_animes(query: String) -> (Vec, Vec, Vec) {
37 | let query = query.replace(" ", "+");
38 | let html = get_anime_html(&format!("https://yugenanime.ro/discover/?q={}", query));
39 | let re = Regex::new(r#"href="(/anime[^"]*)""#).unwrap();
40 | let mut animes_links = Vec::new();
41 | for cap in re.captures_iter(&html) {
42 | animes_links.push(cap[1].to_string());
43 | }
44 | let re = Regex::new(r#"/" title="([^"]*)""#).unwrap();
45 | let mut animes_names = Vec::new();
46 | for cap in re.captures_iter(&html) {
47 | animes_names.push(cap[1].to_string());
48 | }
49 | let re = Regex::new(r#"data-src="([^"]*)"#).unwrap();
50 | let mut animes_images = Vec::new();
51 | for cap in re.captures_iter(&html) {
52 | animes_images.push(cap[1].to_string());
53 | }
54 | (animes_links, animes_names, animes_images)
55 | }
56 |
57 | pub fn get_anime_info(url: &str) -> (i32, u16) {
58 | let url = format!("https://yugenanime.ro{}watch", url);
59 | let html = get_anime_html(&url);
60 | //print html and exit
61 | let re = Regex::new(r#""mal_id":(\d*)"#).unwrap();
62 | let mal_id = re.captures(&html).unwrap()[1].parse().unwrap();
63 | let re =
64 | Regex::new(r#"Episodes(\d*)"#)
65 | .unwrap();
66 | let episodes = re.captures(&html).unwrap()[1].parse().unwrap();
67 | (mal_id, episodes)
68 | }
69 |
70 | pub fn get_anime_link(url: &str, episode: u64) -> String {
71 | let url = &format!(
72 | "https://yugenanime.ro/watch{}{}/",
73 | url.replace("/anime", ""),
74 | episode
75 | );
76 | let html = get_anime_html(url);
77 | let re = Regex::new(r#"/e/([^/]*)"#).unwrap();
78 | let capture = re.captures(&html).unwrap();
79 | let id = &capture[1];
80 | let id = format!("id={}%3D&ac=0", id);
81 | let json = get_post(&id);
82 | let re = Regex::new(r#"hls": \["(.*)","#).unwrap();
83 | let capture = re.captures(&json).unwrap();
84 | let link = &capture[1];
85 | //return the link
86 | link.to_string()
87 | }
88 |
89 | pub fn get_image(url: &str, path: &str) {
90 | let url = url;
91 | let mut response = isahc::get(url).unwrap();
92 | let mut buffer = Vec::new();
93 | response.copy_to(&mut buffer).unwrap();
94 | let mut file = File::create(path).unwrap();
95 | file.write_all(&buffer).unwrap();
96 | }
97 |
--------------------------------------------------------------------------------
/src/anime/trackers.rs:
--------------------------------------------------------------------------------
1 | use crate::string_input;
2 | use isahc::{ReadResponseExt, Request, RequestExt};
3 | use serde_json::json;
4 | use std::fs;
5 |
6 | pub fn get_token() -> String {
7 | //if not on windows create folder ~/.config/kami
8 | let config_path = dirs::config_dir().unwrap().join("kami");
9 | if !config_path.exists() {
10 | fs::create_dir_all(&config_path).unwrap();
11 | }
12 | let token_path = config_path.join("token.txt");
13 | if !token_path.exists() {
14 | //create empty file
15 | fs::File::create(&token_path).unwrap();
16 | }
17 | //read token from file
18 | let token = fs::read_to_string(&token_path).unwrap();
19 | if token.is_empty() {
20 | //ask user if they want to add a token or track locally
21 | let input = string_input(
22 | "would you want to link anilist(sellecting no will track anime localy)? (y/n)",
23 | );
24 | if input == "y" {
25 | println!("please go to the below link and copy and past the token below");
26 | println!(
27 | "https://anilist.co/api/v2/oauth/authorize?client_id=9121&response_type=token"
28 | );
29 | let token = string_input("token: ");
30 | fs::write(&token_path, token).unwrap();
31 | } else if input == "n" {
32 | let token = "local";
33 | fs::write(&token_path, token).unwrap();
34 | } else {
35 | println!("invalid input");
36 | std::process::exit(1);
37 | }
38 | }
39 | let token = fs::read_to_string(&token_path).unwrap();
40 | token
41 | }
42 |
43 | pub fn get_anime_id(mal_id: i32) -> i32 {
44 | const QUERY: &str = "
45 | query ($id: Int, $search: Int) {
46 | Media (id: $id, idMal: $search, type: ANIME) {
47 | id
48 | title {
49 | native
50 | romaji
51 | english
52 | }
53 | }
54 | }
55 | ";
56 | let json = json!({
57 | "query": QUERY,
58 | "variables": {
59 | "search": mal_id
60 | }
61 | });
62 | let resp = Request::builder()
63 | .method("POST")
64 | .uri("https://graphql.anilist.co/")
65 | .header("Content-Type", "application/json")
66 | .header("Accept", "application/json")
67 | .body(json.to_string())
68 | .unwrap()
69 | .send()
70 | .unwrap()
71 | .text();
72 | let regex = regex::Regex::new(r#"id":(.*?),"#).unwrap();
73 | let resp: String = resp.as_ref().unwrap().to_string();
74 | //if error let id = 0
75 | let id = match regex.captures(&resp) {
76 | Some(captures) => captures[1].parse::().unwrap(),
77 | None => 0,
78 | };
79 |
80 | // let id = regex
81 | // .captures(&resp)
82 | // .unwrap()
83 | // .get(1)
84 | // .unwrap()
85 | // .as_str()
86 | // .parse::()
87 | // .unwrap();
88 | id
89 | }
90 |
91 | //get the user id from the token
92 | fn get_user_id(token: &str) -> i32 {
93 | const QUERY: &str = "query {
94 | Viewer {
95 | id
96 | }
97 | }";
98 | let json = json!({ "query": QUERY });
99 | let resp = Request::builder()
100 | .method("POST")
101 | .uri("https://graphql.anilist.co/")
102 | .header("Content-Type", "application/json")
103 | .header("Accept", "application/json")
104 | .header("Authorization", format!("Bearer {}", token))
105 | .body(json.to_string())
106 | .unwrap()
107 | .send()
108 | .unwrap()
109 | .text();
110 | //println!("{}", resp);
111 | let regex = regex::Regex::new(r#"id":(.*?)}"#).unwrap();
112 | let resp: String = resp.as_ref().unwrap().to_string();
113 | let id = regex
114 | .captures(&resp)
115 | .unwrap()
116 | .get(1)
117 | .unwrap()
118 | .as_str()
119 | .parse::()
120 | .unwrap();
121 | id
122 | }
123 |
124 | pub fn get_user_anime_progress(anime_id: i32, token: &str) -> i32 {
125 | let user_id = get_user_id(&token);
126 | const QUERY: &str = "query ($user_id: Int, $media_id: Int) {
127 | MediaList (userId: $user_id, mediaId: $media_id, type: ANIME) {
128 | progress
129 | }
130 | }";
131 | let json = json!({
132 | "query": QUERY,
133 | "variables": {
134 | "user_id": user_id,
135 | "media_id": anime_id,
136 | }
137 | });
138 | let resp = Request::builder()
139 | .method("POST")
140 | .uri("https://graphql.anilist.co/")
141 | .header("Content-Type", "application/json")
142 | .header("Accept", "application/json")
143 | .header("Authorization", format!("Bearer {}", token))
144 | .body(json.to_string())
145 | .unwrap()
146 | .send()
147 | .unwrap()
148 | .text();
149 | let regex = regex::Regex::new(r#"progress":(.*?)}"#).unwrap();
150 | let resp: String = resp.as_ref().unwrap().to_string();
151 | if resp.contains("errors") {
152 | 0
153 | } else {
154 | let progress = regex
155 | .captures(&resp)
156 | .unwrap()
157 | .get(1)
158 | .unwrap()
159 | .as_str()
160 | .parse::()
161 | .unwrap();
162 | progress
163 | }
164 | }
165 |
166 | pub fn update_anime_progress(anime_id: i32, progress: usize, token: &str) {
167 | const UPDATE: &str = "
168 | mutation ($mediaId: Int, $status: MediaListStatus, $progress: Int) {
169 | SaveMediaListEntry (mediaId: $mediaId, status: $status, progress: $progress) {
170 | id
171 | status
172 | progress
173 | }
174 | }
175 | ";
176 | let json = json!({
177 | "query": UPDATE,
178 | "variables": {
179 | "mediaId": anime_id,
180 | "status": "CURRENT",
181 | "progress": progress
182 | }
183 | });
184 | let _resp = Request::builder()
185 | .method("POST")
186 | .uri("https://graphql.anilist.co/")
187 | .header("Content-Type", "application/json")
188 | .header("Accept", "application/json")
189 | .header("Authorization", format!("Bearer {}", token))
190 | .body(json.to_string())
191 | .unwrap()
192 | .send()
193 | .unwrap()
194 | .text();
195 | }
196 |
197 | // local tracking
198 | pub fn get_an_json() -> serde_json::Value {
199 | let config_path = dirs::config_dir().unwrap().join("kami");
200 | if !config_path.exists() {
201 | fs::create_dir_all(&config_path).unwrap();
202 | }
203 | let json_path = config_path.join("an_progress.json");
204 | if !json_path.exists() {
205 | fs::File::create(&json_path).unwrap();
206 | }
207 | let json = fs::read_to_string(&json_path).unwrap();
208 | let json: serde_json::Value = serde_json::from_str(&json).unwrap_or(serde_json::Value::Null);
209 | json
210 | }
211 |
212 | pub fn write_an_progress(anime: (&str, &str, &str), progress: &u64) {
213 | let config_path = dirs::config_dir().unwrap().join("kami");
214 | let json_path = config_path.join("an_progress.json");
215 | let json = fs::read_to_string(&json_path).unwrap();
216 | let mut json: serde_json::Value =
217 | serde_json::from_str(&json).unwrap_or(serde_json::Value::Null);
218 | let mut title_json = serde_json::Map::new();
219 | title_json.insert(
220 | "progress".to_string(),
221 | serde_json::Value::from(progress.clone()),
222 | );
223 | title_json.insert("link".to_string(), serde_json::Value::from(anime.1));
224 | title_json.insert("image".to_string(), serde_json::Value::from(anime.2));
225 | title_json.insert(
226 | "updated".to_string(),
227 | serde_json::Value::from(
228 | std::time::SystemTime::now()
229 | .duration_since(std::time::UNIX_EPOCH)
230 | .unwrap()
231 | .as_secs(),
232 | ),
233 | );
234 | //insert title_json into json
235 | if json[anime.0].is_null() {
236 | json[anime.0] = serde_json::Value::from(title_json);
237 | } else {
238 | json[anime.0]["progress"] = serde_json::Value::from(progress.clone());
239 | json[anime.0]["link"] = serde_json::Value::from(anime.1);
240 | json[anime.0]["image"] = serde_json::Value::from(anime.2);
241 | json[anime.0]["updated"] = serde_json::Value::from(
242 | std::time::SystemTime::now()
243 | .duration_since(std::time::UNIX_EPOCH)
244 | .unwrap()
245 | .as_secs(),
246 | );
247 | }
248 | let json = serde_json::to_string_pretty(&json).unwrap();
249 | fs::write(&json_path, json).unwrap();
250 | }
251 |
252 | pub fn get_an_history() -> (Vec, Vec, Vec) {
253 | //get the titles, links, and images from the json
254 | let json = get_an_json();
255 | let mut titles = vec![];
256 | let mut links = vec![];
257 | let mut images = vec![];
258 | let mut last_updated = vec![];
259 | //if the json is empty, return empty vectors
260 | if json.is_null() {
261 | return (titles, links, images);
262 | }
263 | for (key, value) in json.as_object().unwrap() {
264 | titles.push(key.to_string());
265 | links.push(value["link"].as_str().unwrap().to_string());
266 | images.push(value["image"].as_str().unwrap().to_string());
267 | last_updated.push(value["updated"].as_u64().unwrap());
268 | }
269 | let mut indices: Vec = (0..last_updated.len()).collect();
270 | indices.sort_by(|&a, &b| last_updated[b].cmp(&last_updated[a]));
271 | titles = indices.iter().map(|&i| titles[i].clone()).collect();
272 | links = indices.iter().map(|&i| links[i].clone()).collect();
273 | images = indices.iter().map(|&i| images[i].clone()).collect();
274 | (links, titles, images)
275 | }
276 |
277 | pub fn get_an_progress(title: &str) -> i32 {
278 | let json = get_an_json();
279 | let selected = json[title]["progress"].as_u64().unwrap_or(0);
280 | selected as i32
281 | }
282 |
--------------------------------------------------------------------------------
/src/helpers/fixing_text.rs:
--------------------------------------------------------------------------------
1 | use regex::Regex;
2 |
3 | //function that takes a vector called ln_chapters of strings and removes everyting after the first occurence of "-" and all \ and "
4 | pub fn remove_after_dash(ln_chapters: &Vec) -> Vec {
5 | let mut ln_chapters_new: Vec = Vec::new();
6 | let re = Regex::new(r#"\\"(.*?) -"#).unwrap();
7 | for ln in ln_chapters {
8 | for cap in re.captures_iter(ln) {
9 | ln_chapters_new.push(cap.get(1).unwrap().as_str().trim().to_string());
10 | }
11 | }
12 | ln_chapters_new = replace_unicode(&ln_chapters_new);
13 | ln_chapters_new
14 | }
15 |
16 | //function that takes a vector called ln_chapters and looks for unicode characters and replaces them with the ascii version
17 | pub fn replace_unicode(ln_chapters: &Vec) -> Vec {
18 | let mut ln_chapters_new: Vec = Vec::new();
19 | for ln in ln_chapters {
20 | //make regex to find all \uxxxx and save it in to a vector
21 | let re = Regex::new(r#"(\\u[0-9a-fA-F]{4})"#).unwrap();
22 | let mut vec_unicode: Vec = Vec::new();
23 | for cap in re.captures_iter(ln) {
24 | vec_unicode.push(cap.get(1).unwrap().as_str().to_string());
25 | }
26 | let mut ln_new: String = String::new();
27 | if !vec_unicode.is_empty() {
28 | //loop through the vector and replace the unicode characters with the ascii version
29 | for unicode in vec_unicode {
30 | //convert the unicode to char
31 | let unicode_char =
32 | char::from_u32(u32::from_str_radix(&unicode[2..6], 16).unwrap()).unwrap();
33 | let unicode_str = unicode_char as char;
34 | ln_new = ln.replace(&unicode, &unicode_str.to_string());
35 | }
36 | } else {
37 | ln_new = ln.to_string();
38 | }
39 | ln_chapters_new.push(ln_new);
40 | }
41 | ln_chapters_new
42 | }
43 |
44 | pub fn fix_html_encoding(ln_text: &Vec) -> Vec {
45 | let mut ln_text_new: Vec = Vec::new();
46 | for ln in ln_text {
47 | let ln = ln.replace("―", "--");
48 | let ln = ln.replace("‖", "--");
49 | let ln = ln.replace("‘", "'");
50 | let ln = ln.replace("’", "'");
51 | let ln = ln.replace("“", "\"");
52 | let ln = ln.replace("”", "\"");
53 | let ln = ln.replace("…", "...");
54 | let ln = ln.replace("′", "'");
55 | let ln = ln.replace("″", "\"");
56 | let ln = ln.replace("⁄", "--");
57 | let ln = ln.replace("—", "--");
58 | ln_text_new.push(ln);
59 | }
60 | ln_text_new
61 | }
62 |
--------------------------------------------------------------------------------
/src/helpers/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod fixing_text;
2 | pub mod take_input;
3 |
--------------------------------------------------------------------------------
/src/helpers/take_input.rs:
--------------------------------------------------------------------------------
1 | use std::io::{self, Write};
2 | pub fn string_input(prompt: &str) -> String {
3 | print!("{}", prompt);
4 | let mut input = String::new();
5 | let _ = io::stdout().flush();
6 | io::stdin()
7 | .read_line(&mut input)
8 | .expect("Error reading from STDIN");
9 | input.trim().to_string()
10 | }
11 |
12 | pub fn int_input(prompt: &str) -> usize {
13 | print!("{}", prompt);
14 | let mut input = String::new();
15 | let _ = io::stdout().flush();
16 | io::stdin()
17 | .read_line(&mut input)
18 | .expect("Error reading from STDIN");
19 | //try to parse the input as usize else return max usize
20 | match input.trim().parse::() {
21 | Ok(i) => i,
22 | Err(_) => {
23 | usize::max_value()
24 | }
25 | }
26 | }
27 |
28 | //pub fn u16_input(prompt: &str) -> u16 {
29 | // print!("{}", prompt);
30 | // let mut input = String::new();
31 | // let _ = io::stdout().flush();
32 | // io::stdin()
33 | // .read_line(&mut input)
34 | // .expect("Error reading from STDIN");
35 | // input.trim().parse::().unwrap()
36 | //}
37 |
--------------------------------------------------------------------------------
/src/ln/ln.rs:
--------------------------------------------------------------------------------
1 | use crate::ln::open_text::{open_bat, open_glow};
2 | use crate::ln::scraper::*;
3 | use crate::ln::tracker::*;
4 | use crossterm::{
5 | event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
6 | execute,
7 | terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
8 | };
9 | use std::fs::File;
10 | use std::io::Write;
11 | use std::{error::Error, io};
12 | use tui::{
13 | backend::{Backend, CrosstermBackend},
14 | layout::{Constraint, Direction, Layout},
15 | style::{Color, Modifier, Style},
16 | text::{Span, Spans, Text},
17 | widgets::{Block, BorderType, Borders, List, ListItem, ListState, Paragraph},
18 | Frame, Terminal,
19 | };
20 | use unicode_width::UnicodeWidthStr;
21 |
22 | enum InputMode {
23 | Normal,
24 | Editing,
25 | }
26 |
27 | struct StatefulList {
28 | state: ListState,
29 | items: Vec,
30 | }
31 |
32 | impl StatefulList {
33 | fn with_items(items: Vec) -> StatefulList {
34 | StatefulList {
35 | state: ListState::default(),
36 | items,
37 | }
38 | }
39 |
40 | fn next(&mut self) {
41 | let i = match self.state.selected() {
42 | Some(i) => {
43 | if i >= self.items.len() - 1 {
44 | 0
45 | } else {
46 | i + 1
47 | }
48 | }
49 | None => 0,
50 | };
51 | self.state.select(Some(i));
52 | }
53 |
54 | fn previous(&mut self) {
55 | let i = match self.state.selected() {
56 | Some(i) => {
57 | if i == 0 {
58 | self.items.len() - 1
59 | } else {
60 | i - 1
61 | }
62 | }
63 | None => 0,
64 | };
65 | self.state.select(Some(i));
66 | }
67 |
68 | fn unselect(&mut self) {
69 | self.state.select(None);
70 | }
71 | fn push(&mut self, item: T) {
72 | self.items.push(item);
73 | }
74 | fn iter(&self) -> impl Iterator {
75 | self.items.iter()
76 | }
77 | }
78 |
79 | struct App {
80 | /// Current value of the input box
81 | input: String,
82 | /// Current input mode
83 | input_mode: InputMode,
84 | /// History of recorded messages
85 | messages: StatefulList,
86 | ln_titles: Vec,
87 | ln_links: Vec,
88 | title: String,
89 | ln_id: String,
90 | ln_chapters: Vec,
91 | ln_chapters_links: Vec,
92 | last_page: String,
93 | current_page: String,
94 | current_page_number: u32,
95 | }
96 |
97 | impl<'a> App {
98 | fn default() -> App {
99 | App {
100 | input: String::new(),
101 | input_mode: InputMode::Normal,
102 | messages: StatefulList::with_items(Vec::new()),
103 | ln_titles: Vec::new(),
104 | ln_links: Vec::new(),
105 | title: String::new(),
106 | ln_id: String::new(),
107 | ln_chapters: Vec::new(),
108 | ln_chapters_links: Vec::new(),
109 | last_page: String::new(),
110 | current_page: String::new(),
111 | current_page_number: 0,
112 | }
113 | }
114 | }
115 |
116 | pub fn ln_ui(chapter: u32, reader: String) -> Result<(), Box> {
117 | // setup terminal
118 | let _ = get_ln_json();
119 | enable_raw_mode()?;
120 | let mut stdout = io::stdout();
121 | execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
122 | let backend = CrosstermBackend::new(stdout);
123 | let mut terminal = Terminal::new(backend)?;
124 |
125 | // create app and run it
126 | let mut app = App::default();
127 | let chapter = chapter as f64;
128 | app.current_page_number = 1;
129 | if chapter != 0.0 {
130 | app.current_page_number = (chapter / 48.0).ceil() as u32;
131 | }
132 |
133 | let res = run_app(&mut terminal, app, &*reader);
134 |
135 | // restore terminal
136 | disable_raw_mode()?;
137 | execute!(
138 | terminal.backend_mut(),
139 | LeaveAlternateScreen,
140 | DisableMouseCapture
141 | )?;
142 | terminal.show_cursor()?;
143 |
144 | if let Err(err) = res {
145 | println!("{:?}", err)
146 | }
147 |
148 | Ok(())
149 | }
150 |
151 | fn run_app(terminal: &mut Terminal, mut app: App, reader: &str) -> io::Result<()> {
152 | let mut chapter_select = false;
153 |
154 | loop {
155 | terminal.draw(|f| ui(f, &mut app))?;
156 | if let Event::Key(key) = event::read()? {
157 | match app.input_mode {
158 | InputMode::Normal => match key.code {
159 | KeyCode::Char('i') => {
160 | app.input_mode = InputMode::Editing;
161 | }
162 | KeyCode::Char('q') => {
163 | terminal.clear()?;
164 | return Ok(());
165 | }
166 | KeyCode::Left => app.messages.unselect(),
167 | KeyCode::Char('h') => {
168 | if app.current_page_number > 0 {
169 | app.current_page_number -= 1;
170 | }
171 | app.current_page = get_ln_next_page(&app.ln_id, &app.current_page_number);
172 | app.ln_chapters = get_ln_chapters(&app.current_page);
173 | app.ln_chapters_links = get_ln_chapters_urls(&app.current_page);
174 | app.messages.items.clear();
175 | for chapter in app.ln_chapters.iter() {
176 | app.messages.push(chapter.to_string());
177 | }
178 | }
179 |
180 | KeyCode::Down => app.messages.next(),
181 | KeyCode::Char('j') => app.messages.next(),
182 | KeyCode::Up => app.messages.previous(),
183 | KeyCode::Char('k') => app.messages.previous(),
184 | KeyCode::Char('l') => {
185 | if app.current_page_number < app.last_page.parse::().unwrap() {
186 | app.current_page_number += 1;
187 | }
188 | app.current_page = get_ln_next_page(&app.ln_id, &app.current_page_number);
189 | app.ln_chapters = get_ln_chapters(&app.current_page);
190 | app.ln_chapters_links = get_ln_chapters_urls(&app.current_page);
191 | app.messages.items.clear();
192 | for chapter in app.ln_chapters.iter() {
193 | app.messages.push(chapter.to_string());
194 | }
195 | }
196 | //if KeyCode::Enter => {
197 | KeyCode::Enter => {
198 | if chapter_select == false {
199 | let selected = app.messages.state.selected();
200 | app.title = app
201 | .messages
202 | .iter()
203 | .nth(selected.unwrap())
204 | .unwrap()
205 | .to_string();
206 | if app.current_page_number == 1 {
207 | let progress = get_ln_progress(&app.title);
208 | app.current_page_number = progress.0;
209 | app.messages.state.select(Some(progress.1));
210 | }
211 | let link = app.ln_links[selected.unwrap()].to_string();
212 | let html = get_html(&link);
213 | app.ln_id = get_ln_id(&html).to_string();
214 | app.last_page = get_ln_last_page(&html);
215 | app.current_page =
216 | get_ln_next_page(&app.ln_id.to_string(), &app.current_page_number);
217 | app.ln_chapters = get_ln_chapters(&app.current_page);
218 | app.ln_chapters_links = get_ln_chapters_urls(&app.current_page);
219 | app.messages.items.clear();
220 | for chapter in app.ln_chapters.iter() {
221 | app.messages.push(chapter.to_string());
222 | }
223 | chapter_select = true;
224 | } else {
225 | let selected = app.messages.state.selected();
226 | let chapter_url = app.ln_chapters_links[selected.unwrap()].to_string();
227 | let full_text = get_full_text(&chapter_url);
228 | if cfg!(target_os = "windows") {
229 | use dirs::home_dir;
230 | let mut home = format!("{:?}", home_dir()).replace("\\\\", "/");
231 | home.drain(0..6);
232 | home.drain(home.len() - 2..home.len());
233 | let mut file =
234 | File::create(format!("{}/AppData/Roaming/log_e", home))
235 | .expect("Unable to create file");
236 | file.write_all(full_text.as_bytes())
237 | .expect("Unable to write to file");
238 | file.sync_all().expect("Unable to sync file");
239 | } else {
240 | let mut file =
241 | File::create("/tmp/log_e").expect("Unable to create file");
242 | file.write_all(full_text.as_bytes())
243 | .expect("Unable to write to file");
244 | file.sync_all().expect("Unable to sync file");
245 | };
246 | terminal.clear()?;
247 | let _ = match reader {
248 | "bat" => open_bat(),
249 | "glow" => open_glow(),
250 | &_ => todo!(),
251 | };
252 | write_ln_progress(
253 | &app.title,
254 | &app.current_page_number,
255 | &app.messages.state.selected().unwrap(),
256 | );
257 | terminal.clear()?;
258 | }
259 | }
260 | _ => {}
261 | },
262 | InputMode::Editing => match key.code {
263 | KeyCode::Enter => {
264 | //push app.input into app.messages with '1
265 | let search: String = app.input.drain(..).collect();
266 | let search = search.replace(" ", "+");
267 | let url = "https://readlightnovels.net/?s=".to_string();
268 | let url = format!("{}{}", url, search.trim()).trim().to_string();
269 | let html = get_html(&url);
270 | let ln_list = get_ln_list(html.as_str());
271 | app.ln_titles = get_ln_titles(&ln_list);
272 | app.ln_links = get_ln_urls(&ln_list);
273 | app.messages.items.clear();
274 | //remove index 0 of app.ln_titles and app.ln_links
275 | app.ln_titles.remove(0);
276 | app.ln_links.remove(0);
277 | for ln in &app.ln_titles {
278 | app.messages.push(ln.to_string());
279 | }
280 | chapter_select = false;
281 | app.input_mode = InputMode::Normal;
282 | }
283 | KeyCode::Char(c) => {
284 | app.input.push(c);
285 | }
286 | KeyCode::Backspace => {
287 | app.input.pop();
288 | }
289 | KeyCode::Esc => {
290 | app.input_mode = InputMode::Normal;
291 | }
292 | _ => {}
293 | },
294 | }
295 | }
296 | }
297 | }
298 |
299 | fn ui(f: &mut Frame, app: &mut App) {
300 | let chunks = Layout::default()
301 | .direction(Direction::Vertical)
302 | .margin(1)
303 | .constraints(
304 | [
305 | Constraint::Min(1),
306 | Constraint::Length(1),
307 | Constraint::Length(3),
308 | ]
309 | .as_ref(),
310 | )
311 | .split(f.size());
312 | let block = Block::default()
313 | .borders(Borders::ALL)
314 | .title("kami")
315 | .border_type(BorderType::Rounded);
316 | f.render_widget(block, f.size());
317 |
318 | let (msg, style) = match app.input_mode {
319 | InputMode::Normal => (
320 | vec![
321 | Span::raw("Press "),
322 | Span::styled("q", Style::default().add_modifier(Modifier::BOLD)),
323 | Span::raw(" to exit, "),
324 | Span::styled("i", Style::default().add_modifier(Modifier::BOLD)),
325 | Span::raw(" to search, "),
326 | Span::styled("h", Style::default().add_modifier(Modifier::BOLD)),
327 | Span::raw(" to go to the previous page, "),
328 | Span::styled("l", Style::default().add_modifier(Modifier::BOLD)),
329 | Span::raw(" to go to the next page."),
330 | ],
331 | Style::default().add_modifier(Modifier::RAPID_BLINK),
332 | ),
333 | InputMode::Editing => (
334 | vec![
335 | Span::raw("Press "),
336 | Span::styled("Esc", Style::default().add_modifier(Modifier::BOLD)),
337 | Span::raw(" to stop editing, "),
338 | Span::styled("Enter", Style::default().add_modifier(Modifier::BOLD)),
339 | Span::raw(" to select."),
340 | ],
341 | Style::default(),
342 | ),
343 | };
344 |
345 | let messages: Vec = app
346 | .messages
347 | .iter()
348 | .enumerate()
349 | .map(|(i, m)| {
350 | let content = vec![Spans::from(Span::raw(format!("{}: {}", i, m)))];
351 | ListItem::new(content)
352 | })
353 | .collect();
354 | let messages = List::new(messages)
355 | .block(Block::default().borders(Borders::ALL).title("list"))
356 | .style(Style::default().fg(Color::White))
357 | .highlight_style(
358 | Style::default()
359 | .bg(Color::Rgb(183, 142, 241))
360 | .add_modifier(Modifier::BOLD),
361 | )
362 | .highlight_symbol(">>");
363 | f.render_stateful_widget(messages, chunks[0], &mut app.messages.state);
364 |
365 | let mut text = Text::from(Spans::from(msg));
366 | text.patch_style(style);
367 | let help_message = Paragraph::new(text);
368 | f.render_widget(help_message, chunks[1]);
369 |
370 | let input = Paragraph::new(app.input.as_ref())
371 | .style(match app.input_mode {
372 | InputMode::Normal => Style::default(),
373 | InputMode::Editing => Style::default().fg(Color::Rgb(183, 142, 241)),
374 | })
375 | .block(Block::default().borders(Borders::all()).title("Input"));
376 | f.render_widget(input, chunks[2]);
377 | match app.input_mode {
378 | InputMode::Normal =>
379 | // Hide the cursor. `Frame` does this by default, so we don't need to do anything here
380 | {}
381 |
382 | InputMode::Editing => {
383 | // Make the cursor visible and ask tui-rs to put it at the specified coordinates after rendering
384 | f.set_cursor(
385 | // Put cursor past the end of the input text
386 | chunks[2].x + app.input.width() as u16 + 1,
387 | // Move one line down, from the border to the input line
388 | chunks[2].y + 1,
389 | )
390 | }
391 | }
392 | }
393 |
--------------------------------------------------------------------------------
/src/ln/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod ln;
2 | pub mod open_text;
3 | pub mod scraper;
4 | pub mod tracker;
5 |
--------------------------------------------------------------------------------
/src/ln/open_text.rs:
--------------------------------------------------------------------------------
1 | use std::io::Result;
2 | use std::process::{Command, ExitStatus, Stdio};
3 |
4 | #[allow(unused_assignments)]
5 | pub fn open_bat() -> Result {
6 | let termsize::Size { rows: _, cols } = termsize::get().unwrap();
7 | let mut path = String::new();
8 | if cfg!(target_os = "windows") {
9 | use dirs::home_dir;
10 | let mut home = format!("{:?}", home_dir()).replace("\\\\", "/");
11 | home.drain(0..6);
12 | home.drain(home.len() - 2..home.len());
13 | path = format!("{}/AppData/Roaming/log_e", home).to_string();
14 | } else {
15 | path = "/tmp/log_e".to_string();
16 | }
17 |
18 | let soft_wrap = match Command::new("fold")
19 | .arg("-s")
20 | .arg("-w")
21 | .arg((cols - 9).to_string())
22 | .arg(path)
23 | .stdout(Stdio::piped())
24 | .spawn()
25 | {
26 | Err(why) => panic!("couldn't spawn wc: {}", why),
27 | Ok(soft_wrap) => soft_wrap,
28 | };
29 |
30 | Command::new("bat")
31 | .arg("--paging")
32 | .arg("always")
33 | .arg("-l")
34 | .arg("markdown")
35 | .stdin(soft_wrap.stdout.unwrap())
36 | .spawn()?
37 | .wait()
38 | }
39 |
40 | #[allow(unused_assignments)]
41 | pub fn open_glow() -> Result {
42 | let termsize::Size { rows: _, cols } = termsize::get().unwrap();
43 | let mut path = String::new();
44 | if cfg!(target_os = "windows") {
45 | use dirs::home_dir;
46 | let mut home = format!("{:?}", home_dir()).replace("\\\\", "/");
47 | home.drain(0..6);
48 | home.drain(home.len() - 2..home.len());
49 | path = format!("{}/AppData/Roaming/log_e", home).to_string();
50 | } else {
51 | path = "/tmp/log_e".to_string();
52 | }
53 |
54 | let soft_wrap = match Command::new("fold")
55 | .arg("-s")
56 | .arg("-w")
57 | .arg((cols - 9).to_string())
58 | .arg(path)
59 | .stdout(Stdio::piped())
60 | .spawn()
61 | {
62 | Err(why) => panic!("couldn't spawn wc: {}", why),
63 | Ok(soft_wrap) => soft_wrap,
64 | };
65 |
66 | Command::new("glow")
67 | .arg("-p")
68 | .stdin(soft_wrap.stdout.unwrap())
69 | .spawn()?
70 | .wait()
71 | }
72 |
--------------------------------------------------------------------------------
/src/ln/scraper.rs:
--------------------------------------------------------------------------------
1 | use isahc::config::Configurable;
2 | use isahc::{ReadResponseExt, Request, RequestExt};
3 | use regex::Regex;
4 |
5 | use crate::helpers::fixing_text::remove_after_dash;
6 |
7 | use crate::helpers::fixing_text::fix_html_encoding;
8 |
9 | //gets the full html of the page
10 | pub fn get_html(url: &str) -> String {
11 | let req = Request::builder()
12 | .uri(url)
13 | .redirect_policy(isahc::config::RedirectPolicy::Follow)
14 | .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36")
15 | .body(())
16 | .unwrap();
17 | let mut res = req.send().unwrap();
18 | let html = res.text().unwrap();
19 | html
20 | }
21 |
22 | //using isahc::prelude::* make a php reqest to get the next page of the ln
23 | pub fn get_ln_next_page(ln_id: &str, page: &u32) -> String {
24 | let url = "https://readlightnovels.net/wp-admin/admin-ajax.php".to_string();
25 | let form = format!(
26 | "action=tw_ajax&type=pagination&id={}.html&page={}",
27 | ln_id, page
28 | );
29 | //let mut resp = isahc::post(&url,form).unwrap();
30 | let req = Request::builder()
31 | .method("POST")
32 | .uri(url)
33 | .redirect_policy(isahc::config::RedirectPolicy::Follow)
34 | .header(
35 | "user-agent",
36 | "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0",
37 | )
38 | .body(form)
39 | .unwrap();
40 | let resp = req.send().unwrap().text().unwrap();
41 | resp
42 | }
43 |
44 | pub fn get_full_text(chapter_url: &str) -> String {
45 | let ln_text = get_ln_text(chapter_url);
46 | let mut full_text: String = String::new();
47 | for line in ln_text {
48 | let text = format!("{}\n\n", line);
49 | full_text.push_str(&text);
50 | }
51 | full_text
52 | }
53 |
54 | //gets the chapter urls from the html and returns it as a vector of the chapter's href
55 | pub fn get_ln_chapters_urls(html: &str) -> Vec {
56 | let re = Regex::new(r#"href=\\"(h.*?)""#).unwrap();
57 | let mut ln_list: Vec = Vec::new();
58 | for cap in re.captures_iter(html) {
59 | ln_list.push(cap.get(1).unwrap().as_str().trim().to_string());
60 | }
61 | ln_list = url_clean(&ln_list);
62 | ln_list
63 | } // take a vector of srings called ln_chapters_url and remove all the \
64 |
65 | pub fn url_clean(ln_chapters_url: &Vec) -> Vec {
66 | let mut ln_chapters_url_new: Vec = Vec::new();
67 | for ln in ln_chapters_url {
68 | let ln = ln.replace('\\', "");
69 | ln_chapters_url_new.push(ln);
70 | }
71 | ln_chapters_url_new
72 | }
73 |
74 | //take a html string and return the ln id
75 | pub fn get_ln_last_page(html: &str) -> String {
76 | let re =
77 | Regex::new(r#"(?m)Last"#).unwrap();
78 | let mut ln_last_page: String = String::new();
79 | for cap in re.captures_iter(html) {
80 | ln_last_page = cap.get(1).unwrap().as_str().to_string();
81 | }
82 | ln_last_page
83 | }
84 |
85 | //take a html string and return the ln id
86 | pub fn get_ln_id(html: &str) -> String {
87 | let re = Regex::new(r#"(?m)^\s*"#).unwrap();
88 | let mut ln_id: String = String::new();
89 | for cap in re.captures_iter(html) {
90 | ln_id = cap.get(1).unwrap().as_str().to_string();
91 | }
92 | ln_id
93 | }
94 |
95 | pub fn get_ln_text(chapter_url: &str) -> Vec {
96 | let mut resp = isahc::get(chapter_url).unwrap();
97 | let html = resp.text().unwrap();
98 | let re = Regex::new(r#"(?m)