Версия 1.0.0 #11
15
FyneApp.toml
15
FyneApp.toml
@ -1,9 +1,14 @@
|
||||
Website = "https://gui-for-ffmpeg.projects.kor-elf.net/language/en"
|
||||
|
||||
[Details]
|
||||
Icon = "icon.png"
|
||||
Icon = "assets/icon.png"
|
||||
Name = "GUI for FFmpeg"
|
||||
ID = "net.kor-elf.projects.gui-for-ffmpeg"
|
||||
Version = "0.9.0"
|
||||
Build = 4
|
||||
Version = "1.0.0"
|
||||
Build = 75
|
||||
|
||||
[Migrations]
|
||||
fyneDo = true
|
||||
[LinuxAndBSD]
|
||||
GenericName = "GUI for FFmpeg"
|
||||
Categories = ["AudioVideo", "Utility"]
|
||||
Comment = "A simple interface for the FFmpeg console utility."
|
||||
Keywords = ["ffmpeg", "media", "convert", "transcode", "audio", "video", "конвертер", "видео", "аудио", "кодек"]
|
||||
|
@ -1566,31 +1566,6 @@ SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
go.etcd.io/bbolt
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Ben Johnson
|
||||
|
||||
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.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
golang.org/x/image
|
||||
|
||||
Copyright 2009 The Go Authors.
|
||||
@ -1721,43 +1696,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
gopkg.in/yaml.v3
|
||||
|
||||
This project is covered by two different licenses: MIT and Apache.
|
||||
|
||||
#### MIT License ####
|
||||
|
||||
The following files were ported to Go from C files of libyaml, and thus
|
||||
are still covered by their original MIT license, with the additional
|
||||
copyright staring in 2011 when the project was ported over:
|
||||
|
||||
apic.go emitterc.go parserc.go readerc.go scannerc.go
|
||||
writerc.go yamlh.go yamlprivateh.go
|
||||
|
||||
Copyright (c) 2006-2010 Kirill Simonov
|
||||
Copyright (c) 2006-2011 Kirill Simonov
|
||||
|
||||
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.
|
||||
|
||||
### Apache License ###
|
||||
|
||||
All the remaining project files are covered by the Apache license:
|
||||
|
||||
Copyright (c) 2011-2019 Canonical Ltd
|
||||
Copyright 2011-2016 Canonical Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -1805,3 +1744,683 @@ 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
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
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/bin/linux-amd64** или **fyne-cross/bin/windows-amd64** будут архивы, которые надо распаковать и пользоваться программой.
|
||||
|
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
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,46 +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)
|
||||
GetPathFfplay() (string, error)
|
||||
SavePathFfplay(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)
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfplay() (string, error) {
|
||||
return r.settingRepository.GetValue("ffplay")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfplay(path string) (setting.Setting, error) {
|
||||
return r.settingRepository.CreateOrUpdate("ffplay", path)
|
||||
}
|
@ -1,63 +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,
|
||||
ffplayPath string,
|
||||
save func(ffmpegPath string, ffprobePath string, ffplayPath 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,539 +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"
|
||||
"os"
|
||||
"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)
|
||||
itemsToConvertService kernel.ItemsToConvertContract
|
||||
}
|
||||
|
||||
type HandleConvertSetting struct {
|
||||
DirectoryForSave string
|
||||
OverwriteOutputFiles bool
|
||||
Format string
|
||||
Encoder encoder2.EncoderContract
|
||||
}
|
||||
|
||||
func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContract, runConvert func(setting HandleConvertSetting), settingDirectoryForSaving setting.DirectoryForSavingContract, itemsToConvertService kernel.ItemsToConvertContract) *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, itemsToConvertService)
|
||||
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,
|
||||
itemsToConvertService: itemsToConvertService,
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
if len(c.itemsToConvertService.GetItems()) == 0 {
|
||||
c.form.form.Disable()
|
||||
}
|
||||
}
|
||||
|
||||
func (c Conversion) selectFileForConversion(err error) {
|
||||
c.conversionMessage.Text = ""
|
||||
if len(c.itemsToConvertService.GetItems()) == 0 {
|
||||
if err != nil {
|
||||
c.form.form.Disable()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
c.form.form.Enable()
|
||||
}
|
||||
|
||||
func (c Conversion) submit() {
|
||||
if len(c.itemsToConvertService.GetItems()) == 0 {
|
||||
showConversionMessage(c.conversionMessage, errors.New(c.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorNoFilesAddedForConversion",
|
||||
})))
|
||||
c.enableFormConversion()
|
||||
return
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
c.runConvert(HandleConvertSetting{
|
||||
DirectoryForSave: c.directoryForSaving.path,
|
||||
OverwriteOutputFiles: c.overwriteOutputFiles.IsChecked(),
|
||||
Format: c.selectEncoder.SelectFormat.Selected,
|
||||
Encoder: c.selectEncoder.Encoder,
|
||||
})
|
||||
c.enableFormConversion()
|
||||
|
||||
if len(c.itemsToConvertService.GetItems()) == 0 {
|
||||
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, itemsToConvertService kernel.ItemsToConvertContract) *fileForConversion {
|
||||
message := canvas.NewText("", color.RGBA{R: 255, G: 0, B: 0, A: 255})
|
||||
fileForConversion := &fileForConversion{
|
||||
message: message,
|
||||
|
||||
changeCallbacks: map[int]func(err error){},
|
||||
}
|
||||
|
||||
buttonTitle := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "choose",
|
||||
}) + "\n" + app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "or",
|
||||
}) + "\n" + app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "dragAndDropFiles",
|
||||
})
|
||||
|
||||
var locationURI fyne.ListableURI
|
||||
|
||||
fileForConversion.button = widget.NewButton(buttonTitle, func() {
|
||||
app.GetWindow().NewFileOpen(func(r fyne.URIReadCloser, err error) {
|
||||
fyne.Do(func() {
|
||||
fileForConversion.message.Text = ""
|
||||
fileForConversion.message.Refresh()
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
fyne.Do(func() {
|
||||
fileForConversion.message.Text = err.Error()
|
||||
fileForConversion.message.Refresh()
|
||||
})
|
||||
fileForConversion.eventSelectFile(err)
|
||||
return
|
||||
}
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
app.GetWindow().GetLayout().GetRightTabs().SelectAddedFilesTab()
|
||||
|
||||
itemsToConvertService.Add(&kernel.File{
|
||||
Path: r.URI().Path(),
|
||||
Name: r.URI().Name(),
|
||||
Ext: r.URI().Extension(),
|
||||
})
|
||||
|
||||
fileForConversion.eventSelectFile(nil)
|
||||
|
||||
listableURI := storage.NewFileURI(filepath.Dir(r.URI().Path()))
|
||||
locationURI, _ = storage.ListerForURI(listableURI)
|
||||
}, locationURI)
|
||||
})
|
||||
|
||||
app.GetWindow().SetOnDropped(func(position fyne.Position, uris []fyne.URI) {
|
||||
if len(uris) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
isError := false
|
||||
for _, uri := range uris {
|
||||
info, err := os.Stat(uri.Path())
|
||||
if err != nil {
|
||||
isError = true
|
||||
continue
|
||||
}
|
||||
if info.IsDir() {
|
||||
isError = true
|
||||
continue
|
||||
}
|
||||
|
||||
itemsToConvertService.Add(&kernel.File{
|
||||
Path: uri.Path(),
|
||||
Name: uri.Name(),
|
||||
Ext: uri.Extension(),
|
||||
})
|
||||
|
||||
fileForConversion.eventSelectFile(nil)
|
||||
|
||||
listableURI := storage.NewFileURI(filepath.Dir(uri.Path()))
|
||||
locationURI, _ = storage.ListerForURI(listableURI)
|
||||
}
|
||||
app.GetWindow().GetLayout().GetRightTabs().SelectAddedFilesTab()
|
||||
if isError {
|
||||
fileForConversion.message.Text = app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorDragAndDropFile",
|
||||
})
|
||||
setStringErrorStyle(fileForConversion.message)
|
||||
fileForConversion.eventSelectFile(errors.New(fileForConversion.message.Text))
|
||||
} else {
|
||||
fyne.Do(func() {
|
||||
fileForConversion.message.Text = ""
|
||||
fileForConversion.message.Refresh()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
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,145 +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,
|
||||
currentPathFfplay string,
|
||||
save func(ffmpegPath string, ffprobePath string, ffplayPath 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)
|
||||
ffplayPath, buttonFFplay, buttonFFplayMessage := v.getButtonSelectFile(currentPathFfplay)
|
||||
|
||||
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),
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfplay",
|
||||
}),
|
||||
Widget: buttonFFplay,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFplayMessage),
|
||||
},
|
||||
{
|
||||
Widget: errorMessage,
|
||||
},
|
||||
},
|
||||
SubmitText: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "save",
|
||||
}),
|
||||
OnSubmit: func() {
|
||||
err := save(*ffmpegPath, *ffprobePath, *ffplayPath)
|
||||
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)
|
7
dist/linux/Readme-eng.txt
vendored
Normal file
7
dist/linux/Readme-eng.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
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.
|
7
dist/linux/Readme-rus.txt
vendored
Normal file
7
dist/linux/Readme-rus.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Установить для пользователя (рекомендуется)
|
||||
Запустите "make user-install" для установки в домашнюю папку ~/.local/
|
||||
Запустите "make user-uninstall" для удаления из домашней папки ~/.local/
|
||||
|
||||
Установить для всей системы
|
||||
Запустить "sudo make install" Для установки в систему.
|
||||
Запустить "sudo make uninstall" Для удаления из системы.
|
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;конвертер;видео;аудио;кодек;
|
@ -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,86 +0,0 @@
|
||||
package error
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"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"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
type ViewContract interface {
|
||||
PanicError(err error)
|
||||
}
|
||||
|
||||
type View struct {
|
||||
app kernel.AppContract
|
||||
isSetLanguage bool
|
||||
}
|
||||
|
||||
func NewView(app kernel.AppContract) *View {
|
||||
return &View{
|
||||
app: app,
|
||||
isSetLanguage: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (v View) PanicError(err error) {
|
||||
if v.isSetLanguage {
|
||||
v.isSetLanguage = false
|
||||
_ = v.app.GetLocalizerService().SetCurrentLanguageByCode(lang.SystemLocale().LanguageString())
|
||||
}
|
||||
|
||||
messageHead := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "error",
|
||||
})
|
||||
|
||||
messagetText := err.Error()
|
||||
if errors.Is(err, bbolt.ErrTimeout) {
|
||||
messagetText = v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorDatabaseTimeout",
|
||||
})
|
||||
}
|
||||
|
||||
v.app.GetWindow().SetContent(container.NewBorder(
|
||||
container.NewVBox(
|
||||
widget.NewLabel(messageHead),
|
||||
widget.NewLabel(messagetText),
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
localizer.LanguageSelectionForm(v.app.GetLocalizerService(), func(lang kernel.Lang) {
|
||||
v.PanicError(err)
|
||||
}),
|
||||
))
|
||||
}
|
||||
|
||||
func (v View) PanicErrorWriteDirectoryData() {
|
||||
if v.isSetLanguage {
|
||||
v.isSetLanguage = false
|
||||
_ = v.app.GetLocalizerService().SetCurrentLanguageByCode(lang.SystemLocale().LanguageString())
|
||||
}
|
||||
|
||||
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()
|
||||
}),
|
||||
))
|
||||
}
|
7
go.mod
7
go.mod
@ -6,16 +6,13 @@ 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
|
||||
)
|
||||
|
||||
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/fsnotify/fsnotify v1.9.0 // indirect
|
||||
@ -34,6 +31,7 @@ require (
|
||||
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/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
|
||||
@ -42,5 +40,6 @@ require (
|
||||
github.com/yuin/goldmark v1.7.11 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -67,14 +67,10 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
||||
github.com/ulikunitz/xz v0.5.12/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=
|
||||
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/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/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
|
@ -1,185 +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)
|
||||
GetFfplayVersion() (string, error)
|
||||
}
|
||||
|
||||
type ConvertorHandler struct {
|
||||
app kernel.AppContract
|
||||
convertorView convertor.ViewContract
|
||||
errorView error2.ViewContract
|
||||
convertorRepository convertor.RepositoryContract
|
||||
settingDirectoryForSaving setting.DirectoryForSavingContract
|
||||
itemsToConvertService kernel.ItemsToConvertContract
|
||||
}
|
||||
|
||||
func NewConvertorHandler(
|
||||
app kernel.AppContract,
|
||||
convertorView convertor.ViewContract,
|
||||
errorView error2.ViewContract,
|
||||
convertorRepository convertor.RepositoryContract,
|
||||
settingDirectoryForSaving setting.DirectoryForSavingContract,
|
||||
itemsToConvertService kernel.ItemsToConvertContract,
|
||||
) *ConvertorHandler {
|
||||
return &ConvertorHandler{
|
||||
app: app,
|
||||
convertorView: convertorView,
|
||||
errorView: errorView,
|
||||
convertorRepository: convertorRepository,
|
||||
settingDirectoryForSaving: settingDirectoryForSaving,
|
||||
itemsToConvertService: itemsToConvertService,
|
||||
}
|
||||
}
|
||||
|
||||
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.itemsToConvertService)
|
||||
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()
|
||||
ffplay, _ := h.convertorRepository.GetPathFfplay()
|
||||
h.convertorView.SelectFFPath(ffmpeg, ffprobe, ffplay, 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) GetFfplayVersion() (string, error) {
|
||||
return h.app.GetConvertorService().GetFFplayVersion()
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) runConvert(setting view.HandleConvertSetting) {
|
||||
h.app.GetWindow().GetLayout().GetRightTabs().SelectFileQueueTab()
|
||||
|
||||
for _, item := range h.itemsToConvertService.GetItems() {
|
||||
file := item.GetFile()
|
||||
if file == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
h.app.GetQueue().Add(&kernel.ConvertSetting{
|
||||
VideoFileInput: *file,
|
||||
VideoFileOut: kernel.File{
|
||||
Path: setting.DirectoryForSave + helper.PathSeparator() + file.Name + "." + setting.Format,
|
||||
Name: file.Name,
|
||||
Ext: "." + setting.Format,
|
||||
},
|
||||
OverwriteOutputFiles: setting.OverwriteOutputFiles,
|
||||
Encoder: setting.Encoder,
|
||||
})
|
||||
}
|
||||
h.itemsToConvertService.AfterAddingQueue()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
ffplayChecking, _ := h.app.GetConvertorService().ChangeFFplayPath(item.FFplay)
|
||||
if ffplayChecking == false {
|
||||
continue
|
||||
}
|
||||
_, _ = h.convertorRepository.SavePathFfmpeg(item.FFmpeg)
|
||||
_, _ = h.convertorRepository.SavePathFfprobe(item.FFprobe)
|
||||
_, _ = h.convertorRepository.SavePathFfplay(item.FFplay)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) saveSettingFFPath(ffmpegPath string, ffprobePath string, ffplayPath 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)
|
||||
}
|
||||
|
||||
ffplayChecking, _ := h.app.GetConvertorService().ChangeFFplayPath(ffplayPath)
|
||||
if ffplayChecking == false {
|
||||
errorText := h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFplay",
|
||||
})
|
||||
return errors.New(errorText)
|
||||
}
|
||||
|
||||
_, _ = h.convertorRepository.SavePathFfmpeg(ffmpegPath)
|
||||
_, _ = h.convertorRepository.SavePathFfprobe(ffprobePath)
|
||||
_, _ = h.convertorRepository.SavePathFfplay(ffplayPath)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
_, err = h.app.GetConvertorService().GetFFplayVersion()
|
||||
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: "ffmpeg/bin/ffmpeg", FFprobe: "ffmpeg/bin/ffprobe", FFplay: "ffmpeg/bin/ffplay"}, {FFmpeg: "ffmpeg", FFprobe: "ffprobe", FFplay: "ffplay"}}
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
|
||||
return nil
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"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 {
|
||||
err = h.app.GetLocalizerService().SetCurrentLanguageByCode(lang.SystemLocale().LanguageString())
|
||||
if err != nil {
|
||||
h.menuHandler.LanguageSelection()
|
||||
return
|
||||
}
|
||||
}
|
||||
_ = h.app.GetLocalizerService().SetCurrentLanguageByCode(language)
|
||||
|
||||
h.convertorHandler.MainConvertor()
|
||||
}
|
174
handler/menu.go
174
handler/menu.go
@ -1,174 +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"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/theme"
|
||||
"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
|
||||
menuViewSetting menu.ViewSettingContract
|
||||
localizerView localizer.ViewContract
|
||||
localizerRepository localizer.RepositoryContract
|
||||
themeService theme.ThemeContract
|
||||
}
|
||||
|
||||
func NewMenuHandler(
|
||||
app kernel.AppContract,
|
||||
convertorHandler ConvertorHandlerContract,
|
||||
menuView menu.ViewContract,
|
||||
menuViewSetting menu.ViewSettingContract,
|
||||
localizerView localizer.ViewContract,
|
||||
localizerRepository localizer.RepositoryContract,
|
||||
themeService theme.ThemeContract,
|
||||
) *MenuHandler {
|
||||
return &MenuHandler{
|
||||
app: app,
|
||||
convertorHandler: convertorHandler,
|
||||
menuView: menuView,
|
||||
menuViewSetting: menuViewSetting,
|
||||
localizerView: localizerView,
|
||||
localizerRepository: localizerRepository,
|
||||
themeService: themeService,
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
settingsSelection := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "settings",
|
||||
}), h.settingsSelection)
|
||||
h.app.GetLocalizerService().AddChangeCallback("settings", func(text string) {
|
||||
settingsSelection.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",
|
||||
}), settingsSelection, 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
|
||||
})
|
||||
|
||||
gratitude := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "gratitude",
|
||||
}), h.menuView.Gratitude)
|
||||
h.app.GetLocalizerService().AddChangeCallback("gratitude", func(text string) {
|
||||
gratitude.Label = text
|
||||
})
|
||||
|
||||
helpFFplay := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "helpFFplay",
|
||||
}), h.menuView.HelpFFplay)
|
||||
h.app.GetLocalizerService().AddChangeCallback("helpFFplay", func(text string) {
|
||||
helpFFplay.Label = text
|
||||
})
|
||||
|
||||
help := fyne.NewMenu(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "help",
|
||||
}), helpFFplay, about, gratitude)
|
||||
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",
|
||||
})
|
||||
}
|
||||
ffplay, err := h.convertorHandler.GetFfplayVersion()
|
||||
if err != nil {
|
||||
ffplay = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFplayVersion",
|
||||
})
|
||||
}
|
||||
|
||||
h.menuView.About(ffmpeg, ffprobe, ffplay)
|
||||
}
|
||||
|
||||
func (h MenuHandler) LanguageSelection() {
|
||||
h.localizerView.LanguageSelection(func(lang kernel.Lang) {
|
||||
_, _ = h.localizerRepository.Save(lang.Code)
|
||||
h.convertorHandler.MainConvertor()
|
||||
})
|
||||
}
|
||||
|
||||
func (h MenuHandler) settingsSelection() {
|
||||
save := func(setting *menu.SettingForm) error {
|
||||
err := h.app.GetLocalizerService().SetCurrentLanguage(setting.Language)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = h.localizerRepository.Save(setting.Language.Code)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = h.themeService.SetCurrentTheme(setting.ThemeInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
h.convertorHandler.MainConvertor()
|
||||
return nil
|
||||
}
|
||||
cancel := func() {
|
||||
h.convertorHandler.MainConvertor()
|
||||
}
|
||||
h.menuViewSetting.Main(save, cancel)
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 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)
|
||||
}
|
110
internal/application/setting/theme.go
Normal file
110
internal/application/setting/theme.go
Normal file
@ -0,0 +1,110 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
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" {
|
||||
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,67 +18,72 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func getPathsToFF() []kernel.FFPathUtilities {
|
||||
return []kernel.FFPathUtilities{{FFmpeg: "ffmpeg/bin/ffmpeg", FFprobe: "ffmpeg/bin/ffprobe", FFplay: "ffmpeg/bin/ffplay"}, {FFmpeg: "ffmpeg", FFprobe: "ffprobe", FFplay: "ffplay"}}
|
||||
}
|
||||
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)
|
||||
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
|
||||
}
|
||||
_ = os.Remove("ffmpeg/ffmpeg.tar.xz")
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "testFF",
|
||||
})
|
||||
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 = h.saveSettingFFPath(
|
||||
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffmpeg",
|
||||
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffprobe",
|
||||
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffplay",
|
||||
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
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "completedQueue",
|
||||
})
|
||||
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
|
||||
@ -229,12 +234,3 @@ func unTarXz(fileTar string, directory string, progressBar *widget.ProgressBar)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isDirectory(path string) bool {
|
||||
fileInfo, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fileInfo.IsDir()
|
||||
}
|
@ -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,60 +18,50 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getPathsToFF() []kernel.FFPathUtilities {
|
||||
return []kernel.FFPathUtilities{{FFmpeg: "ffmpeg\\bin\\ffmpeg.exe", FFprobe: "ffmpeg\\bin\\ffprobe.exe", FFplay: "ffmpeg\\bin\\ffplay.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)
|
||||
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
|
||||
}
|
||||
_ = os.Remove("ffmpeg/ffmpeg.zip")
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "testFF",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("unzipRun")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
err = h.saveSettingFFPath(
|
||||
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe",
|
||||
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffprobe.exe",
|
||||
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffplay.exe",
|
||||
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
|
||||
}
|
||||
|
||||
progressMessage.Text = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "completedQueue",
|
||||
})
|
||||
fyne.Do(func() {
|
||||
progressMessage.Text = lang.L("completedQueue")
|
||||
progressMessage.Refresh()
|
||||
})
|
||||
|
||||
@ -183,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)
|
||||
}
|
21
internal/ffmpeg/encoder/mpeg1video/encoder.go
Normal file
21
internal/ffmpeg/encoder/mpeg1video/encoder.go
Normal file
@ -0,0 +1,21 @@
|
||||
package mpeg1video
|
||||
|
||||
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", "mpeg1video"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mpeg1video", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mpeg1video"
|
||||
formats := []string{"mpg", "mpeg"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/mpeg2video/encoder.go
Normal file
21
internal/ffmpeg/encoder/mpeg2video/encoder.go
Normal file
@ -0,0 +1,21 @@
|
||||
package mpeg2video
|
||||
|
||||
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", "mpeg2video"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mpeg2video", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mpeg2video"
|
||||
formats := []string{"mpg", "mpeg"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
21
internal/ffmpeg/encoder/mpeg4/encoder.go
Normal file
21
internal/ffmpeg/encoder/mpeg4/encoder.go
Normal file
@ -0,0 +1,21 @@
|
||||
package mpeg4
|
||||
|
||||
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", "mpeg4"}
|
||||
}
|
||||
|
||||
return encoder.NewEncoder("mpeg4", parameters, getParams)
|
||||
}
|
||||
|
||||
func NewData() encoder.EncoderDataContract {
|
||||
title := "mpeg4"
|
||||
formats := []string{"avi"}
|
||||
fileType := encoder.FileType(encoder.Video)
|
||||
return encoder.NewData(title, formats, fileType, NewEncoder)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user