Compare commits

..

45 Commits
0.0.0 ... main

Author SHA1 Message Date
Bel LaPointe 6095fd69fc 0.1.6 release 2023-12-28 22:20:22 -05:00
Bel LaPointe 8f1c0876c5 for highlighted spans, add a fat green border 2023-12-28 22:19:59 -05:00
Bel LaPointe 6e2cf357f4 0.1.5 release 2023-12-28 22:17:36 -05:00
Bel LaPointe 4aede62dbb lint 2023-12-28 22:17:21 -05:00
Bel LaPointe c3d6cd1545 menu causes crashes so skip it 2023-12-28 22:16:16 -05:00
Bel LaPointe bf7d09dde0 0.1.4 release 2023-12-28 22:08:55 -05:00
Bel LaPointe d13266dd73 while processing, make the whole app look non-interactive 2023-12-28 22:08:29 -05:00
Bel LaPointe ccc4d7fbd2 dont make trivial splits 2023-12-28 21:58:49 -05:00
Bel LaPointe 48961fee2a pretty print timestamps 2023-12-28 21:57:05 -05:00
Bel LaPointe dfbdba81a6 reset statefuls on file change 2023-12-28 21:56:57 -05:00
Bel LaPointe a38e39b808 add cmd-q 2023-12-28 21:38:36 -05:00
Bel LaPointe 9e053c96d6 release 0.1.3 2023-12-28 21:33:42 -05:00
Bel LaPointe 10ef89f0e9 dx bundle --release --platform x86_64-apple-darwin 2023-12-28 21:33:03 -05:00
Bel LaPointe 32a652519a statuses per-event because scrolling stinks 2023-12-28 21:20:27 -05:00
Bel LaPointe a8ba8fc97d drop todos since web so far gone 2023-12-28 21:12:47 -05:00
Bel LaPointe 5bd118704d style.css and numbered instructions 2023-12-28 21:12:26 -05:00
Bel LaPointe daf554ee83 zoom to 150% in desktop and disable clipify until analysis called 2023-12-28 17:32:59 -05:00
Bel LaPointe 6513dc09b4 async clipify 2023-12-28 17:30:09 -05:00
Bel LaPointe 68dd89ffc9 disable buttons while WORKING 2023-12-28 17:22:27 -05:00
Bel LaPointe c5b2945c55 add lib::video::inspect_async 2023-12-28 17:19:20 -05:00
Bel LaPointe 11437bc848 adjust more aggressive scening 2023-12-28 15:31:05 -05:00
Bel LaPointe ddfae7f86d scenes maybe??? 2023-12-28 10:58:04 -05:00
Bel LaPointe 92b9765ad1 give up 2023-12-28 10:28:31 -05:00
Bel LaPointe 89142d69b1 revert 2023-12-28 10:28:17 -05:00
Bel LaPointe 96369424b3 give up 2023-12-28 10:25:53 -05:00
Bel LaPointe 1a1d979ebd grrrr 2023-12-28 10:17:21 -05:00
Bel LaPointe 47339a01f9 cli for src-lib to manual test inspect, clip 2023-12-28 09:39:27 -05:00
Bel LaPointe 1e7c82294f dev.sh 2023-12-28 00:30:25 -05:00
Bel LaPointe 97e149079c MVP WOOOOO 2023-12-28 00:30:08 -05:00
Bel LaPointe 53714ead7c oshit is taht 2023-12-28 00:27:43 -05:00
Bel LaPointe 3f7004cc06 show drops woo 2023-12-27 23:26:09 -05:00
Bel LaPointe a7581da4d1 the ugliest mvp 2023-12-27 23:04:54 -05:00
Bel LaPointe bf3c1af8e5 to web 2023-12-27 22:11:23 -05:00
Bel LaPointe 9c71c3ed3e br 2023-12-27 22:05:49 -05:00
Bel LaPointe 4ab2e798af no head for now 2023-12-27 22:05:02 -05:00
Bel LaPointe 5033c4016f analysis with screenshots is k WOO 2023-12-27 22:04:25 -05:00
Bel LaPointe 01887f061a grrr rfd 2023-12-27 21:54:54 -05:00
Bel LaPointe 49d811fc65 progression 2023-12-27 21:53:08 -05:00
Bel LaPointe f3b960c2f5 from jpg to png 2023-12-27 21:42:53 -05:00
Bel LaPointe 46ca6064c3 well it is at least a wip 2023-12-27 21:01:54 -05:00
Bel LaPointe 7e03cf11a6 ok rfd then 2023-12-27 20:53:10 -05:00
Bel LaPointe 4f69c24e44 gonna try nfd 2023-12-27 20:51:02 -05:00
Bel LaPointe 2645c63bf5 no more egui 2023-12-27 09:52:24 -05:00
Bel LaPointe e77579fd55 egui crashes 2023-12-27 09:52:18 -05:00
Bel LaPointe 50e2abaa2b just -lib 2023-12-27 09:45:53 -05:00
43 changed files with 1679 additions and 2923 deletions

View File

@ -1,18 +0,0 @@
[package]
name = "pa-home-video-blue-extractinator-ui"
version = "0.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
lib = { path = "./src-lib" }
leptos = { version = "0.5", features = ["csr"] }
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.6"
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
tauri-api = "0.7.6"
[workspace]
members = ["src-tauri"]

View File

@ -1,7 +0,0 @@
FROM rust
RUN apt update && cargo install tauri-cli
RUN cargo install trunk
ENTRYPOINT []
CMD []

