diff --git a/go.mod b/go.mod index b9b6ca1..7f3c035 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,6 @@ require ( github.com/Masterminds/sprig/v3 v3.2.3 github.com/PuerkitoBio/goquery v1.9.1 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect - github.com/gen2brain/go-fitz v1.23.7 github.com/hullerob/go.farbfeld v0.0.0-20181222022525-3661193c725f github.com/jbuchbinder/gopnm v0.0.0-20220507095634-e31f54490ce0 github.com/k3a/html2text v1.2.1 diff --git a/go.sum b/go.sum index cc9899a..2fadafb 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/gen2brain/go-fitz v1.23.7 h1:HPhzEVzmOINvCKqQgB/DwMzYh4ArIgy3tMwq1eJTcbg= -github.com/gen2brain/go-fitz v1.23.7/go.mod h1:HU04vc+RisUh/kvEd2pB0LAxmK1oyXdN4ftyshUr9rQ= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= diff --git a/media.go b/media.go index 06a9684..dbc9feb 100644 --- a/media.go +++ b/media.go @@ -31,7 +31,7 @@ import ( "strings" "github.com/gabriel-vasile/mimetype" - "github.com/gen2brain/go-fitz" + // "github.com/gen2brain/go-fitz" // FIXME requires cgo, which goreleaser has a hard time with "github.com/lafriks/go-svg" "github.com/metal3d/go-slugify" recurcopy "github.com/plus3it/gorecurcopy" @@ -292,6 +292,8 @@ func AnalyzeAudio(file *os.File) uint { // AnalyzePDF returns an ImageDimensions struct for the first page of the PDF file at filename. It also returns the number of pages. func AnalyzePDF(filename string) (dimensions ImageDimensions, pagesCount uint, err error) { + return ImageDimensions{}, 0, errors.New("PDF analysis is disabled") + /* fitz requires cgo, which goreleaser has a hard time with. document, err := fitz.New(filename) if err != nil { return dimensions, pagesCount, fmt.Errorf("while opening PDF: %w", err) @@ -312,6 +314,7 @@ func AnalyzePDF(filename string) (dimensions ImageDimensions, pagesCount uint, e Height: int(height), AspectRatio: float32(width) / float32(height), }, uint(document.NumPage()), nil + */ } // AnalyzeVideo returns an ImageDimensions struct with the video's height, width and aspect ratio and a duration in seconds. diff --git a/utils.go b/utils.go index c3247d7..ce72675 100644 --- a/utils.go +++ b/utils.go @@ -240,3 +240,7 @@ func ensureHttpPrefix(url string) string { func debugging() bool { return os.Getenv("DEBUG") == "1" || os.Getenv("ORTFO_DEBUG") == "1" || os.Getenv("ORTFODB_DEBUG") == "1" } + +func cgoEnabled() bool { + return os.Getenv("CGO_ENABLED") == "1" +}