new package: goanime
This commit is contained in:
1 parent
e28c1e52a1
commit
c7e055de55
31 files changed
+141
No files matched your search
@@ -0,0 +1,22 @@
|
||||
--- a/cmd/goanime/main.go
|
||||
+++ b/cmd/goanime/main.go
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/alvarorichard/Goanime/v2/internal/player"
|
||||
"github.com/alvarorichard/Goanime/v2/internal/scraper/cfsolver"
|
||||
"github.com/alvarorichard/Goanime/v2/internal/tui"
|
||||
- "github.com/alvarorichard/Goanime/v2/internal/updater"
|
||||
"github.com/alvarorichard/Goanime/v2/internal/util"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
@@ -49,11 +48,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
- // Finish housekeeping from a previous --update: remove the backup and
|
||||
- // staged files only after this binary has started and its digest matches
|
||||
- // the one recorded by the updater. No marker means nothing to clean up.
|
||||
- updater.CleanupAfterUpdate()
|
||||
-
|
||||
// The sources the user switched on or off in the SOURCES screen. A file
|
||||
// that cannot be read is reported and ignored: sources keep their defaults.
|
||||
if err := util.LoadSavedSourcePrefs(); err != nil {
|
||||
@@ -0,0 +1,97 @@
|
||||
--- a/internal/handlers/request_flow_test.go
|
||||
+++ b/internal/handlers/request_flow_test.go
|
||||
@@ -1,19 +1,15 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
- "encoding/json"
|
||||
"errors"
|
||||
"image"
|
||||
"image/png"
|
||||
- "net/http"
|
||||
- "net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/alvarorichard/Goanime/v2/internal/models"
|
||||
- "github.com/alvarorichard/Goanime/v2/internal/updater"
|
||||
"github.com/alvarorichard/Goanime/v2/internal/upscaler"
|
||||
"github.com/alvarorichard/Goanime/v2/internal/util"
|
||||
"github.com/ktr0731/go-fuzzyfinder"
|
||||
@@ -326,24 +322,11 @@ func TestHandlePlaybackMode_SymbolPin(t *testing.T) {
|
||||
|
||||
// --- HandleUpdateRequest ---
|
||||
|
||||
-func TestHandleUpdateRequest_DoesNotPanic(t *testing.T) {
|
||||
- if runtime.GOOS == "windows" {
|
||||
- // HandleUpdateRequest → updater.CheckAndPromptUpdate may open the huh
|
||||
- // confirm form when GitHub has a newer release. The form blocks on TTY
|
||||
- // on Windows CI. Skip there.
|
||||
- t.Skip("huh form blocks on Windows CI without TTY")
|
||||
- }
|
||||
- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
- _ = json.NewEncoder(w).Encode(updater.GitHubRelease{TagName: "v0.0.0"})
|
||||
- }))
|
||||
- t.Cleanup(srv.Close)
|
||||
- // Cannot override updater.releaseAPIURL from outside its package; just
|
||||
- // ensure the wrapper doesn't panic and either succeeds or returns wrapped
|
||||
- // error from the underlying network call.
|
||||
+func TestHandleUpdateRequest_Disabled(t *testing.T) {
|
||||
err := HandleUpdateRequest()
|
||||
- if err != nil {
|
||||
- assert.Contains(t, err.Error(), "update failed")
|
||||
- }
|
||||
+ require.Error(t, err)
|
||||
+ assert.Contains(t, err.Error(), "self-updating is disabled")
|
||||
+ assert.Contains(t, err.Error(), "package manager")
|
||||
}
|
||||
|
||||
// --- HandleUpscaleRequest, handleImageUpscale, handleVideoUpscale ---
|
||||
diff --git a/internal/handlers/update.go b/internal/handlers/update.go
|
||||
index 6b24f0b..7e52f10 100644
|
||||
--- a/internal/handlers/update.go
|
||||
+++ b/internal/handlers/update.go
|
||||
@@ -2,18 +2,9 @@ package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
-
|
||||
- "github.com/alvarorichard/Goanime/v2/internal/updater"
|
||||
- "github.com/alvarorichard/Goanime/v2/internal/util"
|
||||
)
|
||||
|
||||
// HandleUpdateRequest processes update requests
|
||||
func HandleUpdateRequest() error {
|
||||
- // Initialize logger for update process
|
||||
- util.InitLogger()
|
||||
- util.Info("Checking for updates...")
|
||||
- if updateErr := updater.CheckAndPromptUpdate(); updateErr != nil {
|
||||
- return fmt.Errorf("update failed: %w", updateErr)
|
||||
- }
|
||||
- return nil
|
||||
+ return fmt.Errorf("self-updating is disabled in this package; update GoAnime with your package manager")
|
||||
}
|
||||
diff --git a/internal/util/help.go b/internal/util/help.go
|
||||
index 7961bfb..1b34428 100644
|
||||
--- a/internal/util/help.go
|
||||
+++ b/internal/util/help.go
|
||||
@@ -107,7 +107,7 @@ func ShowBeautifulHelp() {
|
||||
addOption(&helpContent, "--perf", "Enable performance profiling - shows timing metrics for all operations.")
|
||||
addOption(&helpContent, "--help / -h", "Display this beautiful help message with detailed usage information.")
|
||||
addOption(&helpContent, "--version", "Show version information and build details.")
|
||||
- addOption(&helpContent, "--update", "Check for updates and update automatically to the latest version.")
|
||||
+ addOption(&helpContent, "--update", "Self-updating is disabled; use your package manager to update GoAnime.")
|
||||
addOption(&helpContent, "-d", "Download mode - download specific episodes for offline viewing.")
|
||||
addOption(&helpContent, "-r", "Range download mode - download multiple episodes (use with -d or -dm).")
|
||||
addOption(&helpContent, "-a", "Download ALL episodes/seasons. Use with -d (anime) or -dm (TV/series/dorama).")
|
||||
@@ -168,7 +168,7 @@ func ShowBeautifulHelp() {
|
||||
addExample(&helpContent, "goanime", "Start interactive mode")
|
||||
addExample(&helpContent, "goanime \"attack on titan\"", "Search directly for Attack on Titan")
|
||||
addExample(&helpContent, "goanime --debug \"naruto\"", "Search with debug information")
|
||||
- addExample(&helpContent, "goanime --update", "Check for updates and update automatically")
|
||||
+ addExample(&helpContent, "goanime --update", "Show package-manager update guidance")
|
||||
addExample(&helpContent, "goanime --version", "Show version information")
|
||||
addExample(&helpContent, "goanime -d \"one piece\" 1", "Download episode 1 of One Piece")
|
||||
addExample(&helpContent, "goanime -d -r \"naruto\" 1-5", "Download episodes 1-5 of Naruto")
|
||||
@@ -0,0 +1,20 @@
|
||||
# Template file for 'goanime'
|
||||
pkgname=goanime
|
||||
version=2.0.4
|
||||
revision=1
|
||||
build_style=go
|
||||
go_import_path="github.com/alvarorichard/Goanime/v2"
|
||||
go_package="github.com/alvarorichard/Goanime/v2/cmd/goanime"
|
||||
hostmakedepends="go gcc"
|
||||
depends="mpv"
|
||||
short_desc="Terminal application to stream and download anime and movies"
|
||||
maintainer="Juan Rojas <juandmcr@protonmail.com>"
|
||||
license="MIT"
|
||||
homepage="https://github.com/alvarorichard/GoAnime"
|
||||
distfiles="https://github.com/alvarorichard/GoAnime/archive/refs/tags/v${version}.tar.gz"
|
||||
checksum=f4ce3f93bf429144165d338117304829a689eeca8dbfff893e3c9bf8c6b3256b
|
||||
make_check=no # Tests take too long (10m+ and panic exit because of timeout so tbh if the package works I won't run the tests bc I don't have time to waste and this is an unofficial repo anyways, I might fix this in the future tho)
|
||||
|
||||
do_install() {
|
||||
vlicense LICENSE
|
||||
}
|
||||
Reference in new issue
Block a user