View File

@ -1,7 +0,0 @@
# Tauri + Leptos
This template should help get you started developing with Tauri and Leptos.
## Recommended IDE Setup
[VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).

View File

@ -1,10 +0,0 @@
[build]
target = "./index.html"
[watch]
ignore = ["./src-tauri"]
[serve]
address = "127.0.0.1"
port = 1420
open = false

View File

@ -1,10 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Tauri + Leptos App</title>
<link data-trunk rel="css" href="styles.css" />
<link data-trunk rel="copy-dir" href="public" />
<link data-trunk rel="rust" data-wasm-opt="z" />
</head>
</html>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 27.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 437.4294 209.6185" style="enable-background:new 0 0 437.4294 209.6185;" xml:space="preserve">
<path style="fill:none;" d="M130.0327,79.3931c-11.4854-0.23-22.52,9.3486-24.5034,21.0117l49.1157,0.0293
c-2.1729-10.418-11.1821-21.0449-24.1987-21.0449C130.3081,79.3892,130.1714,79.3907,130.0327,79.3931z"/>
<path style="fill:#181139;" d="M95.1109,128.1089H58.6797V65.6861c0-1.5234-0.8169-2.4331-2.1855-2.4331h-3.1187
c-1.3159,0-2.2349,1.0005-2.2349,2.4331v67.4297c0,1.4521,0.8145,2.2852,2.2349,2.2852h41.7353c1.4844,0,2.4819-0.9375,2.4819-2.333
v-2.7744C97.5928,128.9253,96.6651,128.1089,95.1109,128.1089z"/>
<path style="fill:#181139;" d="M146.4561,77.1739c-4.8252-3.001-10.3037-4.5249-16.2837-4.5288c-0.0068,0-0.0137,0-0.0205,0
c-5.7349,0-11.1377,1.4639-16.0566,4.3511c-4.916,2.8853-8.8721,6.8364-11.7593,11.7456
c-2.8975,4.9248-4.3687,10.332-4.3721,16.0713c-0.0034,5.7188,1.4966,11.0654,4.4565,15.8887
c2.9893,4.9209,6.8789,8.7334,11.8887,11.6514c4.8657,2.8633,10.2397,4.3174,15.9717,4.3203c0.0073,0,0.0146,0,0.022,0
c8.123,0,14.7441-2.5869,21.4683-8.3906c0.5493-0.4805,0.8516-1.1201,0.8516-1.8008c0.001-0.6074-0.1743-1.1035-0.5205-1.4756
l-1.3569-1.8428l-0.0732-0.0859c-0.2637-0.2637-0.6929-0.6152-1.3716-0.6152c-0.6421,0-1.2549,0.2217-1.7124,0.6143
c-1.9346,1.585-3.5459,2.8008-4.7969,3.6182c-1.7979,1.208-5.8218,3.2314-12.5986,3.2314c-0.0073,0-0.0142,0-0.021,0
c-0.1357,0.0029-0.269,0.0039-0.4043,0.0039c-12.2642,0-23.4736-10.3262-24.5088-22.4814l53.0127,0.0322c0.0015,0,0.0024,0,0.0034,0
c2.2373,0,3.4697-1.1621,3.4712-3.2715c0.0034-5.2588-1.3574-10.3945-4.0464-15.2705
C155.0015,84.0953,151.2188,80.1363,146.4561,77.1739z M154.6451,100.4341l-49.1157-0.0293
c1.9834-11.6631,13.0181-21.2417,24.5034-21.0117c0.1387-0.0024,0.2754-0.0039,0.4136-0.0039
C143.4629,79.3892,152.4722,90.0162,154.6451,100.4341z"/>
<path style="fill:#181139;" d="M204.0386,136.6382c5.7319,0,11.1069-1.4502,15.9746-4.3115
c4.938-2.9014,8.75-6.7129,11.6533-11.6533c2.8608-4.8672,4.311-10.2578,4.311-16.0244c0-5.7324-1.4502-11.1064-4.311-15.9746
c-2.9019-4.9385-6.7134-8.75-11.6533-11.6533c-4.8687-2.8618-10.2437-4.3125-15.9746-4.3125
c-9.938,0-19.2021,4.7583-24.3516,12.3174v-9.438c0-0.5946-0.1465-1.0788-0.411-1.4511c-0.3815-0.5369-1.0157-0.834-1.8727-0.834
h-2.6738c-1.4521,0-2.2852,0.833-2.2852,2.2852v5.6964v46.4791v23.9676c0,1.2568,0.7808,2.0371,2.0371,2.0371h3.3667
c0.9209,0,1.6421-0.6992,1.6421-1.5908v-17.098v-10.984C185.0884,131.8892,194.2749,136.6382,204.0386,136.6382z M186.6358,122.5591
c-4.9346-4.9346-7.6831-11.4932-7.542-18.0254c-0.1367-6.3506,2.5439-12.751,7.3545-17.5605
c4.8521-4.8521,11.3037-7.5547,17.7383-7.417c4.3691,0,8.4863,1.1465,12.2314,3.4043c3.7344,2.2979,6.7456,5.4053,8.9492,9.2354
c2.1699,3.9072,3.2695,8.0967,3.2695,12.4697c0.1396,6.4619-2.5967,12.9844-7.5083,17.8955
c-4.7617,4.7617-11.0469,7.3857-17.2544,7.2803C197.6856,129.9712,191.396,127.3208,186.6358,122.5591z"/>
<path style="fill:#181139;" d="M241.8955,80.3975h7.5669v42.0259c0,6.8174,4.5674,12.1309,11.0825,12.9189
c0.6836,0.1055,1.8379,0.1572,3.5303,0.1572c2.0078,0,3.0273-0.3535,3.0273-2.2842v-2.377c0-1.7891-1.334-2.0371-2.7568-2.0371
c0,0-0.001,0-0.002,0l-1.7871-0.0488c-2.0117-0.0439-3.4883-0.7627-4.3896-2.1367c-0.9697-1.4805-1.4619-3.1738-1.4619-5.0352
V80.3975h10.0928c1.3076,0,2.2852-1.3628,2.2852-2.5815v-1.9312c0-1.3999-0.8359-2.2354-2.2354-2.2354h-10.1426V60.6861
c0-1.4619-0.7969-2.4829-1.9375-2.4829c-0.1865,0-0.4121,0-0.6392,0.0884l-2.6489,0.6865
c-1.2109,0.3682-2.0171,0.9263-2.0171,2.4507v12.2207h-7.5669c-1.4185,0-2.335,0.897-2.335,2.2852v1.8813
C239.5606,79.2393,240.6079,80.3975,241.8955,80.3975z"/>
<path style="fill:#181139;" d="M379.1182,106.2691c-4.0488-2.9219-8.8545-5.0293-14.291-6.2646
c-6.5049-1.3975-13.4473-5.2129-13.3203-10.3066c0-7.5225,6.6367-10.1914,12.3203-10.1914c5.3574,0,10.2207,3.002,13.001,8.0146
c0.6729,1.2861,1.4785,1.9375,2.3955,1.9375c0.3311,0,0.7061-0.1113,0.9922-0.2832l2.2021-1.1523
c0.5947-0.3408,0.9229-0.9414,0.9229-1.6924c0-0.5205-0.0908-0.9541-0.2617-1.292c-3.6367-8.2466-10.0967-12.4282-19.2021-12.4282
c-11.7305,0-19.6123,6.9263-19.6123,17.2349c0,4.3125,1.8438,7.9746,5.4756,10.8809c3.4482,2.7979,7.9121,4.8623,13.2705,6.1377
c4.5859,1.085,8.3193,2.5654,11.0977,4.4023c1.4159,0.9354,2.4412,2.0535,3.106,3.3672c0.6053,1.1962,0.9135,2.5535,0.9135,4.1005
c0.0742,2.3857-0.79,4.5176-2.5684,6.3389c-3.1445,3.2178-8.4053,4.6689-12.0205,4.6689c-0.0361,0-0.0723,0-0.1074,0
c-3.4268,0-6.4893-0.8438-9.1035-2.5068c-2.5918-1.6484-4.2363-3.8076-5.0293-6.6064c-0.3203-1.0996-0.751-2.1738-2.1553-2.1738
c-0.0742,0-0.2109,0.0146-0.4062,0.0449c-0.1133,0.0166-0.2559,0.0381-0.5088,0.0742l-1.8818,0.4463l-0.1045,0.0332
c-1.0244,0.4082-1.6113,1.1846-1.6113,2.1309c0,0.2285,0.0625,0.6592,0.2178,1.1094c1.9707,8.5801,10.2432,14.3447,20.5732,14.3447
c0.125,0.002,0.249,0.002,0.374,0.002c6.5947,0,12.6748-2.3193,16.7275-6.3945c3.1895-3.208,4.8311-7.2363,4.748-11.6357
c0-2.8187-0.6185-5.3109-1.8062-7.481C382.4437,109.2624,381.0062,107.631,379.1182,106.2691z"/>
<path style="fill:#EF3939;" d="M348.9043,45.7325c0-6.3157-3.2826-11.8699-8.2238-15.0756
c-2.811-1.8237-6.1537-2.8947-9.7469-2.8947c-9.9092,0-17.9707,8.0615-17.9707,17.9702c0,4.7659,1.8775,9.0925,4.9157,12.3123
c-3.6619,4.3709-6.6334,9.3336-8.7663,14.7186c-1.5873-0.2422-3.2123-0.3683-4.8662-0.3683
c-17.7158,0-32.1289,14.4131-32.1289,32.1289c0,14.6854,9.9077,27.0922,23.3869,30.9101
c-6.7762,17.3461-23.6572,29.6719-43.3742,29.6719c-16.8195,0-31.583-8.9662-39.7656-22.369
c-2.4778,0.5446-5.0429,0.8519-7.6721,0.9023c9.0226,16.99,26.8969,28.5917,47.4377,28.5917
c23.2646,0,43.1121-14.8788,50.5461-35.6179c0.5204,0.0251,1.0435,0.0398,1.5701,0.0398c17.7158,0,32.1289-14.4131,32.1289-32.1289
c0-13.557-8.4446-25.1712-20.3465-29.8811c1.9001-4.5678,4.5115-8.7646,7.6888-12.4641c0.9996,0.4404,2.0479,0.785,3.1324,1.0384
c1.3144,0.3071,2.6773,0.486,4.0839,0.486C340.8428,63.7032,348.9043,55.6416,348.9043,45.7325z M304.2461,129.5279
c-13.7871,0-25.0039-11.2168-25.0039-25.0039s11.2168-25.0039,25.0039-25.0039S329.25,90.7369,329.25,104.524
S318.0332,129.5279,304.2461,129.5279z M330.9336,34.8872c0.645,0,1.2737,0.0671,1.8881,0.1755
c5.0818,0.8974,8.9576,5.3347,8.9576,10.6697c0,5.9805-4.8652,10.8457-10.8457,10.8457s-10.8457-4.8652-10.8457-10.8457
c0-1.3967,0.2746-2.7282,0.7576-3.9555C322.4306,37.7496,326.35,34.8872,330.9336,34.8872z"/>
</svg>

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -1,6 +0,0 @@
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

