Compare commits
66 Commits
16b32e0167
...
develop
Author | SHA1 | Date | |
---|---|---|---|
a8602914ce
|
|||
fb82846e9e
|
|||
4a9182d063
|
|||
799d257e9d
|
|||
6adbff9bbf
|
|||
fc4c916735
|
|||
aaf43c15aa
|
|||
04eb6b87f4
|
|||
26827d5ccd
|
|||
b56199fe8b
|
|||
f6958ffa97
|
|||
7f410ef700
|
|||
c4d205a79e
|
|||
c45c106f2f
|
|||
63c13de181
|
|||
57767de4b3
|
|||
c59c87d109
|
|||
0a22377cd6
|
|||
7930a907f1
|
|||
850cbbaf70
|
|||
f4604f94c6
|
|||
077d7a82a9
|
|||
e6db590937
|
|||
d7428683e4
|
|||
a9c59137af
|
|||
c8619cdc7f
|
|||
c49957e583
|
|||
39080cac14
|
|||
cae996a141
|
|||
fc4e585620
|
|||
690f84e2c8
|
|||
568d8f0897
|
|||
2909ef7cea
|
|||
1b1cdd5c22
|
|||
eb43669ae7
|
|||
29ca392880
|
|||
df8095fb16
|
|||
e48f363de0
|
|||
9bb835beaf
|
|||
9cdfa18fc8
|
|||
6c0abac1c5
|
|||
394824ce88
|
|||
6e8b148c81
|
|||
57637606c0
|
|||
c60b9f7b0c
|
|||
b24155caf6
|
|||
43d794373a
|
|||
3241b88158
|
|||
d69767f5e9
|
|||
7340f43d6e
|
|||
5ab11922b9
|
|||
5f72ce8c56
|
|||
5b15848048
|
|||
84b36dd29e
|
|||
82167f042f
|
|||
712ec2f182
|
|||
883bf376b0
|
|||
306383449a
|
|||
a831d56d93
|
|||
9d46db43c2
|
|||
46d210d6d5
|
|||
3149ca25e1
|
|||
992762ef0a
|
|||
411e6c554a
|
|||
bf3340e526
|
|||
6be10dbd75
|
14
FyneApp.toml
Normal file
14
FyneApp.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
Website = "https://gui-for-ffmpeg.projects.kor-elf.net/language/en"
|
||||
|
||||
[Details]
|
||||
Icon = "assets/icon.png"
|
||||
Name = "GUI for FFmpeg"
|
||||
ID = "net.kor-elf.projects.gui-for-ffmpeg"
|
||||
Version = "1.0.1"
|
||||
Build = 98
|
||||
|
||||
[LinuxAndBSD]
|
||||
GenericName = "GUI for FFmpeg"
|
||||
Categories = ["AudioVideo", "Utility"]
|
||||
Comment = "A simple interface for the FFmpeg console utility."
|
||||
Keywords = ["ffmpeg", "media", "convert", "transcode", "audio", "video", "конвертер", "видео", "аудио", "кодек"]
|
@@ -431,6 +431,40 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/fyne-io/oksvg
|
||||
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Steven R Wiley
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/go-gl/gl
|
||||
|
||||
The MIT License (MIT)
|
||||
@@ -639,40 +673,423 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/gopherjs/gopherjs
|
||||
github.com/hack-pad/go-indexeddb
|
||||
|
||||
Copyright (c) 2013 Richard Musiol. All rights reserved.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
1. Definitions.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
http://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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/jinzhu/inflection
|
||||
github.com/hack-pad/safejs
|
||||
|
||||
The MIT License (MIT)
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2015 - Jinzhu
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
http://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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/jeandeaual/go-locale
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Alexis Jeandeau
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -718,29 +1135,21 @@ THE SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/mattn/go-sqlite3
|
||||
github.com/nfnt/resize
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2012, Jan Schlicht <jan.schlicht@gmail.com>
|
||||
|
||||
Copyright (c) 2014 Yasuhiro Matsumoto
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -800,6 +1209,212 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/rymdport/portal
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
http://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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/srwiley/oksvg
|
||||
|
||||
BSD 3-Clause License
|
||||
@@ -894,29 +1509,34 @@ SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/tevino/abool
|
||||
github.com/ulikunitz/xz
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2014-2022 Ulrich Kunitz
|
||||
All rights reserved.
|
||||
|
||||
Copyright (c) 2016 Tevin Zhang
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
* My name, Ulrich Kunitz, may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -948,7 +1568,7 @@ SOFTWARE.
|
||||
|
||||
golang.org/x/image
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -960,39 +1580,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
golang.org/x/mobile
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
@@ -1012,7 +1600,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
golang.org/x/net
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -1024,7 +1612,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
@@ -1044,7 +1632,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
golang.org/x/sys
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -1056,7 +1644,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
@@ -1076,7 +1664,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
golang.org/x/text
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -1088,7 +1676,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
@@ -1124,60 +1712,9 @@ limitations under the License.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
gorm.io/gorm
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-NOW Jinzhu <wosmvp@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
honnef.co/go/js/dom
|
||||
|
||||
Copyright (c) 2014 Dominik Honnef
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
github.com/golang/go
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -1189,7 +1726,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
* Neither the name of Google LLC nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
@@ -1208,6 +1745,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
FFmpeg
|
||||
|
||||
FFmpeg is a trademark of Fabrice Bellard, originator of the FFmpeg project.
|
||||
https://ffmpeg.org/legal.html
|
||||
|
||||
@@ -1885,3 +2423,4 @@ may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
|
88
Makefile
Normal file
88
Makefile
Normal file
@@ -0,0 +1,88 @@
|
||||
VERSION ?= $(shell grep '^ *Version *= *' FyneApp.toml | sed -E "s/.*=[[:space:]]*\"([0-9\.]+)\".*/\1/")
|
||||
|
||||
BUILD_TMP := fyne-cross/tmp
|
||||
|
||||
WINDOWS_AMD64 := gui-for-ffmpeg-$(VERSION)-windows-amd64
|
||||
BUILD_TMP_WINDOWS_AMD64 := $(BUILD_TMP)/$(WINDOWS_AMD64)
|
||||
|
||||
LINUX_AMD64 := gui-for-ffmpeg-$(VERSION)-linux-amd64
|
||||
BUILD_TMP_LINUX_AMD64 := $(BUILD_TMP)/$(LINUX_AMD64)
|
||||
|
||||
RELEASES := fyne-cross/releases/$(VERSION)
|
||||
|
||||
default:
|
||||
# Run "make build-for-linux_amd64"
|
||||
# Run "make build-for-windows_amd64"
|
||||
# Build for all
|
||||
# Run "make build"
|
||||
|
||||
build:
|
||||
make build-for-linux_amd64
|
||||
make build-for-windows_amd64
|
||||
# $(RELEASES)/$(LINUX_AMD64).tar.gz
|
||||
# $(RELEASES)/$(LINUX_AMD64).tar.gz.sha256
|
||||
# $(RELEASES)/$(WINDOWS_AMD64).zip
|
||||
# $(RELEASES)/$(WINDOWS_AMD64).zip.sha256
|
||||
|
||||
build-for-windows_amd64:
|
||||
fyne-cross windows
|
||||
|
||||
@if [ -d $(BUILD_TMP_WINDOWS_AMD64) ]; then \
|
||||
rm -rf $(BUILD_TMP_WINDOWS_AMD64)/*; \
|
||||
else \
|
||||
mkdir -p $(BUILD_TMP_WINDOWS_AMD64); \
|
||||
fi
|
||||
cp LICENSE $(BUILD_TMP_WINDOWS_AMD64)/LICENSE
|
||||
cp LICENSE-3RD-PARTY.txt $(BUILD_TMP_WINDOWS_AMD64)/LICENSE-3RD-PARTY.txt
|
||||
cp "fyne-cross/bin/windows-amd64/GUI for FFmpeg.exe" $(BUILD_TMP_WINDOWS_AMD64)/gui-for-ffmpeg.exe
|
||||
cd $(BUILD_TMP) && 7z a -tzip $(WINDOWS_AMD64).zip $(WINDOWS_AMD64)
|
||||
|
||||
@if [ ! -d $(RELEASES) ]; then \
|
||||
mkdir -p $(RELEASES); \
|
||||
fi
|
||||
|
||||
@if [ -f $(RELEASES)/$(WINDOWS_AMD64).zip ]; then \
|
||||
rm $(RELEASES)/$(WINDOWS_AMD64).zip; \
|
||||
fi
|
||||
|
||||
@if [ -f $(RELEASES)/$(WINDOWS_AMD64).zip.sha256 ]; then \
|
||||
rm $(RELEASES)/$(WINDOWS_AMD64).zip.sha256; \
|
||||
fi
|
||||
|
||||
mv $(BUILD_TMP)/$(WINDOWS_AMD64).zip $(RELEASES)/$(WINDOWS_AMD64).zip
|
||||
cd $(RELEASES) && sha256sum $(WINDOWS_AMD64).zip > $(WINDOWS_AMD64).zip.sha256
|
||||
# $(RELEASES)/$(WINDOWS_AMD64).zip
|
||||
# $(RELEASES)/$(WINDOWS_AMD64).zip.sha256
|
||||
|
||||
build-for-linux_amd64:
|
||||
fyne-cross linux
|
||||
|
||||
@if [ -d $(BUILD_TMP_LINUX_AMD64) ]; then \
|
||||
rm -rf $(BUILD_TMP_LINUX_AMD64)/*; \
|
||||
else \
|
||||
mkdir -p $(BUILD_TMP_LINUX_AMD64); \
|
||||
fi
|
||||
cp -r dist/linux/* $(BUILD_TMP_LINUX_AMD64)/
|
||||
cp LICENSE $(BUILD_TMP_LINUX_AMD64)/LICENSE
|
||||
cp LICENSE-3RD-PARTY.txt $(BUILD_TMP_LINUX_AMD64)/LICENSE-3RD-PARTY.txt
|
||||
cp fyne-cross/bin/linux-amd64/gui-for-ffmpeg $(BUILD_TMP_LINUX_AMD64)/usr/local/bin/gui-for-ffmpeg
|
||||
cp assets/icon.png $(BUILD_TMP_LINUX_AMD64)/usr/local/share/pixmaps/gui-for-ffmpeg.png
|
||||
|
||||
cd $(BUILD_TMP) && tar -czvf $(LINUX_AMD64).tar.gz $(LINUX_AMD64)
|
||||
|
||||
@if [ ! -d $(RELEASES) ]; then \
|
||||
mkdir -p $(RELEASES); \
|
||||
fi
|
||||
|
||||
@if [ -f $(RELEASES)/$(LINUX_AMD64).tar.gz ]; then \
|
||||
rm $(RELEASES)/$(LINUX_AMD64).tar.gz; \
|
||||
fi
|
||||
|
||||
@if [ -f $(RELEASES)/$(LINUX_AMD64).tar.gz.sha256 ]; then \
|
||||
rm $(RELEASES)/$(LINUX_AMD64).tar.gz.sha256; \
|
||||
fi
|
||||
|
||||
mv $(BUILD_TMP)/$(LINUX_AMD64).tar.gz $(RELEASES)/$(LINUX_AMD64).tar.gz
|
||||
cd $(RELEASES) && sha256sum $(LINUX_AMD64).tar.gz > $(LINUX_AMD64).tar.gz.sha256
|
||||
# $(RELEASES)/$(LINUX_AMD64).tar.gz
|
||||
# $(RELEASES)/$(LINUX_AMD64).tar.gz.sha256
|
42
README.md
42
README.md
@@ -1,11 +1,11 @@
|
||||
# GUI for FFmpeg
|
||||
|
||||
<p>Простенький интерфейс для консольной утилиты FFmpeg. Но я <strong>не являюсь</strong> автором самой утилиты <strong>FFmpeg</strong>.</p>
|
||||
<p><strong>FFmpeg</strong> — торговая марка <strong><a href="http://bellard.org/" target="_blank">Fabrice Bellard</a></strong>, создателя проекта <strong><a href="https://ffmpeg.org/about.html" target="_blank">FFmpeg</a></strong>.</p>
|
||||
<p><strong>FFmpeg</strong> — торговая марка <strong><a href="https://bellard.org/" target="_blank">Fabrice Bellard</a></strong>, создателя проекта <strong><a href="https://ffmpeg.org/about.html" target="_blank">FFmpeg</a></strong>.</p>
|
||||
|
||||
<p>Программное обеспечение является MIT (см. <a href="https://git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/branch/main/LICENSE">LICENSE</a>) и использует сторонние библиотеки, которые распространяются на их собственных условиях (см. <a href="https://git.kor-elf.net/kor-elf/gui-for-ffmpeg/src/branch/main/LICENSE-3RD-PARTY.txt">LICENSE-3RD-PARTY.txt</a>).</p>
|
||||
|
||||
<img src="images/screenshot-gui-for-ffmpeg.png">
|
||||
<img src="assets/screenshot-gui-for-ffmpeg.png" alt="Скриншот программы">
|
||||
|
||||
<p>Скачать скомпилированные готовые версии можно тут: <a href="https://git.kor-elf.net/kor-elf/gui-for-ffmpeg/releases">https://git.kor-elf.net/kor-elf/gui-for-ffmpeg/releases</a>.</p>
|
||||
|
||||
@@ -13,6 +13,18 @@
|
||||
1. go install fyne.io/fyne/v2/cmd/fyne@latest
|
||||
2. fyne get git.kor-elf.net/kor-elf/gui-for-ffmpeg
|
||||
|
||||
## Скомпилировать через Makefile:
|
||||
1. git clone https://git.kor-elf.net/kor-elf/gui-for-ffmpeg.git
|
||||
2. Переходим в папку проекта и там переходим в папку src: **cd gui-for-ffmpeg**
|
||||
3. Ознакамливаемся, что нужно ещё установить для Вашей ОС для простого запуска (через go run) тут: https://docs.fyne.io/started/
|
||||
4. go install github.com/fyne-io/fyne-cross@latest
|
||||
* У Вас так же должен быть установлен docker
|
||||
* О fyne-cross можно по подробней почитать тут: https://github.com/fyne-io/fyne-cross
|
||||
5. * make build-for-linux_amd64
|
||||
* make build-for-windows_amd64
|
||||
* Или просто **make build**
|
||||
6. Создаться папка с архивом в **fyne-cross/releases**
|
||||
|
||||
## Скомпилировать через исходники:
|
||||
1. git clone https://git.kor-elf.net/kor-elf/gui-for-ffmpeg.git
|
||||
2. Переходим в папку проекта и там переходим в папку src: **cd gui-for-ffmpeg**
|
||||
@@ -21,25 +33,7 @@
|
||||
5. go install github.com/fyne-io/fyne-cross@latest
|
||||
* У Вас так же должен быть установлен docker
|
||||
* О fyne-cross можно по подробней почитать тут: https://github.com/fyne-io/fyne-cross
|
||||
6. * fyne-cross windows --icon icon.png --app-id "." -name "gui-for-ffmpeg"
|
||||
* fyne-cross linux --icon icon.png --app-id "." -name "gui-for-ffmpeg"
|
||||
7. Создаться папка **fyne-cross/bin** и там будет созданна папка с тем названием под которую Вы компилировали приложения (linux-amd64 или windows-amd64).
|
||||
8. В папку **fyne-cross/bin/linux-amd64** или **fyne-cross/bin/windows-amd64** копируете:
|
||||
* icon.png
|
||||
* data
|
||||
* languages
|
||||
* LICENSE
|
||||
* LICENSE-3RD-PARTY.txt
|
||||
<p><strong>Структура должна получиться такая:</strong></p>
|
||||
<img src="images/screenshot-folder-structure.png">
|
||||
|
||||
## Работа с переводами:
|
||||
1. go install -v github.com/nicksnyder/go-i18n/v2/goi18n@latest
|
||||
3. Создаём файл languages/translate.\*.toml
|
||||
4. goi18n merge -sourceLanguage ru -outdir languages languages/active.\*.toml languages/translate.\*.toml
|
||||
5. В файлах **languages/translate.\*.toml** переводим текст на нужный язык
|
||||
6. goi18n merge -sourceLanguage ru -outdir languages languages/active.\*.toml languages/translate.\*.toml
|
||||
|
||||
___где * подставляем нужный язык___
|
||||
|
||||
Более подробно можно почитать тут: https://github.com/nicksnyder/go-i18n
|
||||
6. * fyne-cross windows
|
||||
* fyne-cross linux
|
||||
7. Создаться папка **fyne-cross/dist** и там будет созданна папка с тем названием под которую Вы компилировали приложения (linux-amd64 или windows-amd64).
|
||||
8. В папке **fyne-cross/dist/linux-amd64** или **fyne-cross/dist/windows-amd64** будут архивы, которые надо распаковать и пользоваться программой.
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
BIN
assets/screenshot-gui-for-ffmpeg.png
Normal file
BIN
assets/screenshot-gui-for-ffmpeg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
@@ -1,36 +0,0 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
||||
)
|
||||
|
||||
type RepositoryContract interface {
|
||||
GetPathFfmpeg() (string, error)
|
||||
SavePathFfmpeg(code string) (setting.Setting, error)
|
||||
GetPathFfprobe() (string, error)
|
||||
SavePathFfprobe(code string) (setting.Setting, error)
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
settingRepository setting.RepositoryContract
|
||||
}
|
||||
|
||||
func NewRepository(settingRepository setting.RepositoryContract) *Repository {
|
||||
return &Repository{settingRepository: settingRepository}
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfmpeg() (string, error) {
|
||||
return r.settingRepository.GetValue("ffmpeg")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfmpeg(path string) (setting.Setting, error) {
|
||||
return r.settingRepository.CreateOrUpdate("ffmpeg", path)
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfprobe() (string, error) {
|
||||
return r.settingRepository.GetValue("ffprobe")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfprobe(path string) (setting.Setting, error) {
|
||||
return r.settingRepository.CreateOrUpdate("ffprobe", path)
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
type ViewContract interface {
|
||||
Main(
|
||||
formConversion view.ConversionContract,
|
||||
)
|
||||
SelectFFPath(
|
||||
ffmpegPath string,
|
||||
ffprobePath string,
|
||||
save func(ffmpegPath string, ffprobePath string) error,
|
||||
cancel func(),
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
)
|
||||
}
|
||||
|
||||
type View struct {
|
||||
app kernel.AppContract
|
||||
downloadFFmpeg *downloadFFmpeg
|
||||
}
|
||||
|
||||
type downloadFFmpeg struct {
|
||||
isDownloadFFmpeg bool
|
||||
blockDownloadFFmpegContainer *fyne.Container
|
||||
}
|
||||
|
||||
func NewView(app kernel.AppContract) *View {
|
||||
return &View{
|
||||
app: app,
|
||||
downloadFFmpeg: &downloadFFmpeg{
|
||||
blockDownloadFFmpegContainer: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (v View) Main(formConversion view.ConversionContract) {
|
||||
converterVideoFilesTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "converterVideoFilesTitle",
|
||||
})
|
||||
v.app.GetWindow().SetContent(widget.NewCard(converterVideoFilesTitle, "", container.NewVScroll(formConversion.GetContent())))
|
||||
formConversion.AfterViewContent()
|
||||
}
|
||||
|
||||
func setStringErrorStyle(text *canvas.Text) {
|
||||
text.Color = color.RGBA{R: 255, G: 0, B: 0, A: 255}
|
||||
text.Refresh()
|
||||
}
|
||||
|
||||
func setStringSuccessStyle(text *canvas.Text) {
|
||||
text.Color = color.RGBA{R: 49, G: 127, B: 114, A: 255}
|
||||
text.Refresh()
|
||||
}
|
@@ -1,474 +0,0 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/storage"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items"
|
||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"image/color"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type ConversionContract interface {
|
||||
GetContent() fyne.CanvasObject
|
||||
AfterViewContent()
|
||||
}
|
||||
|
||||
type Conversion struct {
|
||||
app kernel.AppContract
|
||||
form *form
|
||||
conversionMessage *canvas.Text
|
||||
fileForConversion *fileForConversion
|
||||
directoryForSaving *directoryForSaving
|
||||
overwriteOutputFiles *overwriteOutputFiles
|
||||
selectEncoder *selectEncoder
|
||||
runConvert func(setting HandleConvertSetting)
|
||||
}
|
||||
|
||||
type HandleConvertSetting struct {
|
||||
FileInput kernel.File
|
||||
DirectoryForSave string
|
||||
OverwriteOutputFiles bool
|
||||
Format string
|
||||
Encoder encoder2.EncoderContract
|
||||
}
|
||||
|
||||
func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContract, runConvert func(setting HandleConvertSetting), settingDirectoryForSaving setting.DirectoryForSavingContract) *Conversion {
|
||||
conversionMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
conversionMessage.TextSize = 16
|
||||
conversionMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
fileForConversion := newFileForConversion(app)
|
||||
directoryForSaving := newDirectoryForSaving(app, settingDirectoryForSaving)
|
||||
overwriteOutputFiles := newOverwriteOutputFiles(app)
|
||||
selectEncoder := newSelectEncoder(app, formats)
|
||||
|
||||
items := []*widget.FormItem{
|
||||
{
|
||||
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "fileForConversionTitle"}),
|
||||
Widget: fileForConversion.button,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(fileForConversion.message),
|
||||
},
|
||||
{
|
||||
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "buttonForSelectedDirTitle"}),
|
||||
Widget: directoryForSaving.button,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(directoryForSaving.message),
|
||||
},
|
||||
{
|
||||
Widget: overwriteOutputFiles.checkbox,
|
||||
},
|
||||
{
|
||||
Widget: selectEncoder.SelectFileType,
|
||||
},
|
||||
{
|
||||
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "selectFormat"}),
|
||||
Widget: selectEncoder.SelectFormat,
|
||||
},
|
||||
{
|
||||
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "selectEncoder"}),
|
||||
Widget: selectEncoder.SelectEncoder,
|
||||
},
|
||||
}
|
||||
form := newForm(app, items)
|
||||
|
||||
return &Conversion{
|
||||
app: app,
|
||||
form: form,
|
||||
conversionMessage: conversionMessage,
|
||||
fileForConversion: fileForConversion,
|
||||
directoryForSaving: directoryForSaving,
|
||||
overwriteOutputFiles: overwriteOutputFiles,
|
||||
selectEncoder: selectEncoder,
|
||||
runConvert: runConvert,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Conversion) GetContent() fyne.CanvasObject {
|
||||
c.form.form.OnSubmit = c.submit
|
||||
c.fileForConversion.AddChangeCallback(c.selectFileForConversion)
|
||||
c.selectEncoder.AddChangeCallback(c.changeEncoder)
|
||||
if c.selectEncoder.Encoder != nil {
|
||||
c.selectEncoder.SelectEncoder.SetSelectedIndex(c.selectEncoder.SelectEncoder.SelectedIndex())
|
||||
}
|
||||
|
||||
return container.NewVBox(
|
||||
c.form.form,
|
||||
c.conversionMessage,
|
||||
)
|
||||
}
|
||||
|
||||
func (c Conversion) changeEncoder(encoder encoder2.EncoderContract) {
|
||||
items := []*widget.FormItem{}
|
||||
|
||||
if form_items.Views[encoder.GetName()] != nil {
|
||||
items = form_items.Views[encoder.GetName()](encoder, c.app)
|
||||
}
|
||||
|
||||
c.form.ChangeItems(items)
|
||||
}
|
||||
|
||||
func (c Conversion) AfterViewContent() {
|
||||
c.form.form.Disable()
|
||||
}
|
||||
|
||||
func (c Conversion) selectFileForConversion(err error) {
|
||||
c.conversionMessage.Text = ""
|
||||
if err != nil {
|
||||
c.form.form.Disable()
|
||||
return
|
||||
}
|
||||
|
||||
c.form.form.Enable()
|
||||
}
|
||||
|
||||
func (c Conversion) submit() {
|
||||
if len(c.directoryForSaving.path) == 0 {
|
||||
showConversionMessage(c.conversionMessage, errors.New(c.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorSelectedFolderSave",
|
||||
})))
|
||||
c.enableFormConversion()
|
||||
return
|
||||
}
|
||||
if len(c.selectEncoder.SelectFormat.Selected) == 0 {
|
||||
showConversionMessage(c.conversionMessage, errors.New(c.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorSelectedFormat",
|
||||
})))
|
||||
return
|
||||
}
|
||||
if c.selectEncoder.Encoder == nil {
|
||||
showConversionMessage(c.conversionMessage, errors.New(c.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorSelectedEncoder",
|
||||
})))
|
||||
return
|
||||
}
|
||||
c.conversionMessage.Text = ""
|
||||
|
||||
c.fileForConversion.button.Disable()
|
||||
c.directoryForSaving.button.Disable()
|
||||
c.form.form.Disable()
|
||||
|
||||
setting := HandleConvertSetting{
|
||||
FileInput: *c.fileForConversion.file,
|
||||
DirectoryForSave: c.directoryForSaving.path,
|
||||
OverwriteOutputFiles: c.overwriteOutputFiles.IsChecked(),
|
||||
Format: c.selectEncoder.SelectFormat.Selected,
|
||||
Encoder: c.selectEncoder.Encoder,
|
||||
}
|
||||
c.runConvert(setting)
|
||||
c.enableFormConversion()
|
||||
|
||||
c.fileForConversion.message.Text = ""
|
||||
c.form.form.Disable()
|
||||
}
|
||||
|
||||
func (c Conversion) enableFormConversion() {
|
||||
c.fileForConversion.button.Enable()
|
||||
c.directoryForSaving.button.Enable()
|
||||
c.form.form.Enable()
|
||||
}
|
||||
|
||||
type fileForConversion struct {
|
||||
button *widget.Button
|
||||
message *canvas.Text
|
||||
file *kernel.File
|
||||
|
||||
changeCallbacks map[int]func(err error)
|
||||
}
|
||||
|
||||
func newFileForConversion(app kernel.AppContract) *fileForConversion {
|
||||
fileForConversion := &fileForConversion{
|
||||
file: &kernel.File{},
|
||||
changeCallbacks: map[int]func(err error){},
|
||||
}
|
||||
|
||||
buttonTitle := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "choose",
|
||||
})
|
||||
|
||||
fileForConversion.message = canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
fileForConversion.message.TextSize = 16
|
||||
fileForConversion.message.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
var locationURI fyne.ListableURI
|
||||
|
||||
fileForConversion.button = widget.NewButton(buttonTitle, func() {
|
||||
app.GetWindow().NewFileOpen(func(r fyne.URIReadCloser, err error) {
|
||||
if err != nil {
|
||||
fileForConversion.message.Text = err.Error()
|
||||
setStringErrorStyle(fileForConversion.message)
|
||||
fileForConversion.eventSelectFile(err)
|
||||
return
|
||||
}
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
fileForConversion.file.Path = r.URI().Path()
|
||||
fileForConversion.file.Name = r.URI().Name()
|
||||
fileForConversion.file.Ext = r.URI().Extension()
|
||||
|
||||
fileForConversion.message.Text = r.URI().Path()
|
||||
setStringSuccessStyle(fileForConversion.message)
|
||||
|
||||
fileForConversion.eventSelectFile(nil)
|
||||
|
||||
listableURI := storage.NewFileURI(filepath.Dir(r.URI().Path()))
|
||||
locationURI, err = storage.ListerForURI(listableURI)
|
||||
}, locationURI)
|
||||
})
|
||||
|
||||
return fileForConversion
|
||||
}
|
||||
|
||||
func (c fileForConversion) AddChangeCallback(callback func(err error)) {
|
||||
c.changeCallbacks[len(c.changeCallbacks)] = callback
|
||||
}
|
||||
|
||||
func (c fileForConversion) eventSelectFile(err error) {
|
||||
for _, changeCallback := range c.changeCallbacks {
|
||||
changeCallback(err)
|
||||
}
|
||||
}
|
||||
|
||||
type directoryForSaving struct {
|
||||
button *widget.Button
|
||||
message *canvas.Text
|
||||
path string
|
||||
}
|
||||
|
||||
func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving setting.DirectoryForSavingContract) *directoryForSaving {
|
||||
directoryForSaving := &directoryForSaving{
|
||||
path: "",
|
||||
}
|
||||
|
||||
directoryForSaving.message = canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
directoryForSaving.message.TextSize = 16
|
||||
directoryForSaving.message.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
buttonTitle := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "choose",
|
||||
})
|
||||
|
||||
var locationURI fyne.ListableURI
|
||||
|
||||
location, err := getDirectoryForSaving(settingDirectoryForSaving)
|
||||
if err == nil {
|
||||
directoryForSaving.path = location.Path()
|
||||
directoryForSaving.message.Text = location.Path()
|
||||
setStringSuccessStyle(directoryForSaving.message)
|
||||
}
|
||||
|
||||
directoryForSaving.button = widget.NewButton(buttonTitle, func() {
|
||||
app.GetWindow().NewFolderOpen(func(r fyne.ListableURI, err error) {
|
||||
if err != nil {
|
||||
directoryForSaving.message.Text = err.Error()
|
||||
setStringErrorStyle(directoryForSaving.message)
|
||||
return
|
||||
}
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
directoryForSaving.path = r.Path()
|
||||
|
||||
directoryForSaving.message.Text = r.Path()
|
||||
setStringSuccessStyle(directoryForSaving.message)
|
||||
locationURI, err = storage.ListerForURI(r)
|
||||
|
||||
if err == nil {
|
||||
_, _ = settingDirectoryForSaving.SaveDirectoryForSaving(locationURI.Path())
|
||||
}
|
||||
|
||||
}, locationURI)
|
||||
})
|
||||
|
||||
return directoryForSaving
|
||||
}
|
||||
|
||||
func getDirectoryForSaving(settingDirectoryForSaving setting.DirectoryForSavingContract) (fyne.ListableURI, error) {
|
||||
path, err := settingDirectoryForSaving.GetDirectoryForSaving()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(path) > 0 {
|
||||
path = "file://" + path
|
||||
}
|
||||
|
||||
uri, err := storage.ParseURI(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return storage.ListerForURI(uri)
|
||||
}
|
||||
|
||||
type overwriteOutputFiles struct {
|
||||
checkbox *widget.Check
|
||||
isChecked bool
|
||||
}
|
||||
|
||||
func newOverwriteOutputFiles(app kernel.AppContract) *overwriteOutputFiles {
|
||||
overwriteOutputFiles := &overwriteOutputFiles{
|
||||
isChecked: false,
|
||||
}
|
||||
checkboxOverwriteOutputFilesTitle := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "checkboxOverwriteOutputFilesTitle",
|
||||
})
|
||||
overwriteOutputFiles.checkbox = widget.NewCheck(checkboxOverwriteOutputFilesTitle, func(b bool) {
|
||||
overwriteOutputFiles.isChecked = b
|
||||
})
|
||||
|
||||
return overwriteOutputFiles
|
||||
}
|
||||
|
||||
func (receiver overwriteOutputFiles) IsChecked() bool {
|
||||
return receiver.isChecked
|
||||
}
|
||||
|
||||
type selectEncoder struct {
|
||||
SelectFileType *widget.RadioGroup
|
||||
SelectFormat *widget.Select
|
||||
SelectEncoder *widget.Select
|
||||
Encoder encoder2.EncoderContract
|
||||
|
||||
changeCallbacks map[int]func(encoder encoder2.EncoderContract)
|
||||
}
|
||||
|
||||
func newSelectEncoder(app kernel.AppContract, formats encoder.ConvertorFormatsContract) *selectEncoder {
|
||||
selectEncoder := &selectEncoder{
|
||||
changeCallbacks: map[int]func(encoder encoder2.EncoderContract){},
|
||||
}
|
||||
|
||||
encoders := map[int]encoder2.EncoderDataContract{}
|
||||
selectEncoder.SelectEncoder = widget.NewSelect([]string{}, func(s string) {
|
||||
if encoders[selectEncoder.SelectEncoder.SelectedIndex()] == nil {
|
||||
return
|
||||
}
|
||||
selectEncoderData := encoders[selectEncoder.SelectEncoder.SelectedIndex()]
|
||||
selectEncoder.ChangeEncoder(selectEncoderData.NewEncoder())
|
||||
})
|
||||
|
||||
formatSelected := ""
|
||||
selectEncoder.SelectFormat = widget.NewSelect([]string{}, func(s string) {
|
||||
if formatSelected == s {
|
||||
return
|
||||
}
|
||||
formatSelected = s
|
||||
format, err := formats.GetFormat(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
encoderOptions := []string{}
|
||||
encoders = map[int]encoder2.EncoderDataContract{}
|
||||
for _, e := range format.GetEncoders() {
|
||||
encoders[len(encoders)] = e
|
||||
encoderOptions = append(encoderOptions, app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "encoder_" + e.GetTitle()}))
|
||||
}
|
||||
selectEncoder.SelectEncoder.SetOptions(encoderOptions)
|
||||
selectEncoder.SelectEncoder.SetSelectedIndex(0)
|
||||
})
|
||||
|
||||
fileTypeOptions := []string{}
|
||||
for _, fileType := range encoder2.GetListFileType() {
|
||||
fileTypeOptions = append(fileTypeOptions, fileType.Name())
|
||||
}
|
||||
|
||||
encoderGroupVideo := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "encoderGroupVideo"})
|
||||
encoderGroupAudio := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "encoderGroupAudio"})
|
||||
encoderGroupImage := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "encoderGroupImage"})
|
||||
encoderGroup := map[string]string{
|
||||
encoderGroupVideo: "video",
|
||||
encoderGroupAudio: "audio",
|
||||
encoderGroupImage: "image",
|
||||
}
|
||||
selectEncoder.SelectFileType = widget.NewRadioGroup([]string{encoderGroupVideo, encoderGroupAudio, encoderGroupImage}, func(s string) {
|
||||
groupCode := encoderGroup[s]
|
||||
|
||||
formatOptions := []string{}
|
||||
for _, f := range formats.GetFormats() {
|
||||
if groupCode != f.GetFileType().Name() {
|
||||
continue
|
||||
}
|
||||
formatOptions = append(formatOptions, f.GetTitle())
|
||||
}
|
||||
selectEncoder.SelectFormat.SetOptions(formatOptions)
|
||||
if groupCode == encoder2.FileType(encoder2.Video).Name() {
|
||||
selectEncoder.SelectFormat.SetSelected("mp4")
|
||||
} else {
|
||||
selectEncoder.SelectFormat.SetSelectedIndex(0)
|
||||
}
|
||||
})
|
||||
selectEncoder.SelectFileType.Horizontal = true
|
||||
selectEncoder.SelectFileType.Required = true
|
||||
selectEncoder.SelectFileType.SetSelected(encoderGroupVideo)
|
||||
|
||||
return selectEncoder
|
||||
}
|
||||
|
||||
func (e *selectEncoder) ChangeEncoder(encoder encoder2.EncoderContract) {
|
||||
e.Encoder = encoder
|
||||
e.eventSelectEncoder(e.Encoder)
|
||||
}
|
||||
|
||||
func (e *selectEncoder) AddChangeCallback(callback func(encoder encoder2.EncoderContract)) {
|
||||
e.changeCallbacks[len(e.changeCallbacks)] = callback
|
||||
}
|
||||
|
||||
func (e *selectEncoder) eventSelectEncoder(encoder encoder2.EncoderContract) {
|
||||
for _, changeCallback := range e.changeCallbacks {
|
||||
changeCallback(encoder)
|
||||
}
|
||||
}
|
||||
|
||||
func setStringErrorStyle(text *canvas.Text) {
|
||||
text.Color = color.RGBA{R: 255, G: 0, B: 0, A: 255}
|
||||
text.Refresh()
|
||||
}
|
||||
|
||||
func setStringSuccessStyle(text *canvas.Text) {
|
||||
text.Color = color.RGBA{R: 49, G: 127, B: 114, A: 255}
|
||||
text.Refresh()
|
||||
}
|
||||
|
||||
func showConversionMessage(conversionMessage *canvas.Text, err error) {
|
||||
conversionMessage.Text = err.Error()
|
||||
setStringErrorStyle(conversionMessage)
|
||||
}
|
||||
|
||||
type form struct {
|
||||
form *widget.Form
|
||||
items []*widget.FormItem
|
||||
}
|
||||
|
||||
func newForm(app kernel.AppContract, items []*widget.FormItem) *form {
|
||||
f := widget.NewForm()
|
||||
f.SubmitText = app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "converterVideoFilesSubmitTitle",
|
||||
})
|
||||
f.Items = items
|
||||
|
||||
return &form{
|
||||
form: f,
|
||||
items: items,
|
||||
}
|
||||
}
|
||||
|
||||
func (f form) ChangeItems(items []*widget.FormItem) {
|
||||
f.form.Items = f.items
|
||||
f.form.Refresh()
|
||||
f.form.Items = append(f.form.Items, items...)
|
||||
f.form.Refresh()
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package form_items
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items/h264_nvenc"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items/libx264"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items/libx265"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
)
|
||||
|
||||
var Views = map[string]func(encoder encoder.EncoderContract, app kernel.AppContract) []*widget.FormItem{
|
||||
"libx264": libx264.View,
|
||||
"h264_nvenc": h264_nvenc.View,
|
||||
"libx265": libx265.View,
|
||||
}
|
@@ -1,134 +0,0 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/storage"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"image/color"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (v View) SelectFFPath(
|
||||
currentPathFfmpeg string,
|
||||
currentPathFfprobe string,
|
||||
save func(ffmpegPath string, ffprobePath string) error,
|
||||
cancel func(),
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
) {
|
||||
errorMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
errorMessage.TextSize = 16
|
||||
errorMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
ffmpegPath, buttonFFmpeg, buttonFFmpegMessage := v.getButtonSelectFile(currentPathFfmpeg)
|
||||
ffprobePath, buttonFFprobe, buttonFFprobeMessage := v.getButtonSelectFile(currentPathFfprobe)
|
||||
|
||||
link := widget.NewHyperlink("https://ffmpeg.org/download.html", &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "ffmpeg.org",
|
||||
Path: "download.html",
|
||||
})
|
||||
|
||||
form := &widget.Form{
|
||||
Items: []*widget.FormItem{
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "titleDownloadLink",
|
||||
}),
|
||||
Widget: link,
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfmpeg",
|
||||
}),
|
||||
Widget: buttonFFmpeg,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFmpegMessage),
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfprobe",
|
||||
}),
|
||||
Widget: buttonFFprobe,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFprobeMessage),
|
||||
},
|
||||
{
|
||||
Widget: errorMessage,
|
||||
},
|
||||
},
|
||||
SubmitText: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "save",
|
||||
}),
|
||||
OnSubmit: func() {
|
||||
err := save(*ffmpegPath, *ffprobePath)
|
||||
if err != nil {
|
||||
errorMessage.Text = err.Error()
|
||||
}
|
||||
},
|
||||
}
|
||||
if cancel != nil {
|
||||
form.OnCancel = cancel
|
||||
form.CancelText = v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "cancel",
|
||||
})
|
||||
}
|
||||
selectFFPathTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "selectFFPathTitle",
|
||||
})
|
||||
|
||||
if v.downloadFFmpeg.blockDownloadFFmpegContainer == nil {
|
||||
v.downloadFFmpeg.blockDownloadFFmpegContainer = v.blockDownloadFFmpeg(donwloadFFmpeg)
|
||||
}
|
||||
|
||||
v.app.GetWindow().SetContent(widget.NewCard(selectFFPathTitle, "", container.NewVBox(
|
||||
form,
|
||||
v.downloadFFmpeg.blockDownloadFFmpegContainer,
|
||||
)))
|
||||
}
|
||||
|
||||
func (v View) getButtonSelectFile(path string) (filePath *string, button *widget.Button, buttonMessage *canvas.Text) {
|
||||
filePath = &path
|
||||
|
||||
buttonMessage = canvas.NewText(path, color.RGBA{R: 49, G: 127, B: 114, A: 255})
|
||||
buttonMessage.TextSize = 16
|
||||
buttonMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
buttonTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "choose",
|
||||
})
|
||||
|
||||
var locationURI fyne.ListableURI
|
||||
if len(path) > 0 {
|
||||
listableURI := storage.NewFileURI(filepath.Dir(path))
|
||||
locationURI, _ = storage.ListerForURI(listableURI)
|
||||
}
|
||||
|
||||
button = widget.NewButton(buttonTitle, func() {
|
||||
v.app.GetWindow().NewFileOpen(func(r fyne.URIReadCloser, err error) {
|
||||
if err != nil {
|
||||
buttonMessage.Text = err.Error()
|
||||
setStringErrorStyle(buttonMessage)
|
||||
return
|
||||
}
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
path = r.URI().Path()
|
||||
|
||||
buttonMessage.Text = r.URI().Path()
|
||||
setStringSuccessStyle(buttonMessage)
|
||||
|
||||
listableURI := storage.NewFileURI(filepath.Dir(r.URI().Path()))
|
||||
locationURI, _ = storage.ListerForURI(listableURI)
|
||||
}, locationURI)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
//go:build !windows && !linux
|
||||
// +build !windows,!linux
|
||||
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func (v View) blockDownloadFFmpeg(
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
) *fyne.Container {
|
||||
return container.NewVBox()
|
||||
}
|
2
data/.gitignore
vendored
2
data/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
7
db/db.go
7
db/db.go
@@ -1,7 +0,0 @@
|
||||
package db
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrRecordNotFound = errors.New("record not found")
|
||||
)
|
39
dist/linux/Makefile
vendored
Normal file
39
dist/linux/Makefile
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# If PREFIX isn't provided, we check for $(DESTDIR)/usr/local and use that if it exists.
|
||||
# Otherwice we fall back to using /usr.
|
||||
|
||||
LOCAL != test -d $(DESTDIR)/usr/local && echo -n "/local" || echo -n ""
|
||||
LOCAL ?= $(shell test -d $(DESTDIR)/usr/local && echo "/local" || echo "")
|
||||
PREFIX ?= /usr$(LOCAL)
|
||||
|
||||
Name := "gui-for-ffmpeg"
|
||||
Exec := "gui-for-ffmpeg"
|
||||
Icon := "gui-for-ffmpeg.png"
|
||||
|
||||
default:
|
||||
# User install
|
||||
# Run "make user-install" to install in ~/.local/
|
||||
# Run "make user-uninstall" to uninstall from ~/.local/
|
||||
#
|
||||
# System install
|
||||
# Run "sudo make install" to install the application.
|
||||
# Run "sudo make uninstall" to uninstall the application.
|
||||
|
||||
install:
|
||||
install -Dm00644 usr/local/share/applications/$(Name).desktop $(DESTDIR)$(PREFIX)/share/applications/$(Name).desktop
|
||||
install -Dm00755 usr/local/bin/$(Exec) $(DESTDIR)$(PREFIX)/bin/$(Exec)
|
||||
install -Dm00644 usr/local/share/pixmaps/$(Icon) $(DESTDIR)$(PREFIX)/share/pixmaps/$(Icon)
|
||||
uninstall:
|
||||
-rm $(DESTDIR)$(PREFIX)/share/applications/$(Name).desktop
|
||||
-rm $(DESTDIR)$(PREFIX)/bin/$(Exec)
|
||||
-rm $(DESTDIR)$(PREFIX)/share/pixmaps/$(Icon)
|
||||
|
||||
user-install:
|
||||
install -Dm00644 usr/local/share/applications/$(Name).desktop $(DESTDIR)$(HOME)/.local/share/applications/$(Name).desktop
|
||||
install -Dm00755 usr/local/bin/$(Exec) $(DESTDIR)$(HOME)/.local/bin/$(Exec)
|
||||
install -Dm00644 usr/local/share/pixmaps/$(Icon) $(DESTDIR)$(HOME)/.local/share/icons/$(Icon)
|
||||
sed -i -e "s,Exec=$(Exec),Exec=$(DESTDIR)$(HOME)/.local/bin/$(Exec),g" $(DESTDIR)$(HOME)/.local/share/applications/$(Name).desktop
|
||||
|
||||
user-uninstall:
|
||||
-rm $(DESTDIR)$(HOME)/.local/share/applications/$(Name).desktop
|
||||
-rm $(DESTDIR)$(HOME)/.local/bin/$(Exec)
|
||||
-rm $(DESTDIR)$(HOME)/.local/share/icons/$(Icon)
|
12
dist/linux/Readme-eng.txt
vendored
Normal file
12
dist/linux/Readme-eng.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
User install
|
||||
Run "make user-install" to install in ~/.local/
|
||||
Run "make user-uninstall" to uninstall from ~/.local/
|
||||
|
||||
System install
|
||||
Run "sudo make install" to install the application.
|
||||
Run "sudo make uninstall" to uninstall the application.
|
||||
|
||||
|
||||
The program can be launched via the start menu in the Audio/Video or Standard section.
|
||||
You can also call the program via the terminal:
|
||||
gui-for-ffmpeg
|
12
dist/linux/Readme-rus.txt
vendored
Normal file
12
dist/linux/Readme-rus.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
Установить для пользователя (рекомендуется)
|
||||
Запустите "make user-install" для установки в домашнюю папку ~/.local/
|
||||
Запустите "make user-uninstall" для удаления из домашней папки ~/.local/
|
||||
|
||||
Установить для всей системы
|
||||
Запустить "sudo make install" Для установки в систему.
|
||||
Запустить "sudo make uninstall" Для удаления из системы.
|
||||
|
||||
|
||||
Программу можно запустить через пуск в разделе Аудио/Видео или Стандартные.
|
||||
Также можно вызвать программу через терминал:
|
||||
gui-for-ffmpeg
|
2
dist/linux/usr/local/bin/.gitignore
vendored
Normal file
2
dist/linux/usr/local/bin/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
9
dist/linux/usr/local/share/applications/gui-for-ffmpeg.desktop
vendored
Normal file
9
dist/linux/usr/local/share/applications/gui-for-ffmpeg.desktop
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=GUI for FFmpeg
|
||||
GenericName=GUI for FFmpeg
|
||||
Exec=gui-for-ffmpeg
|
||||
Icon=gui-for-ffmpeg
|
||||
Comment=A simple interface for the FFmpeg console utility.
|
||||
Categories=AudioVideo;Utility;
|
||||
Keywords=ffmpeg;media;convert;transcode;audio;video;конвертер;видео;аудио;кодек;
|
2
dist/linux/usr/local/share/pixmaps/.gitignore
vendored
Normal file
2
dist/linux/usr/local/share/pixmaps/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
@@ -1,19 +0,0 @@
|
||||
package apng
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "apng"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("apng", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "apng"
|
||||
formats := []string{"apng"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package bmp
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "bmp"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("bmp", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "bmp"
|
||||
formats := []string{"bmp"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package flv
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "flv"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("flv", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "flv"
|
||||
formats := []string{"flv"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package gif
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "gif"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("gif", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "gif"
|
||||
formats := []string{"gif"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libmp3lame
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "libmp3lame"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libmp3lame", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libmp3lame"
|
||||
formats := []string{"mp3"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libshine
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "libshine"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libshine", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libshine"
|
||||
formats := []string{"mp3"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libtwolame
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "libtwolame"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libtwolame", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libtwolame"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libvpx
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "libvpx"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libvpx", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libvpx"
|
||||
formats := []string{"webm", "mkv"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libvpx_vp9
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "libvpx-vp9"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libvpx_vp9", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libvpx-vp9"
|
||||
formats := []string{"webm", "mkv"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libwebp
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "libwebp"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libwebp", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libwebp"
|
||||
formats := []string{"webp"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libwebp_anim
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "libwebp_anim"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libwebp_anim", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libwebp_anim"
|
||||
formats := []string{"webp"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package libxvid
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "libxvid"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libxvid", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "libxvid"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mjpeg
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "mjpeg"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mjpeg", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mjpeg"
|
||||
formats := []string{"jpg"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mp2
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "mp2"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mp2", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mp2"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mp2fixed
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "mp2fixed"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mp2fixed", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mp2fixed"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mpeg1video
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "mpeg1video"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mpeg1video", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mpeg1video"
|
||||
formats := []string{"mpg", "mpeg"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mpeg2video
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "mpeg2video"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mpeg2video", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mpeg2video"
|
||||
formats := []string{"mpg", "mpeg"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package mpeg4
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "mpeg4"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("mpeg4", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "mpeg4"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package msmpeg4
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "msmpeg4"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("msmpeg4", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "msmpeg4"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package msmpeg4v2
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "msmpeg4v2"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("msmpeg4v2", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "msmpeg4v2"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package msvideo1
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "msvideo1"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("msvideo1", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "msvideo1"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package png
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "png"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("png", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "png"
|
||||
formats := []string{"png"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package qtrle
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "qtrle"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("qtrle", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "qtrle"
|
||||
formats := []string{"mov"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package sgi
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "sgi"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("sgi", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "sgi"
|
||||
formats := []string{"sgi"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package tiff
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "tiff"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("tiff", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "tiff"
|
||||
formats := []string{"tiff"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package wmav1
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "wmav1"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("wmav1", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "wmav1"
|
||||
formats := []string{"wma"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package wmav2
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:a", "wmav2"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("wmav2", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "wmav2"
|
||||
formats := []string{"wma"}
|
||||
fileType := encoder2.FileType(encoder2.Audio)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package wmv1
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "wmv1"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("wmv1", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "wmv1"
|
||||
formats := []string{"wmv"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package wmv2
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "wmv2"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("wmv2", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "wmv2"
|
||||
formats := []string{"wmv"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package xbm
|
||||
|
||||
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
return []string{"-c:v", "xbm"}
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("xbm", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
title := "xbm"
|
||||
formats := []string{"xbm"}
|
||||
fileType := encoder2.FileType(encoder2.Image)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
package error
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type ViewContract interface {
|
||||
PanicError(err error)
|
||||
}
|
||||
|
||||
type View struct {
|
||||
app kernel.AppContract
|
||||
}
|
||||
|
||||
func NewView(app kernel.AppContract) *View {
|
||||
return &View{
|
||||
app: app,
|
||||
}
|
||||
}
|
||||
|
||||
func (v View) PanicError(err error) {
|
||||
messageHead := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "error",
|
||||
})
|
||||
|
||||
v.app.GetWindow().SetContent(container.NewBorder(
|
||||
container.NewVBox(
|
||||
widget.NewLabel(messageHead),
|
||||
widget.NewLabel(err.Error()),
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
localizer.LanguageSelectionForm(v.app.GetLocalizerService(), func(lang kernel.Lang) {
|
||||
v.PanicError(err)
|
||||
}),
|
||||
))
|
||||
}
|
||||
|
||||
func (v View) PanicErrorWriteDirectoryData() {
|
||||
message := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorDatabase",
|
||||
})
|
||||
messageHead := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "error",
|
||||
})
|
||||
|
||||
v.app.GetWindow().SetContent(container.NewBorder(
|
||||
container.NewVBox(
|
||||
widget.NewLabel(messageHead),
|
||||
widget.NewLabel(message),
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
localizer.LanguageSelectionForm(v.app.GetLocalizerService(), func(lang kernel.Lang) {
|
||||
v.PanicErrorWriteDirectoryData()
|
||||
}),
|
||||
))
|
||||
}
|
29
go.mod
29
go.mod
@@ -5,22 +5,20 @@ go 1.23.0
|
||||
toolchain go1.23.9
|
||||
|
||||
require (
|
||||
fyne.io/fyne/v2 v2.6.1
|
||||
github.com/BurntSushi/toml v1.5.0
|
||||
github.com/nicksnyder/go-i18n/v2 v2.6.0
|
||||
github.com/ulikunitz/xz v0.5.12
|
||||
go.etcd.io/bbolt v1.4.0
|
||||
golang.org/x/image v0.27.0
|
||||
golang.org/x/text v0.25.0
|
||||
fyne.io/fyne/v2 v2.6.3
|
||||
github.com/ulikunitz/xz v0.5.13
|
||||
golang.org/x/image v0.30.0
|
||||
golang.org/x/text v0.28.0
|
||||
)
|
||||
|
||||
require (
|
||||
fyne.io/systray v1.11.0 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fredbi/uri v1.1.0 // indirect
|
||||
github.com/fredbi/uri v1.1.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fyne-io/gl-js v0.1.0 // indirect
|
||||
github.com/fyne-io/glfw-js v0.2.0 // indirect
|
||||
github.com/fyne-io/gl-js v0.2.0 // indirect
|
||||
github.com/fyne-io/glfw-js v0.3.0 // indirect
|
||||
github.com/fyne-io/image v0.1.1 // indirect
|
||||
github.com/fyne-io/oksvg v0.1.0 // indirect
|
||||
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 // indirect
|
||||
@@ -30,17 +28,18 @@ require (
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/hack-pad/go-indexeddb v0.3.2 // indirect
|
||||
github.com/hack-pad/safejs v0.1.1 // indirect
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250421151639-a9d6ed1b3d45 // indirect
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade // indirect
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
github.com/nicksnyder/go-i18n/v2 v2.6.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rymdport/portal v0.4.1 // indirect
|
||||
github.com/rymdport/portal v0.4.2 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
|
||||
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
github.com/yuin/goldmark v1.7.11 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
github.com/yuin/goldmark v1.7.13 // indirect
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
28
go.sum
28
go.sum
@@ -1,5 +1,7 @@
|
||||
fyne.io/fyne/v2 v2.6.1 h1:kjPJD4/rBS9m2nHJp+npPSuaK79yj6ObMTuzR6VQ1Is=
|
||||
fyne.io/fyne/v2 v2.6.1/go.mod h1:YZt7SksjvrSNJCwbWFV32WON3mE1Sr7L41D29qMZ/lU=
|
||||
fyne.io/fyne/v2 v2.6.3 h1:cvtM2KHeRuH+WhtHiA63z5wJVBkQ9+Ay0UMl9PxFHyA=
|
||||
fyne.io/fyne/v2 v2.6.3/go.mod h1:NGSurpRElVoI1G3h+ab2df3O5KLGh1CGbsMMcX0bPIs=
|
||||
fyne.io/systray v1.11.0 h1:D9HISlxSkx+jHSniMBR6fCFOUjk1x/OOOJLa9lJYAKg=
|
||||
fyne.io/systray v1.11.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
@@ -11,12 +13,18 @@ github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g=
|
||||
github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw=
|
||||
github.com/fredbi/uri v1.1.0 h1:OqLpTXtyRg9ABReqvDGdJPqZUxs8cyBDOMXBbskCaB8=
|
||||
github.com/fredbi/uri v1.1.0/go.mod h1:aYTUoAXBOq7BLfVJ8GnKmfcuURosB1xyHDIfWeC/iW4=
|
||||
github.com/fredbi/uri v1.1.1 h1:xZHJC08GZNIUhbP5ImTHnt5Ya0T8FI2VAwI/37kh2Ko=
|
||||
github.com/fredbi/uri v1.1.1/go.mod h1:4+DZQ5zBjEwQCDmXW5JdIjz0PUA+yJbvtBv+u+adr5o=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/fyne-io/gl-js v0.1.0 h1:8luJzNs0ntEAJo+8x8kfUOXujUlP8gB3QMOxO2mUdpM=
|
||||
github.com/fyne-io/gl-js v0.1.0/go.mod h1:ZcepK8vmOYLu96JoxbCKJy2ybr+g1pTnaBDdl7c3ajI=
|
||||
github.com/fyne-io/gl-js v0.2.0 h1:+EXMLVEa18EfkXBVKhifYB6OGs3HwKO3lUElA0LlAjs=
|
||||
github.com/fyne-io/gl-js v0.2.0/go.mod h1:ZcepK8vmOYLu96JoxbCKJy2ybr+g1pTnaBDdl7c3ajI=
|
||||
github.com/fyne-io/glfw-js v0.2.0 h1:8GUZtN2aCoTPNqgRDxK5+kn9OURINhBEBc7M4O1KrmM=
|
||||
github.com/fyne-io/glfw-js v0.2.0/go.mod h1:Ri6te7rdZtBgBpxLW19uBpp3Dl6K9K/bRaYdJ22G8Jk=
|
||||
github.com/fyne-io/glfw-js v0.3.0 h1:d8k2+Y7l+zy2pc7wlGRyPfTgZoqDf3AI4G+2zOWhWUk=
|
||||
github.com/fyne-io/glfw-js v0.3.0/go.mod h1:Ri6te7rdZtBgBpxLW19uBpp3Dl6K9K/bRaYdJ22G8Jk=
|
||||
github.com/fyne-io/image v0.1.1 h1:WH0z4H7qfvNUw5l4p3bC1q70sa5+YWVt6HCj7y4VNyA=
|
||||
github.com/fyne-io/image v0.1.1/go.mod h1:xrfYBh6yspc+KjkgdZU/ifUC9sPA5Iv7WYUBzQKK7JM=
|
||||
github.com/fyne-io/oksvg v0.1.0 h1:7EUKk3HV3Y2E+qypp3nWqMXD7mum0hCw2KEGhI1fnBw=
|
||||
@@ -41,6 +49,8 @@ github.com/hack-pad/safejs v0.1.1 h1:d5qPO0iQ7h2oVtpzGnLExE+Wn9AtytxIfltcS2b9KD8
|
||||
github.com/hack-pad/safejs v0.1.1/go.mod h1:HdS+bKF1NrE72VoXZeWzxFOVQVUSqZJAG0xNCnb+Tio=
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250421151639-a9d6ed1b3d45 h1:vFdvrlsVU+p/KFBWTq0lTG4fvWvG88sawGlCzM+RUEU=
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250421151639-a9d6ed1b3d45/go.mod h1:ZDXo8KHryOWSIqnsb/CiDq7hQUYryCgdVnxbj8tDG7o=
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade h1:FmusiCI1wHw+XQbvL9M+1r/C3SPqKrmBaIOYwVfQoDE=
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade/go.mod h1:ZDXo8KHryOWSIqnsb/CiDq7hQUYryCgdVnxbj8tDG7o=
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 h1:YLvr1eE6cdCqjOe972w/cYF+FjW34v27+9Vo5106B4M=
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -57,6 +67,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rymdport/portal v0.4.1 h1:2dnZhjf5uEaeDjeF/yBIeeRo6pNI2QAKm7kq1w/kbnA=
|
||||
github.com/rymdport/portal v0.4.1/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
|
||||
github.com/rymdport/portal v0.4.2 h1:7jKRSemwlTyVHHrTGgQg7gmNPJs88xkbKcIL3NlcmSU=
|
||||
github.com/rymdport/portal v0.4.2/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE=
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q=
|
||||
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef h1:Ch6Q+AZUxDBCVqdkI8FSpFyZDtCVBc2VmejdNrm5rRQ=
|
||||
@@ -65,20 +77,28 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
||||
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/ulikunitz/xz v0.5.13 h1:ar98gWrjf4H1ev05fYP/o29PDZw9DrI3niHtnEqyuXA=
|
||||
github.com/ulikunitz/xz v0.5.13/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/yuin/goldmark v1.7.11 h1:ZCxLyDMtz0nT2HFfsYG8WZ47Trip2+JyLysKcMYE5bo=
|
||||
github.com/yuin/goldmark v1.7.11/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
|
||||
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
|
||||
github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA=
|
||||
github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w=
|
||||
golang.org/x/image v0.27.0/go.mod h1:xbdrClrAUway1MUTEZDq9mz/UpRwYAkFFNUslZtcB+g=
|
||||
golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4=
|
||||
golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@@ -1,146 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view"
|
||||
error2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/error"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/helper"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type ConvertorHandlerContract interface {
|
||||
MainConvertor()
|
||||
FfPathSelection()
|
||||
GetFfmpegVersion() (string, error)
|
||||
GetFfprobeVersion() (string, error)
|
||||
}
|
||||
|
||||
type ConvertorHandler struct {
|
||||
app kernel.AppContract
|
||||
convertorView convertor.ViewContract
|
||||
errorView error2.ViewContract
|
||||
convertorRepository convertor.RepositoryContract
|
||||
settingDirectoryForSaving setting.DirectoryForSavingContract
|
||||
}
|
||||
|
||||
func NewConvertorHandler(
|
||||
app kernel.AppContract,
|
||||
convertorView convertor.ViewContract,
|
||||
errorView error2.ViewContract,
|
||||
convertorRepository convertor.RepositoryContract,
|
||||
settingDirectoryForSaving setting.DirectoryForSavingContract,
|
||||
) *ConvertorHandler {
|
||||
return &ConvertorHandler{
|
||||
app: app,
|
||||
convertorView: convertorView,
|
||||
errorView: errorView,
|
||||
convertorRepository: convertorRepository,
|
||||
settingDirectoryForSaving: settingDirectoryForSaving,
|
||||
}
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) MainConvertor() {
|
||||
if h.checkingFFPathUtilities() == true {
|
||||
formats, err := h.app.GetConvertorService().GetSupportFormats()
|
||||
if err != nil {
|
||||
h.errorView.PanicError(err)
|
||||
return
|
||||
}
|
||||
conversion := view.NewConversion(h.app, formats, h.runConvert, h.settingDirectoryForSaving)
|
||||
h.convertorView.Main(conversion)
|
||||
return
|
||||
}
|
||||
h.convertorView.SelectFFPath("", "", h.saveSettingFFPath, nil, h.downloadFFmpeg)
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) FfPathSelection() {
|
||||
ffmpeg, _ := h.convertorRepository.GetPathFfmpeg()
|
||||
ffprobe, _ := h.convertorRepository.GetPathFfprobe()
|
||||
h.convertorView.SelectFFPath(ffmpeg, ffprobe, h.saveSettingFFPath, h.MainConvertor, h.downloadFFmpeg)
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) GetFfmpegVersion() (string, error) {
|
||||
return h.app.GetConvertorService().GetFFmpegVesrion()
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) GetFfprobeVersion() (string, error) {
|
||||
return h.app.GetConvertorService().GetFFprobeVersion()
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) runConvert(setting view.HandleConvertSetting) {
|
||||
h.app.GetQueue().Add(&kernel.ConvertSetting{
|
||||
VideoFileInput: setting.FileInput,
|
||||
VideoFileOut: kernel.File{
|
||||
Path: setting.DirectoryForSave + helper.PathSeparator() + setting.FileInput.Name + "." + setting.Format,
|
||||
Name: setting.FileInput.Name,
|
||||
Ext: "." + setting.Format,
|
||||
},
|
||||
OverwriteOutputFiles: setting.OverwriteOutputFiles,
|
||||
Encoder: setting.Encoder,
|
||||
})
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) checkingFFPathUtilities() bool {
|
||||
if h.checkingFFPath() == true {
|
||||
return true
|
||||
}
|
||||
|
||||
pathsToFF := getPathsToFF()
|
||||
for _, item := range pathsToFF {
|
||||
ffmpegChecking, _ := h.app.GetConvertorService().ChangeFFmpegPath(item.FFmpeg)
|
||||
if ffmpegChecking == false {
|
||||
continue
|
||||
}
|
||||
ffprobeChecking, _ := h.app.GetConvertorService().ChangeFFprobePath(item.FFprobe)
|
||||
if ffprobeChecking == false {
|
||||
continue
|
||||
}
|
||||
_, _ = h.convertorRepository.SavePathFfmpeg(item.FFmpeg)
|
||||
_, _ = h.convertorRepository.SavePathFfprobe(item.FFprobe)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) saveSettingFFPath(ffmpegPath string, ffprobePath string) error {
|
||||
ffmpegChecking, _ := h.app.GetConvertorService().ChangeFFmpegPath(ffmpegPath)
|
||||
if ffmpegChecking == false {
|
||||
errorText := h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFmpeg",
|
||||
})
|
||||
return errors.New(errorText)
|
||||
}
|
||||
|
||||
ffprobeChecking, _ := h.app.GetConvertorService().ChangeFFprobePath(ffprobePath)
|
||||
if ffprobeChecking == false {
|
||||
errorText := h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFprobe",
|
||||
})
|
||||
return errors.New(errorText)
|
||||
}
|
||||
|
||||
_, _ = h.convertorRepository.SavePathFfmpeg(ffmpegPath)
|
||||
_, _ = h.convertorRepository.SavePathFfprobe(ffprobePath)
|
||||
|
||||
h.MainConvertor()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) checkingFFPath() bool {
|
||||
_, err := h.app.GetConvertorService().GetFFmpegVesrion()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
_, err = h.app.GetConvertorService().GetFFprobeVersion()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
//go:build !windows && !linux
|
||||
// +build !windows,!linux
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
)
|
||||
|
||||
func getPathsToFF() []kernel.FFPathUtilities {
|
||||
return []kernel.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
|
||||
return nil
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
|
||||
)
|
||||
|
||||
type MainHandler struct {
|
||||
app kernel.AppContract
|
||||
convertorHandler ConvertorHandlerContract
|
||||
menuHandler MenuHandlerContract
|
||||
localizerRepository localizer.RepositoryContract
|
||||
}
|
||||
|
||||
func NewMainHandler(
|
||||
app kernel.AppContract,
|
||||
convertorHandler ConvertorHandlerContract,
|
||||
menuHandler MenuHandlerContract,
|
||||
localizerRepository localizer.RepositoryContract,
|
||||
) *MainHandler {
|
||||
return &MainHandler{
|
||||
app: app,
|
||||
convertorHandler: convertorHandler,
|
||||
menuHandler: menuHandler,
|
||||
localizerRepository: localizerRepository,
|
||||
}
|
||||
}
|
||||
|
||||
func (h MainHandler) Start() {
|
||||
language, err := h.localizerRepository.GetCode()
|
||||
if err != nil {
|
||||
h.menuHandler.LanguageSelection()
|
||||
return
|
||||
}
|
||||
_ = h.app.GetLocalizerService().SetCurrentLanguageByCode(language)
|
||||
|
||||
h.convertorHandler.MainConvertor()
|
||||
}
|
122
handler/menu.go
122
handler/menu.go
@@ -1,122 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/menu"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type MenuHandlerContract interface {
|
||||
GetMainMenu() *fyne.MainMenu
|
||||
LanguageSelection()
|
||||
}
|
||||
|
||||
type MenuHandler struct {
|
||||
app kernel.AppContract
|
||||
convertorHandler ConvertorHandlerContract
|
||||
menuView menu.ViewContract
|
||||
localizerView localizer.ViewContract
|
||||
localizerRepository localizer.RepositoryContract
|
||||
}
|
||||
|
||||
func NewMenuHandler(
|
||||
app kernel.AppContract,
|
||||
convertorHandler ConvertorHandlerContract,
|
||||
menuView menu.ViewContract,
|
||||
localizerView localizer.ViewContract,
|
||||
localizerRepository localizer.RepositoryContract,
|
||||
) *MenuHandler {
|
||||
return &MenuHandler{
|
||||
app: app,
|
||||
convertorHandler: convertorHandler,
|
||||
menuView: menuView,
|
||||
localizerView: localizerView,
|
||||
localizerRepository: localizerRepository,
|
||||
}
|
||||
}
|
||||
|
||||
func (h MenuHandler) GetMainMenu() *fyne.MainMenu {
|
||||
settings := h.getMenuSettings()
|
||||
help := h.getMenuHelp()
|
||||
|
||||
return fyne.NewMainMenu(settings, help)
|
||||
}
|
||||
|
||||
func (h MenuHandler) getMenuSettings() *fyne.Menu {
|
||||
quit := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "exit",
|
||||
}), nil)
|
||||
quit.IsQuit = true
|
||||
h.app.GetLocalizerService().AddChangeCallback("exit", func(text string) {
|
||||
quit.Label = text
|
||||
})
|
||||
|
||||
languageSelection := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "changeLanguage",
|
||||
}), h.LanguageSelection)
|
||||
h.app.GetLocalizerService().AddChangeCallback("changeLanguage", func(text string) {
|
||||
languageSelection.Label = text
|
||||
})
|
||||
|
||||
ffPathSelection := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "changeFFPath",
|
||||
}), h.convertorHandler.FfPathSelection)
|
||||
h.app.GetLocalizerService().AddChangeCallback("changeFFPath", func(text string) {
|
||||
ffPathSelection.Label = text
|
||||
})
|
||||
|
||||
settings := fyne.NewMenu(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "settings",
|
||||
}), languageSelection, ffPathSelection, quit)
|
||||
h.app.GetLocalizerService().AddChangeCallback("settings", func(text string) {
|
||||
settings.Label = text
|
||||
settings.Refresh()
|
||||
})
|
||||
|
||||
return settings
|
||||
}
|
||||
|
||||
func (h MenuHandler) getMenuHelp() *fyne.Menu {
|
||||
about := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "about",
|
||||
}), h.openAbout)
|
||||
h.app.GetLocalizerService().AddChangeCallback("about", func(text string) {
|
||||
about.Label = text
|
||||
})
|
||||
|
||||
help := fyne.NewMenu(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "help",
|
||||
}), about)
|
||||
h.app.GetLocalizerService().AddChangeCallback("help", func(text string) {
|
||||
help.Label = text
|
||||
help.Refresh()
|
||||
})
|
||||
|
||||
return help
|
||||
}
|
||||
|
||||
func (h MenuHandler) openAbout() {
|
||||
ffmpeg, err := h.convertorHandler.GetFfmpegVersion()
|
||||
if err != nil {
|
||||
ffmpeg = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFmpegVersion",
|
||||
})
|
||||
}
|
||||
ffprobe, err := h.convertorHandler.GetFfprobeVersion()
|
||||
if err != nil {
|
||||
ffprobe = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFprobeVersion",
|
||||
})
|
||||
}
|
||||
|
||||
h.menuView.About(ffmpeg, ffprobe)
|
||||
}
|
||||
|
||||
func (h MenuHandler) LanguageSelection() {
|
||||
h.localizerView.LanguageSelection(func(lang kernel.Lang) {
|
||||
_, _ = h.localizerRepository.Save(lang.Code)
|
||||
h.convertorHandler.MainConvertor()
|
||||
})
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 64 KiB |
137
internal/application/app.go
Normal file
137
internal/application/app.go
Normal file
@@ -0,0 +1,137 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/convertor"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AppContract interface {
|
||||
FyneApp() fyne.App
|
||||
GetSetting() setting.SettingContract
|
||||
GetProgressBarService() convertor.ProgressBarContract
|
||||
GetFFmpegService() ffmpeg.UtilitiesContract
|
||||
GetConvertorService() convertor.ConvertorContract
|
||||
GetItemsToConvert() convertor.ItemsToConvertContract
|
||||
GetQueueService() convertor.QueueListContract
|
||||
Run()
|
||||
AfterClosing()
|
||||
RunConvertor()
|
||||
}
|
||||
|
||||
type application struct {
|
||||
fyneApp fyne.App
|
||||
setting setting.SettingContract
|
||||
progressBarService convertor.ProgressBarContract
|
||||
ffmpegService ffmpeg.UtilitiesContract
|
||||
itemsToConvert convertor.ItemsToConvertContract
|
||||
queueService convertor.QueueListContract
|
||||
convertorService convertor.ConvertorContract
|
||||
}
|
||||
|
||||
func NewApp(
|
||||
fyneApp fyne.App,
|
||||
setting setting.SettingContract,
|
||||
progressBarService convertor.ProgressBarContract,
|
||||
ffmpegService ffmpeg.UtilitiesContract,
|
||||
itemsToConvert convertor.ItemsToConvertContract,
|
||||
queueService convertor.QueueListContract,
|
||||
convertorService convertor.ConvertorContract,
|
||||
) AppContract {
|
||||
return &application{
|
||||
fyneApp: fyneApp,
|
||||
setting: setting,
|
||||
progressBarService: progressBarService,
|
||||
ffmpegService: ffmpegService,
|
||||
itemsToConvert: itemsToConvert,
|
||||
queueService: queueService,
|
||||
convertorService: convertorService,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *application) FyneApp() fyne.App {
|
||||
return a.fyneApp
|
||||
}
|
||||
|
||||
func (a *application) GetSetting() setting.SettingContract {
|
||||
return a.setting
|
||||
}
|
||||
|
||||
func (a *application) GetProgressBarService() convertor.ProgressBarContract {
|
||||
return a.progressBarService
|
||||
}
|
||||
|
||||
func (a *application) GetFFmpegService() ffmpeg.UtilitiesContract {
|
||||
return a.ffmpegService
|
||||
}
|
||||
|
||||
func (a *application) GetItemsToConvert() convertor.ItemsToConvertContract {
|
||||
return a.itemsToConvert
|
||||
}
|
||||
|
||||
func (a *application) GetQueueService() convertor.QueueListContract {
|
||||
return a.queueService
|
||||
}
|
||||
|
||||
func (a *application) GetConvertorService() convertor.ConvertorContract {
|
||||
return a.convertorService
|
||||
}
|
||||
|
||||
func (a *application) Run() {
|
||||
a.fyneApp.Run()
|
||||
}
|
||||
|
||||
func (a *application) RunConvertor() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(time.Millisecond * 3000)
|
||||
queueId, queue := a.queueService.Next()
|
||||
if queue == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
queue.Status = convertor.StatusType(convertor.InProgress)
|
||||
a.queueService.EventChangeQueue(queueId, queue)
|
||||
|
||||
if a.progressBarService.GetContainer().Hidden {
|
||||
a.progressBarService.GetContainer().Show()
|
||||
}
|
||||
|
||||
totalDuration := float64(0)
|
||||
ffprobe, err := a.ffmpegService.GetFFprobe()
|
||||
if err == nil {
|
||||
totalDuration, err = ffprobe.GetTotalDuration(&queue.Setting.FileInput)
|
||||
if err != nil {
|
||||
totalDuration = float64(0)
|
||||
}
|
||||
}
|
||||
|
||||
progress := a.progressBarService.GetProgressbar(
|
||||
totalDuration,
|
||||
queue.Setting.FileInput.Path,
|
||||
)
|
||||
|
||||
err = a.convertorService.RunConvert(*queue.Setting, progress)
|
||||
if err != nil {
|
||||
queue.Status = convertor.StatusType(convertor.Error)
|
||||
queue.Error = err
|
||||
a.queueService.EventChangeQueue(queueId, queue)
|
||||
a.progressBarService.ProcessEndedWithError(err.Error())
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
queue.Status = convertor.StatusType(convertor.Completed)
|
||||
a.queueService.EventChangeQueue(queueId, queue)
|
||||
a.progressBarService.ProcessEndedWithSuccess(&queue.Setting.FileOut)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (a *application) AfterClosing() {
|
||||
for _, cmd := range a.convertorService.GetRunningProcesses() {
|
||||
_ = cmd.Process.Kill()
|
||||
}
|
||||
}
|
87
internal/application/convertor/convertor.go
Normal file
87
internal/application/convertor/convertor.go
Normal file
@@ -0,0 +1,87 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/convertor/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
"io"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ConvertorContract interface {
|
||||
RunConvert(setting ffmpeg.ConvertSetting, progress ffmpeg.ProgressContract) error
|
||||
GetSupportFormats() (encoder.ConvertorFormatsContract, error)
|
||||
GetRunningProcesses() map[int]*exec.Cmd
|
||||
}
|
||||
|
||||
type runningProcesses struct {
|
||||
items map[int]*exec.Cmd
|
||||
numberOfStarts int
|
||||
}
|
||||
|
||||
type convertor struct {
|
||||
ffmpegService ffmpeg.UtilitiesContract
|
||||
runningProcesses *runningProcesses
|
||||
}
|
||||
|
||||
func NewConvertor(
|
||||
ffmpegService ffmpeg.UtilitiesContract,
|
||||
) ConvertorContract {
|
||||
return &convertor{
|
||||
ffmpegService: ffmpegService,
|
||||
runningProcesses: &runningProcesses{items: map[int]*exec.Cmd{}, numberOfStarts: 0},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *convertor) RunConvert(setting ffmpeg.ConvertSetting, progress ffmpeg.ProgressContract) error {
|
||||
ffmpegService, err := c.ffmpegService.GetFFmpeg()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
index := c.runningProcesses.numberOfStarts
|
||||
beforeWait := func(cmd *exec.Cmd) {
|
||||
c.runningProcesses.numberOfStarts++
|
||||
c.runningProcesses.items[index] = cmd
|
||||
}
|
||||
|
||||
afterWait := func(cmd *exec.Cmd) {
|
||||
delete(c.runningProcesses.items, index)
|
||||
}
|
||||
|
||||
return ffmpegService.RunConvert(setting, progress, beforeWait, afterWait)
|
||||
}
|
||||
|
||||
func (c *convertor) GetSupportFormats() (encoder.ConvertorFormatsContract, error) {
|
||||
var err error
|
||||
|
||||
formats := encoder.NewConvertorFormats()
|
||||
ffmpeg, err := c.ffmpegService.GetFFmpeg()
|
||||
if err != nil {
|
||||
return formats, err
|
||||
}
|
||||
err = ffmpeg.GetEncoders(func(scanner *bufio.Reader) {
|
||||
for {
|
||||
line, _, err := scanner.ReadLine()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
text := strings.Split(strings.TrimSpace(string(line)), " ")
|
||||
encoderType := string(text[0][0])
|
||||
if len(text) < 2 || (encoderType != "V" && encoderType != "A") {
|
||||
continue
|
||||
}
|
||||
formats.NewEncoder(text[1])
|
||||
}
|
||||
})
|
||||
|
||||
return formats, err
|
||||
}
|
||||
|
||||
func (c *convertor) GetRunningProcesses() map[int]*exec.Cmd {
|
||||
return c.runningProcesses.items
|
||||
}
|
@@ -2,7 +2,7 @@ package encoder
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
type ConvertorFormatContract interface {
|
||||
@@ -18,7 +18,7 @@ type ConvertorFormat struct {
|
||||
encoders map[int]encoder.EncoderDataContract
|
||||
}
|
||||
|
||||
func NewConvertorFormat(title string, fileType encoder.FileTypeContract) *ConvertorFormat {
|
||||
func NewConvertorFormat(title string, fileType encoder.FileTypeContract) ConvertorFormatContract {
|
||||
return &ConvertorFormat{
|
||||
title: title,
|
||||
fileType: fileType,
|
||||
@@ -26,19 +26,19 @@ func NewConvertorFormat(title string, fileType encoder.FileTypeContract) *Conver
|
||||
}
|
||||
}
|
||||
|
||||
func (f ConvertorFormat) GetTitle() string {
|
||||
func (f *ConvertorFormat) GetTitle() string {
|
||||
return f.title
|
||||
}
|
||||
|
||||
func (f ConvertorFormat) AddEncoder(encoder encoder.EncoderDataContract) {
|
||||
func (f *ConvertorFormat) AddEncoder(encoder encoder.EncoderDataContract) {
|
||||
f.encoders[len(f.encoders)] = encoder
|
||||
}
|
||||
|
||||
func (f ConvertorFormat) GetEncoders() map[int]encoder.EncoderDataContract {
|
||||
func (f *ConvertorFormat) GetEncoders() map[int]encoder.EncoderDataContract {
|
||||
return f.encoders
|
||||
}
|
||||
|
||||
func (f ConvertorFormat) GetFileType() encoder.FileTypeContract {
|
||||
func (f *ConvertorFormat) GetFileType() encoder.FileTypeContract {
|
||||
return f.fileType
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ type ConvertorFormats struct {
|
||||
formats map[string]ConvertorFormatContract
|
||||
}
|
||||
|
||||
func NewConvertorFormats() *ConvertorFormats {
|
||||
func NewConvertorFormats() ConvertorFormatsContract {
|
||||
return &ConvertorFormats{
|
||||
formats: map[string]ConvertorFormatContract{},
|
||||
}
|
||||
}
|
||||
|
||||
func (f ConvertorFormats) NewEncoder(encoderName string) bool {
|
||||
func (f *ConvertorFormats) NewEncoder(encoderName string) bool {
|
||||
if supportEncoders[encoderName] == nil {
|
||||
return false
|
||||
}
|
||||
@@ -72,13 +72,13 @@ func (f ConvertorFormats) NewEncoder(encoderName string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (f ConvertorFormats) GetFormats() map[string]ConvertorFormatContract {
|
||||
func (f *ConvertorFormats) GetFormats() map[string]ConvertorFormatContract {
|
||||
return f.formats
|
||||
}
|
||||
|
||||
func (f ConvertorFormats) GetFormat(format string) (ConvertorFormatContract, error) {
|
||||
func (f *ConvertorFormats) GetFormat(format string) (ConvertorFormatContract, error) {
|
||||
if f.formats[format] == nil {
|
||||
return ConvertorFormat{}, errors.New("not found ConvertorFormat")
|
||||
return &ConvertorFormat{}, errors.New("not found ConvertorFormat")
|
||||
}
|
||||
return f.formats[format], nil
|
||||
}
|
74
internal/application/convertor/encoder/encoders.go
Normal file
74
internal/application/convertor/encoder/encoders.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package encoder
|
||||
|
||||
import (
|
||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/apng"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/bmp"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/flv"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/gif"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/h264_nvenc"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libmp3lame"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libshine"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libtwolame"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libvpx"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libvpx_vp9"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libwebp"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libwebp_anim"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libx264"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libx265"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/libxvid"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mjpeg"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mp2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mp2fixed"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mpeg1video"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mpeg2video"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/mpeg4"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/msmpeg4"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/msmpeg4v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/msvideo1"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/png"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/qtrle"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/sgi"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/tiff"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/wmav1"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/wmav2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/wmv1"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/wmv2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder/xbm"
|
||||
)
|
||||
|
||||
var supportEncoders = map[string]func() encoder2.EncoderDataContract{
|
||||
"libx264": libx264.NewData,
|
||||
"h264_nvenc": h264_nvenc.NewData,
|
||||
"libx265": libx265.NewData,
|
||||
"png": png.NewData,
|
||||
"gif": gif.NewData,
|
||||
"flv": flv.NewData,
|
||||
"apng": apng.NewData,
|
||||
"bmp": bmp.NewData,
|
||||
"mjpeg": mjpeg.NewData,
|
||||
"mpeg1video": mpeg1video.NewData,
|
||||
"mpeg2video": mpeg2video.NewData,
|
||||
"mpeg4": mpeg4.NewData,
|
||||
"libxvid": libxvid.NewData,
|
||||
"msmpeg4v2": msmpeg4v2.NewData,
|
||||
"msmpeg4": msmpeg4.NewData,
|
||||
"msvideo1": msvideo1.NewData,
|
||||
"qtrle": qtrle.NewData,
|
||||
"tiff": tiff.NewData,
|
||||
"sgi": sgi.NewData,
|
||||
"libvpx": libvpx.NewData,
|
||||
"libvpx-vp9": libvpx_vp9.NewData,
|
||||
"libwebp_anim": libwebp_anim.NewData,
|
||||
"libwebp": libwebp.NewData,
|
||||
"wmv1": wmv1.NewData,
|
||||
"wmv2": wmv2.NewData,
|
||||
"xbm": xbm.NewData,
|
||||
"mp2": mp2.NewData,
|
||||
"mp2fixed": mp2fixed.NewData,
|
||||
"libtwolame": libtwolame.NewData,
|
||||
"libmp3lame": libmp3lame.NewData,
|
||||
"libshine": libshine.NewData,
|
||||
"wmav1": wmav1.NewData,
|
||||
"wmav2": wmav2.NewData,
|
||||
}
|
139
internal/application/convertor/items_to_convert.go
Normal file
139
internal/application/convertor/items_to_convert.go
Normal file
@@ -0,0 +1,139 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
)
|
||||
|
||||
type ItemsToConvertContract interface {
|
||||
Add(file *ffmpeg.File)
|
||||
Clear()
|
||||
GetItems() map[int]ItemToConvertContract
|
||||
GetItemsContainer() *fyne.Container
|
||||
AfterAddingQueue()
|
||||
GetIsAutoRemove() bool
|
||||
SetIsAutoRemove(isAutoRemove bool)
|
||||
}
|
||||
|
||||
type itemsToConvert struct {
|
||||
ffmpeg ffmpeg.UtilitiesContract
|
||||
nextId int
|
||||
items map[int]ItemToConvertContract
|
||||
itemsContainer *fyne.Container
|
||||
isAutoRemove bool
|
||||
}
|
||||
|
||||
func NewItemsToConvert(ffmpeg ffmpeg.UtilitiesContract) ItemsToConvertContract {
|
||||
return &itemsToConvert{
|
||||
ffmpeg: ffmpeg,
|
||||
nextId: 0,
|
||||
items: map[int]ItemToConvertContract{},
|
||||
itemsContainer: container.NewVBox(),
|
||||
isAutoRemove: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) GetItemsContainer() *fyne.Container {
|
||||
return items.itemsContainer
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) Add(file *ffmpeg.File) {
|
||||
nextId := items.nextId
|
||||
var content *fyne.Container
|
||||
var buttonPlay *widget.Button
|
||||
|
||||
buttonPlay = widget.NewButtonWithIcon("", theme.Icon(theme.IconNameMediaPlay), func() {
|
||||
buttonPlay.Disable()
|
||||
go func() {
|
||||
ffplay, err := items.ffmpeg.GetFFplay()
|
||||
if err != nil {
|
||||
fyne.Do(func() {
|
||||
buttonPlay.Enable()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
_ = ffplay.Play(file)
|
||||
fyne.Do(func() {
|
||||
buttonPlay.Enable()
|
||||
})
|
||||
}()
|
||||
})
|
||||
|
||||
buttonRemove := widget.NewButtonWithIcon("", theme.Icon(theme.IconNameDelete), func() {
|
||||
items.itemsContainer.Remove(content)
|
||||
items.itemsContainer.Refresh()
|
||||
delete(items.items, nextId)
|
||||
})
|
||||
buttonRemove.Importance = widget.DangerImportance
|
||||
|
||||
content = container.NewVBox(
|
||||
container.NewBorder(
|
||||
nil,
|
||||
nil,
|
||||
buttonPlay,
|
||||
buttonRemove,
|
||||
container.NewHScroll(widget.NewLabel(file.Name)),
|
||||
),
|
||||
container.NewHScroll(widget.NewLabel(file.Path)),
|
||||
container.NewPadded(),
|
||||
canvas.NewLine(theme.Color(theme.ColorNameFocus)),
|
||||
container.NewPadded(),
|
||||
)
|
||||
|
||||
items.itemsContainer.Add(content)
|
||||
items.items[nextId] = newItemToConvert(file, content)
|
||||
items.nextId++
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) GetIsAutoRemove() bool {
|
||||
return items.isAutoRemove
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) SetIsAutoRemove(isAutoRemove bool) {
|
||||
items.isAutoRemove = isAutoRemove
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) GetItems() map[int]ItemToConvertContract {
|
||||
return items.items
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) AfterAddingQueue() {
|
||||
if items.isAutoRemove {
|
||||
items.Clear()
|
||||
}
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) Clear() {
|
||||
items.itemsContainer.RemoveAll()
|
||||
items.items = map[int]ItemToConvertContract{}
|
||||
}
|
||||
|
||||
type ItemToConvertContract interface {
|
||||
GetFile() *ffmpeg.File
|
||||
GetContent() *fyne.Container
|
||||
}
|
||||
|
||||
type itemToConvert struct {
|
||||
file *ffmpeg.File
|
||||
content *fyne.Container
|
||||
}
|
||||
|
||||
func newItemToConvert(file *ffmpeg.File, content *fyne.Container) ItemToConvertContract {
|
||||
return &itemToConvert{
|
||||
file: file,
|
||||
content: content,
|
||||
}
|
||||
}
|
||||
|
||||
func (item *itemToConvert) GetFile() *ffmpeg.File {
|
||||
return item.file
|
||||
}
|
||||
|
||||
func (item *itemToConvert) GetContent() *fyne.Container {
|
||||
return item.content
|
||||
}
|
217
internal/application/convertor/progressbar.go
Normal file
217
internal/application/convertor/progressbar.go
Normal file
@@ -0,0 +1,217 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
"image/color"
|
||||
"io"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ProgressBarContract interface {
|
||||
GetContainer() *fyne.Container
|
||||
GetProgressbar(totalDuration float64, filePath string) ffmpeg.ProgressContract
|
||||
ProcessEndedWithError(errorText string)
|
||||
ProcessEndedWithSuccess(file *ffmpeg.File)
|
||||
}
|
||||
|
||||
type progressBar struct {
|
||||
container *fyne.Container
|
||||
label *widget.Label
|
||||
progressbar *widget.ProgressBar
|
||||
errorBlock *container.Scroll
|
||||
messageError *canvas.Text
|
||||
statusMessage *canvas.Text
|
||||
buttonPlay *widget.Button
|
||||
ffmpegService ffmpeg.UtilitiesContract
|
||||
}
|
||||
|
||||
func NewProgressBar(ffmpegService ffmpeg.UtilitiesContract) ProgressBarContract {
|
||||
label := widget.NewLabel("")
|
||||
progressbar := widget.NewProgressBar()
|
||||
|
||||
statusMessage := canvas.NewText("", theme.Color(theme.ColorNamePrimary))
|
||||
messageError := canvas.NewText("", theme.Color(theme.ColorNameError))
|
||||
buttonPlay := widget.NewButtonWithIcon("", theme.Icon(theme.IconNameMediaPlay), func() {
|
||||
|
||||
})
|
||||
buttonPlay.Hide()
|
||||
|
||||
errorBlock := container.NewHScroll(messageError)
|
||||
errorBlock.Hide()
|
||||
|
||||
content := container.NewVBox(
|
||||
container.NewHScroll(label),
|
||||
progressbar,
|
||||
container.NewHScroll(container.NewHBox(
|
||||
buttonPlay,
|
||||
statusMessage,
|
||||
)),
|
||||
errorBlock,
|
||||
)
|
||||
content.Hide()
|
||||
|
||||
return &progressBar{
|
||||
container: content,
|
||||
label: label,
|
||||
progressbar: progressbar,
|
||||
errorBlock: errorBlock,
|
||||
messageError: messageError,
|
||||
statusMessage: statusMessage,
|
||||
buttonPlay: buttonPlay,
|
||||
ffmpegService: ffmpegService,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *progressBar) GetContainer() *fyne.Container {
|
||||
return p.container
|
||||
}
|
||||
|
||||
func (p *progressBar) GetProgressbar(totalDuration float64, filePath string) ffmpeg.ProgressContract {
|
||||
p.label.Text = filePath
|
||||
p.statusMessage.Color = theme.Color(theme.ColorNamePrimary)
|
||||
p.statusMessage.Text = lang.L("inProgressQueue")
|
||||
p.messageError.Text = ""
|
||||
fyne.Do(func() {
|
||||
p.buttonPlay.Hide()
|
||||
if p.errorBlock.Visible() {
|
||||
p.errorBlock.Hide()
|
||||
}
|
||||
p.statusMessage.Refresh()
|
||||
p.container.Refresh()
|
||||
p.errorBlock.Refresh()
|
||||
})
|
||||
|
||||
p.progressbar.Value = 0
|
||||
return NewProgress(totalDuration, p.progressbar)
|
||||
}
|
||||
|
||||
func (p *progressBar) ProcessEndedWithError(errorText string) {
|
||||
fyne.Do(func() {
|
||||
p.statusMessage.Color = theme.Color(theme.ColorNameError)
|
||||
p.statusMessage.Text = lang.L("errorQueue")
|
||||
p.messageError.Text = errorText
|
||||
p.errorBlock.Show()
|
||||
})
|
||||
}
|
||||
|
||||
func (p *progressBar) ProcessEndedWithSuccess(file *ffmpeg.File) {
|
||||
fyne.Do(func() {
|
||||
p.statusMessage.Color = color.RGBA{R: 49, G: 127, B: 114, A: 255}
|
||||
p.statusMessage.Text = lang.L("completedQueue")
|
||||
p.buttonPlay.Show()
|
||||
p.buttonPlay.OnTapped = func() {
|
||||
p.buttonPlay.Disable()
|
||||
go func() {
|
||||
ffplay, err := p.ffmpegService.GetFFplay()
|
||||
if err == nil {
|
||||
_ = ffplay.Play(file)
|
||||
}
|
||||
|
||||
fyne.Do(func() {
|
||||
p.buttonPlay.Enable()
|
||||
})
|
||||
}()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
type Progress struct {
|
||||
totalDuration float64
|
||||
progressbar *widget.ProgressBar
|
||||
protocol string
|
||||
}
|
||||
|
||||
func NewProgress(totalDuration float64, progressbar *widget.ProgressBar) ffmpeg.ProgressContract {
|
||||
return &Progress{
|
||||
totalDuration: totalDuration,
|
||||
progressbar: progressbar,
|
||||
protocol: "pipe:",
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Progress) GetProtocole() string {
|
||||
return p.protocol
|
||||
}
|
||||
|
||||
func (p *Progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
|
||||
isProcessCompleted := false
|
||||
var errorText string
|
||||
|
||||
p.progressbar.Value = 0
|
||||
p.progressbar.Max = p.totalDuration
|
||||
fyne.Do(func() {
|
||||
p.progressbar.Refresh()
|
||||
})
|
||||
progress := 0.0
|
||||
|
||||
go func() {
|
||||
scannerErr := bufio.NewReader(stdErr)
|
||||
for {
|
||||
line, _, err := scannerErr.ReadLine()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
data := strings.TrimSpace(string(line))
|
||||
errorText = data
|
||||
}
|
||||
}()
|
||||
|
||||
scannerOut := bufio.NewReader(stdOut)
|
||||
for {
|
||||
line, _, err := scannerOut.ReadLine()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
data := strings.TrimSpace(string(line))
|
||||
if strings.Contains(data, "progress=end") {
|
||||
p.progressbar.Value = p.totalDuration
|
||||
fyne.Do(func() {
|
||||
p.progressbar.Refresh()
|
||||
})
|
||||
isProcessCompleted = true
|
||||
break
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`frame=(\d+)`)
|
||||
a := re.FindAllStringSubmatch(data, -1)
|
||||
|
||||
if len(a) > 0 && len(a[len(a)-1]) > 0 {
|
||||
c, err := strconv.Atoi(a[len(a)-1][len(a[len(a)-1])-1])
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
progress = float64(c)
|
||||
}
|
||||
if p.progressbar.Value != progress {
|
||||
p.progressbar.Value = progress
|
||||
fyne.Do(func() {
|
||||
p.progressbar.Refresh()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if isProcessCompleted == false {
|
||||
if len(errorText) == 0 {
|
||||
errorText = lang.L("errorConverter")
|
||||
}
|
||||
return errors.New(errorText)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
152
internal/application/convertor/queue.go
Normal file
152
internal/application/convertor/queue.go
Normal file
@@ -0,0 +1,152 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
)
|
||||
|
||||
type Queue struct {
|
||||
Setting *ffmpeg.ConvertSetting
|
||||
Status StatusContract
|
||||
Error error
|
||||
}
|
||||
|
||||
type StatusContract interface {
|
||||
Name() string
|
||||
Ordinal() int
|
||||
}
|
||||
|
||||
const (
|
||||
Waiting = iota
|
||||
InProgress
|
||||
Completed
|
||||
Error
|
||||
)
|
||||
|
||||
type StatusType uint
|
||||
|
||||
var statusTypeStrings = []string{
|
||||
"waiting",
|
||||
"inProgress",
|
||||
"completed",
|
||||
"error",
|
||||
}
|
||||
|
||||
func (status StatusType) Name() string {
|
||||
return statusTypeStrings[status]
|
||||
}
|
||||
|
||||
func (status StatusType) Ordinal() int {
|
||||
return int(status)
|
||||
}
|
||||
|
||||
type QueueListenerContract interface {
|
||||
AddQueue(key int, queue *Queue)
|
||||
ChangeQueue(key int, queue *Queue)
|
||||
RemoveQueue(key int, status StatusContract)
|
||||
}
|
||||
|
||||
type QueueListContract interface {
|
||||
AddListener(queueListener QueueListenerContract)
|
||||
GetItems() map[int]*Queue
|
||||
Add(setting *ffmpeg.ConvertSetting)
|
||||
EventChangeQueue(key int, queue *Queue)
|
||||
Remove(key int)
|
||||
GetItem(key int) (*Queue, error)
|
||||
Next() (key int, queue *Queue)
|
||||
}
|
||||
|
||||
type queueList struct {
|
||||
currentKey int
|
||||
items map[int]*Queue
|
||||
queue map[int]int
|
||||
queueListener map[int]QueueListenerContract
|
||||
}
|
||||
|
||||
func NewQueueList() QueueListContract {
|
||||
return &queueList{
|
||||
currentKey: 0,
|
||||
items: map[int]*Queue{},
|
||||
queue: map[int]int{},
|
||||
queueListener: map[int]QueueListenerContract{},
|
||||
}
|
||||
}
|
||||
|
||||
func (l *queueList) GetItems() map[int]*Queue {
|
||||
return l.items
|
||||
}
|
||||
|
||||
func (l *queueList) Add(setting *ffmpeg.ConvertSetting) {
|
||||
queue := Queue{
|
||||
Setting: setting,
|
||||
Status: StatusType(Waiting),
|
||||
}
|
||||
|
||||
l.currentKey += 1
|
||||
l.items[l.currentKey] = &queue
|
||||
l.queue[l.currentKey] = l.currentKey
|
||||
|
||||
l.eventAdd(l.currentKey, &queue)
|
||||
}
|
||||
|
||||
func (l *queueList) EventChangeQueue(key int, queue *Queue) {
|
||||
l.eventChange(key, queue)
|
||||
}
|
||||
|
||||
func (l *queueList) Remove(key int) {
|
||||
if _, ok := l.queue[key]; ok {
|
||||
delete(l.queue, key)
|
||||
}
|
||||
|
||||
if _, ok := l.items[key]; ok {
|
||||
status := l.items[key].Status
|
||||
l.eventRemove(key, status)
|
||||
delete(l.items, key)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *queueList) GetItem(key int) (*Queue, error) {
|
||||
if item, ok := l.items[key]; ok {
|
||||
return item, nil
|
||||
}
|
||||
|
||||
return nil, errors.New("key not found")
|
||||
}
|
||||
|
||||
func (l *queueList) AddListener(queueListener QueueListenerContract) {
|
||||
l.queueListener[len(l.queueListener)] = queueListener
|
||||
}
|
||||
|
||||
func (l *queueList) Next() (key int, queue *Queue) {
|
||||
statusWaiting := StatusType(Waiting)
|
||||
for key, queueId := range l.queue {
|
||||
if queue, ok := l.items[queueId]; ok {
|
||||
if queue.Status == statusWaiting {
|
||||
return queueId, queue
|
||||
}
|
||||
}
|
||||
|
||||
if _, ok := l.queue[key]; ok {
|
||||
delete(l.queue, key)
|
||||
}
|
||||
}
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (l *queueList) eventAdd(key int, queue *Queue) {
|
||||
for _, listener := range l.queueListener {
|
||||
listener.AddQueue(key, queue)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *queueList) eventChange(key int, queue *Queue) {
|
||||
for _, listener := range l.queueListener {
|
||||
listener.ChangeQueue(key, queue)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *queueList) eventRemove(key int, status StatusContract) {
|
||||
for _, listener := range l.queueListener {
|
||||
listener.RemoveQueue(key, status)
|
||||
}
|
||||
}
|
40
internal/application/setting/ffmpeg.go
Normal file
40
internal/application/setting/ffmpeg.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package setting
|
||||
|
||||
func (s *setting) GetFFmpegPath() string {
|
||||
path := s.fyneApp.Preferences().String("ffmpegPath")
|
||||
if path == "" {
|
||||
return "ffmpeg"
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
func (s *setting) SetFFmpegPath(path string) {
|
||||
s.fyneApp.Preferences().SetString("ffmpegPath", path)
|
||||
}
|
||||
|
||||
func (s *setting) GetFFprobePath() string {
|
||||
path := s.fyneApp.Preferences().String("ffprobePath")
|
||||
if path == "" {
|
||||
return "ffprobe"
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
func (s *setting) SetFFprobePath(path string) {
|
||||
s.fyneApp.Preferences().SetString("ffprobePath", path)
|
||||
}
|
||||
|
||||
func (s *setting) GetFFplayPath() string {
|
||||
path := s.fyneApp.Preferences().String("ffplayPath")
|
||||
if path == "" {
|
||||
return "ffplay"
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
func (s *setting) SetFFplayPath(path string) {
|
||||
s.fyneApp.Preferences().SetString("ffplayPath", path)
|
||||
}
|
66
internal/application/setting/lang.go
Normal file
66
internal/application/setting/lang.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fyne.io/fyne/v2"
|
||||
fyneLang "fyne.io/fyne/v2/lang"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/resources"
|
||||
)
|
||||
|
||||
var supportedLanguages = map[string]Lang{
|
||||
"ru": {Code: "ru", Title: "Русский"},
|
||||
"kk": {Code: "kk", Title: "Қазақ Тілі"},
|
||||
"en": {Code: "en", Title: "English"},
|
||||
}
|
||||
|
||||
type Lang struct {
|
||||
Code string
|
||||
Title string
|
||||
}
|
||||
|
||||
func ChangeLang(lang Lang) error {
|
||||
translationsData, err := getTranslations(lang)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
name := fyneLang.SystemLocale().LanguageString()
|
||||
return fyneLang.AddTranslations(fyne.NewStaticResource(name+".json", translationsData))
|
||||
}
|
||||
|
||||
func defaultLang() Lang {
|
||||
return supportedLanguages["ru"]
|
||||
}
|
||||
|
||||
func getTranslations(language Lang) ([]byte, error) {
|
||||
translations := resources.GetTranslations()
|
||||
|
||||
baseJson, err := translations.ReadFile("translations/base." + language.Code + ".json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
appJson, err := translations.ReadFile("translations/app." + language.Code + ".json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return mergeTranslations(baseJson, appJson)
|
||||
}
|
||||
|
||||
func mergeTranslations(baseJson []byte, appJson []byte) ([]byte, error) {
|
||||
base := map[string]interface{}{}
|
||||
custom := map[string]interface{}{}
|
||||
err := json.Unmarshal(baseJson, &base)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = json.Unmarshal(appJson, &custom)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for k, v := range custom {
|
||||
base[k] = v
|
||||
}
|
||||
return json.Marshal(base)
|
||||
}
|
84
internal/application/setting/setting.go
Normal file
84
internal/application/setting/setting.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type SettingContract interface {
|
||||
GetLanguages() []Lang
|
||||
GetCurrentLangOrDefaultLang() (currentLang Lang, isDefault bool)
|
||||
SetLang(language Lang) error
|
||||
|
||||
GetDirectoryForSaving() string
|
||||
SetDirectoryForSaving(path string)
|
||||
|
||||
GetFFmpegPath() string
|
||||
SetFFmpegPath(path string)
|
||||
|
||||
GetFFprobePath() string
|
||||
SetFFprobePath(path string)
|
||||
|
||||
GetFFplayPath() string
|
||||
SetFFplayPath(path string)
|
||||
|
||||
ThemeInit()
|
||||
GetThemes() map[string]ThemeInfoContract
|
||||
GetTheme() ThemeInfoContract
|
||||
SetTheme(themeInfo ThemeInfoContract)
|
||||
}
|
||||
|
||||
type setting struct {
|
||||
fyneApp fyne.App
|
||||
}
|
||||
|
||||
func NewSetting(fyneApp fyne.App) SettingContract {
|
||||
return &setting{
|
||||
fyneApp: fyneApp,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *setting) GetLanguages() []Lang {
|
||||
items := []Lang{}
|
||||
for _, item := range supportedLanguages {
|
||||
items = append(items, item)
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
func (s *setting) GetCurrentLangOrDefaultLang() (currentLang Lang, isDefault bool) {
|
||||
languageCode := s.fyneApp.Preferences().String("language")
|
||||
|
||||
if languageCode == "" {
|
||||
languageTag, err := language.Parse(lang.SystemLocale().LanguageString())
|
||||
if err != nil {
|
||||
return currentLang, true
|
||||
}
|
||||
base, _ := languageTag.Base()
|
||||
languageCode = base.String()
|
||||
}
|
||||
|
||||
if currentLang, ok := supportedLanguages[languageCode]; ok {
|
||||
return currentLang, false
|
||||
}
|
||||
|
||||
return defaultLang(), true
|
||||
}
|
||||
|
||||
func (s *setting) SetLang(language Lang) error {
|
||||
err := ChangeLang(language)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.fyneApp.Preferences().SetString("language", language.Code)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *setting) GetDirectoryForSaving() string {
|
||||
return s.fyneApp.Preferences().String("directoryForSaving")
|
||||
}
|
||||
|
||||
func (s *setting) SetDirectoryForSaving(path string) {
|
||||
s.fyneApp.Preferences().SetString("directoryForSaving", path)
|
||||
}
|
112
internal/application/setting/theme.go
Normal file
112
internal/application/setting/theme.go
Normal file
@@ -0,0 +1,112 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
)
|
||||
|
||||
func (s *setting) GetTheme() ThemeInfoContract {
|
||||
name := s.fyneApp.Preferences().String("theme")
|
||||
if name != "" {
|
||||
if _, ok := s.GetThemes()[name]; ok {
|
||||
return s.GetThemes()[name]
|
||||
}
|
||||
}
|
||||
|
||||
return s.GetThemes()["default"]
|
||||
}
|
||||
|
||||
func (s *setting) SetTheme(themeInfo ThemeInfoContract) {
|
||||
s.fyneApp.Preferences().SetString("theme", themeInfo.GetName())
|
||||
|
||||
if themeInfo.GetName() == "default" {
|
||||
s.fyneApp.Settings().SetTheme(theme.DefaultTheme())
|
||||
return
|
||||
}
|
||||
s.fyneApp.Settings().SetTheme(&forcedVariant{theme: theme.DefaultTheme(), variant: themeInfo.GetVariant()})
|
||||
}
|
||||
|
||||
func (s *setting) ThemeInit() {
|
||||
themeInfo := s.GetTheme()
|
||||
if themeInfo.GetName() == "default" {
|
||||
// In the new version of Fyne the theme color changes incorrectly if it is set to default.
|
||||
// s.fyneApp.Settings().SetTheme(theme.DefaultTheme())
|
||||
return
|
||||
}
|
||||
s.fyneApp.Settings().SetTheme(&forcedVariant{theme: theme.DefaultTheme(), variant: themeInfo.GetVariant()})
|
||||
}
|
||||
|
||||
func (s *setting) GetThemes() map[string]ThemeInfoContract {
|
||||
themesNameDefault := &themeInfo{
|
||||
name: "default",
|
||||
title: lang.L("themesNameDefault"),
|
||||
}
|
||||
|
||||
themesNameLight := &themeInfo{
|
||||
name: "light",
|
||||
title: lang.L("themesNameLight"),
|
||||
variant: theme.VariantLight,
|
||||
}
|
||||
|
||||
themesNameDark := &themeInfo{
|
||||
name: "dark",
|
||||
title: lang.L("themesNameDark"),
|
||||
variant: theme.VariantDark,
|
||||
}
|
||||
|
||||
list := map[string]ThemeInfoContract{
|
||||
"default": themesNameDefault,
|
||||
"light": themesNameLight,
|
||||
"dark": themesNameDark,
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
type ThemeInfoContract interface {
|
||||
GetName() string
|
||||
GetTitle() string
|
||||
GetVariant() fyne.ThemeVariant
|
||||
}
|
||||
|
||||
type themeInfo struct {
|
||||
name string
|
||||
title string
|
||||
variant fyne.ThemeVariant
|
||||
}
|
||||
|
||||
func (inf *themeInfo) GetName() string {
|
||||
return inf.name
|
||||
}
|
||||
|
||||
func (inf *themeInfo) GetTitle() string {
|
||||
return inf.title
|
||||
}
|
||||
|
||||
func (inf *themeInfo) GetVariant() fyne.ThemeVariant {
|
||||
return inf.variant
|
||||
}
|
||||
|
||||
type forcedVariant struct {
|
||||
theme fyne.Theme
|
||||
variant fyne.ThemeVariant
|
||||
}
|
||||
|
||||
func (f *forcedVariant) Color(name fyne.ThemeColorName, _ fyne.ThemeVariant) color.Color {
|
||||
return f.theme.Color(name, f.variant)
|
||||
}
|
||||
|
||||
func (f *forcedVariant) Font(style fyne.TextStyle) fyne.Resource {
|
||||
return theme.DefaultTheme().Font(style)
|
||||
}
|
||||
|
||||
func (f *forcedVariant) Icon(name fyne.ThemeIconName) fyne.Resource {
|
||||
return theme.DefaultTheme().Icon(name)
|
||||
}
|
||||
|
||||
func (f *forcedVariant) Size(name fyne.ThemeSizeName) float32 {
|
||||
return theme.DefaultTheme().Size(name)
|
||||
}
|
111
internal/controller/convertor.go
Normal file
111
internal/controller/convertor.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/download/service"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/utils"
|
||||
)
|
||||
|
||||
func (c *controller) convertor() {
|
||||
formats, err := c.app.GetConvertorService().GetSupportFormats()
|
||||
if err != nil {
|
||||
c.startWithError(err)
|
||||
return
|
||||
}
|
||||
|
||||
content := view.Convertor(
|
||||
c.window,
|
||||
c.addFileForConversion,
|
||||
c.app.GetSetting().GetDirectoryForSaving(),
|
||||
c.setDirectoryForSaving,
|
||||
formats,
|
||||
c.addToConversion,
|
||||
)
|
||||
c.window.SetContent(content)
|
||||
}
|
||||
|
||||
func (c *controller) addFileForConversion(file ffmpeg.File) {
|
||||
c.app.GetItemsToConvert().Add(&file)
|
||||
c.window.GetLayout().GetRContainer().SelectAddedFilesTab()
|
||||
}
|
||||
|
||||
func (c *controller) setDirectoryForSaving(path string) {
|
||||
c.app.GetSetting().SetDirectoryForSaving(path)
|
||||
}
|
||||
|
||||
func (c *controller) addToConversion(convertSetting view.ConvertSetting) error {
|
||||
if len(c.app.GetItemsToConvert().GetItems()) == 0 {
|
||||
return errors.New(lang.L("errorNoFilesAddedForConversion"))
|
||||
}
|
||||
c.window.GetLayout().GetRContainer().SelectFileQueueTab()
|
||||
for _, item := range c.app.GetItemsToConvert().GetItems() {
|
||||
file := item.GetFile()
|
||||
if file == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
c.app.GetQueueService().Add(&ffmpeg.ConvertSetting{
|
||||
FileInput: *file,
|
||||
FileOut: ffmpeg.File{
|
||||
Path: convertSetting.DirectoryForSave + utils.PathSeparator() + file.Name + "." + convertSetting.Format,
|
||||
Name: file.Name,
|
||||
Ext: "." + convertSetting.Format,
|
||||
},
|
||||
OverwriteOutputFiles: convertSetting.OverwriteOutputFiles,
|
||||
Encoder: convertSetting.Encoder,
|
||||
})
|
||||
}
|
||||
c.app.GetItemsToConvert().AfterAddingQueue()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *controller) settingConvertor(isAllowCancellation bool) {
|
||||
ffmpegPath := c.app.GetFFmpegService().GetFFmpegPath()
|
||||
ffprobePath := c.app.GetFFmpegService().GetFFprobePath()
|
||||
ffplayPath := c.app.GetFFmpegService().GetFFplayPath()
|
||||
|
||||
var cancel func()
|
||||
cancel = nil
|
||||
if isAllowCancellation {
|
||||
cancel = func() {
|
||||
c.convertor()
|
||||
}
|
||||
}
|
||||
|
||||
content := view.ConfiguringFFmpegUtilities(
|
||||
c.window,
|
||||
ffmpegPath,
|
||||
ffprobePath,
|
||||
ffplayPath,
|
||||
c.saveSettingConvertor,
|
||||
cancel,
|
||||
service.DownloadFFmpeg(c.app, c.saveSettingConvertor),
|
||||
)
|
||||
c.window.SetContent(content)
|
||||
}
|
||||
|
||||
func (c *controller) saveSettingConvertor(ffmpegPath string, ffprobePath string, ffplayPath string) error {
|
||||
var err error
|
||||
|
||||
err = c.app.GetFFmpegService().ChangeFFmpeg(ffmpegPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.app.GetFFmpegService().ChangeFFprobe(ffprobePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.app.GetFFmpegService().ChangeFFplay(ffplayPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.convertor()
|
||||
return nil
|
||||
}
|
16
internal/controller/error.go
Normal file
16
internal/controller/error.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
)
|
||||
|
||||
func (c *controller) startWithError(err error) {
|
||||
languages := c.app.GetSetting().GetLanguages()
|
||||
|
||||
content := view.StartWithError(err, languages, func(lang setting.Lang) {
|
||||
_ = setting.ChangeLang(lang)
|
||||
c.startWithError(err)
|
||||
})
|
||||
c.window.SetContent(content)
|
||||
}
|
96
internal/controller/main.go
Normal file
96
internal/controller/main.go
Normal file
@@ -0,0 +1,96 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/menu"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/window"
|
||||
)
|
||||
|
||||
type ControllerContract interface {
|
||||
Start()
|
||||
}
|
||||
|
||||
type controller struct {
|
||||
app application.AppContract
|
||||
window window.WindowContract
|
||||
}
|
||||
|
||||
func NewController(app application.AppContract) ControllerContract {
|
||||
fyneWindow := app.FyneApp().NewWindow("GUI for FFmpeg")
|
||||
fyneWindow.SetMaster()
|
||||
queueLayout := window.NewQueueLayout(app.GetFFmpegService())
|
||||
app.GetQueueService().AddListener(queueLayout)
|
||||
|
||||
return &controller{
|
||||
app: app,
|
||||
window: window.NewMainWindow(
|
||||
fyneWindow,
|
||||
app.GetProgressBarService(),
|
||||
app.GetItemsToConvert(),
|
||||
queueLayout,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *controller) Start() {
|
||||
isDefault, err := c.initLanguage()
|
||||
if err != nil {
|
||||
c.startWithError(err)
|
||||
c.window.Show()
|
||||
return
|
||||
}
|
||||
|
||||
c.app.GetSetting().ThemeInit()
|
||||
|
||||
if isDefault {
|
||||
languages := c.app.GetSetting().GetLanguages()
|
||||
content := view.StartWithoutSupportLang(languages, func(lang setting.Lang) {
|
||||
err = c.app.GetSetting().SetLang(lang)
|
||||
if err != nil {
|
||||
c.startWithError(err)
|
||||
return
|
||||
}
|
||||
c.initLayout()
|
||||
c.verificareaFFmpeg()
|
||||
})
|
||||
c.window.SetContent(content)
|
||||
c.window.Show()
|
||||
return
|
||||
}
|
||||
|
||||
c.initLayout()
|
||||
c.verificareaFFmpeg()
|
||||
c.window.Show()
|
||||
}
|
||||
|
||||
func (c *controller) verificareaFFmpeg() {
|
||||
if !c.app.GetFFmpegService().UtilityCheck() {
|
||||
c.settingConvertor(false)
|
||||
return
|
||||
}
|
||||
|
||||
c.convertor()
|
||||
}
|
||||
|
||||
func (c *controller) initLanguage() (isDefault bool, err error) {
|
||||
lang, isDefault := c.app.GetSetting().GetCurrentLangOrDefaultLang()
|
||||
err = setting.ChangeLang(lang)
|
||||
return isDefault, err
|
||||
}
|
||||
|
||||
func (c *controller) initLayout() {
|
||||
c.window.SetMainMenu(fyne.NewMainMenu(
|
||||
menu.MainMenuSettings(
|
||||
c.actionMainSettings,
|
||||
c.actionSettingConvertor,
|
||||
),
|
||||
menu.MainMenuHelp(
|
||||
c.actionAbout,
|
||||
c.actionHelpFFplay,
|
||||
),
|
||||
))
|
||||
c.window.InitLayout()
|
||||
}
|
67
internal/controller/menu.go
Normal file
67
internal/controller/menu.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
|
||||
)
|
||||
|
||||
func (c *controller) actionSettingConvertor() {
|
||||
c.settingConvertor(true)
|
||||
}
|
||||
|
||||
func (c *controller) actionMainSettings() {
|
||||
currentLang, _ := c.app.GetSetting().GetCurrentLangOrDefaultLang()
|
||||
content := view.MainSettings(
|
||||
currentLang,
|
||||
c.app.GetSetting().GetLanguages(),
|
||||
|
||||
c.app.GetSetting().GetTheme(),
|
||||
c.app.GetSetting().GetThemes(),
|
||||
|
||||
c.actionMainSettingsSave,
|
||||
c.convertor,
|
||||
)
|
||||
c.window.SetContent(content)
|
||||
}
|
||||
|
||||
func (c *controller) actionMainSettingsSave(setting *view.MainSettingForm) error {
|
||||
err := c.app.GetSetting().SetLang(setting.Language)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.app.GetSetting().SetTheme(setting.ThemeInfo)
|
||||
c.initLayout()
|
||||
|
||||
c.convertor()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *controller) actionAbout() {
|
||||
ffmpegVersion := c.app.GetFFmpegService().GetFFmpegVersion()
|
||||
ffprobeVersion := c.app.GetFFmpegService().GetFFprobeVersion()
|
||||
ffplayVersion := c.app.GetFFmpegService().GetFFplayVersion()
|
||||
appVersion := c.app.FyneApp().Metadata().Version
|
||||
|
||||
window := c.app.FyneApp().NewWindow(lang.L("about"))
|
||||
window.Resize(fyne.Size{Width: 793, Height: 550})
|
||||
window.SetFixedSize(true)
|
||||
|
||||
content := view.About(appVersion, ffmpegVersion, ffprobeVersion, ffplayVersion)
|
||||
|
||||
window.SetContent(content)
|
||||
window.CenterOnScreen()
|
||||
window.Show()
|
||||
}
|
||||
|
||||
func (c *controller) actionHelpFFplay() {
|
||||
window := c.app.FyneApp().NewWindow(lang.L("helpFFplay"))
|
||||
window.Resize(fyne.Size{Width: 800, Height: 550})
|
||||
window.SetFixedSize(true)
|
||||
|
||||
content := view.HelpFFplay()
|
||||
|
||||
window.SetContent(content)
|
||||
window.CenterOnScreen()
|
||||
window.Show()
|
||||
}
|
14
internal/ffmpeg/download/gui/download_anyos.go
Normal file
14
internal/ffmpeg/download/gui/download_anyos.go
Normal file
@@ -0,0 +1,14 @@
|
||||
//go:build !windows && !linux
|
||||
// +build !windows,!linux
|
||||
|
||||
package gui
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func DownloadFFmpeg(donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error) fyne.CanvasObject {
|
||||
return container.NewVBox()
|
||||
}
|
@@ -1,22 +1,19 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package convertor
|
||||
package gui
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"golang.org/x/image/colornames"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
func (v View) blockDownloadFFmpeg(
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
) *fyne.Container {
|
||||
|
||||
func DownloadFFmpeg(donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error) fyne.CanvasObject {
|
||||
errorDownloadFFmpegMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
errorDownloadFFmpegMessage.TextSize = 16
|
||||
errorDownloadFFmpegMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
@@ -29,9 +26,7 @@ func (v View) blockDownloadFFmpeg(
|
||||
|
||||
var buttonDownloadFFmpeg *widget.Button
|
||||
|
||||
buttonDownloadFFmpeg = widget.NewButton(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "download",
|
||||
}), func() {
|
||||
buttonDownloadFFmpeg = widget.NewButton(lang.L("download"), func() {
|
||||
fyne.Do(func() {
|
||||
buttonDownloadFFmpeg.Disable()
|
||||
})
|
||||
@@ -47,20 +42,16 @@ func (v View) blockDownloadFFmpeg(
|
||||
|
||||
})
|
||||
|
||||
downloadFFmpegFromSiteMessage := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "downloadFFmpegFromSite",
|
||||
})
|
||||
downloadFFmpegFromSiteMessage := lang.L("downloadFFmpegFromSite")
|
||||
|
||||
return container.NewVBox(
|
||||
canvas.NewLine(colornames.Darkgreen),
|
||||
widget.NewCard(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "buttonDownloadFFmpeg",
|
||||
}), "", container.NewVBox(
|
||||
widget.NewCard(lang.L("buttonDownloadFFmpeg"), "", container.NewVBox(
|
||||
widget.NewRichTextFromMarkdown(
|
||||
downloadFFmpegFromSiteMessage+" [https://github.com/BtbN/FFmpeg-Builds/releases](https://github.com/BtbN/FFmpeg-Builds/releases)",
|
||||
),
|
||||
buttonDownloadFFmpeg,
|
||||
errorDownloadFFmpegMessage,
|
||||
container.NewHScroll(errorDownloadFFmpegMessage),
|
||||
progressDownloadFFmpegMessage,
|
||||
progressBar,
|
||||
)),
|
@@ -1,22 +1,19 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package convertor
|
||||
package gui
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"golang.org/x/image/colornames"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
func (v View) blockDownloadFFmpeg(
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
) *fyne.Container {
|
||||
|
||||
func DownloadFFmpeg(donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error) fyne.CanvasObject {
|
||||
errorDownloadFFmpegMessage := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
errorDownloadFFmpegMessage.TextSize = 16
|
||||
errorDownloadFFmpegMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
@@ -29,9 +26,7 @@ func (v View) blockDownloadFFmpeg(
|
||||
|
||||
var buttonDownloadFFmpeg *widget.Button
|
||||
|
||||
buttonDownloadFFmpeg = widget.NewButton(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "download",
|
||||
}), func() {
|
||||
buttonDownloadFFmpeg = widget.NewButton(lang.L("download"), func() {
|
||||
|
||||
go func() {
|
||||
fyne.Do(func() {
|
||||
@@ -47,20 +42,16 @@ func (v View) blockDownloadFFmpeg(
|
||||
}()
|
||||
})
|
||||
|
||||
downloadFFmpegFromSiteMessage := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "downloadFFmpegFromSite",
|
||||
})
|
||||
downloadFFmpegFromSiteMessage := lang.L("downloadFFmpegFromSite")
|
||||
|
||||
return container.NewVBox(
|
||||
canvas.NewLine(colornames.Darkgreen),
|
||||
widget.NewCard(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "buttonDownloadFFmpeg",
|
||||
}), "", container.NewVBox(
|
||||
widget.NewCard(lang.L("buttonDownloadFFmpeg"), "", container.NewVBox(
|
||||
widget.NewRichTextFromMarkdown(
|
||||
downloadFFmpegFromSiteMessage+" [https://github.com/BtbN/FFmpeg-Builds/releases](https://github.com/BtbN/FFmpeg-Builds/releases)",
|
||||
),
|
||||
buttonDownloadFFmpeg,
|
||||
errorDownloadFFmpegMessage,
|
||||
container.NewHScroll(errorDownloadFFmpegMessage),
|
||||
progressDownloadFFmpegMessage,
|
||||
progressBar,
|
||||
)),
|
21
internal/ffmpeg/download/service/download.go
Normal file
21
internal/ffmpeg/download/service/download.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/download/gui"
|
||||
)
|
||||
|
||||
func DownloadFFmpeg(app application.AppContract, save func(ffmpegPath string, ffprobePath string, ffplayPath string) error) fyne.CanvasObject {
|
||||
return gui.DownloadFFmpeg(func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error {
|
||||
var err error
|
||||
err = startDownload(app, progressBar, progressMessage, save)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
15
internal/ffmpeg/download/service/download_anyos.go
Normal file
15
internal/ffmpeg/download/service/download_anyos.go
Normal file
@@ -0,0 +1,15 @@
|
||||
//go:build !windows && !linux
|
||||
// +build !windows,!linux
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
)
|
||||
|
||||
func startDownload(app application.AppContract, progressBar *widget.ProgressBar, progressMessage *canvas.Text, save func(ffmpegPath string, ffprobePath string, ffplayPath string) error) error {
|
||||
return nil
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package handler
|
||||
package service
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"errors"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
"github.com/ulikunitz/xz"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -18,63 +18,72 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func getPathsToFF() []kernel.FFPathUtilities {
|
||||
return []kernel.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
|
||||
}
|
||||
func startDownload(app application.AppContract, progressBar *widget.ProgressBar, progressMessage *canvas.Text, save func(ffmpegPath string, ffprobePath string, ffplayPath string) error) error {
|
||||
var err error
|
||||
|
||||
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
|
||||
isDirectoryFFmpeg := isDirectory("ffmpeg")
|
||||
if isDirectoryFFmpeg == false {
|
||||
err = os.Mkdir("ffmpeg", 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir, err := localSharePath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "downloadRun",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = downloadFile("ffmpeg/ffmpeg.tar.xz", "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz", progressBar)
|
||||
dir = filepath.Join(dir, "fyne", app.FyneApp().UniqueID())
|
||||
err = os.MkdirAll(dir, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "unzipRun",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("downloadRun")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = unTarXz("ffmpeg/ffmpeg.tar.xz", "ffmpeg", progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = os.Remove("ffmpeg/ffmpeg.tar.xz")
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "testFF",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
|
||||
err = h.saveSettingFFPath("ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffmpeg", "ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffprobe")
|
||||
err = downloadFile(dir+"/ffmpeg.tar.xz", "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz", progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "completedQueue",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("unzipRun")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = unTarXz(dir+"/ffmpeg.tar.xz", dir, progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = os.Remove(dir + "/ffmpeg.tar.xz")
|
||||
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("testFF")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
|
||||
err = save(
|
||||
dir+"/ffmpeg-master-latest-linux64-gpl/bin/ffmpeg",
|
||||
dir+"/ffmpeg-master-latest-linux64-gpl/bin/ffprobe",
|
||||
dir+"/ffmpeg-master-latest-linux64-gpl/bin/ffplay",
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("completedQueue")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func localSharePath() (string, error) {
|
||||
xdgDataHome := os.Getenv("XDG_DATA_HOME")
|
||||
if xdgDataHome != "" {
|
||||
return xdgDataHome, nil
|
||||
}
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(homeDir, ".local", "share"), nil
|
||||
}
|
||||
|
||||
func downloadFile(filepath string, url string, progressBar *widget.ProgressBar) (err error) {
|
||||
progressBar.Value = 0
|
||||
progressBar.Max = 100
|
||||
@@ -217,14 +226,11 @@ func unTarXz(fileTar string, directory string, progressBar *widget.ProgressBar)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isDirectory(path string) bool {
|
||||
fileInfo, err := os.Stat(path)
|
||||
ffplayPath := filepath.Join(directory, "ffmpeg-master-latest-linux64-gpl", "bin", "ffplay")
|
||||
err = os.Chmod(ffplayPath, 0755)
|
||||
if err != nil {
|
||||
return false
|
||||
return err
|
||||
}
|
||||
|
||||
return fileInfo.IsDir()
|
||||
return nil
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package handler
|
||||
package service
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"errors"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -18,56 +18,50 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getPathsToFF() []kernel.FFPathUtilities {
|
||||
return []kernel.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
|
||||
}
|
||||
func startDownload(app application.AppContract, progressBar *widget.ProgressBar, progressMessage *canvas.Text, save func(ffmpegPath string, ffprobePath string, ffplayPath string) error) error {
|
||||
var err error
|
||||
|
||||
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
|
||||
isDirectoryFFmpeg := isDirectory("ffmpeg")
|
||||
if isDirectoryFFmpeg == false {
|
||||
err = os.Mkdir("ffmpeg", 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "downloadRun",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = downloadFile("ffmpeg/ffmpeg.zip", "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip", progressBar)
|
||||
dir := os.Getenv("APPDATA")
|
||||
dir = filepath.Join(dir, "fyne", app.FyneApp().UniqueID())
|
||||
err = os.MkdirAll(dir, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "unzipRun",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("downloadRun")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = unZip("ffmpeg/ffmpeg.zip", "ffmpeg", progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = os.Remove("ffmpeg/ffmpeg.zip")
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "testFF",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = h.saveSettingFFPath("ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe", "ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffprobe.exe")
|
||||
err = downloadFile(dir+"/ffmpeg.zip", "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip", progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "completedQueue",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("unzipRun")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = unZip(dir+"/ffmpeg.zip", dir, progressBar)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = os.Remove(dir + "/ffmpeg.zip")
|
||||
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("testFF")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = save(
|
||||
dir+"/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe",
|
||||
dir+"/ffmpeg-master-latest-win64-gpl/bin/ffprobe.exe",
|
||||
dir+"/ffmpeg-master-latest-win64-gpl/bin/ffplay.exe",
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("completedQueue")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
|
||||
@@ -179,12 +173,3 @@ func unZip(fileZip string, directory string, progressBar *widget.ProgressBar) er
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isDirectory(path string) bool {
|
||||
fileInfo, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fileInfo.IsDir()
|
||||
}
|
21
internal/ffmpeg/encoder/apng/encoder.go
Normal file
21
internal/ffmpeg/encoder/apng/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package apng
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "apng"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("apng", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "apng"
|
||||
formats := []string{"apng"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/bmp/encoder.go
Normal file
21
internal/ffmpeg/encoder/bmp/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package bmp
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "bmp"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("bmp", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "bmp"
|
||||
formats := []string{"bmp"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -24,15 +24,15 @@ type EncoderDataContract interface {
|
||||
NewEncoder() EncoderContract
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
type data struct {
|
||||
title string
|
||||
formats []string
|
||||
fileType FileTypeContract
|
||||
encoder func() EncoderContract
|
||||
}
|
||||
|
||||
func NewData(title string, formats []string, fileType FileTypeContract, encoder func() EncoderContract) *Data {
|
||||
return &Data{
|
||||
func NewData(title string, formats []string, fileType FileTypeContract, encoder func() EncoderContract) EncoderDataContract {
|
||||
return &data{
|
||||
title: title,
|
||||
formats: formats,
|
||||
fileType: fileType,
|
||||
@@ -40,19 +40,19 @@ func NewData(title string, formats []string, fileType FileTypeContract, encoder
|
||||
}
|
||||
}
|
||||
|
||||
func (data Data) GetTitle() string {
|
||||
func (data *data) GetTitle() string {
|
||||
return data.title
|
||||
}
|
||||
|
||||
func (data Data) GetFormats() []string {
|
||||
func (data *data) GetFormats() []string {
|
||||
return data.formats
|
||||
}
|
||||
|
||||
func (data Data) NewEncoder() EncoderContract {
|
||||
func (data *data) NewEncoder() EncoderContract {
|
||||
return data.encoder()
|
||||
}
|
||||
|
||||
func (data Data) GetFileType() FileTypeContract {
|
||||
func (data *data) GetFileType() FileTypeContract {
|
||||
return data.fileType
|
||||
}
|
||||
|
||||
@@ -91,29 +91,29 @@ func GetListFileType() []FileTypeContract {
|
||||
}
|
||||
}
|
||||
|
||||
type Encoder struct {
|
||||
type encoder struct {
|
||||
name string
|
||||
parameters map[string]ParameterContract
|
||||
getParams func(parameters map[string]ParameterContract) []string
|
||||
}
|
||||
|
||||
func NewEncoder(name string, parameters map[string]ParameterContract, getParams func(parameters map[string]ParameterContract) []string) *Encoder {
|
||||
return &Encoder{
|
||||
func NewEncoder(name string, parameters map[string]ParameterContract, getParams func(parameters map[string]ParameterContract) []string) EncoderContract {
|
||||
return &encoder{
|
||||
name: name,
|
||||
parameters: parameters,
|
||||
getParams: getParams,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Encoder) GetName() string {
|
||||
func (e *encoder) GetName() string {
|
||||
return e.name
|
||||
}
|
||||
|
||||
func (e *Encoder) GetParams() []string {
|
||||
func (e *encoder) GetParams() []string {
|
||||
return e.getParams(e.parameters)
|
||||
}
|
||||
|
||||
func (e *Encoder) GetParameter(name string) (ParameterContract, error) {
|
||||
func (e *encoder) GetParameter(name string) (ParameterContract, error) {
|
||||
if e.parameters[name] == nil {
|
||||
return nil, errors.New("parameter not found")
|
||||
}
|
||||
@@ -121,15 +121,15 @@ func (e *Encoder) GetParameter(name string) (ParameterContract, error) {
|
||||
return e.parameters[name], nil
|
||||
}
|
||||
|
||||
type Parameter struct {
|
||||
type parameter struct {
|
||||
name string
|
||||
isEnabled bool
|
||||
parameter string
|
||||
setParameter func(string) (string, error)
|
||||
}
|
||||
|
||||
func NewParameter(name string, isEnabled bool, defaultParameter string, setParameter func(string) (string, error)) *Parameter {
|
||||
return &Parameter{
|
||||
func NewParameter(name string, isEnabled bool, defaultParameter string, setParameter func(string) (string, error)) ParameterContract {
|
||||
return ¶meter{
|
||||
name: name,
|
||||
isEnabled: isEnabled,
|
||||
parameter: defaultParameter,
|
||||
@@ -137,11 +137,11 @@ func NewParameter(name string, isEnabled bool, defaultParameter string, setParam
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Parameter) GetName() string {
|
||||
func (p *parameter) GetName() string {
|
||||
return p.name
|
||||
}
|
||||
|
||||
func (p *Parameter) Set(s string) (err error) {
|
||||
func (p *parameter) Set(s string) (err error) {
|
||||
if p.setParameter != nil {
|
||||
s, err = p.setParameter(s)
|
||||
if err != nil {
|
||||
@@ -152,18 +152,18 @@ func (p *Parameter) Set(s string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Parameter) Get() string {
|
||||
func (p *parameter) Get() string {
|
||||
return p.parameter
|
||||
}
|
||||
|
||||
func (p *Parameter) IsEnabled() bool {
|
||||
func (p *parameter) IsEnabled() bool {
|
||||
return p.isEnabled
|
||||
}
|
||||
|
||||
func (p *Parameter) SetEnable() {
|
||||
func (p *parameter) SetEnable() {
|
||||
p.isEnabled = true
|
||||
}
|
||||
|
||||
func (p *Parameter) SetDisable() {
|
||||
func (p *parameter) SetDisable() {
|
||||
p.isEnabled = false
|
||||
}
|
21
internal/ffmpeg/encoder/flv/encoder.go
Normal file
21
internal/ffmpeg/encoder/flv/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package flv
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "flv"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("flv", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "flv"
|
||||
formats := []string{"flv"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/gif/encoder.go
Normal file
21
internal/ffmpeg/encoder/gif/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package gif
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "gif"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("gif", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "gif"
|
||||
formats := []string{"gif"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -2,7 +2,7 @@ package h264_nvenc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
var Presets = []string{
|
||||
@@ -20,11 +20,11 @@ var Presets = []string{
|
||||
"losslesshp",
|
||||
}
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{
|
||||
"preset": newParameterPreset(),
|
||||
}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
params := []string{"-c:v", "h264_nvenc"}
|
||||
|
||||
if parameters["preset"] != nil && parameters["preset"].IsEnabled() {
|
||||
@@ -34,17 +34,17 @@ func NewEncoder() encoder2.EncoderContract {
|
||||
return params
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("h264_nvenc", parameters, getParams)
|
||||
return encoder.NewEncoder("h264_nvenc", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "h264_nvenc"
|
||||
formats := []string{"mp4"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
||||
|
||||
func newParameterPreset() encoder2.ParameterContract {
|
||||
func newParameterPreset() encoder.ParameterContract {
|
||||
setParameter := func(s string) (string, error) {
|
||||
for _, value := range Presets {
|
||||
if value == s {
|
||||
@@ -54,5 +54,5 @@ func newParameterPreset() encoder2.ParameterContract {
|
||||
|
||||
return "", errors.New("preset not found")
|
||||
}
|
||||
return encoder2.NewParameter("preset", false, "default", setParameter)
|
||||
return encoder.NewParameter("preset", false, "default", setParameter)
|
||||
}
|
21
internal/ffmpeg/encoder/libmp3lame/encoder.go
Normal file
21
internal/ffmpeg/encoder/libmp3lame/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libmp3lame
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:a", "libmp3lame"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libmp3lame", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libmp3lame"
|
||||
formats := []string{"mp3"}
|
||||
fileType := encoder.FileType(encoder.Audio)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libshine/encoder.go
Normal file
21
internal/ffmpeg/encoder/libshine/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libshine
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:a", "libshine"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libshine", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libshine"
|
||||
formats := []string{"mp3"}
|
||||
fileType := encoder.FileType(encoder.Audio)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libtwolame/encoder.go
Normal file
21
internal/ffmpeg/encoder/libtwolame/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libtwolame
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:a", "libtwolame"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libtwolame", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libtwolame"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder.FileType(encoder.Audio)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libvpx/encoder.go
Normal file
21
internal/ffmpeg/encoder/libvpx/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libvpx
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "libvpx"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libvpx", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libvpx"
|
||||
formats := []string{"webm", "mkv"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libvpx_vp9/encoder.go
Normal file
21
internal/ffmpeg/encoder/libvpx_vp9/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libvpx_vp9
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "libvpx-vp9"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libvpx_vp9", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libvpx-vp9"
|
||||
formats := []string{"webm", "mkv"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libwebp/encoder.go
Normal file
21
internal/ffmpeg/encoder/libwebp/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libwebp
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "libwebp"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libwebp", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libwebp"
|
||||
formats := []string{"webp"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/libwebp_anim/encoder.go
Normal file
21
internal/ffmpeg/encoder/libwebp_anim/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libwebp_anim
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "libwebp_anim"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libwebp_anim", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libwebp_anim"
|
||||
formats := []string{"webp"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
@@ -2,7 +2,7 @@ package libx264
|
||||
|
||||
import (
|
||||
"errors"
|
||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
var Presets = []string{
|
||||
@@ -18,11 +18,11 @@ var Presets = []string{
|
||||
"placebo",
|
||||
}
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{
|
||||
"preset": newParameterPreset(),
|
||||
}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
params := []string{"-c:v", "libx264"}
|
||||
|
||||
if parameters["preset"] != nil && parameters["preset"].IsEnabled() {
|
||||
@@ -32,17 +32,17 @@ func NewEncoder() encoder2.EncoderContract {
|
||||
return params
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libx264", parameters, getParams)
|
||||
return encoder.NewEncoder("libx264", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libx264"
|
||||
formats := []string{"mp4"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
||||
|
||||
func newParameterPreset() encoder2.ParameterContract {
|
||||
func newParameterPreset() encoder.ParameterContract {
|
||||
setParameter := func(s string) (string, error) {
|
||||
for _, value := range Presets {
|
||||
if value == s {
|
||||
@@ -52,5 +52,5 @@ func newParameterPreset() encoder2.ParameterContract {
|
||||
|
||||
return "", errors.New("preset not found")
|
||||
}
|
||||
return encoder2.NewParameter("preset", false, "medium", setParameter)
|
||||
return encoder.NewParameter("preset", false, "medium", setParameter)
|
||||
}
|
@@ -2,7 +2,7 @@ package libx265
|
||||
|
||||
import (
|
||||
"errors"
|
||||
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
var Presets = []string{
|
||||
@@ -18,11 +18,11 @@ var Presets = []string{
|
||||
"placebo",
|
||||
}
|
||||
|
||||
func NewEncoder() encoder2.EncoderContract {
|
||||
parameters := map[string]encoder2.ParameterContract{
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{
|
||||
"preset": newParameterPreset(),
|
||||
}
|
||||
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
params := []string{"-c:v", "libx265"}
|
||||
|
||||
if parameters["preset"] != nil && parameters["preset"].IsEnabled() {
|
||||
@@ -32,17 +32,17 @@ func NewEncoder() encoder2.EncoderContract {
|
||||
return params
|
||||
}
|
||||
|
||||
return encoder2.NewEncoder("libx265", parameters, getParams)
|
||||
return encoder.NewEncoder("libx265", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder2.EncoderDataContract {
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libx265"
|
||||
formats := []string{"mp4"}
|
||||
fileType := encoder2.FileType(encoder2.Video)
|
||||
return encoder2.NewData(title, formats, fileType, NewEncoder)
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
||||
|
||||
func newParameterPreset() encoder2.ParameterContract {
|
||||
func newParameterPreset() encoder.ParameterContract {
|
||||
setParameter := func(s string) (string, error) {
|
||||
for _, value := range Presets {
|
||||
if value == s {
|
||||
@@ -52,5 +52,5 @@ func newParameterPreset() encoder2.ParameterContract {
|
||||
|
||||
return "", errors.New("preset not found")
|
||||
}
|
||||
return encoder2.NewParameter("preset", false, "medium", setParameter)
|
||||
return encoder.NewParameter("preset", false, "medium", setParameter)
|
||||
}
|
21
internal/ffmpeg/encoder/libxvid/encoder.go
Normal file
21
internal/ffmpeg/encoder/libxvid/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package libxvid
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "libxvid"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("libxvid", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "libxvid"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/mjpeg/encoder.go
Normal file
21
internal/ffmpeg/encoder/mjpeg/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mjpeg
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:v", "mjpeg"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mjpeg", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mjpeg"
|
||||
formats := []string{"jpg"}
|
||||
fileType := encoder.FileType(encoder.Image)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/mp2/encoder.go
Normal file
21
internal/ffmpeg/encoder/mp2/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mp2
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:a", "mp2"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mp2", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mp2"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder.FileType(encoder.Audio)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/mp2fixed/encoder.go
Normal file
21
internal/ffmpeg/encoder/mp2fixed/encoder.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mp2fixed
|
||||
|
||||
import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder"
|
||||
)
|
||||
|
||||
func NewEncoder() encoder.EncoderContract {
|
||||
parameters := map[string]encoder.ParameterContract{}
|
||||
getParams := func(parameters map[string]encoder.ParameterContract) []string {
|
||||
return []string{"-c:a", "mp2fixed"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mp2fixed", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mp2fixed"
|
||||
formats := []string{"mp2"}
|
||||
fileType := encoder.FileType(encoder.Audio)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user