mirror of
https://github.com/coalaura/ffwebp.git
synced 2025-09-08 13:59:54 +00:00
fixes and cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -10,22 +11,53 @@ import (
|
|||||||
"github.com/coalaura/ffwebp/internal/logx"
|
"github.com/coalaura/ffwebp/internal/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func banner() {
|
func codecList() []string {
|
||||||
codecs := codec.All()
|
codecs := codec.All()
|
||||||
|
|
||||||
names := make([]string, len(codecs))
|
names := make([]string, len(codecs))
|
||||||
|
|
||||||
for i, c := range codecs {
|
for i, c := range codecs {
|
||||||
names[i] = c.String()
|
names[i] = c.String()
|
||||||
|
|
||||||
|
if !c.CanEncode() {
|
||||||
|
names[i] += "*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Strings(names)
|
sort.Strings(names)
|
||||||
|
|
||||||
|
return names
|
||||||
|
}
|
||||||
|
|
||||||
|
func tags() string {
|
||||||
|
var (
|
||||||
|
codec = "none"
|
||||||
|
feature = "none"
|
||||||
|
)
|
||||||
|
|
||||||
if effects.HasEffects() {
|
if effects.HasEffects() {
|
||||||
names = append(names, "effects")
|
feature = "effects"
|
||||||
}
|
}
|
||||||
|
|
||||||
build := strings.Join(names, ",")
|
codecs := codecList()
|
||||||
|
|
||||||
|
if len(codecs) > 0 {
|
||||||
|
codec = strings.Join(codecs, " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("[codecs: %s] [features: %s]", codec, feature)
|
||||||
|
}
|
||||||
|
|
||||||
|
func banner() {
|
||||||
|
tags := codecList()
|
||||||
|
|
||||||
|
if effects.HasEffects() {
|
||||||
|
tags = append(tags, "effects")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(tags) == 0 {
|
||||||
|
tags = []string{"none"}
|
||||||
|
}
|
||||||
|
|
||||||
logx.Printf("ffwebp version %s\n", Version)
|
logx.Printf("ffwebp version %s\n", Version)
|
||||||
logx.Printf(
|
logx.Printf(
|
||||||
@@ -34,8 +66,5 @@ func banner() {
|
|||||||
runtime.Version(),
|
runtime.Version(),
|
||||||
runtime.GOARCH,
|
runtime.GOARCH,
|
||||||
)
|
)
|
||||||
logx.Printf(
|
logx.Printf(" %s\n", strings.Join(tags, ","))
|
||||||
" configuration: -tags %s\n",
|
|
||||||
build,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,7 @@ func main() {
|
|||||||
app := &cli.Command{
|
app := &cli.Command{
|
||||||
Name: "ffwebp",
|
Name: "ffwebp",
|
||||||
Usage: "Convert any image format into any other image format",
|
Usage: "Convert any image format into any other image format",
|
||||||
Version: Version,
|
Version: fmt.Sprintf("%s %s", Version, tags()),
|
||||||
Flags: flags,
|
Flags: flags,
|
||||||
Action: run,
|
Action: run,
|
||||||
Writer: os.Stderr,
|
Writer: os.Stderr,
|
||||||
|
@@ -87,8 +87,6 @@ func Sniff(reader io.Reader, input, force string, ignoreExtension bool) (*Sniffe
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(codec.String(), confidence)
|
|
||||||
|
|
||||||
if confidence <= 0 {
|
if confidence <= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user