453
src-lib/Cargo.lock generated
View File

@ -3,5 +3,456 @@
version = 3
[[package]]
name = "src-lib"
name = "async-channel"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
dependencies = [
"concurrent-queue",
"event-listener 4.0.1",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-io"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7"
dependencies = [
"async-lock 3.2.0",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix",
"slab",
"tracing",
"windows-sys 0.52.0",
]
[[package]]
name = "async-lock"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
dependencies = [
"event-listener 2.5.3",
]
[[package]]
name = "async-lock"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
dependencies = [
"event-listener 4.0.1",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-process"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c1cd5d253ecac3d3cf15e390fd96bd92a13b1d14497d81abf077304794fb04"
dependencies = [
"async-channel",
"async-io",
"async-lock 3.2.0",
"async-signal",
"blocking",
"cfg-if",
"event-listener 4.0.1",
"futures-lite",
"rustix",
"windows-sys 0.52.0",
]
[[package]]
name = "async-signal"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
dependencies = [
"async-io",
"async-lock 2.8.0",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix",
"signal-hook-registry",
"slab",
"windows-sys 0.48.0",
]
[[package]]
name = "async-task"
version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46"
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "blocking"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
dependencies = [
"async-channel",
"async-lock 3.2.0",
"async-task",
"fastrand",
"futures-io",
"futures-lite",
"piper",
"tracing",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "concurrent-queue"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c"
dependencies = [
"cfg-if",
]
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "4.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
dependencies = [
"event-listener 4.0.1",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "futures-core"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
[[package]]
name = "futures-io"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-lite"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "lib"
version = "0.1.0"
dependencies = [
"async-process",
]
[[package]]
name = "libc"
version = "0.2.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
[[package]]
name = "parking"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]]
name = "pin-project-lite"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]]
name = "piper"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "polling"
version = "3.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e"
dependencies = [
"cfg-if",
"concurrent-queue",
"pin-project-lite",
"rustix",
"tracing",
"windows-sys 0.52.0",
]
[[package]]
name = "rustix"
version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
"libc",
]
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"pin-project-lite",
"tracing-core",
]
[[package]]
name = "tracing-core"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"

