Compare commits
660 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 866f7f228c | |||
| 5babd17d18 | |||
| b3d1b866c2 | |||
| 7c2ab47c98 | |||
| fc0ae7bedd | |||
| b8562f48e7 | |||
| 1116f80066 | |||
| 2979924068 | |||
| 14633fe72c | |||
| 35111ad7fa | |||
| 174ac51736 | |||
| d76388c28b | |||
| dcad56a4b4 | |||
| 3339f9a2ce | |||
| 2c7af614d6 | |||
| e69f8b7ff8 | |||
| 701c939e8d | |||
| 21f6f8c83b | |||
| 46b5454a9d | |||
| 42f8d9a83b | |||
| 54960414fe | |||
| a13b949c9b | |||
| 22627c387a | |||
| 7fc45625bd | |||
| f00c45d38b | |||
| a49661736b | |||
| 6b47327f87 | |||
| 7cc7679746 | |||
| ec20ff0b02 | |||
| 438044faaf | |||
| ed6bddb95f | |||
| 6dab106f2a | |||
| 15f8c4c076 | |||
| c39366960f | |||
| 8a042a3fd3 | |||
| 44cd5c2182 | |||
| 7cb2eed79d | |||
| c8aeb3759f | |||
| 4e7fd5a9f7 | |||
| 767372be54 | |||
| 10ffc77e7c | |||
| 768a162ac0 | |||
| 30b5d6907c | |||
| 84fdb98885 | |||
| 6735ab54a5 | |||
| 6a423365cd | |||
| 8f06f8682d | |||
| c5e379a65b | |||
| ace6a66455 | |||
| 811004096b | |||
| c54944b4ad | |||
| 0693505d73 | |||
| 4d3a4c9e43 | |||
| 894288ec0e | |||
| 1badf860dc | |||
| ad8e3a669b | |||
| 1dc1d15652 | |||
| 365c131a1e | |||
| 7d0027f5e6 | |||
| 7f8e7c44bc | |||
| 921f724157 | |||
| 9e3a938ce4 | |||
| ea75487682 | |||
| dc87aa394c | |||
| 66f5e12a51 | |||
| 8e2489c31e | |||
| 71359254f2 | |||
| 1d43b9b0a0 | |||
| 76fa917104 | |||
| 1ca711a3e2 | |||
| a782ad4f8a | |||
| 49a3002259 | |||
| 7343d51b15 | |||
| cb2d6ac593 | |||
| 965a05d2b7 | |||
| b94864b00a | |||
| 534400c738 | |||
| 29923771fd | |||
| c0de46b41a | |||
| dd3de9b380 | |||
| 9780923e6a | |||
| 950d643325 | |||
| a86347aaa5 | |||
| ab21fc76d9 | |||
| b58f980c04 | |||
| c58c3c175f | |||
| adc715ed8e | |||
| 4eb19a51c4 | |||
| c5ab426e23 | |||
| 4044c04118 | |||
| 78237ed004 | |||
| 5dfa73af08 | |||
| 75acee51fd | |||
| 99443bc288 | |||
| ca04e34525 | |||
| 4708252aea | |||
| 8aeae926fb | |||
| 7206224cfa | |||
| c3a6de00e3 | |||
| e9750292ba | |||
| 49bf4ad36d | |||
| 807b39f24d | |||
| 089406962b | |||
| ec3be9eae5 | |||
| 642f0e6dd5 | |||
| 9d7c9de4ab | |||
| 3c9dfd4276 | |||
| 483c57af69 | |||
| 7d5bcc40b0 | |||
| 742ae64d30 | |||
| 30a067bb90 | |||
| d27d37c4db | |||
| d70238d3e0 | |||
| 037525d8e3 | |||
| 894d42f941 | |||
| 885cfd9312 | |||
| 36eb28ad6b | |||
| af3f7bbc1a | |||
| 13b6e496c8 | |||
| bd89f400ce | |||
| d246403f74 | |||
| 181b1630be | |||
| 0b7dff7970 | |||
| 4a06a108a9 | |||
| 93de9b4497 | |||
| fa8be8f08a | |||
| d76e54e22d | |||
| 7a3053741c | |||
| 60adf51a4c | |||
| 922bb08954 | |||
| 2bcdc38f09 | |||
| 3925fb758b | |||
| b0ca3efc58 | |||
| 4092cef839 | |||
| 1e5ac12f3d | |||
| 1415163618 | |||
| 2c66739552 | |||
| a8a57e714e | |||
| d8cd06b5ba | |||
| 1c9c8809fa | |||
| 45b1327345 | |||
| 6d4fb2d35f | |||
| 312a957294 | |||
| 13bb901552 | |||
| 8a5415300b | |||
| b0d1ddaad5 | |||
| bcaac44b37 | |||
| f33a0f5064 | |||
| 2ced0f6c43 | |||
| d2c9910b5a | |||
| 0a40834ab9 | |||
| ad3f838d09 | |||
| 2cf3717cf7 | |||
| f5113e2cf8 | |||
| b327eb7eca | |||
| 5c85587446 | |||
| c2e0f18700 | |||
| cc6656ed5d | |||
| 82b48b8c13 | |||
| 295349e78b | |||
| 6bc2ade681 | |||
| 6d615abb0d | |||
| 8096a979ea | |||
| f85fbde89d | |||
| 2400cf0580 | |||
| 2c61650a0e | |||
| b32ff8ce4f | |||
| e84a6494aa | |||
| 59ce796db8 | |||
| 1838b6e4ab | |||
| 69ae0ba5ab | |||
| ef9aeb1dd2 | |||
| b5ae862812 | |||
| 9b0b0766aa | |||
| 931e60c301 | |||
| 099be5e6f7 | |||
| 35d4299e74 | |||
| b1061b3c9e | |||
| d7555b825f | |||
| e8811248db | |||
| b9c7c5cdb5 | |||
| b7e679a255 | |||
| b48c59b377 | |||
| 7f79eb1e26 | |||
| 421afb8096 | |||
| 9c6aa304a8 | |||
| 7f014a494c | |||
| 0dc550e435 | |||
| 77ca12963c | |||
| 6ce7094119 | |||
| b6fa3977b1 | |||
| 91588392a3 | |||
| 98437a0891 | |||
| c86ea07073 | |||
| f452678990 | |||
| dca730afc2 | |||
| 816e268b2d | |||
| d1e96f5d2a | |||
| 66589ffaf6 | |||
| 073d0a4d8d | |||
| a36db258af | |||
| 4dc54379d8 | |||
| e1df66f994 | |||
| 58e3766ebd | |||
| 33736ceca7 | |||
| cd821b7e08 | |||
| 374753595c | |||
| 22c23a6f27 | |||
| 77ba64664f | |||
| 8bd9c9e121 | |||
| 48b7a0d2ad | |||
| 6284db2bea | |||
| a3ffec6fc1 | |||
| e02754f390 | |||
| 749194f9e1 | |||
| e663c743ab | |||
| c464b110da | |||
| 513815a9c5 | |||
| 671b367957 | |||
| fac82f06eb | |||
| 278763be31 | |||
| d8f0f5db85 | |||
| a27e50f909 | |||
| 01a5d21e69 | |||
| 39d2bbe0b3 | |||
| b36f0c5e1d | |||
| 14a366f035 | |||
| 1543ef6aba | |||
| 7a5c872ab0 | |||
| 9b4a177529 | |||
| 364ce23892 | |||
| 66742304a9 | |||
| 3c7532ba17 | |||
| ac4f79ff7a | |||
| 422971a914 | |||
| 78d4014d77 | |||
| d9e9aa6a2f | |||
| 6243b1b46a | |||
| 078ee42f51 | |||
| c3859b4bea | |||
| a763f3ec5f | |||
| d2d8b0f12d | |||
| 82cb245639 | |||
| e4e972f36b | |||
| db333920a1 | |||
| 3216212c43 | |||
| b8737fb687 | |||
| a1b91eefc0 | |||
| 741b2e6ca2 | |||
| 7ab8e73cb5 | |||
| a6b2874b56 | |||
| ad02f40085 | |||
| 62e0453ce9 | |||
| 53dea1c480 | |||
| 0740242232 | |||
| 5683d23db9 | |||
| 78971ce69e | |||
| 7375a5a847 | |||
| 6e25d1e67f | |||
| 5a50c986f4 | |||
| 8b8a073216 | |||
| f9600c0745 | |||
| cec4e2aca2 | |||
| 9df446b2b3 | |||
| 9244013949 | |||
| caab3c02c6 | |||
| bf6f0faf4c | |||
| e380f12cd2 | |||
| 3f403e3009 | |||
| da0470e88f | |||
| 136ac4e0a7 | |||
| db7a82b3b7 | |||
| 4955e49f54 | |||
| b02b0ce05b | |||
| 58d5fbc1e3 | |||
| 18d72c4159 | |||
| 28a09dd2f1 | |||
| 2543b1daee | |||
| 8f7db18aea | |||
| 027bd4241b | |||
| a57c60934c | |||
| d9d20a76c2 | |||
| eb6be405ef | |||
| c576845e56 | |||
| 663ac056b7 | |||
| 4e5b4a293f | |||
| 31438544ac | |||
| 5c04c368d8 | |||
| 2ea3a69bdd | |||
| 6f0ff2da7c | |||
| ac227f075f | |||
| f8a69ee620 | |||
| a4c1b6978d | |||
| 9424f25dcc | |||
| b74d5215e2 | |||
| 8700340313 | |||
| 38abf4f522 | |||
| 57cb1bc8fb | |||
| 6269f625e3 | |||
| 01a3949df4 | |||
| 3a919d2638 | |||
| 5be1468891 | |||
| afa0900755 | |||
| 4638560c30 | |||
| d2c1e8ccb7 | |||
| efd4725074 | |||
| 1528741713 | |||
| b2f9ab1b64 | |||
| c4da613344 | |||
| 4f1b4d78ad | |||
| 1d8928a745 | |||
| abe863f015 | |||
| be7c742b30 | |||
| 64c5df4772 | |||
| c2cd6f451e | |||
| ff21cb9595 | |||
| 5cf7dff3f2 | |||
| 2bc6e91f5c | |||
| 60fde76249 | |||
| 938a5c7ee8 | |||
| 49a88bcbaf | |||
| 01df7ef239 | |||
| 9ecdcd88fe | |||
| 717350e23c | |||
| 3712ebb115 | |||
| 48d1eec2a4 | |||
| b6ee215e2f | |||
| c3eb9744e9 | |||
| 612467495a | |||
| 2d2929da8f | |||
| e25d0d4e9e | |||
| 639b205376 | |||
| 1c4aca908e | |||
| 5494e1d47e | |||
| ae2887fdea | |||
| 15e719fe8e | |||
| 4f9de1220d | |||
| a14e6a1686 | |||
| 20ce2880d2 | |||
| e169fc39e5 | |||
| 5e24246912 | |||
| accce27eb6 | |||
| d03da3f37a | |||
| 27f45ded91 | |||
| 880285e238 | |||
| 4d21d06781 | |||
| 9c7e42ae29 | |||
| 3efc04744c | |||
| 778a2045a0 | |||
| 4e54445170 | |||
| d08bac2c41 | |||
| bcc65e7da6 | |||
| b9b25089b3 | |||
| 1d521aca91 | |||
| 015052b97c | |||
| d67e40180d | |||
| 3a4a5b271a | |||
| afe635f1c5 | |||
| 9486606351 | |||
| 8bf709d899 | |||
| 072cb2b192 | |||
| 199cee8594 | |||
| 7c896688c8 | |||
| 4c14d525ce | |||
| 861dcd00d8 | |||
| 0aee64c7f3 | |||
| f5a3603a5a | |||
| c8f3fa5102 | |||
| 40918ad008 | |||
| 4a47823b09 | |||
| a74e39ed1e | |||
| a5fc251da7 | |||
| fc4ec73894 | |||
| 0190816614 | |||
| 278d7a4e6e | |||
| 91ae79e388 | |||
| 8d64e88664 | |||
| 038037a15e | |||
| 3a32f30838 | |||
| d30d175616 | |||
| 2af5f81574 | |||
| c531c220fc | |||
| cd8cda3c23 | |||
| 63622d6a1f | |||
| 0d38a75797 | |||
| 94e7aa02b0 | |||
| 0c210cf48f | |||
| a316583d6d | |||
| d71f74d7c7 | |||
| 1f0be50126 | |||
| b1e250c7a7 | |||
| ed75777a47 | |||
| 7389362cae | |||
| 8ae9cbc302 | |||
| 12f3f6e3ac | |||
| 72b2d30fab | |||
| c58b00a236 | |||
| fe3c238adb | |||
| 31a47405df | |||
| 7380e8a23e | |||
| e48a529a77 | |||
| 7d8255cb37 | |||
| 78518514b8 | |||
| c39354da09 | |||
| 1abbd6ecd8 | |||
| 504b11ba5d | |||
| 423c6707e9 | |||
| 2020022b13 | |||
| 7cd4591bf1 | |||
| 2b3c3f7f52 | |||
| 8024583d36 | |||
| 44e34cead6 | |||
| 46b053eaf0 | |||
| 8ccefc1843 | |||
| 9ebcaacc38 | |||
| fdd631bce0 | |||
| 13681fb696 | |||
| 8153d8e9b3 | |||
| a9d05511fb | |||
| 51e1c5a9ee | |||
| 50aebda69e | |||
| 0a271801dd | |||
| 2b58c4f070 | |||
| bd85ce5de7 | |||
| e669b43ba7 | |||
| c3176333fe | |||
| 41ff93969e | |||
| 307a4e90c5 | |||
| 1330adf2de | |||
| b238d4ee9a | |||
| a97432c69b | |||
| 07f21d4f1d | |||
| 8477fd7bb2 | |||
| 32c0eadea2 | |||
| bf5c710fd3 | |||
| 3358a37341 | |||
| 0607c629da | |||
| 4173c6c9ed | |||
| 35503c7703 | |||
| c553a554f0 | |||
| 961fd5cc1f | |||
| edc8d6dfcf | |||
| f1de123f9b | |||
| ddfd2a0e5d | |||
| bbae7d932d | |||
| f0251fae55 | |||
| 6886909ec0 | |||
| 77f1787403 | |||
| 9244a65235 | |||
| 8c71df05b9 | |||
| e3da00ee0d | |||
| 4d4e80a2b9 | |||
| f8c5c03438 | |||
| 4f0886b3fd | |||
| 8746ed0d6f | |||
| 1fd7ed5dae | |||
| 858f147553 | |||
| e46029bedd | |||
| 583c0613a5 | |||
| 99a864319f | |||
| b0f6e354ea | |||
| 92794574d7 | |||
| e776e00375 | |||
| 4d7af0dedb | |||
| ca46332007 | |||
| a455146441 | |||
| 13651b6e90 | |||
| 67ba916360 | |||
| 8985476e61 | |||
| 066781edb9 | |||
| ac2baa5787 | |||
| e090e98fa5 | |||
| 5c1a8bd105 | |||
| 1e394c1938 | |||
| e5bb1c1733 | |||
| d10bca3d1a | |||
| ea992e6ea7 | |||
| d6a8ea6297 | |||
| 29fc5fa118 | |||
| 2f3fff1e64 | |||
| 88c9d3c306 | |||
| f3c5beaacd | |||
| b245cf6f94 | |||
| 7663f4d7e5 | |||
| fecd87c136 | |||
| f28dda5fd6 | |||
| 9d4c5d8316 | |||
| b3366a2b5f | |||
| 9dd1825064 | |||
| c5f785f2ba | |||
| 7becd3d30c | |||
| a3a94a5f8c | |||
| 2fea47b841 | |||
| 174e20e11f | |||
| 6b5c115a2c | |||
| 7c25437a10 | |||
| 645c7b7a8e | |||
| a275514696 | |||
| bc7f557a3e | |||
| 5235e0838c | |||
| 7638f573dd | |||
| 84bc18ab41 | |||
| 3211cb2608 | |||
| 5fd910b78d | |||
| 6313c2b990 | |||
| e6550bcfb0 | |||
| 528d07f645 | |||
| 607142cc75 | |||
| 3b8ce8f86a | |||
| 80a7d3e706 | |||
| 85caa81781 | |||
| e889dc3c61 | |||
| f847a0669c | |||
| d82488405f | |||
| d25b736aa0 | |||
| 385b18e097 | |||
| e519dc9540 | |||
| c215e7aaae | |||
| f37ce39266 | |||
| 768f743462 | |||
| fd61dcbeeb | |||
| 5e52385c68 | |||
| dcf247fe41 | |||
| 9f5946b2c7 | |||
| 0a632acfcd | |||
| 4a01dac180 | |||
| 88fc344530 | |||
| 47ee7b9ff8 | |||
| fba5ae697a | |||
| eae7d8dd10 | |||
| b407159f22 | |||
| 353217bd3f | |||
| 1d7280290c | |||
| b80ee038b2 | |||
| fe47168718 | |||
| ea8892ef3f | |||
| 4a061057a6 | |||
| b55f1d65eb | |||
| fbb710b8f8 | |||
| cf35aa6ea7 | |||
| d1fb815d4d | |||
| 9b85848522 | |||
| ca1e603cc0 | |||
| e0ad7770e2 | |||
| 892aef3942 | |||
| 22c0c0335c | |||
| ce5cd71daa | |||
| af8a1d9b9b | |||
| 66f35401bc | |||
| 50b171df65 | |||
| f416698ad8 | |||
| a3b83bc8a1 | |||
| b5a7aa0f36 | |||
| 3d64a99213 | |||
| 5b964970a0 | |||
| 0c1fe99c7a | |||
| dcdcc57c89 | |||
| 7088f0221b | |||
| 72e73c2c20 | |||
| 5eb94df884 | |||
| f0a8e14aaa | |||
| 6090c2e8c0 | |||
| 98527ec02f | |||
|
|
b9a10e7585 | ||
|
|
98ca3e239f | ||
|
|
68f3d05d56 | ||
|
|
63ead22e49 | ||
|
|
6e2968e0eb | ||
|
|
764f95014a | ||
|
|
ce4019a1e6 | ||
|
|
0c2a6f3c1c | ||
|
|
6fd490689e | ||
|
|
4b4aac9496 | ||
|
|
fca4408f8e | ||
|
|
173859cffc | ||
|
|
07111f7b98 | ||
|
|
876d900e9b | ||
|
|
4f3be9a642 | ||
|
|
fc5bb6a71c | ||
|
|
3e8924af8f | ||
|
|
d6958ff0ce | ||
|
|
d4d0f6f0fb | ||
|
|
c7bad81bd9 | ||
|
|
3d872a7488 | ||
|
|
56d440aa5e | ||
|
|
4bbc43368e | ||
|
|
204af0279b | ||
|
|
e8eb486721 | ||
|
|
a92cc60b2f | ||
|
|
4acc058038 | ||
|
|
6c9d1da854 | ||
|
|
e159560bca | ||
|
|
d88c75a8cc | ||
|
|
2d263d009e | ||
|
|
24db5444f2 | ||
|
|
5c4e8f7de8 | ||
|
|
d38003f7f9 | ||
|
|
fc6e8558f6 | ||
|
|
0f5ffe3694 | ||
|
|
f48e7419e9 | ||
|
|
849c4d1df4 | ||
|
|
1d7f78bfea | ||
|
|
08f0a66b20 | ||
|
|
fc29b57cbe | ||
|
|
fd468520d5 | ||
|
|
f3d42c06d2 | ||
|
|
3d798a13fb | ||
|
|
e231caae28 | ||
|
|
963af81353 | ||
|
|
0cc161e612 | ||
|
|
0283739e19 | ||
|
|
6e1cc17235 | ||
|
|
08fc781d86 | ||
|
|
809e60083b | ||
|
|
b8b50e7350 | ||
|
|
9365e19237 | ||
|
|
af5e1613be | ||
|
|
a365d16962 | ||
|
|
e64e4c1142 | ||
|
|
5f3982f4dd | ||
|
|
660a2f436f | ||
|
|
38449408f4 | ||
|
|
9e84b07536 | ||
|
|
4a39f67649 | ||
|
|
b4036d10c4 | ||
|
|
b663bcaf05 | ||
|
|
a6681dd3e8 | ||
|
|
1a15eb07ef | ||
|
|
3e7bca531c | ||
|
|
8edb6cc7eb | ||
|
|
8366b6a197 | ||
|
|
11c440e29b | ||
|
|
71eeaeb256 | ||
|
|
15fcea06e5 | ||
|
|
c38d6890fd | ||
|
|
163e5f19af | ||
|
|
5a93ff91ff | ||
|
|
c3c41cc2c4 | ||
|
|
a663271e16 | ||
|
|
e0a2a3c0b1 | ||
|
|
94ec763e29 | ||
|
|
0a3b5782a8 | ||
|
|
ea0528ed2c | ||
|
|
f6f5ce4687 | ||
|
|
fb1d090120 | ||
|
|
71a4edfa4f | ||
|
|
2661828ec3 | ||
|
|
852f45d85e | ||
|
|
858b66a883 | ||
|
|
90e9d873f0 | ||
|
|
4e9cdb10a4 | ||
|
|
3d119813dd | ||
|
|
1ba4c0ee6d | ||
|
|
d775f91c3e | ||
|
|
fd2483629a | ||
|
|
036138bb19 | ||
|
|
dd214c8ff9 | ||
|
|
57800a1fba | ||
|
|
729bb03b70 | ||
|
|
1b83bec7c0 |
100
.github/workflows/build-java-app.yml
vendored
Normal file
100
.github/workflows/build-java-app.yml
vendored
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
name: Build Java App
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
app:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dockerTag:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
enabled:
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
shouldBuild:
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-java:
|
||||||
|
if: ${{ inputs.enabled && inputs.shouldBuild }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Detect frontend
|
||||||
|
id: detect_web
|
||||||
|
run: |
|
||||||
|
if [ -d "apps/${{ inputs.app }}/web" ]; then
|
||||||
|
echo "has_web=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "has_web=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build React frontend
|
||||||
|
if: ${{ steps.detect_web.outputs.has_web == 'true' }}
|
||||||
|
run: |
|
||||||
|
cd apps/${{ inputs.app }}/web
|
||||||
|
npm install
|
||||||
|
export CI=false
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Copy React build into Spring Boot resources
|
||||||
|
if: ${{ steps.detect_web.outputs.has_web == 'true' }}
|
||||||
|
run: |
|
||||||
|
rm -rf apps/${{ inputs.app }}/src/main/resources/static
|
||||||
|
mkdir -p apps/${{ inputs.app }}/src/main/resources/static
|
||||||
|
cp -r apps/${{ inputs.app }}/web/build/* apps/${{ inputs.app }}/src/main/resources/static
|
||||||
|
|
||||||
|
- name: Extract version
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep '^version' apps/${{ inputs.app }}/build.gradle.kts | sed 's/.*"\(.*\)".*/\1/')
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:${{ inputs.app }}:test --info --stacktrace
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Java module
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:${{ inputs.app }}:bootJar --info --stacktrace
|
||||||
|
|
||||||
|
- name: Build Docker image locally
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-f ./dockerfiles/DebianJava \
|
||||||
|
-t local-${{ inputs.app }}:${{ inputs.dockerTag }} \
|
||||||
|
--build-arg MODULE_NAME=${{ inputs.app }} \
|
||||||
|
--build-arg PASS_APP_VERSION=${{ env.VERSION }} \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Test Docker container
|
||||||
|
run: |
|
||||||
|
docker run --rm local-${{ inputs.app }}:${{ inputs.dockerTag }} /bin/sh -c "echo 'Smoke test OK'"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=${{ inputs.app }}
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ inputs.dockerTag }}
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ github.sha }}
|
||||||
127
.github/workflows/build-python-app.yml
vendored
Normal file
127
.github/workflows/build-python-app.yml
vendored
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
name: Build Python App
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
app:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dockerTag:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
enabled:
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
shouldBuild:
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-python:
|
||||||
|
if: ${{ inputs.enabled && inputs.shouldBuild }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Cache pip per app
|
||||||
|
# -----------------------------
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ inputs.app }}-${{ hashFiles('apps/${{ inputs.app }}/requirements*.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-${{ inputs.app }}-
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Install Python deps
|
||||||
|
# -----------------------------
|
||||||
|
- name: Install dependencies
|
||||||
|
working-directory: apps/${{ inputs.app }}
|
||||||
|
run: |
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Run tests
|
||||||
|
# -----------------------------
|
||||||
|
- name: Run Python tests
|
||||||
|
working-directory: apps/${{ inputs.app }}
|
||||||
|
run: python -m pytest -q
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Setup Buildx
|
||||||
|
# -----------------------------
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Cache Docker layers per app
|
||||||
|
# -----------------------------
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache-${{ inputs.app }}
|
||||||
|
key: ${{ runner.os }}-buildx-${{ inputs.app }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-${{ inputs.app }}-
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Build image (load locally for smoke test)
|
||||||
|
# -----------------------------
|
||||||
|
- name: Build Docker image (local load)
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/Python
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=${{ inputs.app }}
|
||||||
|
load: true
|
||||||
|
tags: local-${{ inputs.app }}:${{ inputs.dockerTag }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache-${{ inputs.app }}
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-${{ inputs.app }}-new
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Smoke test
|
||||||
|
# -----------------------------
|
||||||
|
- name: Smoke test container
|
||||||
|
run: |
|
||||||
|
docker run --rm local-${{ inputs.app }}:${{ inputs.dockerTag }} \
|
||||||
|
/bin/sh -c "echo 'Smoke test OK'"
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Docker login
|
||||||
|
# -----------------------------
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Push final image (no rebuild)
|
||||||
|
# -----------------------------
|
||||||
|
- name: Push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/Python
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=${{ inputs.app }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ inputs.dockerTag }}
|
||||||
|
bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ github.sha }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache-${{ inputs.app }}
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-${{ inputs.app }}-new
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Move Docker cache
|
||||||
|
# -----------------------------
|
||||||
|
- name: Move Docker cache
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/.buildx-cache-${{ inputs.app }}
|
||||||
|
mv /tmp/.buildx-cache-${{ inputs.app }}-new /tmp/.buildx-cache-${{ inputs.app }}
|
||||||
26
.github/workflows/build-shared.yml
vendored
Normal file
26
.github/workflows/build-shared.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Build Shared
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
dockerTag:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-shared:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Build Shared module
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :shared:build --info --stacktrace
|
||||||
115
.github/workflows/build-v5.yml
vendored
Normal file
115
.github/workflows/build-v5.yml
vendored
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
name: Build v5
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ v5 ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ v5 ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
sharedDefinitions: ${{ steps.filter.outputs.sharedDefinitions }}
|
||||||
|
shared: ${{ steps.filter.outputs.shared }}
|
||||||
|
processer: ${{ steps.filter.outputs.processer }}
|
||||||
|
converter: ${{ steps.filter.outputs.converter }}
|
||||||
|
coordinator: ${{ steps.filter.outputs.coordinator }}
|
||||||
|
ui: ${{ steps.filter.outputs.ui }}
|
||||||
|
py-metadata: ${{ steps.filter.outputs.metadata }}
|
||||||
|
py-watcher: ${{ steps.filter.outputs.watcher }}
|
||||||
|
dockerTag: ${{ steps.tag.outputs.tag }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
base: ${{ github.event.before }}
|
||||||
|
|
||||||
|
- name: Detect changes
|
||||||
|
id: filter
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
shared:
|
||||||
|
- 'shared/**'
|
||||||
|
sharedDefinitions:
|
||||||
|
- 'gradle/**'
|
||||||
|
processer:
|
||||||
|
- 'apps/processer/**'
|
||||||
|
converter:
|
||||||
|
- 'apps/converter/**'
|
||||||
|
coordinator:
|
||||||
|
- 'apps/coordinator/**'
|
||||||
|
ui:
|
||||||
|
- 'apps/ui/**'
|
||||||
|
metadata:
|
||||||
|
- 'apps/py-metadata/**'
|
||||||
|
watcher:
|
||||||
|
- 'apps/py-watcher/**'
|
||||||
|
|
||||||
|
- name: Generate docker tag
|
||||||
|
id: tag
|
||||||
|
run: echo "tag=$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
build-shared:
|
||||||
|
needs: pre-check
|
||||||
|
if: ${{
|
||||||
|
needs.pre-check.outputs.shared == 'true'
|
||||||
|
|| needs.pre-check.outputs.sharedDefinitions == 'true'
|
||||||
|
|| needs.pre-check.outputs.processer == 'true'
|
||||||
|
|| needs.pre-check.outputs.converter == 'true'
|
||||||
|
|| needs.pre-check.outputs.coordinator == 'true'
|
||||||
|
|| needs.pre-check.outputs.ui == 'true'
|
||||||
|
|| github.event_name == 'workflow_dispatch'
|
||||||
|
}}
|
||||||
|
uses: ./.github/workflows/build-shared.yml
|
||||||
|
with:
|
||||||
|
dockerTag: ${{ needs.pre-check.outputs.dockerTag }}
|
||||||
|
|
||||||
|
build-java:
|
||||||
|
needs: [pre-check, build-shared]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- app: processer
|
||||||
|
enabled: true
|
||||||
|
- app: converter
|
||||||
|
enabled: true
|
||||||
|
- app: coordinator
|
||||||
|
enabled: true
|
||||||
|
- app: ui
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
uses: ./.github/workflows/build-java-app.yml
|
||||||
|
with:
|
||||||
|
app: ${{ matrix.app }}
|
||||||
|
dockerTag: ${{ needs.pre-check.outputs.dockerTag }}
|
||||||
|
enabled: ${{ matrix.enabled }}
|
||||||
|
shouldBuild: ${{ needs.pre-check.outputs[matrix.app] == 'true'
|
||||||
|
|| needs.pre-check.outputs.shared == 'true'
|
||||||
|
|| needs.pre-check.outputs.sharedDefinitions == 'true'
|
||||||
|
|| github.event_name == 'workflow_dispatch' }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
|
||||||
|
build-python:
|
||||||
|
needs: [pre-check]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- app: py-metadata
|
||||||
|
enabled: true
|
||||||
|
- app: py-watcher
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
uses: ./.github/workflows/build-python-app.yml
|
||||||
|
with:
|
||||||
|
app: ${{ matrix.app }}
|
||||||
|
dockerTag: ${{ needs.pre-check.outputs.dockerTag }}
|
||||||
|
enabled: ${{ matrix.enabled }}
|
||||||
|
shouldBuild: ${{ needs.pre-check.outputs[matrix.app] == 'true'
|
||||||
|
|| github.event_name == 'workflow_dispatch' }}
|
||||||
|
secrets: inherit
|
||||||
250
.github/workflows/main.yml
vendored
250
.github/workflows/main.yml
vendored
@ -1,250 +0,0 @@
|
|||||||
name: Build Modules
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pre-check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
pyMetadata: ${{ steps.filter.outputs.pyMetadata }}
|
|
||||||
commonCode: ${{ steps.filter.outputs.commonCode }}
|
|
||||||
reader: ${{ steps.filter.outputs.reader }}
|
|
||||||
encode: ${{ steps.filter.outputs.encode }}
|
|
||||||
convert: ${{ steps.filter.outputs.convert }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: dorny/paths-filter@v2
|
|
||||||
id: filter
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
pyMetadata:
|
|
||||||
- 'pyMetadata/**'
|
|
||||||
reader:
|
|
||||||
- 'Reader/**'
|
|
||||||
encode:
|
|
||||||
- 'Encode/**'
|
|
||||||
convert:
|
|
||||||
- 'Convert/**'
|
|
||||||
commonCode:
|
|
||||||
- 'CommonCode/**'
|
|
||||||
# Step to print the outputs from "pre-check" job
|
|
||||||
- name: Print Outputs from pre-check job
|
|
||||||
run: |
|
|
||||||
echo "pyMetadata: ${{ needs.pre-check.outputs.pyMetadata }}"
|
|
||||||
echo "commonCode: ${{ needs.pre-check.outputs.commonCode }}"
|
|
||||||
echo "reader: ${{ needs.pre-check.outputs.reader }}"
|
|
||||||
echo "encode: ${{ needs.pre-check.outputs.encode }}"
|
|
||||||
echo "convert: ${{ needs.pre-check.outputs.convert }}"
|
|
||||||
|
|
||||||
build-commoncode:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: pre-check
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache CommonCode Gradle dependencies
|
|
||||||
id: cache-gradle
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('CommonCode/gradle/wrapper/gradle-wrapper.properties') }}
|
|
||||||
|
|
||||||
- name: Build CommonCode
|
|
||||||
if: steps.cache-gradle.outputs.cache-hit != 'true' || needs.pre-check.outputs.commonCode == 'true' || github.event_name == 'workflow_dispatch'
|
|
||||||
run: |
|
|
||||||
cd CommonCode
|
|
||||||
chmod +x ./gradlew
|
|
||||||
./gradlew build
|
|
||||||
|
|
||||||
build-encode:
|
|
||||||
needs: build-commoncode
|
|
||||||
if: ${{ needs.pre-check.outputs.encode == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.commonCode == 'true' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache CommonCode Gradle dependencies
|
|
||||||
id: cache-gradle
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('CommonCode/gradle/wrapper/gradle-wrapper.properties') }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Build Encode module
|
|
||||||
id: build-encode
|
|
||||||
run: |
|
|
||||||
cd Encode
|
|
||||||
chmod +x ./gradlew
|
|
||||||
./gradlew build
|
|
||||||
echo "Build completed"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Generate Docker image tag
|
|
||||||
id: docker-tag
|
|
||||||
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
|
||||||
|
|
||||||
- name: Docker login
|
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: ./Encode
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
bskjon/mediaprocessing-encoder:latest
|
|
||||||
bskjon/mediaprocessing-encoder:${{ github.sha }}
|
|
||||||
bskjon/mediaprocessing-encoder:${{ steps.docker-tag.outputs.tag }}
|
|
||||||
|
|
||||||
build-reader:
|
|
||||||
needs: build-commoncode
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ needs.pre-check.outputs.reader == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.commonCode == 'true' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache CommonCode Gradle dependencies
|
|
||||||
id: cache-gradle
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('CommonCode/gradle/wrapper/gradle-wrapper.properties') }}
|
|
||||||
|
|
||||||
- name: Build Reader module
|
|
||||||
id: build-reader
|
|
||||||
run: |
|
|
||||||
cd Reader
|
|
||||||
chmod +x ./gradlew
|
|
||||||
./gradlew build
|
|
||||||
echo "Build completed"
|
|
||||||
|
|
||||||
- name: Generate Docker image tag
|
|
||||||
id: docker-tag
|
|
||||||
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
|
||||||
|
|
||||||
- name: Docker login
|
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: ./Reader
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
bskjon/mediaprocessing-reader:latest
|
|
||||||
bskjon/mediaprocessing-reader:${{ github.sha }}
|
|
||||||
bskjon/mediaprocessing-reader:${{ steps.docker-tag.outputs.tag }}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build-pymetadata:
|
|
||||||
needs: pre-check
|
|
||||||
if: ${{ needs.pre-check.outputs.pyMetadata == 'true' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Build pyMetadata module
|
|
||||||
id: build-pymetadata
|
|
||||||
run: |
|
|
||||||
if [[ "${{ steps.check-pymetadata.outputs.changed }}" == "true" || "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
||||||
cd pyMetadata
|
|
||||||
# Add the necessary build steps for your Python module here
|
|
||||||
echo "Build completed"
|
|
||||||
else
|
|
||||||
echo "pyMetadata has not changed. Skipping pyMetadata module build."
|
|
||||||
echo "::set-output name=job_skipped::true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate Docker image tag
|
|
||||||
id: docker-tag
|
|
||||||
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
|
||||||
|
|
||||||
- name: Docker login
|
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: ./pyMetadata
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
bskjon/mediaprocessing-pymetadata:latest
|
|
||||||
bskjon/mediaprocessing-pymetadata:${{ github.sha }}
|
|
||||||
bskjon/mediaprocessing-pymetadata:${{ steps.docker-tag.outputs.tag }}
|
|
||||||
|
|
||||||
|
|
||||||
build-convert:
|
|
||||||
needs: build-commoncode
|
|
||||||
if: ${{ needs.pre-check.outputs.convert == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.commonCode == 'true' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Cache CommonCode Gradle dependencies
|
|
||||||
id: cache-gradle
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('CommonCode/gradle/wrapper/gradle-wrapper.properties') }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Build Convert module
|
|
||||||
id: build-convert
|
|
||||||
run: |
|
|
||||||
cd Convert
|
|
||||||
chmod +x ./gradlew
|
|
||||||
./gradlew build
|
|
||||||
echo "Build completed"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Generate Docker image tag
|
|
||||||
id: docker-tag
|
|
||||||
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
|
||||||
|
|
||||||
- name: Docker login
|
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: ./Convert
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
bskjon/mediaprocessing-converter:latest
|
|
||||||
bskjon/mediaprocessing-converter:${{ github.sha }}
|
|
||||||
bskjon/mediaprocessing-converter:${{ steps.docker-tag.outputs.tag }}
|
|
||||||
295
.github/workflows/v2.yml
vendored
Normal file
295
.github/workflows/v2.yml
vendored
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
name: Build V2
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v2
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- v2
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
pyMetadata: ${{ steps.filter.outputs.pyMetadata }}
|
||||||
|
coordinator: ${{ steps.filter.outputs.coordinator }}
|
||||||
|
processer: ${{ steps.filter.outputs.processer }}
|
||||||
|
converter: ${{ steps.filter.outputs.converter }}
|
||||||
|
shared: ${{ steps.filter.outputs.shared }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
pyMetadata:
|
||||||
|
- 'apps/pyMetadata/**'
|
||||||
|
apps/coordinator:
|
||||||
|
- 'apps/coordinator/**'
|
||||||
|
apps/processer:
|
||||||
|
- 'apps/processer/**'
|
||||||
|
apps/converter:
|
||||||
|
- 'apps/converter/**'
|
||||||
|
|
||||||
|
shared:
|
||||||
|
- 'shared/**'
|
||||||
|
# Step to print the outputs from "pre-check" job
|
||||||
|
- name: Print Outputs from pre-check job
|
||||||
|
run: |
|
||||||
|
echo "Apps\n"
|
||||||
|
echo "app:pyMetadata: ${{ needs.pre-check.outputs.pyMetadata }}"
|
||||||
|
echo "app:coordinator: ${{ needs.pre-check.outputs.coordinator }}"
|
||||||
|
echo "app:processer: ${{ needs.pre-check.outputs.processer }}"
|
||||||
|
echo "app:converter: ${{ needs.pre-check.outputs.converter }}"
|
||||||
|
|
||||||
|
echo "Shared"
|
||||||
|
echo "shared: ${{ needs.pre-check.outputs.shared }}"
|
||||||
|
echo "\n"
|
||||||
|
echo "${{ needs.pre-check.outputs }}"
|
||||||
|
echo "${{ needs.pre-check }}"
|
||||||
|
|
||||||
|
build-shared:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: pre-check
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared code Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Build Shared code
|
||||||
|
if: steps.cache-gradle.outputs.cache-hit != 'true' || needs.pre-check.outputs.shared == 'true' || github.event_name == 'workflow_dispatch'
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :shared:build --stacktrace --info
|
||||||
|
|
||||||
|
|
||||||
|
build-processer:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.processer == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/processer/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Processer module
|
||||||
|
id: build-processer
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:processer:bootJar --info
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=processer
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-processer:v2
|
||||||
|
bskjon/mediaprocessing-processer:v2-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-processer:v2-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-converter:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.converter == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/converter/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Converter module
|
||||||
|
id: build-converter
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:converter:bootJar --info
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJava
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=converter
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-converter:v2
|
||||||
|
bskjon/mediaprocessing-converter:v2-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-converter:v2-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-coordinator:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.coordinator == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/coordinator/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build Coordinator module
|
||||||
|
id: build-coordinator
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:coordinator:bootJar
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Debug Check extracted version
|
||||||
|
run: |
|
||||||
|
echo "Extracted version: ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=coordinator
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-coordinator:v2
|
||||||
|
bskjon/mediaprocessing-coordinator:v2-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-coordinator:v2-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-pymetadata:
|
||||||
|
needs: pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.pyMetadata == 'true' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build pyMetadata module
|
||||||
|
id: build-pymetadata
|
||||||
|
run: |
|
||||||
|
if [[ "${{ steps.check-pymetadata.outputs.changed }}" == "true" || "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
cd apps/pyMetadata
|
||||||
|
# Add the necessary build steps for your Python module here
|
||||||
|
echo "Build completed"
|
||||||
|
else
|
||||||
|
echo "pyMetadata has not changed. Skipping pyMetadata module build."
|
||||||
|
echo "::set-output name=job_skipped::true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5.1.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/Python
|
||||||
|
build-args:
|
||||||
|
MODULE_NAME=pyMetadata
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-pymetadata:v2
|
||||||
|
bskjon/mediaprocessing-pymetadata:v2-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-pymetadata:v2-${{ steps.docker-tag.outputs.tag }}
|
||||||
295
.github/workflows/v3.yml
vendored
Normal file
295
.github/workflows/v3.yml
vendored
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
name: Build V3
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v3
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- v3
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
pyMetadata: ${{ steps.filter.outputs.pyMetadata }}
|
||||||
|
coordinator: ${{ steps.filter.outputs.coordinator }}
|
||||||
|
processer: ${{ steps.filter.outputs.processer }}
|
||||||
|
converter: ${{ steps.filter.outputs.converter }}
|
||||||
|
shared: ${{ steps.filter.outputs.shared }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
pyMetadata:
|
||||||
|
- 'apps/pyMetadata/**'
|
||||||
|
apps/coordinator:
|
||||||
|
- 'apps/coordinator/**'
|
||||||
|
apps/processer:
|
||||||
|
- 'apps/processer/**'
|
||||||
|
apps/converter:
|
||||||
|
- 'apps/converter/**'
|
||||||
|
|
||||||
|
shared:
|
||||||
|
- 'shared/**'
|
||||||
|
# Step to print the outputs from "pre-check" job
|
||||||
|
- name: Print Outputs from pre-check job
|
||||||
|
run: |
|
||||||
|
echo "Apps\n"
|
||||||
|
echo "app:pyMetadata: ${{ needs.pre-check.outputs.pyMetadata }}"
|
||||||
|
echo "app:coordinator: ${{ needs.pre-check.outputs.coordinator }}"
|
||||||
|
echo "app:processer: ${{ needs.pre-check.outputs.processer }}"
|
||||||
|
echo "app:converter: ${{ needs.pre-check.outputs.converter }}"
|
||||||
|
|
||||||
|
echo "Shared"
|
||||||
|
echo "shared: ${{ needs.pre-check.outputs.shared }}"
|
||||||
|
echo "\n"
|
||||||
|
echo "${{ needs.pre-check.outputs }}"
|
||||||
|
echo "${{ needs.pre-check }}"
|
||||||
|
|
||||||
|
build-shared:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: pre-check
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared code Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Build Shared code
|
||||||
|
if: steps.cache-gradle.outputs.cache-hit != 'true' || needs.pre-check.outputs.shared == 'true' || github.event_name == 'workflow_dispatch'
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :shared:build --stacktrace --info
|
||||||
|
|
||||||
|
|
||||||
|
build-processer:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.processer == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/processer/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Processer module
|
||||||
|
id: build-processer
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:processer:bootJar --info --stacktrace
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=processer
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-processer:v3
|
||||||
|
bskjon/mediaprocessing-processer:v3-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-processer:v3-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-converter:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.converter == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/converter/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Converter module
|
||||||
|
id: build-converter
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:converter:bootJar --info --debug
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJava
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=converter
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-converter:v3
|
||||||
|
bskjon/mediaprocessing-converter:v3-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-converter:v3-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-coordinator:
|
||||||
|
needs: build-shared
|
||||||
|
if: ${{ needs.pre-check.outputs.coordinator == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.shared == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/coordinator/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build Coordinator module
|
||||||
|
id: build-coordinator
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:coordinator:bootJar
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Debug Check extracted version
|
||||||
|
run: |
|
||||||
|
echo "Extracted version: ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=coordinator
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-coordinator:v3
|
||||||
|
bskjon/mediaprocessing-coordinator:v3-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-coordinator:v3-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-pymetadata:
|
||||||
|
needs: pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.pyMetadata == 'true' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build pyMetadata module
|
||||||
|
id: build-pymetadata
|
||||||
|
run: |
|
||||||
|
if [[ "${{ steps.check-pymetadata.outputs.changed }}" == "true" || "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
cd apps/pyMetadata
|
||||||
|
# Add the necessary build steps for your Python module here
|
||||||
|
echo "Build completed"
|
||||||
|
else
|
||||||
|
echo "pyMetadata has not changed. Skipping pyMetadata module build."
|
||||||
|
echo "::set-output name=job_skipped::true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5.1.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/Python
|
||||||
|
build-args:
|
||||||
|
MODULE_NAME=pyMetadata
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-pymetadata:v3
|
||||||
|
bskjon/mediaprocessing-pymetadata:v3-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-pymetadata:v3-${{ steps.docker-tag.outputs.tag }}
|
||||||
386
.github/workflows/v4.yml
vendored
Normal file
386
.github/workflows/v4.yml
vendored
Normal file
@ -0,0 +1,386 @@
|
|||||||
|
name: Build v4
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v4
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- v4
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
pyMetadata: ${{ steps.checkAppChanges.outputs.metadata }}
|
||||||
|
sharedLibrary: ${{ steps.checkAppChanges.outputs.shared }}
|
||||||
|
coordinator: ${{ steps.checkAppChanges.outputs.coordinator }}
|
||||||
|
processer: ${{ steps.checkAppChanges.outputs.processer }}
|
||||||
|
converter: ${{ steps.checkAppChanges.outputs.converter }}
|
||||||
|
ui: ${{ steps.checkAppChanges.outputs.ui }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
name: "Detect app changes"
|
||||||
|
id: checkAppChanges
|
||||||
|
with:
|
||||||
|
base: ''
|
||||||
|
filters: |
|
||||||
|
metadata:
|
||||||
|
- 'apps/pyMetadata/**'
|
||||||
|
coordinator:
|
||||||
|
- 'apps/coordinator/**'
|
||||||
|
processer:
|
||||||
|
- 'apps/processer/**'
|
||||||
|
converter:
|
||||||
|
- 'apps/converter/**'
|
||||||
|
ui:
|
||||||
|
- 'apps/ui/**'
|
||||||
|
shared:
|
||||||
|
- 'shared/**'
|
||||||
|
|
||||||
|
# Step to print the outputs from "pre-check" job
|
||||||
|
- name: Print Outputs from pre-check job
|
||||||
|
run: |
|
||||||
|
echo "Apps\n"
|
||||||
|
echo "app:pyMetadata: ${{ steps.checkAppChanges.outputs.metadata }}"
|
||||||
|
echo "app:coordinator: ${{ steps.checkAppChanges.outputs.coordinator }}"
|
||||||
|
echo "app:processer: ${{ steps.checkAppChanges.outputs.processer }}"
|
||||||
|
echo "app:converter: ${{ steps.checkAppChanges.outputs.converter }}"
|
||||||
|
echo "app:ui: ${{ steps.checkAppChanges.outputs.ui }}"
|
||||||
|
|
||||||
|
echo "Shared"
|
||||||
|
echo "shared: ${{ steps.checkAppChanges.outputs.shared }}"
|
||||||
|
echo "${{ steps.checkAppChanges.outputs }}"
|
||||||
|
|
||||||
|
build-shared:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: pre-check
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared code Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Build Shared code
|
||||||
|
if: steps.cache-gradle.outputs.cache-hit != 'true' || needs.pre-check.outputs.sharedLibrary == 'true' || github.event_name == 'workflow_dispatch'
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :shared:build --stacktrace --info
|
||||||
|
|
||||||
|
|
||||||
|
build-processer:
|
||||||
|
needs:
|
||||||
|
- build-shared
|
||||||
|
- pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.processer == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.sharedLibrary == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/processer/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Processer module
|
||||||
|
id: build-processer
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:processer:bootJar --info --stacktrace
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=processer
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-processer:v4
|
||||||
|
bskjon/mediaprocessing-processer:v4-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-processer:v4-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-converter:
|
||||||
|
needs:
|
||||||
|
- build-shared
|
||||||
|
- pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.converter == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.sharedLibrary == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/converter/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build Converter module
|
||||||
|
id: build-converter
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:converter:bootJar --info --debug
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJava
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=converter
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-converter:v4
|
||||||
|
bskjon/mediaprocessing-converter:v4-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-converter:v4-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-coordinator:
|
||||||
|
needs:
|
||||||
|
- build-shared
|
||||||
|
- pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.coordinator == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.sharedLibrary == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/coordinator/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build Coordinator module
|
||||||
|
id: build-coordinator
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:coordinator:bootJar
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Debug Check extracted version
|
||||||
|
run: |
|
||||||
|
echo "Extracted version: ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJavaFfmpeg
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=coordinator
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-coordinator:v4
|
||||||
|
bskjon/mediaprocessing-coordinator:v4-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-coordinator:v4-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-pymetadata:
|
||||||
|
needs:
|
||||||
|
- pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.pyMetadata == 'true' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Build pyMetadata module
|
||||||
|
id: build-pymetadata
|
||||||
|
run: |
|
||||||
|
if [[ "${{ needs.pre-check.outputs.pyMetadata }}" == "true" || "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
cd apps/pyMetadata
|
||||||
|
# Add the necessary build steps for your Python module here
|
||||||
|
echo "Build completed"
|
||||||
|
else
|
||||||
|
echo "pyMetadata has not changed. Skipping pyMetadata module build."
|
||||||
|
echo "::set-output name=job_skipped::true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5.1.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/Python
|
||||||
|
build-args:
|
||||||
|
MODULE_NAME=pyMetadata
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-pymetadata:v4
|
||||||
|
bskjon/mediaprocessing-pymetadata:v4-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-pymetadata:v4-${{ steps.docker-tag.outputs.tag }}
|
||||||
|
|
||||||
|
build-ui:
|
||||||
|
needs:
|
||||||
|
- build-shared
|
||||||
|
- pre-check
|
||||||
|
if: ${{ needs.pre-check.outputs.ui == 'true' || github.event_name == 'workflow_dispatch' || needs.pre-check.outputs.sharedLibrary == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Shared Gradle dependencies
|
||||||
|
id: cache-gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('shared/build.gradle.kts') }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
working-directory: ./apps/ui/web
|
||||||
|
|
||||||
|
- name: Build React app
|
||||||
|
run: |
|
||||||
|
export CI=false
|
||||||
|
npm run build
|
||||||
|
working-directory: ./apps/ui/web
|
||||||
|
|
||||||
|
- name : Copy build files
|
||||||
|
run: |
|
||||||
|
mkdir -p ./apps/ui/src/main/resources/static
|
||||||
|
cp -r ./apps/ui/web/build/* ./apps/ui/src/main/resources/static
|
||||||
|
|
||||||
|
- name: Extract version from build.gradle.kts
|
||||||
|
id: extract_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat ./apps/ui/build.gradle.kts | grep '^version\s*=\s*\".*\"' | sed 's/^version\s*=\s*\"\(.*\)\"/\1/')
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build UI module
|
||||||
|
id: build-ui
|
||||||
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew :apps:ui:bootJar
|
||||||
|
echo "Build completed"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Generate Docker image tag
|
||||||
|
id: docker-tag
|
||||||
|
run: echo "::set-output name=tag::$(date -u +'%Y.%m.%d')-$(uuidgen | cut -c 1-8)"
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Debug Check extracted version
|
||||||
|
run: |
|
||||||
|
echo "Extracted version: ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./dockerfiles/DebianJava
|
||||||
|
build-args: |
|
||||||
|
MODULE_NAME=ui
|
||||||
|
PASS_APP_VERSION=${{ env.VERSION }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
bskjon/mediaprocessing-ui:v4
|
||||||
|
bskjon/mediaprocessing-ui:v4-${{ github.sha }}
|
||||||
|
bskjon/mediaprocessing-ui:v4-${{ steps.docker-tag.outputs.tag }}
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@ -5,8 +5,6 @@ build/
|
|||||||
!**/src/test/**/build/
|
!**/src/test/**/build/
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea
|
|
||||||
**/.idea/*
|
|
||||||
.idea/modules.xml
|
.idea/modules.xml
|
||||||
.idea/jarRepositories.xml
|
.idea/jarRepositories.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
@ -38,7 +36,12 @@ bin/
|
|||||||
/.nb-gradle/
|
/.nb-gradle/
|
||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
### Mac OS ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|
||||||
|
.idea/runConfigurations
|
||||||
|
/apps/py-metadata/venv/
|
||||||
|
/apps/py-watcher/venv/
|
||||||
|
|||||||
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
|||||||
|
MediaProcessing
|
||||||
6
.idea/copilot.data.migration.agent.xml
generated
Normal file
6
.idea/copilot.data.migration.agent.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AgentMigrationStateService">
|
||||||
|
<option name="migrationStatus" value="COMPLETED" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/copilot.data.migration.ask.xml
generated
Normal file
6
.idea/copilot.data.migration.ask.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AskMigrationStateService">
|
||||||
|
<option name="migrationStatus" value="COMPLETED" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/copilot.data.migration.ask2agent.xml
generated
Normal file
6
.idea/copilot.data.migration.ask2agent.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Ask2AgentMigrationStateService">
|
||||||
|
<option name="migrationStatus" value="COMPLETED" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/copilot.data.migration.edit.xml
generated
Normal file
6
.idea/copilot.data.migration.edit.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EditMigrationStateService">
|
||||||
|
<option name="migrationStatus" value="COMPLETED" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
26
.idea/gradle.xml
generated
Normal file
26
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleJvm" value="17" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/apps" />
|
||||||
|
<option value="$PROJECT_DIR$/apps/converter" />
|
||||||
|
<option value="$PROJECT_DIR$/apps/coordinator" />
|
||||||
|
<option value="$PROJECT_DIR$/apps/processer" />
|
||||||
|
<option value="$PROJECT_DIR$/apps/ui" />
|
||||||
|
<option value="$PROJECT_DIR$/shared" />
|
||||||
|
<option value="$PROJECT_DIR$/shared/common" />
|
||||||
|
<option value="$PROJECT_DIR$/shared/event-task-contract" />
|
||||||
|
<option value="$PROJECT_DIR$/shared/ffmpeg" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/kotlinc.xml
generated
Normal file
6
.idea/kotlinc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="2.1.0" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
5
.idea/misc.xml
generated
Normal file
5
.idea/misc.xml
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="azul-17" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
||||||
26
.idea/runConfigurations/UIApplicationKt.xml
generated
Normal file
26
.idea/runConfigurations/UIApplicationKt.xml
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="UIApplicationKt" type="JetRunConfigurationType" nameIsGenerated="true">
|
||||||
|
<envs>
|
||||||
|
<env name="DATABASE_ADDRESS" value="192.168.2.250" />
|
||||||
|
<env name="DATABASE_NAME_E" value="eventsV4" />
|
||||||
|
<env name="DATABASE_NAME_S" value="streamitv3" />
|
||||||
|
<env name="DATABASE_PASSWORD" value="shFZ27eL2x2NoxyEDBMfDWkvFO" />
|
||||||
|
<env name="DATABASE_PORT" value="3306" />
|
||||||
|
<env name="DATABASE_USERNAME" value="root" />
|
||||||
|
<env name="DIRECTORY_CONTENT_INCOMING" value="G:\MediaProcessingPlayground\input" />
|
||||||
|
<env name="DIRECTORY_CONTENT_OUTGOING" value="G:\MediaProcessingPlayground\output" />
|
||||||
|
<env name="DISABLE_COMPLETE" value="true" />
|
||||||
|
<env name="DISABLE_PRODUCE" value="true" />
|
||||||
|
<env name="EncoderWs" value="ws://192.168.2.250:6081/ws" />
|
||||||
|
<env name="METADATA_TIMEOUT" value="0" />
|
||||||
|
<env name="SUPPORTING_EXECUTABLE_FFMPEG" value="G:\MediaProcessingPlayground\ffmpeg.exe" />
|
||||||
|
<env name="SUPPORTING_EXECUTABLE_FFPROBE" value="G:\MediaProcessingPlayground\ffprobe.exe" />
|
||||||
|
</envs>
|
||||||
|
<option name="MAIN_CLASS_NAME" value="no.iktdev.mediaprocessing.ui.UIApplicationKt" />
|
||||||
|
<module name="MediaProcessing.apps.ui.main" />
|
||||||
|
<shortenClasspath name="NONE" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1281
.idea/workspace.xml
generated
Normal file
1281
.idea/workspace.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
CommonCode/.gitignore
vendored
42
CommonCode/.gitignore
vendored
@ -1,42 +0,0 @@
|
|||||||
.gradle
|
|
||||||
build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea/modules.xml
|
|
||||||
.idea/jarRepositories.xml
|
|
||||||
.idea/compiler.xml
|
|
||||||
.idea/libraries/
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
out/
|
|
||||||
!**/src/main/**/out/
|
|
||||||
!**/src/test/**/out/
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
bin/
|
|
||||||
!**/src/main/**/bin/
|
|
||||||
!**/src/test/**/bin/
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
|
||||||
.DS_Store
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
plugins {
|
|
||||||
kotlin("jvm") version "1.8.21"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "no.iktdev.streamit.content"
|
|
||||||
version = "1.0-SNAPSHOT"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/releases")
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/snapshots")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("com.github.pgreze:kotlin-process:1.3.1")
|
|
||||||
implementation("io.github.microutils:kotlin-logging-jvm:2.0.11")
|
|
||||||
|
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-kafka:0.0.2-alpha84")
|
|
||||||
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
|
||||||
|
|
||||||
implementation("com.google.code.gson:gson:2.8.9")
|
|
||||||
implementation("org.json:json:20230227")
|
|
||||||
|
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.1")
|
|
||||||
testImplementation("org.assertj:assertj-core:3.4.1")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
#Sat Jul 15 17:55:49 CEST 2023
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
rootProject.name = "CommonCode"
|
|
||||||
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
object CommonConfig {
|
|
||||||
var kafkaTopic: String = System.getenv("KAFKA_TOPIC") ?: "contentEvents"
|
|
||||||
var incomingContent: File = if (!System.getenv("DIRECTORY_CONTENT_INCOMING").isNullOrBlank()) File(System.getenv("DIRECTORY_CONTENT_INCOMING")) else File("/src/input")
|
|
||||||
val outgoingContent: File = if (!System.getenv("DIRECTORY_CONTENT_OUTGOING").isNullOrBlank()) File(System.getenv("DIRECTORY_CONTENT_OUTGOING")) else File("/src/output")
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.consumers.DefaultConsumer
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Status
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
import no.iktdev.streamit.library.kafka.producer.DefaultProducer
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
abstract class DefaultKafkaReader(val subId: String = UUID.randomUUID().toString()) {
|
|
||||||
val messageProducer = DefaultProducer(CommonConfig.kafkaTopic)
|
|
||||||
val defaultConsumer = DefaultConsumer(subId = subId)
|
|
||||||
|
|
||||||
open fun loadDeserializers(): Map<String, IMessageDataDeserialization<*>> {
|
|
||||||
return emptyMap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun produceErrorMessage(event: KafkaEvents, baseMessage: Message, reason: String) {
|
|
||||||
val message = Message(
|
|
||||||
referenceId = baseMessage.referenceId,
|
|
||||||
Status(statusType = StatusType.ERROR, message = reason)
|
|
||||||
)
|
|
||||||
messageProducer.sendMessage(event.event, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun produceErrorMessage(event: KafkaEvents, referenceId: String, reason: String) {
|
|
||||||
val message = Message(
|
|
||||||
referenceId = referenceId,
|
|
||||||
Status(statusType = StatusType.ERROR, message = reason)
|
|
||||||
)
|
|
||||||
messageProducer.sendMessage(event.event, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun produceMessage(event: KafkaEvents, baseMessage: Message, data: Any?) {
|
|
||||||
val message = Message(
|
|
||||||
referenceId = baseMessage.referenceId,
|
|
||||||
baseMessage.status,
|
|
||||||
data = data
|
|
||||||
)
|
|
||||||
messageProducer.sendMessage(event.event, message)
|
|
||||||
}
|
|
||||||
fun produceSuccessMessage(event: KafkaEvents, referenceId: String, data: Any? = null) {
|
|
||||||
val message = Message(
|
|
||||||
referenceId = referenceId,
|
|
||||||
status = Status(StatusType.SUCCESS),
|
|
||||||
data = data
|
|
||||||
)
|
|
||||||
messageProducer.sendMessage(event.event, message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import no.iktdev.exfl.using
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
import kotlin.math.sign
|
|
||||||
|
|
||||||
open class Downloader(val url: String, val outDir: File, val baseName: String) {
|
|
||||||
protected val http: HttpURLConnection = openConnection()
|
|
||||||
private val BUFFER_SIZE = 4096
|
|
||||||
|
|
||||||
private fun openConnection(): HttpURLConnection {
|
|
||||||
try {
|
|
||||||
return URL(url).openConnection() as HttpURLConnection
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
throw BadAddressException("Provided url is either not provided (null) or is not a valid http url")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun getLength(): Int {
|
|
||||||
return http.contentLength
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun getProgress(read: Int, total: Int = getLength()): Int {
|
|
||||||
return ((read * 100) / total)
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun download(): File? {
|
|
||||||
val extension = getExtension()
|
|
||||||
?: throw UnsupportedFormatException("Provided url does not contain a supported file extension")
|
|
||||||
val outFile = outDir.using("$baseName.$extension")
|
|
||||||
val inputStream = http.inputStream
|
|
||||||
val fos = FileOutputStream(outFile, false)
|
|
||||||
|
|
||||||
var totalBytesRead = 0
|
|
||||||
val buffer = ByteArray(BUFFER_SIZE)
|
|
||||||
inputStream.apply {
|
|
||||||
fos.use { fout ->
|
|
||||||
run {
|
|
||||||
var bytesRead = read(buffer)
|
|
||||||
while (bytesRead >= 0) {
|
|
||||||
fout.write(buffer, 0, bytesRead)
|
|
||||||
totalBytesRead += bytesRead
|
|
||||||
bytesRead = read(buffer)
|
|
||||||
// System.out.println(getProgress(totalBytesRead))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputStream.close()
|
|
||||||
fos.close()
|
|
||||||
return outFile
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun getExtension(): String? {
|
|
||||||
val possiblyExtension = url.lastIndexOf(".") + 1
|
|
||||||
return if (possiblyExtension > 1) {
|
|
||||||
return url.toString().substring(possiblyExtension)
|
|
||||||
} else {
|
|
||||||
val mimeType = http.contentType ?: null
|
|
||||||
contentTypeToExtension()[mimeType]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun contentTypeToExtension(): Map<String, String> {
|
|
||||||
return mapOf(
|
|
||||||
"image/png" to "png",
|
|
||||||
"image/jpeg" to "jpg",
|
|
||||||
"image/webp" to "webp",
|
|
||||||
"image/bmp" to "bmp",
|
|
||||||
"image/tiff" to "tiff"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class BadAddressException : java.lang.Exception {
|
|
||||||
constructor() : super() {}
|
|
||||||
constructor(message: String?) : super(message) {}
|
|
||||||
constructor(message: String?, cause: Throwable?) : super(message, cause) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UnsupportedFormatException : Exception {
|
|
||||||
constructor() : super() {}
|
|
||||||
constructor(message: String?) : super(message) {}
|
|
||||||
constructor(message: String?, cause: Throwable?) : super(message, cause) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class InvalidFileException : Exception {
|
|
||||||
constructor() : super() {}
|
|
||||||
constructor(message: String?) : super(message) {}
|
|
||||||
constructor(message: String?, cause: Throwable?) : super(message, cause) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import java.io.File
|
|
||||||
import java.io.RandomAccessFile
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
class FileAccess {
|
|
||||||
companion object {
|
|
||||||
fun isFileAvailable(file: File): Boolean {
|
|
||||||
if (!file.exists()) return false
|
|
||||||
var stream: RandomAccessFile? = null
|
|
||||||
try {
|
|
||||||
stream = RandomAccessFile(file, "rw")
|
|
||||||
stream.close()
|
|
||||||
logger.info { "File ${file.name} is read and writable" }
|
|
||||||
return true
|
|
||||||
} catch (e: Exception) {
|
|
||||||
stream?.close()
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
class Naming(val fileName: String) {
|
|
||||||
var cleanedFileName: String
|
|
||||||
private set
|
|
||||||
|
|
||||||
init {
|
|
||||||
cleanedFileName = fileName
|
|
||||||
.let { removeBracketedText(it) }
|
|
||||||
.let { removeParenthesizedText(it) }
|
|
||||||
.let { removeResolutionAndTags(it) }
|
|
||||||
.let { removeInBetweenCharacters(it) }
|
|
||||||
.let { removeExtraWhiteSpace(it) }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun guessDesiredFileName(): String {
|
|
||||||
val parts = cleanedFileName.split(" - ")
|
|
||||||
return when {
|
|
||||||
parts.size == 2 && parts[1].matches(Regex("\\d{4}")) -> {
|
|
||||||
val title = parts[0]
|
|
||||||
val year = parts[1]
|
|
||||||
"$title ($year)"
|
|
||||||
}
|
|
||||||
|
|
||||||
parts.size >= 3 && parts[1].matches(Regex("S\\d+")) && parts[2].matches(Regex("\\d+[vV]\\d+")) -> {
|
|
||||||
val title = parts[0]
|
|
||||||
val episodeWithRevision = parts[2]
|
|
||||||
val episodeParts = episodeWithRevision.split("v", "V")
|
|
||||||
val episodeNumber = episodeParts[0].toInt()
|
|
||||||
val revisionNumber = episodeParts[1].toInt()
|
|
||||||
val seasonEpisode =
|
|
||||||
"S${episodeNumber.toString().padStart(2, '0')}E${revisionNumber.toString().padStart(2, '0')}"
|
|
||||||
val episodeTitle = if (parts.size > 3) parts[3] else ""
|
|
||||||
"$title - $seasonEpisode - $episodeTitle"
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> cleanedFileName
|
|
||||||
}.trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun guessDesiredTitle(): String {
|
|
||||||
val desiredFileName = guessDesiredFileName()
|
|
||||||
val seasonRegex = Regex("\\sS[0-9]+(\\s- [0-9]+|\\s[0-9]+)", RegexOption.IGNORE_CASE)
|
|
||||||
if (seasonRegex.containsMatchIn(desiredFileName)) {
|
|
||||||
return seasonRegex.replace(desiredFileName, "").trim()
|
|
||||||
} else {
|
|
||||||
val result = if (desiredFileName.contains(" - ")) {
|
|
||||||
return desiredFileName.split(" - ").firstOrNull() ?: desiredFileName
|
|
||||||
} else desiredFileName
|
|
||||||
return result.trim()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modifies the input value and removes "[Text]"
|
|
||||||
* @param text "[TEST] Dummy - 01 [AZ 1080p] "
|
|
||||||
*/
|
|
||||||
fun removeBracketedText(text: String): String {
|
|
||||||
return Regex("\\[.*?]").replace(text, " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
fun removeParenthesizedText(text: String): String {
|
|
||||||
return Regex("\\(.*?\\)").replace(text, " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
fun removeResolutionAndTags(text: String): String {
|
|
||||||
return Regex("(.*?)(?=\\d+[pk]\\b)").replace(text, " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeInBetweenCharacters(text: String): String {
|
|
||||||
return Regex("[.]").replace(text, " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param text "example text with extra spaces"
|
|
||||||
* @return example text with extra spaces
|
|
||||||
*/
|
|
||||||
fun removeExtraWhiteSpace(text: String): String {
|
|
||||||
return Regex("\\s{2,}").replace(text, " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun getMatch(regex: String): String? {
|
|
||||||
return Regex(regex).find(fileName)?.value ?: return null
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.consumers.DefaultConsumer
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Status
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.sequential.ISequentialMessageEvent
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.sequential.SequentialMessageListener
|
|
||||||
import no.iktdev.streamit.library.kafka.producer.DefaultProducer
|
|
||||||
|
|
||||||
abstract class SequentialKafkaReader(subId: String): DefaultKafkaReader(subId), ISequentialMessageEvent {
|
|
||||||
|
|
||||||
abstract val accept: KafkaEvents
|
|
||||||
abstract val subAccepts: List<KafkaEvents>
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deamon
|
|
||||||
|
|
||||||
import com.github.pgreze.process.ProcessResult
|
|
||||||
import com.github.pgreze.process.Redirect
|
|
||||||
import com.github.pgreze.process.process
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import kotlinx.coroutines.*
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.exfl.coroutines.Coroutines
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
open class Daemon(open val executable: String, val daemonInterface: IDaemon) {
|
|
||||||
val scope = Coroutines.io()
|
|
||||||
var job: Job? = null
|
|
||||||
var executor: ProcessResult? = null
|
|
||||||
open suspend fun run(parameters: List<String>): Int {
|
|
||||||
daemonInterface.onStarted()
|
|
||||||
logger.info { "\nDaemon arguments: $executable \nParamters:\n${parameters.joinToString(" ")}" }
|
|
||||||
job = scope.launch {
|
|
||||||
executor = process(executable, *parameters.toTypedArray(),
|
|
||||||
stdout = Redirect.CAPTURE,
|
|
||||||
stderr = Redirect.CAPTURE,
|
|
||||||
consumer = {
|
|
||||||
daemonInterface.onOutputChanged(it)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
job?.join()
|
|
||||||
|
|
||||||
val resultCode = executor?.resultCode ?: -1
|
|
||||||
if (resultCode == 0) {
|
|
||||||
daemonInterface.onEnded()
|
|
||||||
} else daemonInterface.onError(resultCode)
|
|
||||||
logger.info { "$executable result: $resultCode" }
|
|
||||||
return resultCode
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun cancel() {
|
|
||||||
job?.cancelAndJoin()
|
|
||||||
scope.cancel("Cancel operation triggered!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deamon
|
|
||||||
|
|
||||||
interface IDaemon {
|
|
||||||
|
|
||||||
fun onStarted() {}
|
|
||||||
|
|
||||||
fun onOutputChanged(line: String) {}
|
|
||||||
|
|
||||||
fun onEnded() {}
|
|
||||||
|
|
||||||
fun onError(code: Int)
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.ContentOutName
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class ContentOutNameDeserializer: IMessageDataDeserialization<ContentOutName> {
|
|
||||||
override fun deserialize(incomingMessage: Message): ContentOutName? {
|
|
||||||
return incomingMessage.dataAs(ContentOutName::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class ConvertWorkDeserializer: IMessageDataDeserialization<ConvertWork> {
|
|
||||||
override fun deserialize(incomingMessage: Message): ConvertWork? {
|
|
||||||
return incomingMessage.dataAs(ConvertWork::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class DeserializerRegistry {
|
|
||||||
companion object {
|
|
||||||
private val _registry = mutableMapOf<KafkaEvents, IMessageDataDeserialization<*>>(
|
|
||||||
KafkaEvents.EVENT_READER_RECEIVED_FILE to FileResultDeserializer(),
|
|
||||||
KafkaEvents.EVENT_READER_RECEIVED_STREAMS to MediaStreamsDeserializer(),
|
|
||||||
KafkaEvents.EVENT_METADATA_OBTAINED to MetadataResultDeserializer(),
|
|
||||||
KafkaEvents.EVENT_READER_DETERMINED_SERIE to EpisodeInfoDeserializer(),
|
|
||||||
KafkaEvents.EVENT_READER_DETERMINED_MOVIE to MovieInfoDeserializer(),
|
|
||||||
KafkaEvents.EVENT_READER_DETERMINED_FILENAME to ContentOutNameDeserializer(),
|
|
||||||
|
|
||||||
KafkaEvents.EVENT_READER_ENCODE_GENERATED_VIDEO to EncodeWorkDeserializer(),
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_QUEUED to EncodeWorkDeserializer(),
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_STARTED to EncodeWorkDeserializer(),
|
|
||||||
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_ENDED to EncodeWorkDeserializer(),
|
|
||||||
KafkaEvents.EVENT_READER_ENCODE_GENERATED_SUBTITLE to ExtractWorkDeserializer(),
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_ENDED to ExtractWorkDeserializer(),
|
|
||||||
KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_ENDED to ConvertWorkDeserializer()
|
|
||||||
|
|
||||||
)
|
|
||||||
fun getRegistry(): Map<KafkaEvents, IMessageDataDeserialization<*>> = _registry.toMap()
|
|
||||||
fun getEventToDeserializer(vararg keys: KafkaEvents): Map<String, IMessageDataDeserialization<*>> {
|
|
||||||
val missingFields = keys.filter { !getRegistry().keys.contains(it) }
|
|
||||||
|
|
||||||
if (missingFields.isNotEmpty()) {
|
|
||||||
throw MissingDeserializerException("Missing deserializers for: ${missingFields.joinToString(", ")}")
|
|
||||||
}
|
|
||||||
return getRegistry().filter { keys.contains(it.key) }.map { it.key.event to it.value }.toMap()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun toEvent(event: String): KafkaEvents? {
|
|
||||||
return KafkaEvents.values().find { it.event == event }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDeserializerForEvent(event: String): IMessageDataDeserialization<*>? {
|
|
||||||
val deszEvent = toEvent(event) ?: return null
|
|
||||||
return getEventToDeserializer(deszEvent).values.first()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addDeserializer(key: KafkaEvents, deserializer: IMessageDataDeserialization<*>) {
|
|
||||||
_registry[key] = deserializer
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MissingDeserializerException(override val message: String): RuntimeException()
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class EncodeWorkDeserializer: IMessageDataDeserialization<EncodeWork> {
|
|
||||||
override fun deserialize(incomingMessage: Message): EncodeWork? {
|
|
||||||
return incomingMessage.dataAs(EncodeWork::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.EpisodeInfo
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class EpisodeInfoDeserializer: IMessageDataDeserialization<EpisodeInfo> {
|
|
||||||
override fun deserialize(incomingMessage: Message): EpisodeInfo? {
|
|
||||||
return incomingMessage.dataAs(EpisodeInfo::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class ExtractWorkDeserializer: IMessageDataDeserialization<ExtractWork> {
|
|
||||||
override fun deserialize(incomingMessage: Message): ExtractWork? {
|
|
||||||
return incomingMessage.dataAs(ExtractWork::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.FileResult
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class FileResultDeserializer: IMessageDataDeserialization<FileResult> {
|
|
||||||
override fun deserialize(incomingMessage: Message): FileResult? {
|
|
||||||
return incomingMessage.dataAs(FileResult::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import no.iktdev.streamit.content.common.streams.AudioStream
|
|
||||||
import no.iktdev.streamit.content.common.streams.MediaStreams
|
|
||||||
import no.iktdev.streamit.content.common.streams.SubtitleStream
|
|
||||||
import no.iktdev.streamit.content.common.streams.VideoStream
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class MediaStreamsDeserializer: IMessageDataDeserialization<MediaStreams> {
|
|
||||||
override fun deserialize(incomingMessage: Message): MediaStreams? {
|
|
||||||
return try {
|
|
||||||
val gson = Gson()
|
|
||||||
val jsonObject = if (incomingMessage.data is String) {
|
|
||||||
gson.fromJson(incomingMessage.data as String, JsonObject::class.java)
|
|
||||||
} else {
|
|
||||||
gson.fromJson(incomingMessage.dataAsJson(), JsonObject::class.java)
|
|
||||||
}
|
|
||||||
|
|
||||||
val streamsJsonArray = jsonObject.getAsJsonArray("streams")
|
|
||||||
|
|
||||||
val rstreams = streamsJsonArray.mapNotNull { streamJson ->
|
|
||||||
val streamObject = streamJson.asJsonObject
|
|
||||||
|
|
||||||
val codecType = streamObject.get("codec_type").asString
|
|
||||||
if (streamObject.has("codec_name") && streamObject.get("codec_name").asString == "mjpeg") {
|
|
||||||
null
|
|
||||||
} else {
|
|
||||||
when (codecType) {
|
|
||||||
"video" -> gson.fromJson(streamObject, VideoStream::class.java)
|
|
||||||
"audio" -> gson.fromJson(streamObject, AudioStream::class.java)
|
|
||||||
"subtitle" -> gson.fromJson(streamObject, SubtitleStream::class.java)
|
|
||||||
else -> null //throw IllegalArgumentException("Unknown stream type: $codecType")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return MediaStreams(rstreams)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.Metadata
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class MetadataResultDeserializer: IMessageDataDeserialization<Metadata> {
|
|
||||||
override fun deserialize(incomingMessage: Message): Metadata? {
|
|
||||||
return incomingMessage.dataAs(Metadata::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.deserializers
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.MovieInfo
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
|
|
||||||
class MovieInfoDeserializer: IMessageDataDeserialization<MovieInfo> {
|
|
||||||
override fun deserialize(incomingMessage: Message): MovieInfo? {
|
|
||||||
return incomingMessage.dataAs(MovieInfo::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto
|
|
||||||
|
|
||||||
data class ContentOutName(
|
|
||||||
val baseName: String
|
|
||||||
)
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto
|
|
||||||
|
|
||||||
data class Metadata(
|
|
||||||
val title: String,
|
|
||||||
val altTitle: List<String> = emptyList(),
|
|
||||||
val cover: String? = null,
|
|
||||||
val type: String,
|
|
||||||
val summary: String? = null,
|
|
||||||
val genres: List<String> = emptyList()
|
|
||||||
)
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto
|
|
||||||
|
|
||||||
data class WorkOrderItem(
|
|
||||||
val id: String,
|
|
||||||
val inputFile: String,
|
|
||||||
val outputFile: String,
|
|
||||||
val collection: String,
|
|
||||||
val state: State,
|
|
||||||
val progress: Int = 0,
|
|
||||||
val remainingTime: Long? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
enum class State {
|
|
||||||
QUEUED,
|
|
||||||
STARTED,
|
|
||||||
UPDATED,
|
|
||||||
FAILURE,
|
|
||||||
ENDED
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader
|
|
||||||
|
|
||||||
data class EpisodeInfo(
|
|
||||||
val title: String,
|
|
||||||
val episode: Int,
|
|
||||||
val season: Int,
|
|
||||||
val episodeTitle: String?,
|
|
||||||
override val fullName: String
|
|
||||||
): VideoInfo(fullName)
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader
|
|
||||||
|
|
||||||
data class FileResult(
|
|
||||||
val file: String,
|
|
||||||
val title: String = "",
|
|
||||||
val sanitizedName: String = ""
|
|
||||||
)
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader
|
|
||||||
|
|
||||||
data class MovieInfo(
|
|
||||||
val title: String,
|
|
||||||
override val fullName: String
|
|
||||||
) : VideoInfo(fullName)
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader
|
|
||||||
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
data class SubtitleInfo(
|
|
||||||
val inputFile: String,
|
|
||||||
val collection: String,
|
|
||||||
val language: String
|
|
||||||
)
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader
|
|
||||||
|
|
||||||
abstract class VideoInfo(
|
|
||||||
@Transient open val fullName: String
|
|
||||||
)
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader.work
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
data class ConvertWork(
|
|
||||||
val workId: String = UUID.randomUUID().toString(),
|
|
||||||
val collection: String,
|
|
||||||
val language: String,
|
|
||||||
val inFile: String,
|
|
||||||
val outFiles: List<String>
|
|
||||||
)
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader.work
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
data class EncodeWork(
|
|
||||||
override val workId: String = UUID.randomUUID().toString(),
|
|
||||||
override val collection: String,
|
|
||||||
override val inFile: String,
|
|
||||||
override val outFile: String,
|
|
||||||
val arguments: List<String>
|
|
||||||
) : WorkBase(collection = collection, inFile = inFile, outFile = outFile)
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader.work
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
data class ExtractWork(
|
|
||||||
override val workId: String = UUID.randomUUID().toString(),
|
|
||||||
override val collection: String,
|
|
||||||
val language: String,
|
|
||||||
override val inFile: String,
|
|
||||||
val arguments: List<String>,
|
|
||||||
override val outFile: String,
|
|
||||||
var produceConvertEvent: Boolean = true
|
|
||||||
) : WorkBase(collection = collection, inFile = inFile, outFile = outFile)
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.dto.reader.work
|
|
||||||
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
abstract class WorkBase(
|
|
||||||
@Transient open val workId: String = UUID.randomUUID().toString(),
|
|
||||||
@Transient open val collection: String,
|
|
||||||
@Transient open val inFile: String,
|
|
||||||
@Transient open val outFile: String
|
|
||||||
)
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.streams
|
|
||||||
|
|
||||||
class SubtitleStreamSelector(val streams: List<SubtitleStream>) {
|
|
||||||
|
|
||||||
fun getCandidateForConversion(): List<SubtitleStream> {
|
|
||||||
val languageGrouped = getDesiredStreams().groupBy { it.tags.language ?: "eng" }
|
|
||||||
val priority = listOf("subrip", "srt", "webvtt", "vtt", "ass")
|
|
||||||
|
|
||||||
val result = mutableListOf<SubtitleStream>()
|
|
||||||
for ((language, streams) in languageGrouped) {
|
|
||||||
val selectedStream = streams.firstOrNull { it.codec_name in priority }
|
|
||||||
if (selectedStream != null) {
|
|
||||||
result.add(selectedStream)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDesiredStreams(): List<SubtitleStream> {
|
|
||||||
val desiredTypes = listOf(SubtitleType.DEFAULT, SubtitleType.CC, SubtitleType.SHD)
|
|
||||||
val typeGuesser = SubtitleTypeGuesser()
|
|
||||||
val codecFiltered = streams.filter { getFormatToCodec(it.codec_name) != null }
|
|
||||||
|
|
||||||
val mappedToType = codecFiltered.map { typeGuesser.guessType(it) to it }.filter { it.first in desiredTypes }
|
|
||||||
.groupBy { it.second.tags.language ?: "eng" }
|
|
||||||
.mapValues { entry ->
|
|
||||||
val languageStreams = entry.value
|
|
||||||
val sortedStreams = languageStreams.sortedBy { desiredTypes.indexOf(it.first) }
|
|
||||||
sortedStreams.firstOrNull()?.second
|
|
||||||
}.mapNotNull { it.value }
|
|
||||||
|
|
||||||
|
|
||||||
return mappedToType
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun getFormatToCodec(codecName: String): String? {
|
|
||||||
return when(codecName) {
|
|
||||||
"ass" -> "ass"
|
|
||||||
"subrip" -> "srt"
|
|
||||||
"webvtt", "vtt" -> "vtt"
|
|
||||||
"smi" -> "smi"
|
|
||||||
"hdmv_pgs_subtitle" -> null
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common.streams
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @property SHD is Hard of hearing
|
|
||||||
* @property CC is Closed-Captions
|
|
||||||
* @property NON_DIALOGUE is for Signs or Song (as in lyrics)
|
|
||||||
* @property DEFAULT is default subtitle as dialog
|
|
||||||
*/
|
|
||||||
enum class SubtitleType {
|
|
||||||
SHD,
|
|
||||||
CC,
|
|
||||||
NON_DIALOGUE,
|
|
||||||
DEFAULT
|
|
||||||
}
|
|
||||||
|
|
||||||
class SubtitleTypeGuesser {
|
|
||||||
fun guessType(subtitle: SubtitleStream): SubtitleType {
|
|
||||||
if (subtitle.tags != null && subtitle.tags.title?.isBlank() == false) {
|
|
||||||
val title = subtitle.tags.title!!
|
|
||||||
if (title.lowercase().contains("song")
|
|
||||||
|| title.lowercase().contains("songs")
|
|
||||||
|| title.lowercase().contains("sign")
|
|
||||||
|| title.lowercase().contains("signs")
|
|
||||||
) {
|
|
||||||
return SubtitleType.NON_DIALOGUE
|
|
||||||
}
|
|
||||||
if (getSubtitleType(title, listOf("cc", "closed caption"),
|
|
||||||
SubtitleType.CC
|
|
||||||
) == SubtitleType.CC
|
|
||||||
) return SubtitleType.CC
|
|
||||||
if (getSubtitleType(title, listOf("shd", "hh", "Hard-of-Hearing", "Hard of Hearing"),
|
|
||||||
SubtitleType.SHD
|
|
||||||
) == SubtitleType.SHD
|
|
||||||
) return SubtitleType.SHD
|
|
||||||
}
|
|
||||||
|
|
||||||
return SubtitleType.DEFAULT
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getSubtitleType(title: String, keys: List<String>, expected: SubtitleType): SubtitleType {
|
|
||||||
val bracedText = Regex.fromLiteral("[(](?<=\\().*?(?=\\))[)]").find(title)
|
|
||||||
val brakedText = Regex.fromLiteral("[(](?<=\\().*?(?=\\))[)]").find(title)
|
|
||||||
|
|
||||||
if (bracedText == null || brakedText == null)
|
|
||||||
return SubtitleType.DEFAULT
|
|
||||||
|
|
||||||
var text = bracedText.value.ifBlank { brakedText.value }
|
|
||||||
text = Regex.fromLiteral("[\\[\\]()-.,_+]").replace(text, "")
|
|
||||||
|
|
||||||
return if (keys.find { item ->
|
|
||||||
item.lowercase().contains(text.lowercase()) || text.lowercase().contains(item.lowercase())
|
|
||||||
}.isNullOrEmpty()) SubtitleType.DEFAULT else expected
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.common
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.FileResult
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Status
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.junit.jupiter.api.Named
|
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
|
||||||
import org.junit.jupiter.params.provider.MethodSource
|
|
||||||
|
|
||||||
class NamingTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun checkThatBracketsGetsRemoved() {
|
|
||||||
val input = "[AAA] Sir fancy - 13 [1080p HEVC][000000]"
|
|
||||||
val name = Naming(input)
|
|
||||||
assertThat(name.guessDesiredTitle()).doesNotContain("[")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun checkThatSeasonIsStripped() {
|
|
||||||
val input = "[AAA] Kafka Topic S2 - 01"
|
|
||||||
val naming = Naming(input)
|
|
||||||
val result = naming.guessDesiredTitle()
|
|
||||||
assertThat(result).isEqualTo("Kafka Topic")
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@ParameterizedTest
|
|
||||||
@MethodSource("serieOnlyTest")
|
|
||||||
fun ensureOnlySerieAndDecodedCorrectly(testData: TestData) {
|
|
||||||
val naming = Naming(testData.input).getName() ?: throw NullPointerException("Named is null")
|
|
||||||
assertThat(naming.type).isEqualTo("serie")
|
|
||||||
assertThat(naming.season).isEqualTo(testData.expected.season)
|
|
||||||
assertThat(naming.episode).isEqualTo(testData.expected.episode)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testTest() {
|
|
||||||
val tmp = TestData(Naming.Name(title = "Demo", season = 1, episode = 1, type = "serie"), "[Kametsu] Ghost in the Shell Arise - 05 - Pyrophoric Cult (BD 1080p Hi10 FLAC) [13FF85A7]")
|
|
||||||
val naming = Naming(tmp.input).getName()
|
|
||||||
assertThat(naming).isNotNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun serieOnlyTest(): List<Named<TestData>> {
|
|
||||||
return listOf(
|
|
||||||
Named.of("Is defined", TestData(Naming.Name(title = "Demo", season = 1, episode = 1, type = "serie"), "Demo - S01E01")),
|
|
||||||
Named.of("Is decoded", TestData(Naming.Name("Demo!", "serie", season = 1, episode = 1), "[TMP] Demo! - 03")),
|
|
||||||
Named.of("Is only Episode", TestData(Naming.Name("Demo", "serie", 1, 1), "Demo E1"))
|
|
||||||
)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
data class TestData(
|
|
||||||
val expected: Naming.Name,
|
|
||||||
val input: String
|
|
||||||
)*/
|
|
||||||
}
|
|
||||||
42
Convert/.gitignore
vendored
42
Convert/.gitignore
vendored
@ -1,42 +0,0 @@
|
|||||||
.gradle
|
|
||||||
build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea/modules.xml
|
|
||||||
.idea/jarRepositories.xml
|
|
||||||
.idea/compiler.xml
|
|
||||||
.idea/libraries/
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
out/
|
|
||||||
!**/src/main/**/out/
|
|
||||||
!**/src/test/**/out/
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
bin/
|
|
||||||
!**/src/main/**/bin/
|
|
||||||
!**/src/test/**/bin/
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
|
||||||
.DS_Store
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
FROM bskjon/azuljava:17
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
COPY ./build/libs/converter.jar /usr/share/app/app.jar
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm") version "1.8.21"
|
|
||||||
id("org.springframework.boot") version "2.5.5"
|
|
||||||
id("io.spring.dependency-management") version "1.0.11.RELEASE"
|
|
||||||
kotlin("plugin.spring") version "1.5.31"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "no.iktdev.streamit.content"
|
|
||||||
version = "1.0-SNAPSHOT"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/releases")
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/snapshots")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":CommonCode"))
|
|
||||||
|
|
||||||
implementation("no.iktdev.library:subtitle:1.7.8-SNAPSHOT")
|
|
||||||
|
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-kafka:0.0.2-alpha84")
|
|
||||||
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
|
||||||
|
|
||||||
implementation("com.github.pgreze:kotlin-process:1.3.1")
|
|
||||||
implementation("io.github.microutils:kotlin-logging-jvm:2.0.11")
|
|
||||||
|
|
||||||
implementation("com.google.code.gson:gson:2.8.9")
|
|
||||||
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter:2.7.0")
|
|
||||||
implementation("org.springframework.kafka:spring-kafka:2.8.5")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-websocket:2.6.3")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testImplementation(platform("org.junit:junit-bom:5.9.1"))
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.bootJar {
|
|
||||||
archiveFileName.set("converter.jar")
|
|
||||||
launchScript()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.jar {
|
|
||||||
archivesName.set("converter.jar")
|
|
||||||
archiveBaseName.set("converter")
|
|
||||||
}
|
|
||||||
archivesName.set("converter.jar")
|
|
||||||
BIN
Convert/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Convert/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +0,0 @@
|
|||||||
#Sun Jul 23 01:48:17 CEST 2023
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
234
Convert/gradlew
vendored
234
Convert/gradlew
vendored
@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright © 2015-2021 the original authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
|
||||||
#
|
|
||||||
# Important for running:
|
|
||||||
#
|
|
||||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
||||||
# noncompliant, but you have some other compliant shell such as ksh or
|
|
||||||
# bash, then to run this script, type that shell name before the whole
|
|
||||||
# command line, like:
|
|
||||||
#
|
|
||||||
# ksh Gradle
|
|
||||||
#
|
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
|
||||||
# requires all of these POSIX shell features:
|
|
||||||
# * functions;
|
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
|
||||||
#
|
|
||||||
# Important for patching:
|
|
||||||
#
|
|
||||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
||||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
||||||
#
|
|
||||||
# The "traditional" practice of packing multiple parameters into a
|
|
||||||
# space-separated string is a well documented source of bugs and security
|
|
||||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
||||||
# options in "$@", and eventually passing that to Java.
|
|
||||||
#
|
|
||||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
||||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
||||||
# see the in-line comments for details.
|
|
||||||
#
|
|
||||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
||||||
# Darwin, MinGW, and NonStop.
|
|
||||||
#
|
|
||||||
# (3) This script is generated from the Groovy template
|
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
app_path=$0
|
|
||||||
|
|
||||||
# Need this for daisy-chained symlinks.
|
|
||||||
while
|
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
||||||
[ -h "$app_path" ]
|
|
||||||
do
|
|
||||||
ls=$( ls -ld "$app_path" )
|
|
||||||
link=${ls#*' -> '}
|
|
||||||
case $link in #(
|
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD=maximum
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "$( uname )" in #(
|
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
|
||||||
Darwin* ) darwin=true ;; #(
|
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
|
||||||
NONSTOP* ) nonstop=true ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
||||||
else
|
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD=java
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
||||||
case $MAX_FD in #(
|
|
||||||
max*)
|
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
|
||||||
warn "Could not query maximum file descriptor limit"
|
|
||||||
esac
|
|
||||||
case $MAX_FD in #(
|
|
||||||
'' | soft) :;; #(
|
|
||||||
*)
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
|
||||||
# * args from the command line
|
|
||||||
# * the main class name
|
|
||||||
# * -classpath
|
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if "$cygwin" || "$msys" ; then
|
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
||||||
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
for arg do
|
|
||||||
if
|
|
||||||
case $arg in #(
|
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
|
||||||
#
|
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
||||||
#
|
|
||||||
# In Bash we could simply go:
|
|
||||||
#
|
|
||||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
||||||
# set -- "${ARGS[@]}" "$@"
|
|
||||||
#
|
|
||||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
||||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
||||||
# character that might be a shell metacharacter, then use eval to reverse
|
|
||||||
# that process (while maintaining the separation between arguments), and wrap
|
|
||||||
# the whole thing up as a single "set" statement.
|
|
||||||
#
|
|
||||||
# This will of course break if any of these variables contains a newline or
|
|
||||||
# an unmatched quote.
|
|
||||||
#
|
|
||||||
|
|
||||||
eval "set -- $(
|
|
||||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
||||||
xargs -n1 |
|
|
||||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
||||||
tr '\n' ' '
|
|
||||||
)" '"$@"'
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
||||||
89
Convert/gradlew.bat
vendored
89
Convert/gradlew.bat
vendored
@ -1,89 +0,0 @@
|
|||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
rootProject.name = "Convert"
|
|
||||||
|
|
||||||
include(":CommonCode")
|
|
||||||
project(":CommonCode").projectDir = File("../CommonCode")
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.convert
|
|
||||||
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
|
||||||
import org.springframework.boot.runApplication
|
|
||||||
import org.springframework.context.ApplicationContext
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
class ConvertApplication
|
|
||||||
|
|
||||||
private var context: ApplicationContext? = null
|
|
||||||
@Suppress("unused")
|
|
||||||
fun getContext(): ApplicationContext? {
|
|
||||||
return context
|
|
||||||
}
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
context = runApplication<ConvertApplication>(*args)
|
|
||||||
}
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.convert
|
|
||||||
|
|
||||||
class ConvertEnv {
|
|
||||||
companion object {
|
|
||||||
val allowOverwrite = System.getenv("ALLOW_OVERWRITE").toBoolean() ?: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.convert
|
|
||||||
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.library.subtitle.Syncro
|
|
||||||
import no.iktdev.library.subtitle.classes.DialogType
|
|
||||||
import no.iktdev.library.subtitle.export.Export
|
|
||||||
import no.iktdev.library.subtitle.reader.BaseReader
|
|
||||||
import no.iktdev.library.subtitle.reader.Reader
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.SubtitleInfo
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.content.common.streams.SubtitleType
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
|
|
||||||
class ConvertRunner(val referenceId: String, val listener: IConvertListener) {
|
|
||||||
|
|
||||||
private fun getReade(inputFile: File): BaseReader? {
|
|
||||||
return Reader(inputFile).getSubtitleReader()
|
|
||||||
}
|
|
||||||
private val maxDelay = 1000 * 5
|
|
||||||
private var currentDelayed = 0
|
|
||||||
suspend fun readAndConvert (subtitleInfo: SubtitleInfo) {
|
|
||||||
val inFile = File(subtitleInfo.inputFile)
|
|
||||||
while (!inFile.canRead()) {
|
|
||||||
if (currentDelayed > maxDelay) {
|
|
||||||
logger.error { "Could not out wait lock on file!" }
|
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
listener.onError(referenceId, subtitleInfo, "Cant read file!")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
logger.error { "$referenceId ${subtitleInfo.inputFile}: Cant read file!" }
|
|
||||||
delay(500)
|
|
||||||
currentDelayed += 500
|
|
||||||
}
|
|
||||||
val reader = getReade(inFile)
|
|
||||||
val dialogs = reader?.read()
|
|
||||||
if (dialogs.isNullOrEmpty()) {
|
|
||||||
logger.error { "$referenceId ${subtitleInfo.inputFile}: Dialogs read from file is null or empty!" }
|
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
listener.onError(referenceId, subtitleInfo, "Dialogs read from file is null or empty!")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
listener.onStarted(referenceId)
|
|
||||||
}
|
|
||||||
|
|
||||||
val filtered = dialogs.filter { !it.ignore && it.type !in listOf(DialogType.SIGN_SONG, DialogType.CAPTION) }
|
|
||||||
|
|
||||||
val syncedDialogs = Syncro().sync(filtered)
|
|
||||||
|
|
||||||
try {
|
|
||||||
val converted = Export(inFile,inFile.parentFile, inFile.nameWithoutExtension).write(syncedDialogs)
|
|
||||||
val item = ConvertWork(
|
|
||||||
inFile = inFile.absolutePath,
|
|
||||||
collection = subtitleInfo.collection,
|
|
||||||
language = subtitleInfo.language,
|
|
||||||
outFiles = converted.map { it.absolutePath }
|
|
||||||
)
|
|
||||||
|
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
listener.onEnded(referenceId, subtitleInfo, work = item)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
listener.onError(referenceId, subtitleInfo, "See log")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IConvertListener {
|
|
||||||
fun onStarted(referenceId: String)
|
|
||||||
fun onError(referenceId: String, info: SubtitleInfo, message: String)
|
|
||||||
fun onEnded(referenceId: String, info: SubtitleInfo, work: ConvertWork)
|
|
||||||
}
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.convert.kafka
|
|
||||||
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.exfl.coroutines.Coroutines
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.content.common.DefaultKafkaReader
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.SubtitleInfo
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.content.convert.ConvertRunner
|
|
||||||
import no.iktdev.streamit.content.convert.IConvertListener
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Status
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.SimpleMessageListener
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class SubtitleConsumer: DefaultKafkaReader("convertHandlerSubtitle"), IConvertListener {
|
|
||||||
|
|
||||||
private final val listener = object : SimpleMessageListener(
|
|
||||||
topic = CommonConfig.kafkaTopic,
|
|
||||||
consumer = defaultConsumer,
|
|
||||||
accepts = listOf(KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_ENDED.event)
|
|
||||||
) {
|
|
||||||
override fun onMessageReceived(data: ConsumerRecord<String, Message>) {
|
|
||||||
val referenceId = data.value().referenceId
|
|
||||||
val workResult = data.value().dataAs(ExtractWork::class.java)
|
|
||||||
|
|
||||||
if (workResult?.produceConvertEvent == true) {
|
|
||||||
logger.info { "Using ${data.value().referenceId} ${workResult.outFile} as it is a convert candidate" }
|
|
||||||
val convertWork = SubtitleInfo(
|
|
||||||
inputFile = workResult.outFile,
|
|
||||||
collection = workResult.collection,
|
|
||||||
language = workResult.language,
|
|
||||||
)
|
|
||||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_STARTED, Message(referenceId = referenceId, Status(statusType = StatusType.PENDING)), convertWork)
|
|
||||||
Coroutines.io().launch {
|
|
||||||
ConvertRunner(referenceId, this@SubtitleConsumer).readAndConvert(convertWork)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.info { "Skipping ${data.value().referenceId} ${workResult?.outFile} as it is not a convert candidate" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
listener.listen()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStarted(referenceId: String) {
|
|
||||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_STARTED, Message(referenceId = referenceId, Status(statusType = StatusType.SUCCESS)), null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(referenceId: String, info: SubtitleInfo, message: String) {
|
|
||||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_ENDED, Message(referenceId = referenceId, Status(statusType = StatusType.ERROR, message = message)), null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onEnded(referenceId: String, info: SubtitleInfo, work: ConvertWork) {
|
|
||||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_ENDED, Message(referenceId = referenceId, Status(statusType = StatusType.SUCCESS)), work)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
spring.output.ansi.enabled=always
|
|
||||||
logging.level.org.apache.kafka=INFO
|
|
||||||
#logging.level.root=DEBUG
|
|
||||||
42
Encode/.gitignore
vendored
42
Encode/.gitignore
vendored
@ -1,42 +0,0 @@
|
|||||||
.gradle
|
|
||||||
build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea/modules.xml
|
|
||||||
.idea/jarRepositories.xml
|
|
||||||
.idea/compiler.xml
|
|
||||||
.idea/libraries/
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
out/
|
|
||||||
!**/src/main/**/out/
|
|
||||||
!**/src/test/**/out/
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
bin/
|
|
||||||
!**/src/main/**/bin/
|
|
||||||
!**/src/test/**/bin/
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
|
||||||
.DS_Store
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
FROM bskjon/debian-azuljava17-ffmpeg:latest
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
COPY ./build/libs/encoder.jar /usr/share/app/app.jar
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm") version "1.8.21"
|
|
||||||
id("org.springframework.boot") version "2.5.5"
|
|
||||||
id("io.spring.dependency-management") version "1.0.11.RELEASE"
|
|
||||||
kotlin("plugin.spring") version "1.5.31"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "no.iktdev.streamit.content"
|
|
||||||
version = "1.0-SNAPSHOT"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/releases")
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/snapshots")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":CommonCode"))
|
|
||||||
|
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-kafka:0.0.2-alpha84")
|
|
||||||
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
|
||||||
|
|
||||||
|
|
||||||
implementation("com.github.pgreze:kotlin-process:1.3.1")
|
|
||||||
implementation("io.github.microutils:kotlin-logging-jvm:2.0.11")
|
|
||||||
|
|
||||||
implementation("com.google.code.gson:gson:2.8.9")
|
|
||||||
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter:2.7.0")
|
|
||||||
implementation("org.springframework.kafka:spring-kafka:2.8.5")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-websocket:2.6.3")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.1")
|
|
||||||
testImplementation("org.assertj:assertj-core:3.4.1")
|
|
||||||
testImplementation("org.mockito:mockito-core:3.+")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.bootJar {
|
|
||||||
archiveFileName.set("encoder.jar")
|
|
||||||
launchScript()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.jar {
|
|
||||||
archivesName.set("encoder.jar")
|
|
||||||
archiveBaseName.set("encoder")
|
|
||||||
}
|
|
||||||
archivesName.set("encoder.jar")
|
|
||||||
BIN
Encode/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Encode/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +0,0 @@
|
|||||||
#Tue Jul 11 02:14:45 CEST 2023
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
234
Encode/gradlew
vendored
234
Encode/gradlew
vendored
@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright © 2015-2021 the original authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
|
||||||
#
|
|
||||||
# Important for running:
|
|
||||||
#
|
|
||||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
||||||
# noncompliant, but you have some other compliant shell such as ksh or
|
|
||||||
# bash, then to run this script, type that shell name before the whole
|
|
||||||
# command line, like:
|
|
||||||
#
|
|
||||||
# ksh Gradle
|
|
||||||
#
|
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
|
||||||
# requires all of these POSIX shell features:
|
|
||||||
# * functions;
|
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
|
||||||
#
|
|
||||||
# Important for patching:
|
|
||||||
#
|
|
||||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
||||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
||||||
#
|
|
||||||
# The "traditional" practice of packing multiple parameters into a
|
|
||||||
# space-separated string is a well documented source of bugs and security
|
|
||||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
||||||
# options in "$@", and eventually passing that to Java.
|
|
||||||
#
|
|
||||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
||||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
||||||
# see the in-line comments for details.
|
|
||||||
#
|
|
||||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
||||||
# Darwin, MinGW, and NonStop.
|
|
||||||
#
|
|
||||||
# (3) This script is generated from the Groovy template
|
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
app_path=$0
|
|
||||||
|
|
||||||
# Need this for daisy-chained symlinks.
|
|
||||||
while
|
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
||||||
[ -h "$app_path" ]
|
|
||||||
do
|
|
||||||
ls=$( ls -ld "$app_path" )
|
|
||||||
link=${ls#*' -> '}
|
|
||||||
case $link in #(
|
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD=maximum
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "$( uname )" in #(
|
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
|
||||||
Darwin* ) darwin=true ;; #(
|
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
|
||||||
NONSTOP* ) nonstop=true ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
||||||
else
|
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD=java
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
||||||
case $MAX_FD in #(
|
|
||||||
max*)
|
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
|
||||||
warn "Could not query maximum file descriptor limit"
|
|
||||||
esac
|
|
||||||
case $MAX_FD in #(
|
|
||||||
'' | soft) :;; #(
|
|
||||||
*)
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
|
||||||
# * args from the command line
|
|
||||||
# * the main class name
|
|
||||||
# * -classpath
|
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if "$cygwin" || "$msys" ; then
|
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
||||||
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
for arg do
|
|
||||||
if
|
|
||||||
case $arg in #(
|
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
|
||||||
#
|
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
||||||
#
|
|
||||||
# In Bash we could simply go:
|
|
||||||
#
|
|
||||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
||||||
# set -- "${ARGS[@]}" "$@"
|
|
||||||
#
|
|
||||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
||||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
||||||
# character that might be a shell metacharacter, then use eval to reverse
|
|
||||||
# that process (while maintaining the separation between arguments), and wrap
|
|
||||||
# the whole thing up as a single "set" statement.
|
|
||||||
#
|
|
||||||
# This will of course break if any of these variables contains a newline or
|
|
||||||
# an unmatched quote.
|
|
||||||
#
|
|
||||||
|
|
||||||
eval "set -- $(
|
|
||||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
||||||
xargs -n1 |
|
|
||||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
||||||
tr '\n' ' '
|
|
||||||
)" '"$@"'
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
||||||
89
Encode/gradlew.bat
vendored
89
Encode/gradlew.bat
vendored
@ -1,89 +0,0 @@
|
|||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
rootProject.name = "Encode"
|
|
||||||
|
|
||||||
include(":CommonCode")
|
|
||||||
project(":CommonCode").projectDir = File("../CommonCode")
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value
|
|
||||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
|
|
||||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer
|
|
||||||
import org.springframework.context.annotation.Bean
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
import org.springframework.web.method.HandlerTypePredicate
|
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
|
||||||
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer
|
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
|
||||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
|
|
||||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry
|
|
||||||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableWebSocketMessageBroker
|
|
||||||
class WebSocketConfig : WebSocketMessageBrokerConfigurer {
|
|
||||||
|
|
||||||
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
|
|
||||||
registry.addEndpoint("/ws")
|
|
||||||
// .setAllowedOrigins("*")
|
|
||||||
.withSockJS()
|
|
||||||
|
|
||||||
registry.addEndpoint("/")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun configureMessageBroker(registry: MessageBrokerRegistry) {
|
|
||||||
registry.enableSimpleBroker("/topic")
|
|
||||||
registry.setApplicationDestinationPrefixes("/app")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
class EncodeEnv {
|
|
||||||
companion object {
|
|
||||||
val ffmpeg: String = System.getenv("SUPPORTING_EXECUTABLE_FFMPEG") ?: "ffmpeg"
|
|
||||||
val allowOverwrite = System.getenv("ALLOW_OVERWRITE").toBoolean() ?: false
|
|
||||||
val maxRunners: Int = try {System.getenv("SIMULTANEOUS_ENCODE_RUNNERS").toIntOrNull() ?: 1 } catch (e: Exception) {1}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.content.common.DefaultKafkaReader
|
|
||||||
import no.iktdev.streamit.content.common.deserializers.DeserializerRegistry
|
|
||||||
import no.iktdev.streamit.content.common.deserializers.EncodeWorkDeserializer
|
|
||||||
import no.iktdev.streamit.content.encode.runner.RunnerCoordinator
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.consumers.DefaultConsumer
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.SimpleMessageListener
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.deserializeIfSuccessful
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class EncodeWorkConsumer(private val runnerCoordinator: RunnerCoordinator) : DefaultKafkaReader("encodeWork") {
|
|
||||||
|
|
||||||
lateinit var encodeInstructionsListener: EncodeInformationListener
|
|
||||||
|
|
||||||
init {
|
|
||||||
encodeInstructionsListener = EncodeInformationListener(
|
|
||||||
topic = CommonConfig.kafkaTopic,
|
|
||||||
defaultConsumer,
|
|
||||||
accepts = listOf(KafkaEvents.EVENT_READER_ENCODE_GENERATED_VIDEO.event),
|
|
||||||
runnerCoordinator
|
|
||||||
)
|
|
||||||
encodeInstructionsListener.listen()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadDeserializers(): Map<String, IMessageDataDeserialization<*>> {
|
|
||||||
return DeserializerRegistry.getEventToDeserializer(
|
|
||||||
KafkaEvents.EVENT_READER_ENCODE_GENERATED_VIDEO
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class EncodeInformationListener(
|
|
||||||
topic: String,
|
|
||||||
consumer: DefaultConsumer,
|
|
||||||
accepts: List<String>,
|
|
||||||
val runnerCoordinator: RunnerCoordinator
|
|
||||||
) : SimpleMessageListener(
|
|
||||||
topic, consumer,
|
|
||||||
accepts
|
|
||||||
) {
|
|
||||||
override fun onMessageReceived(data: ConsumerRecord<String, Message>) {
|
|
||||||
logger.info { "\nreferenceId: ${data.value().referenceId} \nEvent: ${data.key()} \nData:\n${Gson().toJson(data.value())}" }
|
|
||||||
val message = data.value().apply {
|
|
||||||
this.data = EncodeWorkDeserializer().deserializeIfSuccessful(data.value())
|
|
||||||
}
|
|
||||||
runnerCoordinator.addEncodeMessageToQueue(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
import no.iktdev.exfl.observable.ObservableMap
|
|
||||||
import no.iktdev.exfl.observable.observableMapOf
|
|
||||||
import no.iktdev.streamit.content.common.dto.WorkOrderItem
|
|
||||||
import no.iktdev.streamit.content.encode.progress.Progress
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
|
||||||
import org.springframework.boot.runApplication
|
|
||||||
import org.springframework.context.ApplicationContext
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
class EncoderApplication
|
|
||||||
|
|
||||||
private var context: ApplicationContext? = null
|
|
||||||
val progressMap = observableMapOf<String, Progress>()
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
fun getContext(): ApplicationContext? {
|
|
||||||
return context
|
|
||||||
}
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
context = runApplication<EncoderApplication>(*args)
|
|
||||||
}
|
|
||||||
|
|
||||||
val encoderItems = ObservableMap<String, WorkOrderItem>()
|
|
||||||
val extractItems = ObservableMap<String, WorkOrderItem>()
|
|
||||||
|
|
||||||
/*val progress = ObservableMap<String, EncodeInformation>().also {
|
|
||||||
it.addListener(object: ObservableMap.Listener<String, EncodeInformation> {
|
|
||||||
override fun onPut(key: String, value: EncodeInformation) {
|
|
||||||
super.onPut(key, value)
|
|
||||||
logger.info { "$key with progress: $value." }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.content.common.DefaultKafkaReader
|
|
||||||
import no.iktdev.streamit.content.common.deserializers.DeserializerRegistry
|
|
||||||
import no.iktdev.streamit.content.common.deserializers.ExtractWorkDeserializer
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.content.encode.runner.RunnerCoordinator
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.consumers.DefaultConsumer
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.SimpleMessageListener
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.IMessageDataDeserialization
|
|
||||||
import no.iktdev.streamit.library.kafka.listener.deserializer.deserializeIfSuccessful
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class ExtractWorkConsumer(private val runnerCoordinator: RunnerCoordinator) : DefaultKafkaReader("extractWork") {
|
|
||||||
lateinit var encodeInstructionsListener: ExtractWorkListener
|
|
||||||
|
|
||||||
init {
|
|
||||||
encodeInstructionsListener = ExtractWorkListener(
|
|
||||||
topic = CommonConfig.kafkaTopic,
|
|
||||||
defaultConsumer,
|
|
||||||
accepts = listOf(KafkaEvents.EVENT_READER_ENCODE_GENERATED_SUBTITLE.event),
|
|
||||||
runnerCoordinator
|
|
||||||
)
|
|
||||||
encodeInstructionsListener.listen()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadDeserializers(): Map<String, IMessageDataDeserialization<*>> {
|
|
||||||
return DeserializerRegistry.getEventToDeserializer(
|
|
||||||
KafkaEvents.EVENT_READER_ENCODE_GENERATED_SUBTITLE
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ExtractWorkListener(
|
|
||||||
topic: String,
|
|
||||||
consumer: DefaultConsumer,
|
|
||||||
accepts: List<String>,
|
|
||||||
val runnerCoordinator: RunnerCoordinator
|
|
||||||
) : SimpleMessageListener(
|
|
||||||
topic, consumer,
|
|
||||||
accepts
|
|
||||||
) {
|
|
||||||
override fun onMessageReceived(data: ConsumerRecord<String, Message>) {
|
|
||||||
logger.info { "\nreferenceId: ${data.value().referenceId} \nEvent: ${data.key()} \nData:\n${Gson().toJson(data.value())}" }
|
|
||||||
val message = data.value().apply {
|
|
||||||
this.data = ExtractWorkDeserializer().deserializeIfSuccessful(data.value())
|
|
||||||
}
|
|
||||||
runnerCoordinator.addExtractMessageToQueue(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.controllers
|
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import no.iktdev.streamit.content.encode.progressMap
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
import javax.servlet.http.HttpServletResponse
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
class ProgressController {
|
|
||||||
@GetMapping("/progress")
|
|
||||||
fun getValue(response: HttpServletResponse): String {
|
|
||||||
response.setHeader("Refresh", "5")
|
|
||||||
return Gson().toJson(progressMap.values)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.progress
|
|
||||||
|
|
||||||
data class DecodedProgressData(
|
|
||||||
val frame: Int?,
|
|
||||||
val fps: Double?,
|
|
||||||
val stream_0_0_q: Double?,
|
|
||||||
val bitrate: String?,
|
|
||||||
val total_size: Int?,
|
|
||||||
val out_time_us: Long?,
|
|
||||||
val out_time_ms: Long?,
|
|
||||||
val out_time: String?,
|
|
||||||
val dup_frames: Int?,
|
|
||||||
val drop_frames: Int?,
|
|
||||||
val speed: Double?,
|
|
||||||
val progress: String?
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ECT(val day: Int = 0, val hour: Int = 0, val minute: Int = 0, val second: Int = 0)
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.progress
|
|
||||||
|
|
||||||
data class Progress(
|
|
||||||
val workId: String,
|
|
||||||
val outFileName: String,
|
|
||||||
val progress: Int = -1,
|
|
||||||
val time: String,
|
|
||||||
val duration: String,
|
|
||||||
val speed: String,
|
|
||||||
val estimatedCompletionSeconds: Long = -1,
|
|
||||||
val estimatedCompletion: String = "Unknown",
|
|
||||||
)
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.runner
|
|
||||||
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.streamit.content.encode.EncodeEnv
|
|
||||||
import no.iktdev.exfl.observable.ObservableList
|
|
||||||
import no.iktdev.exfl.observable.observableListOf
|
|
||||||
import no.iktdev.exfl.using
|
|
||||||
import no.iktdev.streamit.content.common.deamon.Daemon
|
|
||||||
import no.iktdev.streamit.content.common.deamon.IDaemon
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.content.encode.progress.DecodedProgressData
|
|
||||||
import no.iktdev.streamit.content.encode.progress.Progress
|
|
||||||
import no.iktdev.streamit.content.encode.progress.ProgressDecoder
|
|
||||||
import java.io.BufferedWriter
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileWriter
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
class EncodeDaemon(val referenceId: String, val work: EncodeWork, val daemonInterface: IEncodeListener, val outFile: File = File("src").using("logs", "${work.workId}-${work.collection}.log")): IDaemon {
|
|
||||||
var outputCache = observableListOf<String>()
|
|
||||||
private val decoder = ProgressDecoder(work)
|
|
||||||
fun produceProgress(items: List<String>): Progress? {
|
|
||||||
try {
|
|
||||||
val decodedProgress = decoder.parseVideoProgress(items)
|
|
||||||
if (decodedProgress != null) {
|
|
||||||
val progress = decoder.getProgress(decodedProgress)
|
|
||||||
outputCache.clear()
|
|
||||||
return progress
|
|
||||||
}
|
|
||||||
} catch (e: IndexOutOfBoundsException) {
|
|
||||||
// Do nothing
|
|
||||||
} catch (e: Exception) {
|
|
||||||
//logger.error { e.message }
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
outputCache.addListener(object : ObservableList.Listener<String> {
|
|
||||||
override fun onAdded(item: String) {
|
|
||||||
val progress = produceProgress(outputCache)
|
|
||||||
progress?.let {
|
|
||||||
daemonInterface.onProgress(referenceId, work, progress)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
outFile.parentFile.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun runUsingWorkItem(): Int {
|
|
||||||
val outFile = File(work.outFile)
|
|
||||||
if (!outFile.parentFile.exists()) {
|
|
||||||
outFile.parentFile.mkdirs()
|
|
||||||
}
|
|
||||||
val adjustedArgs = (if (EncodeEnv.allowOverwrite) listOf("-y") else listOf("-nostdin")) + listOf(
|
|
||||||
"-hide_banner", "-i", File(work.inFile).absolutePath, *work.arguments.toTypedArray(), outFile.absolutePath,
|
|
||||||
"-progress", "pipe:1"
|
|
||||||
)
|
|
||||||
logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" }
|
|
||||||
return Daemon(EncodeEnv.ffmpeg, this).run(adjustedArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStarted() {
|
|
||||||
super.onStarted()
|
|
||||||
daemonInterface.onStarted(referenceId, work)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onEnded() {
|
|
||||||
super.onEnded()
|
|
||||||
daemonInterface.onEnded(referenceId, work)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(code: Int) {
|
|
||||||
daemonInterface.onError(referenceId, work, code)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOutputChanged(line: String) {
|
|
||||||
super.onOutputChanged(line)
|
|
||||||
if (decoder.isDuration(line))
|
|
||||||
decoder.setDuration(line)
|
|
||||||
if (decoder.expectedKeys.any { line.startsWith(it) }) {
|
|
||||||
outputCache.add(line)
|
|
||||||
}
|
|
||||||
writeToLog(line)
|
|
||||||
}
|
|
||||||
fun writeToLog(line: String) {
|
|
||||||
val fileWriter = FileWriter(outFile, true) // true indikerer at vi ønsker å appende til filen
|
|
||||||
val bufferedWriter = BufferedWriter(fileWriter)
|
|
||||||
|
|
||||||
// Skriv logglinjen til filen
|
|
||||||
bufferedWriter.write(line)
|
|
||||||
bufferedWriter.newLine() // Legg til en ny linje etter logglinjen
|
|
||||||
|
|
||||||
// Lukk BufferedWriter og FileWriter for å frigjøre ressurser
|
|
||||||
bufferedWriter.close()
|
|
||||||
fileWriter.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEncodeListener {
|
|
||||||
fun onStarted(referenceId: String, work: EncodeWork)
|
|
||||||
fun onError(referenceId: String, work: EncodeWork, code: Int)
|
|
||||||
fun onProgress(referenceId: String, work: EncodeWork, progress: Progress)
|
|
||||||
fun onEnded(referenceId: String, work: EncodeWork)
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.runner
|
|
||||||
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.streamit.content.encode.EncodeEnv
|
|
||||||
import no.iktdev.exfl.observable.observableListOf
|
|
||||||
import no.iktdev.streamit.content.common.deamon.Daemon
|
|
||||||
import no.iktdev.streamit.content.common.deamon.IDaemon
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.content.encode.progress.DecodedProgressData
|
|
||||||
import java.io.File
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
class ExtractDaemon(val referenceId: String, val work: ExtractWork, val daemonInterface: IExtractListener): IDaemon {
|
|
||||||
var outputCache = observableListOf<String>()
|
|
||||||
|
|
||||||
|
|
||||||
suspend fun runUsingWorkItem(): Int {
|
|
||||||
val outFile = File(work.outFile)
|
|
||||||
if (!outFile.parentFile.exists()) {
|
|
||||||
outFile.parentFile.mkdirs()
|
|
||||||
}
|
|
||||||
val adjustedArgs = (if (EncodeEnv.allowOverwrite) listOf("-y") else emptyList()) + listOf(
|
|
||||||
"-i", File(work.inFile).absolutePath, *work.arguments.toTypedArray(), outFile.absolutePath
|
|
||||||
)
|
|
||||||
logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" }
|
|
||||||
return Daemon(EncodeEnv.ffmpeg, this).run(adjustedArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStarted() {
|
|
||||||
super.onStarted()
|
|
||||||
daemonInterface.onStarted(referenceId, work)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onEnded() {
|
|
||||||
super.onEnded()
|
|
||||||
daemonInterface.onEnded(referenceId, work)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(code: Int) {
|
|
||||||
daemonInterface.onError(referenceId, work, code)
|
|
||||||
}
|
|
||||||
override fun onOutputChanged(line: String) {
|
|
||||||
super.onOutputChanged(line)
|
|
||||||
outputCache.add(line)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IExtractListener {
|
|
||||||
fun onStarted(referenceId: String, work: ExtractWork)
|
|
||||||
fun onError(referenceId: String, work: ExtractWork, code: Int)
|
|
||||||
fun onProgress(referenceId: String, work: ExtractWork, progress: DecodedProgressData) {}
|
|
||||||
fun onEnded(referenceId: String, work: ExtractWork)
|
|
||||||
}
|
|
||||||
@ -1,324 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.runner
|
|
||||||
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import kotlinx.coroutines.*
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
|
||||||
import no.iktdev.streamit.content.encode.EncodeEnv
|
|
||||||
import mu.KotlinLogging
|
|
||||||
import no.iktdev.exfl.coroutines.Coroutines
|
|
||||||
import no.iktdev.streamit.content.common.CommonConfig
|
|
||||||
import no.iktdev.streamit.content.common.dto.State
|
|
||||||
import no.iktdev.streamit.content.common.dto.WorkOrderItem
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
|
||||||
import no.iktdev.streamit.content.encode.encoderItems
|
|
||||||
import no.iktdev.streamit.content.encode.extractItems
|
|
||||||
import no.iktdev.streamit.content.encode.progress.Progress
|
|
||||||
import no.iktdev.streamit.content.encode.progressMap
|
|
||||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Message
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.Status
|
|
||||||
import no.iktdev.streamit.library.kafka.dto.StatusType
|
|
||||||
import no.iktdev.streamit.library.kafka.producer.DefaultProducer
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
|
||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
data class ExecutionBlock(
|
|
||||||
val workId: String,
|
|
||||||
val type: String,
|
|
||||||
val work: suspend () -> Int
|
|
||||||
)
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class RunnerCoordinator(
|
|
||||||
private var maxConcurrentJobs: Int = 1,
|
|
||||||
) {
|
|
||||||
private val logger = KotlinLogging.logger {}
|
|
||||||
|
|
||||||
val producer = DefaultProducer(CommonConfig.kafkaTopic)
|
|
||||||
final val defaultScope = Coroutines.default()
|
|
||||||
|
|
||||||
private val jobsInProgress = AtomicInteger(0)
|
|
||||||
private var inProgressJobs = mutableListOf<Job>()
|
|
||||||
val queue = Channel<ExecutionBlock>(Channel.UNLIMITED)
|
|
||||||
|
|
||||||
|
|
||||||
init {
|
|
||||||
maxConcurrentJobs = EncodeEnv.maxRunners
|
|
||||||
repeat(EncodeEnv.maxRunners) {
|
|
||||||
launchWorker()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun launchWorker() = defaultScope.launch {
|
|
||||||
while (true) {
|
|
||||||
logger.info("Worker is waiting for a work item...")
|
|
||||||
val workItem = queue.receive() // Coroutine will wait here until a work item is available
|
|
||||||
logger.info("Worker received a work item.")
|
|
||||||
if (jobsInProgress.get() < maxConcurrentJobs) {
|
|
||||||
jobsInProgress.incrementAndGet()
|
|
||||||
val job = processWorkItem(workItem)
|
|
||||||
inProgressJobs.add(job)
|
|
||||||
job.invokeOnCompletion {
|
|
||||||
logger.info { "OnCompletion invoked!\n\nWorkId: ${workItem.workId}-${workItem.type} \n\tCurrent active worksers: ${jobsInProgress.get()}" }
|
|
||||||
val workers = jobsInProgress.decrementAndGet()
|
|
||||||
logger.info { "Worker Released: $workers" }
|
|
||||||
logger.info { "Available: ${workers}/${maxConcurrentJobs}" }
|
|
||||||
inProgressJobs.remove(job)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info { "Available workers: ${jobsInProgress.get()}/$maxConcurrentJobs" }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun processWorkItem(workItem: ExecutionBlock): Job {
|
|
||||||
logger.info { "Processing work: ${workItem.type}" }
|
|
||||||
workItem.work()
|
|
||||||
return Job().apply { complete() }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun addEncodeMessageToQueue(message: Message) {
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.PENDING))
|
|
||||||
)
|
|
||||||
try {
|
|
||||||
if (message.data != null && message.data is EncodeWork) {
|
|
||||||
val work = message.data as EncodeWork
|
|
||||||
encoderItems.put(
|
|
||||||
message.referenceId, WorkOrderItem(
|
|
||||||
id = message.referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.QUEUED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val workBlock = suspend {
|
|
||||||
val data: EncodeWork = work
|
|
||||||
val encodeDaemon = EncodeDaemon(message.referenceId, data, encodeListener)
|
|
||||||
logger.info { "\nreferenceId: ${message.referenceId} \nStarting encoding. \nWorkId: ${data.workId}" }
|
|
||||||
encodeDaemon.runUsingWorkItem()
|
|
||||||
}
|
|
||||||
val result = queue.trySend(ExecutionBlock(work.workId, "encode", workBlock))
|
|
||||||
val statusType = when (result.isClosed) {
|
|
||||||
true -> StatusType.IGNORED // Køen er lukket, jobben ble ignorert
|
|
||||||
false -> {
|
|
||||||
if (result.isSuccess) {
|
|
||||||
StatusType.SUCCESS // Jobben ble sendt til køen
|
|
||||||
} else {
|
|
||||||
StatusType.ERROR // Feil ved sending av jobben
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(statusType))
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.ERROR, "Data is not an instance of EncodeWork or null"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.ERROR, e.message))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addExtractMessageToQueue(message: Message) {
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.PENDING))
|
|
||||||
)
|
|
||||||
try {
|
|
||||||
if (message.data != null && message.data is ExtractWork) {
|
|
||||||
val work = message.data as ExtractWork
|
|
||||||
extractItems.put(
|
|
||||||
message.referenceId, WorkOrderItem(
|
|
||||||
id = message.referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.QUEUED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
val workBlock = suspend {
|
|
||||||
val data: ExtractWork = work
|
|
||||||
val extractDaemon = ExtractDaemon(message.referenceId, data, extractListener)
|
|
||||||
logger.info { "\nreferenceId: ${message.referenceId} \nStarting extracting. \nWorkId: ${data.workId}" }
|
|
||||||
extractDaemon.runUsingWorkItem()
|
|
||||||
}
|
|
||||||
val result = queue.trySend(ExecutionBlock(work.workId, "extract", workBlock))
|
|
||||||
val statusType = when (result.isClosed) {
|
|
||||||
true -> StatusType.IGNORED // Køen er lukket, jobben ble ignorert
|
|
||||||
false -> {
|
|
||||||
if (result.isSuccess) {
|
|
||||||
StatusType.SUCCESS // Jobben ble sendt til køen
|
|
||||||
} else {
|
|
||||||
StatusType.ERROR // Feil ved sending av jobben
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(statusType))
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.ERROR, "Data is not an instance of ExtractWork"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_QUEUED.event,
|
|
||||||
message.withNewStatus(Status(StatusType.ERROR, e.message))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
val encodeListener = object : IEncodeListener {
|
|
||||||
override fun onStarted(referenceId: String, work: EncodeWork) {
|
|
||||||
logger.info { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nEncode: Started\n${work.outFile}" }
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_STARTED.event,
|
|
||||||
Message(referenceId, Status(statusType = StatusType.SUCCESS), work)
|
|
||||||
)
|
|
||||||
encoderItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.STARTED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(referenceId: String, work: EncodeWork, code: Int) {
|
|
||||||
logger.error { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nEncode: Failed\n${work.outFile} \nError: $code" }
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_ENDED.event,
|
|
||||||
Message(referenceId, Status(StatusType.ERROR, message = code.toString()), work)
|
|
||||||
)
|
|
||||||
encoderItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.FAILURE
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onProgress(referenceId: String, work: EncodeWork, progress: Progress) {
|
|
||||||
logger.debug {
|
|
||||||
"Work progress for $referenceId with WorkId ${work.workId} @ ${work.outFile}: Progress: ${
|
|
||||||
Gson().toJson(
|
|
||||||
progress
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
}
|
|
||||||
progressMap.put(work.workId, progress)
|
|
||||||
encoderItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.UPDATED,
|
|
||||||
progress = progress.progress,
|
|
||||||
remainingTime = progress.estimatedCompletionSeconds
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onEnded(referenceId: String, work: EncodeWork) {
|
|
||||||
logger.info { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nEncode: Ended\n${work.outFile}" }
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_VIDEO_FILE_ENDED.event,
|
|
||||||
Message(referenceId, Status(statusType = StatusType.SUCCESS), work)
|
|
||||||
)
|
|
||||||
encoderItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.ENDED,
|
|
||||||
progress = 100,
|
|
||||||
remainingTime = null
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val extractListener = object : IExtractListener {
|
|
||||||
override fun onStarted(referenceId: String, work: ExtractWork) {
|
|
||||||
logger.info { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nExtract: Started\n${work.outFile}" }
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_STARTED.event,
|
|
||||||
Message(referenceId, Status(statusType = StatusType.SUCCESS), work)
|
|
||||||
)
|
|
||||||
extractItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.STARTED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(referenceId: String, work: ExtractWork, code: Int) {
|
|
||||||
logger.error { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nExtract: Failed\n${work.outFile} \nError: $code" }
|
|
||||||
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_ENDED.event,
|
|
||||||
Message(referenceId, Status(StatusType.ERROR, code.toString()), work)
|
|
||||||
)
|
|
||||||
extractItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.FAILURE
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onEnded(referenceId: String, work: ExtractWork) {
|
|
||||||
logger.info { "\nreferenceId: $referenceId \nWorkId ${work.workId} \nExtract: Ended\n${work.outFile}" }
|
|
||||||
producer.sendMessage(
|
|
||||||
KafkaEvents.EVENT_ENCODER_SUBTITLE_FILE_ENDED.event,
|
|
||||||
Message(referenceId, Status(statusType = StatusType.SUCCESS), work)
|
|
||||||
)
|
|
||||||
extractItems.put(
|
|
||||||
referenceId, WorkOrderItem(
|
|
||||||
id = referenceId,
|
|
||||||
inputFile = work.inFile,
|
|
||||||
outputFile = work.outFile,
|
|
||||||
collection = work.collection,
|
|
||||||
state = State.ENDED
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.topics
|
|
||||||
|
|
||||||
import no.iktdev.exfl.observable.ObservableMap
|
|
||||||
import no.iktdev.streamit.content.common.dto.WorkOrderItem
|
|
||||||
import no.iktdev.streamit.content.encode.encoderItems
|
|
||||||
import no.iktdev.streamit.content.encode.extractItems
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.messaging.handler.annotation.MessageMapping
|
|
||||||
import org.springframework.messaging.simp.SimpMessagingTemplate
|
|
||||||
import org.springframework.stereotype.Controller
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
class EncoderTopic(
|
|
||||||
@Autowired val template: SimpMessagingTemplate?,
|
|
||||||
) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
encoderItems.addListener(object : ObservableMap.Listener<String, WorkOrderItem> {
|
|
||||||
override fun onMapUpdated(map: Map<String, WorkOrderItem>) {
|
|
||||||
super.onMapUpdated(map)
|
|
||||||
pushEncoderQueue()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPut(key: String, value: WorkOrderItem) {
|
|
||||||
super.onPut(key, value)
|
|
||||||
pushEncoderWorkOrder(value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
extractItems.addListener(object : ObservableMap.Listener<String, WorkOrderItem> {
|
|
||||||
override fun onMapUpdated(map: Map<String, WorkOrderItem>) {
|
|
||||||
super.onMapUpdated(map)
|
|
||||||
pushExtractorQueue()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPut(key: String, value: WorkOrderItem) {
|
|
||||||
super.onPut(key, value)
|
|
||||||
pushExtractorWorkOrder(value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun pushEncoderWorkOrder(item: WorkOrderItem) {
|
|
||||||
template?.convertAndSend("/topic/encoder/workorder", item)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun pushExtractorWorkOrder(item: WorkOrderItem) {
|
|
||||||
template?.convertAndSend("/topic/extractor/workorder", item)
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessageMapping("/encoder/queue")
|
|
||||||
fun pushEncoderQueue() {
|
|
||||||
template?.convertAndSend("/topic/encoder/queue", encoderItems.values)
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessageMapping("/extractor/queue")
|
|
||||||
fun pushExtractorQueue() {
|
|
||||||
template?.convertAndSend("/topic/extractor/queue", extractItems.values)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
spring.output.ansi.enabled=always
|
|
||||||
logging.level.org.apache.kafka=WARN
|
|
||||||
#logging.level.root=DEBUG
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord
|
|
||||||
|
|
||||||
open class Resources {
|
|
||||||
|
|
||||||
fun getText(path: String): String? {
|
|
||||||
return this.javaClass.classLoader.getResource(path)?.readText()
|
|
||||||
}
|
|
||||||
|
|
||||||
open class Streams(): Resources() {
|
|
||||||
fun all(): List<String> {
|
|
||||||
return listOf<String>(
|
|
||||||
getSample(0),
|
|
||||||
getSample(1),
|
|
||||||
getSample(2),
|
|
||||||
getSample(3),
|
|
||||||
getSample(4),
|
|
||||||
getSample(5),
|
|
||||||
getSample(6),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getSample(number: Int): String {
|
|
||||||
return getText("streams/sample$number.json")!!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,176 +0,0 @@
|
|||||||
package no.iktdev.streamit.content.encode.progress
|
|
||||||
|
|
||||||
import no.iktdev.streamit.content.common.dto.reader.work.EncodeWork
|
|
||||||
import no.iktdev.streamit.content.encode.Resources
|
|
||||||
import no.iktdev.streamit.content.encode.runner.EncodeDaemon
|
|
||||||
import no.iktdev.streamit.content.encode.runner.IEncodeListener
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.junit.BeforeClass
|
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
import org.junit.jupiter.api.assertDoesNotThrow
|
|
||||||
import org.mockito.ArgumentMatchers.anyBoolean
|
|
||||||
import org.mockito.ArgumentMatchers.anyString
|
|
||||||
import org.mockito.Mockito.*
|
|
||||||
import java.io.BufferedWriter
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileWriter
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
class DecodedProgressDataDecoderTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun test() {
|
|
||||||
val progress = ProgressDecoder(EncodeWork(
|
|
||||||
workId = UUID.randomUUID().toString(),
|
|
||||||
collection = "Demo",
|
|
||||||
inFile = "Demo.mkv",
|
|
||||||
outFile = "FancyDemo.mp4",
|
|
||||||
arguments = emptyList()
|
|
||||||
))
|
|
||||||
val lines = text.split("\n")
|
|
||||||
val cache: MutableList<String> = mutableListOf()
|
|
||||||
lines.forEach {
|
|
||||||
cache.add(it)
|
|
||||||
assertDoesNotThrow {
|
|
||||||
val progressItem = progress.parseVideoProgress(cache)
|
|
||||||
progressItem?.progress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertThat(lines).isNotEmpty()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testCanRead() {
|
|
||||||
val res = Resources()
|
|
||||||
val data = res.getText("Output1.txt") ?: ""
|
|
||||||
assertThat(data).isNotEmpty()
|
|
||||||
val lines = data.split("\n").map { it.trim() }
|
|
||||||
assertThat(lines).isNotEmpty()
|
|
||||||
|
|
||||||
val encodeWork = EncodeWork(
|
|
||||||
workId = UUID.randomUUID().toString(),
|
|
||||||
collection = "Demo",
|
|
||||||
inFile = "Demo.mkv",
|
|
||||||
outFile = "FancyDemo.mp4",
|
|
||||||
arguments = emptyList()
|
|
||||||
)
|
|
||||||
val decoder = ProgressDecoder(encodeWork)
|
|
||||||
lines.forEach { decoder.setDuration(it) }
|
|
||||||
assertThat(decoder.duration).isNotNull()
|
|
||||||
val produced = mutableListOf<Progress>()
|
|
||||||
|
|
||||||
val tempFile = File.createTempFile("test", ".log")
|
|
||||||
|
|
||||||
val encoder = EncodeDaemon(UUID.randomUUID().toString(), encodeWork, object : IEncodeListener {
|
|
||||||
override fun onStarted(referenceId: String, work: EncodeWork) {
|
|
||||||
}
|
|
||||||
override fun onError(referenceId: String, work: EncodeWork, code: Int) {
|
|
||||||
}
|
|
||||||
override fun onProgress(referenceId: String, work: EncodeWork, progress: Progress) {
|
|
||||||
produced.add(progress)
|
|
||||||
}
|
|
||||||
override fun onEnded(referenceId: String, work: EncodeWork) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}, tempFile)
|
|
||||||
|
|
||||||
|
|
||||||
lines.forEach {
|
|
||||||
encoder.onOutputChanged(it)
|
|
||||||
}
|
|
||||||
assertThat(produced).isNotEmpty()
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testThatProgressIsCalculated() {
|
|
||||||
val encodeWork = EncodeWork(
|
|
||||||
workId = UUID.randomUUID().toString(),
|
|
||||||
collection = "Demo",
|
|
||||||
inFile = "Demo.mkv",
|
|
||||||
outFile = "FancyDemo.mp4",
|
|
||||||
arguments = emptyList()
|
|
||||||
)
|
|
||||||
val decoder = ProgressDecoder(encodeWork)
|
|
||||||
decoder.setDuration("Duration: 01:48:54.82,")
|
|
||||||
assertThat(decoder.duration).isNotNull()
|
|
||||||
val decodedProgressData = DecodedProgressData(
|
|
||||||
frame = null,
|
|
||||||
fps = null,
|
|
||||||
stream_0_0_q = null,
|
|
||||||
bitrate = null,
|
|
||||||
total_size = null,
|
|
||||||
out_time_ms = null,
|
|
||||||
out_time_us = null,
|
|
||||||
out_time = "01:48:54.82",
|
|
||||||
dup_frames = null,
|
|
||||||
drop_frames = null,
|
|
||||||
speed = 1.0,
|
|
||||||
progress = "Continue"
|
|
||||||
)
|
|
||||||
val progress = decoder.getProgress(decodedProgressData)
|
|
||||||
assertThat(progress.progress).isGreaterThanOrEqualTo(99)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testThatProgressIsNotNone() {
|
|
||||||
val encodeWork = EncodeWork(
|
|
||||||
workId = UUID.randomUUID().toString(),
|
|
||||||
collection = "Demo",
|
|
||||||
inFile = "Demo.mkv",
|
|
||||||
outFile = "FancyDemo.mp4",
|
|
||||||
arguments = emptyList()
|
|
||||||
)
|
|
||||||
val decoder = ProgressDecoder(encodeWork)
|
|
||||||
decoder.setDuration("Duration: 01:48:54.82,")
|
|
||||||
assertThat(decoder.duration).isNotNull()
|
|
||||||
val decodedProgressData = DecodedProgressData(
|
|
||||||
frame = null,
|
|
||||||
fps = null,
|
|
||||||
stream_0_0_q = null,
|
|
||||||
bitrate = null,
|
|
||||||
total_size = null,
|
|
||||||
out_time_ms = null,
|
|
||||||
out_time_us = null,
|
|
||||||
out_time = "01:00:50.174667",
|
|
||||||
dup_frames = null,
|
|
||||||
drop_frames = null,
|
|
||||||
speed = 1.0,
|
|
||||||
progress = "Continue"
|
|
||||||
)
|
|
||||||
val progress = decoder.getProgress(decodedProgressData)
|
|
||||||
assertThat(progress.progress).isGreaterThanOrEqualTo(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
val text = """
|
|
||||||
frame=16811 fps= 88 q=40.0 size= 9984kB time=00:x01:10.79 bitrate=1155.3kbits/s speed=3.71x
|
|
||||||
fps=88.03
|
|
||||||
stream_0_0_q=40.0
|
|
||||||
bitrate=1155.3kbits/s
|
|
||||||
total_size=10223752
|
|
||||||
out_time_us=70798005
|
|
||||||
out_time_ms=70798005
|
|
||||||
out_time=00:01:10.798005
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.71x
|
|
||||||
progress=continue
|
|
||||||
frame= 1710 fps= 84 q=-1.0 Lsize= 12124kB time=00:01:11.91 bitrate=1381.2kbits/s speed=3.53x
|
|
||||||
frame=1710
|
|
||||||
fps=84.01
|
|
||||||
stream_0_0_q=-1.0
|
|
||||||
bitrate=1381.2kbits/s
|
|
||||||
total_size=12415473
|
|
||||||
out_time_us=71910998
|
|
||||||
out_time_ms=71910998
|
|
||||||
out_time=00:01:11.910998
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.53x
|
|
||||||
progress=end
|
|
||||||
""".trimIndent()
|
|
||||||
}
|
|
||||||
@ -1,389 +0,0 @@
|
|||||||
Guessed Channel Layout for Input Stream #0.1 : 5.1
|
|
||||||
Input #0, matroska,webm, from '/src/input/DemoFile.mkv':
|
|
||||||
Metadata:
|
|
||||||
CREATION_TIME : 2019-06-15T08:06:07Z
|
|
||||||
ENCODER : Lavf57.7.2
|
|
||||||
Duration: 01:48:54.82, start: 0.000000, bitrate: 2709 kb/s
|
|
||||||
Chapter #0:0: start 0.000000, end 328.537000
|
|
||||||
Metadata:
|
|
||||||
title : 00:00:00.000
|
|
||||||
Chapter #0:1: start 328.537000, end 419.044000
|
|
||||||
Metadata:
|
|
||||||
title : 00:05:28.537
|
|
||||||
Chapter #0:2: start 419.044000, end 916.874000
|
|
||||||
Metadata:
|
|
||||||
title : 00:06:59.044
|
|
||||||
Chapter #0:3: start 916.874000, end 1309.433000
|
|
||||||
Metadata:
|
|
||||||
title : 00:15:16.749
|
|
||||||
Chapter #0:4: start 1309.433000, end 1399.023000
|
|
||||||
Metadata:
|
|
||||||
title : 00:21:49.391
|
|
||||||
Chapter #0:5: start 1399.023000, end 1508.924000
|
|
||||||
Metadata:
|
|
||||||
title : 00:23:19.023
|
|
||||||
Chapter #0:6: start 1508.924000, end 1767.099000
|
|
||||||
Metadata:
|
|
||||||
title : 00:25:08.924
|
|
||||||
Chapter #0:7: start 1767.099000, end 1975.474000
|
|
||||||
Metadata:
|
|
||||||
title : 00:29:27.099
|
|
||||||
Chapter #0:8: start 1975.474000, end 2301.466000
|
|
||||||
Metadata:
|
|
||||||
title : 00:32:55.473
|
|
||||||
Chapter #0:9: start 2301.466000, end 2498.246000
|
|
||||||
Metadata:
|
|
||||||
title : 00:38:21.466
|
|
||||||
Chapter #0:10: start 2498.246000, end 2622.036000
|
|
||||||
Metadata:
|
|
||||||
title : 00:41:38.246
|
|
||||||
Chapter #0:11: start 2622.036000, end 2925.172000
|
|
||||||
Metadata:
|
|
||||||
title : 00:43:42.036
|
|
||||||
Chapter #0:12: start 2925.172000, end 3183.472000
|
|
||||||
Metadata:
|
|
||||||
title : 00:48:45.172
|
|
||||||
Chapter #0:13: start 3183.472000, end 3467.172000
|
|
||||||
Metadata:
|
|
||||||
title : 00:53:03.472
|
|
||||||
Chapter #0:14: start 3467.172000, end 3684.472000
|
|
||||||
Metadata:
|
|
||||||
title : 00:57:47.172
|
|
||||||
Chapter #0:15: start 3684.472000, end 3885.840000
|
|
||||||
Metadata:
|
|
||||||
title : 01:01:24.472
|
|
||||||
Chapter #0:16: start 3885.840000, end 4063.059000
|
|
||||||
Metadata:
|
|
||||||
title : 01:04:45.840
|
|
||||||
Chapter #0:17: start 4063.059000, end 4275.605000
|
|
||||||
Metadata:
|
|
||||||
title : 01:07:43.059
|
|
||||||
Chapter #0:18: start 4275.605000, end 4434.263000
|
|
||||||
Metadata:
|
|
||||||
title : 01:11:15.605
|
|
||||||
Chapter #0:19: start 4434.263000, end 4709.205000
|
|
||||||
Metadata:
|
|
||||||
title : 01:13:54.263
|
|
||||||
Chapter #0:20: start 4709.205000, end 4900.020000
|
|
||||||
Metadata:
|
|
||||||
title : 01:18:29.204
|
|
||||||
Chapter #0:21: start 4900.020000, end 5081.201000
|
|
||||||
Metadata:
|
|
||||||
title : 01:21:40.020
|
|
||||||
Chapter #0:22: start 5081.201000, end 5211.123000
|
|
||||||
Metadata:
|
|
||||||
title : 01:24:41.201
|
|
||||||
Chapter #0:23: start 5211.123000, end 5359.938000
|
|
||||||
Metadata:
|
|
||||||
title : 01:26:51.123
|
|
||||||
Chapter #0:24: start 5359.938000, end 5833.786000
|
|
||||||
Metadata:
|
|
||||||
title : 01:29:19.938
|
|
||||||
Chapter #0:25: start 5833.786000, end 5953.865000
|
|
||||||
Metadata:
|
|
||||||
title : 01:37:13.786
|
|
||||||
Chapter #0:26: start 5953.865000, end 6229.432000
|
|
||||||
Metadata:
|
|
||||||
title : 01:39:13.865
|
|
||||||
Chapter #0:27: start 6229.432000, end 6534.779000
|
|
||||||
Metadata:
|
|
||||||
title : 01:43:49.181
|
|
||||||
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
|
|
||||||
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1, fltp (default)
|
|
||||||
Metadata:
|
|
||||||
title : Surround
|
|
||||||
Stream #0:2(jpn): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
|
|
||||||
Metadata:
|
|
||||||
title : Surround
|
|
||||||
Stream #0:3(eng): Subtitle: ass (default) (forced)
|
|
||||||
Stream #0:4(eng): Subtitle: ass
|
|
||||||
Stream mapping:
|
|
||||||
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
|
|
||||||
Stream #0:2 -> #0:1 (ac3 (native) -> eac3 (native))
|
|
||||||
x265 [info]: HEVC encoder version 3.4
|
|
||||||
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
|
|
||||||
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
|
|
||||||
x265 [info]: Main profile, Level-4 (Main tier)
|
|
||||||
x265 [info]: Thread pool created using 12 threads
|
|
||||||
x265 [info]: Slices : 1
|
|
||||||
x265 [info]: frame threads / pool features : 3 / wpp(17 rows)
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
set_mempolicy: Operation not permitted
|
|
||||||
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
|
|
||||||
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
|
|
||||||
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
|
|
||||||
x265 [info]: Keyframe min / max / scenecut / bias : 23 / 250 / 40 / 5.00
|
|
||||||
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
|
|
||||||
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
|
|
||||||
x265 [info]: References / ref-limit cu / depth : 3 / off / on
|
|
||||||
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
|
|
||||||
x265 [info]: Rate Control / qCompress : CRF-16.0 / 0.60
|
|
||||||
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
|
|
||||||
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
|
|
||||||
Output #0, mp4, to '/src/output/Demo/Demo.mp4':
|
|
||||||
Metadata:
|
|
||||||
encoder : Lavf58.45.100
|
|
||||||
Chapter #0:0: start 0.000000, end 328.537000
|
|
||||||
Metadata:
|
|
||||||
title : 00:00:00.000
|
|
||||||
Chapter #0:1: start 328.537000, end 419.044000
|
|
||||||
Metadata:
|
|
||||||
title : 00:05:28.537
|
|
||||||
Chapter #0:2: start 419.044000, end 916.874000
|
|
||||||
Metadata:
|
|
||||||
title : 00:06:59.044
|
|
||||||
Chapter #0:3: start 916.874000, end 1309.433000
|
|
||||||
Metadata:
|
|
||||||
title : 00:15:16.749
|
|
||||||
Chapter #0:4: start 1309.433000, end 1399.023000
|
|
||||||
Metadata:
|
|
||||||
title : 00:21:49.391
|
|
||||||
Chapter #0:5: start 1399.023000, end 1508.924000
|
|
||||||
Metadata:
|
|
||||||
title : 00:23:19.023
|
|
||||||
Chapter #0:6: start 1508.924000, end 1767.099000
|
|
||||||
Metadata:
|
|
||||||
title : 00:25:08.924
|
|
||||||
Chapter #0:7: start 1767.099000, end 1975.474000
|
|
||||||
Metadata:
|
|
||||||
title : 00:29:27.099
|
|
||||||
Chapter #0:8: start 1975.474000, end 2301.466000
|
|
||||||
Metadata:
|
|
||||||
title : 00:32:55.473
|
|
||||||
Chapter #0:9: start 2301.466000, end 2498.246000
|
|
||||||
Metadata:
|
|
||||||
title : 00:38:21.466
|
|
||||||
Chapter #0:10: start 2498.246000, end 2622.036000
|
|
||||||
Metadata:
|
|
||||||
title : 00:41:38.246
|
|
||||||
Chapter #0:11: start 2622.036000, end 2925.172000
|
|
||||||
Metadata:
|
|
||||||
title : 00:43:42.036
|
|
||||||
Chapter #0:12: start 2925.172000, end 3183.472000
|
|
||||||
Metadata:
|
|
||||||
title : 00:48:45.172
|
|
||||||
Chapter #0:13: start 3183.472000, end 3467.172000
|
|
||||||
Metadata:
|
|
||||||
title : 00:53:03.472
|
|
||||||
Chapter #0:14: start 3467.172000, end 3684.472000
|
|
||||||
Metadata:
|
|
||||||
title : 00:57:47.172
|
|
||||||
Chapter #0:15: start 3684.472000, end 3885.840000
|
|
||||||
Metadata:
|
|
||||||
title : 01:01:24.472
|
|
||||||
Chapter #0:16: start 3885.840000, end 4063.059000
|
|
||||||
Metadata:
|
|
||||||
title : 01:04:45.840
|
|
||||||
Chapter #0:17: start 4063.059000, end 4275.605000
|
|
||||||
Metadata:
|
|
||||||
title : 01:07:43.059
|
|
||||||
Chapter #0:18: start 4275.605000, end 4434.263000
|
|
||||||
Metadata:
|
|
||||||
title : 01:11:15.605
|
|
||||||
Chapter #0:19: start 4434.263000, end 4709.205000
|
|
||||||
Metadata:
|
|
||||||
title : 01:13:54.263
|
|
||||||
Chapter #0:20: start 4709.205000, end 4900.020000
|
|
||||||
Metadata:
|
|
||||||
title : 01:18:29.204
|
|
||||||
Chapter #0:21: start 4900.020000, end 5081.201000
|
|
||||||
Metadata:
|
|
||||||
title : 01:21:40.020
|
|
||||||
Chapter #0:22: start 5081.201000, end 5211.123000
|
|
||||||
Metadata:
|
|
||||||
title : 01:24:41.201
|
|
||||||
Chapter #0:23: start 5211.123000, end 5359.938000
|
|
||||||
Metadata:
|
|
||||||
title : 01:26:51.123
|
|
||||||
Chapter #0:24: start 5359.938000, end 5833.786000
|
|
||||||
Metadata:
|
|
||||||
title : 01:29:19.938
|
|
||||||
Chapter #0:25: start 5833.786000, end 5953.865000
|
|
||||||
Metadata:
|
|
||||||
title : 01:37:13.786
|
|
||||||
Chapter #0:26: start 5953.865000, end 6229.432000
|
|
||||||
Metadata:
|
|
||||||
title : 01:39:13.865
|
|
||||||
Chapter #0:27: start 6229.432000, end 6534.779000
|
|
||||||
Metadata:
|
|
||||||
title : 01:43:49.181
|
|
||||||
Stream #0:0: Video: hevc (libx265) (hev1 / 0x31766568), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc (default)
|
|
||||||
Metadata:
|
|
||||||
encoder : Lavc58.91.100 libx265
|
|
||||||
Side data:
|
|
||||||
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
|
|
||||||
Stream #0:1(jpn): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 448 kb/s
|
|
||||||
Metadata:
|
|
||||||
title : Surround
|
|
||||||
encoder : Lavc58.91.100 eac3
|
|
||||||
frame= 49 fps=0.0 q=24.0 size= 1kB time=00:00:02.52 bitrate= 2.4kbits/s speed=4.85x
|
|
||||||
frame=49
|
|
||||||
fps=0.00
|
|
||||||
stream_0_0_q=24.0
|
|
||||||
bitrate= 2.4kbits/s
|
|
||||||
total_size=772
|
|
||||||
out_time_us=2526667
|
|
||||||
out_time_ms=2526667
|
|
||||||
out_time=00:00:02.526667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=4.85x
|
|
||||||
progress=continue
|
|
||||||
frame= 87 fps= 84 q=16.7 size= 1kB time=00:00:04.09 bitrate= 1.5kbits/s speed=3.96x
|
|
||||||
frame=87
|
|
||||||
fps=84.21
|
|
||||||
stream_0_0_q=16.7
|
|
||||||
bitrate= 1.5kbits/s
|
|
||||||
total_size=772
|
|
||||||
out_time_us=4094667
|
|
||||||
out_time_ms=4094667
|
|
||||||
out_time=00:00:04.094667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.96x
|
|
||||||
progress=continue
|
|
||||||
frame= 115 fps= 75 q=22.4 size= 257kB time=00:00:05.27 bitrate= 398.5kbits/s speed=3.44x
|
|
||||||
frame=115
|
|
||||||
fps=74.95
|
|
||||||
stream_0_0_q=22.4
|
|
||||||
bitrate= 398.5kbits/s
|
|
||||||
total_size=262916
|
|
||||||
out_time_us=5278667
|
|
||||||
out_time_ms=5278667
|
|
||||||
out_time=00:00:05.278667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.44x
|
|
||||||
progress=continue
|
|
||||||
frame= 146 fps= 72 q=22.6 size= 257kB time=00:00:06.55 bitrate= 320.7kbits/s speed=3.22x
|
|
||||||
frame=146
|
|
||||||
fps=71.64
|
|
||||||
stream_0_0_q=22.6
|
|
||||||
bitrate= 320.7kbits/s
|
|
||||||
total_size=262916
|
|
||||||
out_time_us=6558667
|
|
||||||
out_time_ms=6558667
|
|
||||||
out_time=00:00:06.558667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.22x
|
|
||||||
progress=continue
|
|
||||||
frame= 175 fps= 69 q=20.5 size= 513kB time=00:00:07.77 bitrate= 540.3kbits/s speed=3.06x
|
|
||||||
frame=175
|
|
||||||
fps=68.82
|
|
||||||
stream_0_0_q=20.5
|
|
||||||
bitrate= 540.3kbits/s
|
|
||||||
total_size=525060
|
|
||||||
out_time_us=7774667
|
|
||||||
out_time_ms=7774667
|
|
||||||
out_time=00:00:07.774667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=3.06x
|
|
||||||
progress=continue
|
|
||||||
frame= 204 fps= 67 q=21.1 size= 769kB time=00:00:08.99 bitrate= 700.5kbits/s speed=2.94x
|
|
||||||
frame=204
|
|
||||||
fps=66.66
|
|
||||||
stream_0_0_q=21.1
|
|
||||||
bitrate= 700.5kbits/s
|
|
||||||
total_size=787204
|
|
||||||
out_time_us=8990667
|
|
||||||
out_time_ms=8990667
|
|
||||||
out_time=00:00:08.990667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.94x
|
|
||||||
progress=continue
|
|
||||||
frame= 231 fps= 65 q=20.5 size= 1025kB time=00:00:10.11 bitrate= 830.3kbits/s speed=2.83x
|
|
||||||
frame=231
|
|
||||||
fps=64.66
|
|
||||||
stream_0_0_q=20.5
|
|
||||||
bitrate= 830.3kbits/s
|
|
||||||
total_size=1049348
|
|
||||||
out_time_us=10110667
|
|
||||||
out_time_ms=10110667
|
|
||||||
out_time=00:00:10.110667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.83x
|
|
||||||
progress=continue
|
|
||||||
frame= 268 fps= 65 q=20.7 size= 1025kB time=00:00:11.64 bitrate= 720.8kbits/s speed=2.84x
|
|
||||||
frame=268
|
|
||||||
fps=65.29
|
|
||||||
stream_0_0_q=20.7
|
|
||||||
bitrate= 720.8kbits/s
|
|
||||||
total_size=1049348
|
|
||||||
out_time_us=11646667
|
|
||||||
out_time_ms=11646667
|
|
||||||
out_time=00:00:11.646667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.84x
|
|
||||||
progress=continue
|
|
||||||
frame= 312 fps= 68 q=21.0 size= 1281kB time=00:00:13.47 bitrate= 778.9kbits/s speed=2.92x
|
|
||||||
frame=312
|
|
||||||
fps=67.67
|
|
||||||
stream_0_0_q=21.0
|
|
||||||
bitrate= 778.9kbits/s
|
|
||||||
total_size=1311492
|
|
||||||
out_time_us=13470667
|
|
||||||
out_time_ms=13470667
|
|
||||||
out_time=00:00:13.470667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.92x
|
|
||||||
progress=continue
|
|
||||||
frame= 353 fps= 69 q=19.9 size= 1281kB time=00:00:15.19 bitrate= 690.3kbits/s speed=2.97x
|
|
||||||
frame=353
|
|
||||||
fps=68.97
|
|
||||||
stream_0_0_q=19.9
|
|
||||||
bitrate= 690.3kbits/s
|
|
||||||
total_size=1311492
|
|
||||||
out_time_us=15198667
|
|
||||||
out_time_ms=15198667
|
|
||||||
out_time=00:00:15.198667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.97x
|
|
||||||
progress=continue
|
|
||||||
frame= 372 fps= 66 q=17.9 size= 1537kB time=00:00:15.99 bitrate= 786.9kbits/s speed=2.84x
|
|
||||||
frame=372
|
|
||||||
fps=66.01
|
|
||||||
stream_0_0_q=17.9
|
|
||||||
bitrate= 786.9kbits/s
|
|
||||||
total_size=1573636
|
|
||||||
out_time_us=15998667
|
|
||||||
out_time_ms=15998667
|
|
||||||
out_time=00:00:15.998667
|
|
||||||
dup_frames=0
|
|
||||||
drop_frames=0
|
|
||||||
speed=2.84x
|
|
||||||
progress=continue
|
|
||||||
42
Reader/.gitignore
vendored
42
Reader/.gitignore
vendored
@ -1,42 +0,0 @@
|
|||||||
.gradle
|
|
||||||
build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea/modules.xml
|
|
||||||
.idea/jarRepositories.xml
|
|
||||||
.idea/compiler.xml
|
|
||||||
.idea/libraries/
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
out/
|
|
||||||
!**/src/main/**/out/
|
|
||||||
!**/src/test/**/out/
|
|
||||||
|
|
||||||
### Eclipse ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
bin/
|
|
||||||
!**/src/main/**/bin/
|
|
||||||
!**/src/test/**/bin/
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
|
||||||
.DS_Store
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
FROM bskjon/debian-azuljava17-ffmpeg:latest
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
COPY ./build/libs/reader.jar /usr/share/app/app.jar
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm") version "1.8.21"
|
|
||||||
id("org.springframework.boot") version "2.5.5"
|
|
||||||
id("io.spring.dependency-management") version "1.0.11.RELEASE"
|
|
||||||
kotlin("plugin.spring") version "1.5.31"
|
|
||||||
}
|
|
||||||
|
|
||||||
archivesName.set("reader.jar")
|
|
||||||
group = "no.iktdev.streamit.content"
|
|
||||||
version = "1.0-SNAPSHOT"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/releases")
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url = uri("https://reposilite.iktdev.no/snapshots")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val exposedVersion = "0.38.2"
|
|
||||||
dependencies {
|
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-kafka:0.0.2-alpha84")
|
|
||||||
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
|
||||||
|
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-db:0.0.6-alpha14")
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
|
||||||
|
|
||||||
|
|
||||||
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
|
|
||||||
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
|
|
||||||
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
|
|
||||||
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
|
|
||||||
implementation ("mysql:mysql-connector-java:8.0.29")
|
|
||||||
|
|
||||||
implementation("com.github.pgreze:kotlin-process:1.3.1")
|
|
||||||
implementation("com.github.vishna:watchservice-ktx:master-SNAPSHOT")
|
|
||||||
implementation("io.github.microutils:kotlin-logging-jvm:2.0.11")
|
|
||||||
|
|
||||||
implementation("com.google.code.gson:gson:2.8.9")
|
|
||||||
implementation("org.json:json:20210307")
|
|
||||||
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter:2.7.0")
|
|
||||||
implementation("org.springframework.kafka:spring-kafka:2.8.5")
|
|
||||||
implementation("org.springframework.boot:spring-boot-starter-websocket:2.6.3")
|
|
||||||
|
|
||||||
|
|
||||||
implementation(project(":CommonCode"))
|
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.1")
|
|
||||||
testImplementation("org.assertj:assertj-core:3.4.1")
|
|
||||||
testImplementation("org.mockito:mockito-core:3.+")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.bootJar {
|
|
||||||
archiveFileName.set("reader.jar")
|
|
||||||
launchScript()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.jar {
|
|
||||||
archivesName.set("reader.jar")
|
|
||||||
archiveBaseName.set("reader")
|
|
||||||
}
|
|
||||||
BIN
Reader/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
Reader/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,6 +0,0 @@
|
|||||||
#Tue Jul 11 02:16:45 CEST 2023
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
234
Reader/gradlew
vendored
234
Reader/gradlew
vendored
@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright © 2015-2021 the original authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
|
||||||
#
|
|
||||||
# Important for running:
|
|
||||||
#
|
|
||||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
||||||
# noncompliant, but you have some other compliant shell such as ksh or
|
|
||||||
# bash, then to run this script, type that shell name before the whole
|
|
||||||
# command line, like:
|
|
||||||
#
|
|
||||||
# ksh Gradle
|
|
||||||
#
|
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
|
||||||
# requires all of these POSIX shell features:
|
|
||||||
# * functions;
|
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
|
||||||
#
|
|
||||||
# Important for patching:
|
|
||||||
#
|
|
||||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
||||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
||||||
#
|
|
||||||
# The "traditional" practice of packing multiple parameters into a
|
|
||||||
# space-separated string is a well documented source of bugs and security
|
|
||||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
||||||
# options in "$@", and eventually passing that to Java.
|
|
||||||
#
|
|
||||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
||||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
||||||
# see the in-line comments for details.
|
|
||||||
#
|
|
||||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
||||||
# Darwin, MinGW, and NonStop.
|
|
||||||
#
|
|
||||||
# (3) This script is generated from the Groovy template
|
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
app_path=$0
|
|
||||||
|
|
||||||
# Need this for daisy-chained symlinks.
|
|
||||||
while
|
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
||||||
[ -h "$app_path" ]
|
|
||||||
do
|
|
||||||
ls=$( ls -ld "$app_path" )
|
|
||||||
link=${ls#*' -> '}
|
|
||||||
case $link in #(
|
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD=maximum
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "$( uname )" in #(
|
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
|
||||||
Darwin* ) darwin=true ;; #(
|
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
|
||||||
NONSTOP* ) nonstop=true ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
||||||
else
|
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD=java
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
||||||
case $MAX_FD in #(
|
|
||||||
max*)
|
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
|
||||||
warn "Could not query maximum file descriptor limit"
|
|
||||||
esac
|
|
||||||
case $MAX_FD in #(
|
|
||||||
'' | soft) :;; #(
|
|
||||||
*)
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
|
||||||
# * args from the command line
|
|
||||||
# * the main class name
|
|
||||||
# * -classpath
|
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if "$cygwin" || "$msys" ; then
|
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
||||||
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
for arg do
|
|
||||||
if
|
|
||||||
case $arg in #(
|
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
|
||||||
#
|
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
||||||
#
|
|
||||||
# In Bash we could simply go:
|
|
||||||
#
|
|
||||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
||||||
# set -- "${ARGS[@]}" "$@"
|
|
||||||
#
|
|
||||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
||||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
||||||
# character that might be a shell metacharacter, then use eval to reverse
|
|
||||||
# that process (while maintaining the separation between arguments), and wrap
|
|
||||||
# the whole thing up as a single "set" statement.
|
|
||||||
#
|
|
||||||
# This will of course break if any of these variables contains a newline or
|
|
||||||
# an unmatched quote.
|
|
||||||
#
|
|
||||||
|
|
||||||
eval "set -- $(
|
|
||||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
||||||
xargs -n1 |
|
|
||||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
||||||
tr '\n' ' '
|
|
||||||
)" '"$@"'
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user