View File

@ -6,3 +6,12 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
async-process = "2.0.1"
[lib]
name = "lib"
path = "src/lib.rs"
[[bin]]
name = "cli"
path = "src/cli/main.rs"

29
src-lib/src/cli/main.rs Normal file
View File

@ -0,0 +1,29 @@
use lib;
use std::str::FromStr;
fn main() {
let cmd = std::env::args().nth(1).expect("first argument must be [inspect] or [clip]");
let file = std::env::args().nth(2).expect("second argument must be [path to file]");
match cmd.as_ref() {
"clip" => {
let content_span = lib::video::ContentSpan{
start: f32::from_str(&std::env::args().nth(3).expect("third argument must be [start time as f32 seconds]")).unwrap(),
stop: f32::from_str(&std::env::args().nth(4).expect("fourth argument must be [stop time as f32 seconds]")).unwrap(),
};
let output = format!("{}.clipped.mp4", &file);
eprintln!("clipping {} from {} to {} as {}...", &file, &content_span.start, &content_span.stop, &output);
lib::video::clip(&output, &file, content_span).unwrap();
},
"inspect" => {
eprintln!("inspecting {}...", &file);
let content_spans = lib::video::inspect(&file).unwrap();
content_spans.iter()
.for_each(|x| {
println!("{}..{}", x.start, x.stop);
});
},
_ => {
panic!("unrecognized command {}", cmd);
},
};
}

View File

@ -1,26 +1,26 @@
pub mod video;
use std::path::Path;
pub fn analyze(file: &str) -> String {
match _analyze(file) {
pub fn must_analyze(file: &str) -> String {
match analyze(file) {
Ok(result) => result,
Err(msg) => msg,
}
}
fn _analyze(file: &str) -> Result<String, String> {
pub fn analyze(file: &str) -> Result<String, String> {
eprintln!("analyzing {}", file);
Err(format!("not impl"))
}
pub fn clipify(file: &str) -> String {
match _clipify(file) {
pub fn must_clipify(file: &str) -> String {
match clipify(file) {
Ok(result) => result,
Err(msg) => msg,
}
}
fn _clipify(file: &str) -> Result<String, String> {
pub fn clipify(file: &str) -> Result<String, String> {
eprintln!("clipifying {}", file);
let files = video::clipify(&file.to_string())?;
match files.iter().nth(0) {

View File

@ -2,10 +2,11 @@ use std::str::FromStr;
use core::cmp::Ordering;
use std::fs;
use std::path::Path;
use std::io::Write;
pub fn screenshotify(input: &String) -> Result<Vec<String>, String> {
let output_d = format!("{}.d", input);
let ext = "jpg".to_string();
let ext = "png".to_string();
let mut result = vec![];
let _ = ify(input, |content_span| {
let output = format!("{}/{}.{}", output_d, result.len(), ext);
@ -66,7 +67,41 @@ pub fn clip(output: &String, input: &String, content_span: ContentSpan) -> Resul
}
}
pub async fn clip_async(output: &String, input: &String, content_span: ContentSpan) -> Result<(), String> {
fs::create_dir_all(Path::new(output).parent().unwrap()).unwrap();
match async_process::Command::new("ffmpeg")
.args([
"-y",
"-ss", &content_span.start.to_string(),
"-i", input,
"-t", &(content_span.stop - content_span.start).to_string(),
output,
])
.output().await {
Ok(output) => match output.status.success() {
true => Ok(()),
false => Err(format!("failed to ffmpeg clip {}: {}", input, String::from_utf8(output.stderr).unwrap())),
},
Err(msg) => Err(format!("failed to ffmpeg clip {}: {}", input, msg)),
}
}
pub fn screenshot(output: &String, input: &String, ts: f32) -> Result<(), String> {
match screenshot_png(input, ts) {
Ok(png) => {
match std::fs::File::create(output) {
Ok(mut f) => {
f.write_all(&png).unwrap();
Ok(())
},
Err(msg) => Err(format!("failed to open {} for writing: {}", output, msg)),
}
},
Err(msg) => Err(msg),
}
}
pub fn screenshot_png(input: &String, ts: f32) -> Result<Vec<u8>, String> {
match std::process::Command::new("ffmpeg")
.args([
"-y",
@ -74,10 +109,12 @@ pub fn screenshot(output: &String, input: &String, ts: f32) -> Result<(), String
"-i", input,
"-frames:v", "1",
"-q:v", "2",
output,
"-c:v", "png",
"-f", "image2pipe",
"-",
])
.output() {
Ok(_) => Ok(()),
Ok(output) => Ok(output.stdout),
Err(msg) => Err(format!("failed to ffmpeg screenshot {}: {}", input, msg)),
}
}
@ -93,7 +130,7 @@ fn _inspect(file: &String) -> Result<Inspection, String> {
match std::process::Command::new("ffmpeg")
.args([
"-i", file,
"-vf", "mpdecimate",
"-vf", "mpdecimate,select='gt(scene,0.0)'",
"-af", "silencedetect=n=-50dB:d=1",
"-loglevel", "debug",
"-f", "null",
@ -108,7 +145,38 @@ fn _inspect(file: &String) -> Result<Inspection, String> {
lines: line_iter.map(|x| x.to_string()).collect(),
})
},
Err(msg) => Err(format!("failed to ffmpeg inspect {}: {}", file, msg)),
Err(msg) => Err(format!("failed to inspect with ffmpeg: {}", msg)),
}
}
pub async fn inspect_async(file: &String) -> Result<Vec<ContentSpan>, String> {
match _inspect_async(file).await {
Ok(inspection) => Ok(inspection.content_spans()),
Err(msg) => Err(msg)
}
}
async fn _inspect_async(file: &String) -> Result<Inspection, String> {
match async_process::Command::new("ffmpeg")
.args([
"-i", file,
"-vf", "mpdecimate,select='gt(scene,0.0)'",
"-af", "silencedetect=n=-50dB:d=1",
"-loglevel", "debug",
"-f", "null",
"-",
])
.output().await {
Ok(output) => {
let stderr = String::from_utf8(output.stderr).unwrap();
let stdout = String::from_utf8(output.stdout).unwrap();
let line_iter = stderr.split("\n").chain(stdout.split("\n"));
Ok(Inspection{
lines: line_iter.map(|x| x.to_string()).collect(),
})
},
Err(msg) => Err(format!("failed to inspect with ffmpeg: {}", msg)),
}
}
@ -133,10 +201,36 @@ impl Inspection {
}
fn visual_spans(&self) -> Vec<ContentSpan> {
self.spans_from_transitions(self.visual_transitions())
let unstuck_spans = self.spans_from_transitions(self.visual_transitions_unstuck_frames());
let scene_splits = self.visual_transitions_scene_splits();
let mut result = vec![];
for i in 0..unstuck_spans.len() {
let mut span = unstuck_spans[i];
for split in scene_splits.iter() {
if &(span.start + 5.0) < split && split < &(span.stop - 5.0) { // TODO const
result.push(ContentSpan{start: span.start, stop: *split});
span.start = *split;
}
}
if span.stop - span.start > 2.0 {
result.push(span);
}
}
result
}
fn visual_transitions(&self) -> Vec<f32> {
fn visual_transitions_scene_splits(&self) -> Vec<f32> {
self.lines.iter()
.filter(|x| x.contains("[Parsed_select_1") && x.contains(" scene:"))
.map(|x| f32::from_str(x
.split(" scene:").nth(1).unwrap()
.split(" ").nth(0).unwrap()
).unwrap())
.filter(|x| *x > 0.3) // TODO const
.collect()
}
fn visual_transitions_unstuck_frames(&self) -> Vec<f32> {
let lines: Vec<_> = self.lines.iter()
.filter(|x| x.contains("Parsed_mpdecimate_0"))
.filter(|x| x.contains("keep pts:") || x.contains("drop pts:"))
@ -178,15 +272,19 @@ impl Inspection {
fn duration(&self) -> f32 {
let ts = self.lines.iter()
.filter(|x| (*x).contains("Duration: "))
.filter(|x| (*x).contains("start: "))
.filter(|x| (*x).contains("bitrate: "))
.nth(0)
.expect("did not find duration from ffmpeg")
.split(",").nth(0).unwrap()
.split(": ").nth(1).unwrap();
let pieces: Vec<_> = ts.split(":")
.map(|x| f32::from_str(x).unwrap())
.map(|x| f32::from_str(x))
.filter(|x| x.is_ok())
.map(|x| x.unwrap())
.collect();
if pieces.len() == 0 {
return 0.0;
}
assert_eq!(3, pieces.len());
let hours = pieces[0] * 60.0 * 60.0;
let minutes = pieces[1] * 60.0;
@ -269,7 +367,7 @@ mod test_inspection {
#[test]
fn test_screenshot() {
let output = format!("{}.clipped.jpg", FILE);
let output = format!("{}.clipped.png", FILE);
screenshot(
&output,
&FILE.to_string(),
@ -279,7 +377,7 @@ mod test_inspection {
let inspection = _inspect(&output);
assert_eq!(true, inspection.is_ok());
let inspection = inspection.unwrap();
assert_eq!(0.04, inspection.duration());
assert_eq!(0.0, inspection.duration());
}
#[test]
@ -305,7 +403,11 @@ mod test_inspection {
assert_eq!(28.14, inspection.duration());
assert_eq!(4, inspection.visual_transitions().len());
assert_eq!(2, inspection.visual_transitions_scene_splits().len()); // TODO
assert_eq!(0.307763, inspection.visual_transitions_scene_splits()[0]); // TODO
assert_eq!(0.65986, inspection.visual_transitions_scene_splits()[1]); // TODO
assert_eq!(4, inspection.visual_transitions_unstuck_frames().len());
assert_eq!(
vec![ContentSpan{start: 1.0520501, stop: 22.0043}],
inspection.visual_spans(),

View File

@ -1,4 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/

View File

@ -1,24 +0,0 @@
[package]
name = "pa-home-video-blue-extractinator"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.5", features = [] }
[dependencies]
lib = { path = "../src-lib" }
tauri = { version = "1.5", features = [ "dialog-open", "shell-open"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
[features]
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]

View File

@ -1,3 +0,0 @@
fn main() {
tauri_build::build()
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,21 +0,0 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use lib;
#[tauri::command]
fn analyze(file: &str) -> String {
lib::analyze(file)
}
#[tauri::command]
fn clipify(file: &str) -> String {
lib::clipify(file)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![analyze, clipify])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@ -1,49 +0,0 @@
{
"build": {
"beforeDevCommand": "trunk serve",
"beforeBuildCommand": "trunk build",
"devPath": "http://localhost:1420",
"distDir": "../dist",
"withGlobalTauri": true
},
"package": {
"productName": "pa-home-video-blue-extractinator",
"version": "0.0.0"
},
"tauri": {
"allowlist": {
"all": false,
"shell": {
"all": false,
"open": true
},
"dialog": {
"open": true
}
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.breel.pa-home-video-blue-extractinator",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
},
"security": {
"csp": null
},
"windows": [
{
"fullscreen": false,
"resizable": true,
"title": "pa-home-video-blue-extractinator-2",
"width": 800,
"height": 600
}
]
}
}

File diff suppressed because it is too large Load Diff

22
src/Cargo.toml Normal file
View File

@ -0,0 +1,22 @@
[package]
name = "home-video-blue-extractinator"
version = "0.1.6"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus = "0.4.3"
lib = { path = "../src-lib" }
base64 = "0.21.5"
opener = "0.6.1"
dioxus-desktop = "0.4.3"
[package.metadata.bundle]
name = "home-video-blue-extractinator"
identifier = "com.breel.home-video-blue-extractinator"
version = "0.1.6"
copyright = "Copyright (c) breel.dev 2023. All rights reserved."
long_description = """
Tool to turn long home movies into clips with less noise.
"""

12
src/Dioxus.toml Normal file
View File

@ -0,0 +1,12 @@
[application]
name = "home-video-blue-extractinator"
default_platform = "desktop"
[web.app]
title = "home-video-blue-extractinator"
[web.watcher]
[web.resource]
[web.resource.dev]

View File

@ -1,140 +0,0 @@
use leptos::leptos_dom::ev;
use leptos::*;
use serde::{Deserialize, Serialize};
use serde_wasm_bindgen::to_value;
use wasm_bindgen::prelude::*;
use tauri_api::dialog::{select, Response};
use lib;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = ["window", "__TAURI__", "tauri"])]
async fn invoke(cmd: &str, args: JsValue) -> JsValue;
}
#[derive(Serialize, Deserialize)]
struct Args<'a> {
file: &'a str,
}
#[component]
pub fn App() -> impl IntoView {
let (file, set_file) = create_signal(String::new());
let (err, set_err) = create_signal(String::new());
let update_file = move |ev| {
let v = event_target_value(&ev);
set_file.set(v);
};
let (analyze_result, set_analyze_result) = create_signal(String::new());
let (clipify_result, set_clipify_result) = create_signal(String::new());
let noop = move |ev: ev::SubmitEvent| { ev.prevent_default(); };
let select_file = move |ev: ev::MouseEvent| {
ev.prevent_default();
match select(None, None) {
Ok(response) => match response {
Response::Okay(s) => { set_file.set(s) },
_ => {},
},
Err(msg) => set_err.set(format!("failed to select a file: {}", msg)),
};
};
let analyze = move |ev: ev::MouseEvent| {
ev.prevent_default();
spawn_local(async move {
if file.get_untracked().is_empty() {
return;
}
let args = to_value(&Args { file: &file.get_untracked() }).unwrap();
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
match invoke("analyze", args).await.as_string() {
Some(new_analyze_result) => set_analyze_result.set(new_analyze_result),
None => set_err.set("analyze result failed".to_string()),
};
});
};
let clipify = move |ev: ev::MouseEvent| {
ev.prevent_default();
spawn_local(async move {
if file.get_untracked().is_empty() {
return;
}
let args = to_value(&Args { file: &file.get_untracked() }).unwrap();
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
match invoke("clipify", args).await.as_string() {
Some(new_clipify_result) => set_clipify_result.set(new_clipify_result),
None => set_err.set("clipify result failed".to_string()),
};
});
};
view! {
<main class="container">
<div class="row">
<form class="row" on:submit=noop>
<p id="file_selection" on:click=select_file>{ move || file.get() }</p>
<button type="submit" on:click=analyze>"Analyze"</button>
<button type="button" on:click=clipify>"Clipify"</button>
</form>
</div>
<div class="row">
<p><b style="color: red;">{ move || err.get() }</b></p>
</div>
<div class="row">
<div class="column">
<div class="row">
<h2>Analysis</h2>
</div>
<div class="row">
<p><b>{ move || analyze_result.get() }FOO</b></p>
</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="row">
<h2>Clipified</h2>
</div>
<div class="row">
<p><b>{ move || clipify_result.get() }BAR</b></p>
</div>
</div>
</div>
/*
<p>"Click on the Tauri and Leptos logos to learn more."</p>
<p>
"Recommended IDE setup: "
<a href="https://code.visualstudio.com/" target="_blank">"VS Code"</a>
" + "
<a href="https://github.com/tauri-apps/tauri-vscode" target="_blank">"Tauri"</a>
" + "
<a href="https://github.com/rust-lang/rust-analyzer" target="_blank">"rust-analyzer"</a>
</p>
<form class="row" on:submit=greet>
<input
id="greet-input"
placeholder="Enter a name..."
on:input=update_name
/>
<button type="submit">"Greet"</button>
</form>
<p><b>{ move || greet_msg.get() }</b></p>
*/
</main>
}
}

1
src/bel_1_1.mp4 Symbolic link
View File

@ -0,0 +1 @@
/Users/breel/Movies/bel_1_1.mp4

3
src/dev.sh Normal file
View File

@ -0,0 +1,3 @@
#! /bin/bash
echo dx serve --hot-reload --platform desktop

View File

@ -1,12 +0,0 @@
mod app;
use app::*;
use leptos::*;
fn main() {
mount_to_body(|| {
view! {
<App/>
}
})
}

265
src/src/main.rs Normal file
View File

@ -0,0 +1,265 @@
#![allow(non_snake_case)]
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
use dioxus::prelude::*;
use lib;
use base64::{engine::general_purpose, Engine as _};
use std::str::FromStr;
fn main() {
dioxus_desktop::launch(App);
dioxus_desktop::launch_cfg(App, dioxus_desktop::Config::new()
.with_window(dioxus_desktop::WindowBuilder::new()
.with_title("home-video-blue-extractinator")
));
}
// define a component that renders a div with the text "Hello, world!"
fn App(cx: Scope) -> Element {
let file = use_state(cx, || String::new());
let analyze_status = use_state(cx, || String::new());
let clipify_status = use_state(cx, || String::new());
let processing = use_state(cx, || false);
let analysis = use_state(cx, || Analysis::new());
let a_css = String::from_utf8_lossy(include_bytes!("./style.css"));
let processing_css = || {
match *processing.get() {
true => "body { background-color: lightgray !important; opacity: 0.75 !important; }".to_string(),
false => "".to_string(),
}
};
cx.render(rsx! {
header {
title { "home-video-blue-extractinator" }
style { "{a_css} {processing_css()}" }
}
main {
rsx! {
h1 { "home-video-blue-extractinator" }
h3 { "1. Choose your movie" }
div {
input {
r#type: "file",
disabled: *processing.get(),
onchange: |evt| {
if let Some(file_engine) = &evt.files {
for f in &file_engine.files() {
file.set(f.clone());
analyze_status.set(String::new());
clipify_status.set(String::new());
processing.set(false);
analysis.set(Analysis::new());
}
}
},
},
p { file.get().clone() }
}
h3 { "2. Analyze your movie" }
div {
input { r#type: "button", value: "analyze", disabled: file.get().len() == 0 || *processing.get(), onclick: move |_| {
cx.spawn({
let file = file.to_owned();
let analyze_status = analyze_status.to_owned();
let processing = processing.to_owned();
let analysis = analysis.to_owned();
async move {
processing.set(true);
analyze_status.set(format!("analyzing {file}... (this may take a while, like 5 minutes, but I promise I'm working on it)"));
let analyzed = analyze(file.get().clone()).await;
if analyzed.err.len() > 0 {
analyze_status.set(analyzed.err.clone());
} else {
analyze_status.set(format!(
"found {} clips to keep and {} clips to drop",
analyzed.result.iter().filter(|x| x.has_content).count(),
analyzed.result.iter().filter(|x| !x.has_content).count(),
));
}
analysis.set(analyzed);
processing.set(false);
}
});
}}
br {}
div { analyze_status.get().clone() }
}
div {
form {
onsubmit: |evt| {
let content_spans: Vec<_> = evt.values.iter()
.filter(|kv| kv.1.len() > 0)
.map(|kv| {
let span_str = kv.0;
let idx = span_str.find("..").unwrap();
lib::video::ContentSpan{
start: f32::from_str(&span_str[0..idx]).unwrap(),
stop: f32::from_str(&span_str[idx+2..span_str.len()]).unwrap(),
}
})
.collect();
clipify_status.set(format!("clipifying {:?}...", content_spans));
let file = file.get().clone();
to_owned![clipify_status];
to_owned![processing];
async move {
processing.set(true);
let f = clipify(file, content_spans).await;
clipify_status.set(f);
processing.set(false);
}
},
hr {}
h3 { "3. Double check the scenes to keep (green) are okay" }
analysis.get().result.iter().map(|a| {
rsx! {
div {
label {
input {
r#type: "checkbox",
checked: a.has_content,
name: "{a.start}..{a.stop}",
}
"{a.pretty_range()}"
br {}
img { src: "data:image/png;base64, {a.screenshot}" }
}
}
}
})
hr {}
h3 { "4. Submit your re-clip" }
div { clipify_status.get().clone() }
br {}
input { r#type: "submit", value: "clipify selected spans", disabled: file.get().len() == 0 || *processing.get() || analysis.get().result.len() == 0 }
}
}
}
}
})
}
struct Analysis {
result: Vec<Analyzed>,
err: String,
}
impl Analysis {
fn new() -> Self {
Self{
result: vec![],
err: "".to_string(),
}
}
}
#[derive(Clone)]
struct Analyzed {
_start: f32,
_stop: f32,
start: String,
stop: String,
screenshot: String,
has_content: bool,
}
impl Analyzed {
fn pretty_range(&self) -> String {
format!("{} - {}", self.pretty_t(self._start), self.pretty_t(self._stop))
}
fn pretty_t(&self, t: f32) -> String {
if t < 60.0 {
return format!(":{:02}", t as i32);
} else if t < 60.0 * 60.0 {
return format!("{:02}:{:02}", (t / 60.0) as i32, (t % 60.0) as i32);
} else {
return format!("{:02}:{:02}:{:02}",
(t / 60.0 / 60.0) as i32,
(t / 60.0) as i32,
(t % 60.0) as i32);
}
}
}
async fn analyze(file: String) -> Analysis {
let content_spans = lib::video::inspect_async(&file).await;
if content_spans.is_err() {
return Analysis{
result: vec![],
err: format!("failed to analyze {}: {}", file, content_spans.err().unwrap()),
};
}
let content_spans = content_spans.unwrap();
let mut non_content_spans = vec![];
if let Some(first_content_span) = content_spans.iter().nth(0) {
non_content_spans.push(lib::video::ContentSpan{start: 0.0, stop: first_content_span.start});
}
for i in 1..content_spans.len() {
non_content_spans.push(lib::video::ContentSpan{
start: content_spans[i-1].stop,
stop: content_spans[i].start,
});
}
let screenshot = |content_span: &lib::video::ContentSpan| -> Analyzed {
let ts = (content_span.start + content_span.stop) / 2.0;
Analyzed {
_start: content_span.start,
_stop: content_span.stop,
start: content_span.start.to_string(),
stop: content_span.stop.to_string(),
screenshot: match lib::video::screenshot_png(&file, ts) {
Ok(png) => general_purpose::STANDARD.encode(&png),
Err(_) => A_PNG.to_string(),
},
has_content: false,
}
};
let mut result = vec![];
content_spans.iter()
.map(screenshot)
.map(|x| {
let mut x = x.clone();
x.has_content = true;
x
})
.for_each(|x| result.push(x));
non_content_spans.iter()
.map(screenshot)
.for_each(|x| result.push(x));
result.sort_by(|x, y| x.start.partial_cmp(&y.start).unwrap());
Analysis{
result: result,
err: "".to_string(),
}
}
async fn clipify(file: String, content_spans: Vec<lib::video::ContentSpan>) -> String {
let d = format!("{}.d", &file);
let mut statuses = vec![];
for content_span in content_spans.iter() {
let output = format!("{}/{}.mp4", &d, content_span.start);
match std::path::Path::new(&output).exists() {
true => { statuses.push(format!("skipping {} as it already exists", &output)); },
false => {
let cur = lib::video::clip_async(&output, &file, *content_span).await;
if cur.is_err() {
statuses.push(format!("failed to clipify {} at {}..{}: {}", &file, &content_span.start, &content_span.stop, cur.err().unwrap()));
}
},
}
}
let _ = opener::open(d.clone());
match statuses.len() {
0 => d,
_ => statuses.join(", "),
}
}
const A_PNG: &str = r"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";

14
src/src/style.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,112 +0,0 @@
.logo.leptos:hover {
filter: drop-shadow(0 0 2em #a82e20);
}
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color: #0f0f0f;
background-color: #f6f6f6;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
.container {
margin: 0;
padding-top: 10vh;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: 0.75s;
}
.logo.tauri:hover {
filter: drop-shadow(0 0 2em #24c8db);
}
.row {
display: flex;
justify-content: center;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
h1 {
text-align: center;
}
input,
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
color: #0f0f0f;
background-color: #ffffff;
transition: border-color 0.25s;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}
button {
cursor: pointer;
}
button:hover {
border-color: #396cd8;
}
button:active {
border-color: #396cd8;
background-color: #e8e8e8;
}
input,
button {
outline: none;
}
#greet-input {
margin-right: 5px;
}
@media (prefers-color-scheme: dark) {
:root {
color: #f6f6f6;
background-color: #2f2f2f;
}
a:hover {
color: #24c8db;
}
input,
button {
color: #ffffff;
background-color: #0f0f0f98;
}
button:active {
background-color: #0f0f0f69;
}
}