From adecf1fd2e55a0605d03f36952846f6336506d37 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 30 Apr 2026 10:45:30 +0300 Subject: Rename module to codeberg.org/snonux/play (task aa) - Update go.mod module path - Replace all internal imports from github.com/paul/kiss-media-player to codeberg.org/snonux/play - Run go mod tidy and gofmt -w . --- cmd/mediaplayer/main.go | 12 +- go.mod | 2 +- internal/api/handlers.go | 6 +- internal/api/handlers_more_test.go | 228 ++++++++++++++-------------- internal/api/handlers_test.go | 36 ++--- internal/api/middleware.go | 6 +- internal/api/server.go | 8 +- internal/auth/auth_test.go | 6 +- internal/auth/session.go | 6 +- internal/probe/probe.go | 2 +- internal/probe/probe_test.go | 6 +- internal/repository/favorite.go | 2 +- internal/repository/media.go | 2 +- internal/repository/mock.go | 2 +- internal/repository/note.go | 2 +- internal/repository/playback_accumulator.go | 2 +- internal/repository/playback_progress.go | 2 +- internal/repository/repository.go | 2 +- internal/repository/session.go | 2 +- internal/repository/set.go | 2 +- internal/repository/set_permission.go | 2 +- internal/repository/share.go | 2 +- internal/repository/sqlite_test.go | 8 +- internal/repository/tag.go | 2 +- internal/repository/user.go | 3 +- internal/scanner/fs.go | 2 +- internal/scanner/scanner.go | 10 +- internal/scanner/scanner_test.go | 28 ++-- internal/service/admin.go | 8 +- internal/service/admin_test.go | 4 +- internal/service/gc.go | 4 +- internal/service/gc_test.go | 6 +- internal/service/media.go | 6 +- internal/service/media_test.go | 6 +- internal/service/mock.go | 48 +++--- internal/service/no_rows_test.go | 4 +- internal/service/progress.go | 6 +- internal/service/progress_test.go | 30 ++-- internal/service/service.go | 4 +- 39 files changed, 260 insertions(+), 259 deletions(-) diff --git a/cmd/mediaplayer/main.go b/cmd/mediaplayer/main.go index d064274..fcc83e7 100644 --- a/cmd/mediaplayer/main.go +++ b/cmd/mediaplayer/main.go @@ -11,12 +11,12 @@ import ( "syscall" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/api" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/api" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) func main() { diff --git a/go.mod b/go.mod index 597d57c..28dfa4a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/paul/kiss-media-player +module codeberg.org/snonux/play go 1.25.0 diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 8bd8238..fc1d43d 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -14,9 +14,9 @@ import ( "strings" "time" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) type bootstrapRequest struct { diff --git a/internal/api/handlers_more_test.go b/internal/api/handlers_more_test.go index d6e93a8..e7eb99a 100644 --- a/internal/api/handlers_more_test.go +++ b/internal/api/handlers_more_test.go @@ -15,12 +15,12 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) // ------------------------------------------------------------------ @@ -239,7 +239,7 @@ func TestServer_Bootstrap_hashError(t *testing.T) { func TestServer_Bootstrap_createUserError(t *testing.T) { store := &repository.MockStore{ UserRepo: repository.MockUserRepo{ - CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, + CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, CreateUserFunc: func(ctx context.Context, user *model.User) (int64, error) { return 0, errors.New("boom") }, }, } @@ -258,7 +258,7 @@ func TestServer_Bootstrap_createUserError(t *testing.T) { func TestServer_Bootstrap_createSessionError(t *testing.T) { store := &repository.MockStore{ UserRepo: repository.MockUserRepo{ - CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, + CountUsersFunc: func(ctx context.Context) (int, error) { return 0, nil }, CreateUserFunc: func(ctx context.Context, user *model.User) (int64, error) { return 1, nil }, }, } @@ -325,10 +325,10 @@ func TestServer_SetCover(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -402,11 +402,11 @@ func TestServer_Upload(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24, MaxUploadSizeMB: 10} tests := []struct { - name string - id string - svcNil bool - svcErr error - noFile bool + name string + id string + svcNil bool + svcErr error + noFile bool wantCode int }{ {"nil service", "1", true, nil, false, http.StatusNotImplemented}, @@ -471,10 +471,10 @@ func TestServer_Favorite_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -525,11 +525,11 @@ func TestServer_RemoveTag_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - tag string - svcNil bool - svcErr error + name string + id string + tag string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", "t", true, nil, http.StatusNotImplemented}, @@ -570,11 +570,11 @@ func TestServer_Stream(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "1", true, nil, nil, http.StatusNotImplemented}, @@ -614,11 +614,11 @@ func TestServer_Download(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int wantDisp bool }{ @@ -665,11 +665,11 @@ func TestServer_Thumbnail(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error - res *service.FileResult + name string + id string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "1", true, nil, nil, http.StatusNotImplemented}, @@ -708,10 +708,10 @@ func TestServer_RegenThumbnail(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -752,10 +752,10 @@ func TestServer_CreateShare_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24, ShareDefaultExpiryDays: 14} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -791,10 +791,10 @@ func TestServer_ListShares_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -830,10 +830,10 @@ func TestServer_RevokeShare(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error + name string + token string + svcNil bool + svcErr error wantCode int }{ {"nil service", "abc", true, nil, http.StatusNotImplemented}, @@ -867,11 +867,11 @@ func TestServer_SharePage(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error - share *model.Share + name string + token string + svcNil bool + svcErr error + share *model.Share wantCode int }{ {"nil service", "abc", true, nil, nil, http.StatusNotImplemented}, @@ -906,11 +906,11 @@ func TestServer_ShareStream(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - token string - svcNil bool - svcErr error - res *service.FileResult + name string + token string + svcNil bool + svcErr error + res *service.FileResult wantCode int }{ {"nil service", "abc", true, nil, nil, http.StatusNotImplemented}, @@ -951,10 +951,10 @@ func TestServer_SoftDelete_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -991,10 +991,10 @@ func TestServer_Restore_negative(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -1035,11 +1035,11 @@ func TestServer_UpsertNote(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - body string - svcNil bool - svcErr error + name string + id string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", `{"content":"hi"}`, true, nil, http.StatusNotImplemented}, @@ -1078,10 +1078,10 @@ func TestServer_DeleteNote(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "1", true, nil, http.StatusNotImplemented}, @@ -1167,9 +1167,9 @@ func TestServer_AdminRescan(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1203,9 +1203,9 @@ func TestServer_AdminListTrash(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1239,9 +1239,9 @@ func TestServer_AdminListUsers(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1275,10 +1275,10 @@ func TestServer_AdminCreateUser(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"username":"bob","password":"pass","is_admin":false}`, true, nil, http.StatusNotImplemented}, @@ -1317,10 +1317,10 @@ func TestServer_AdminDeleteUser(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - id string - svcNil bool - svcErr error + name string + id string + svcNil bool + svcErr error wantCode int }{ {"nil service", "2", true, nil, http.StatusNotImplemented}, @@ -1355,9 +1355,9 @@ func TestServer_AdminListPermissions(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - svcNil bool - svcErr error + name string + svcNil bool + svcErr error wantCode int }{ {"nil service", true, nil, http.StatusNotImplemented}, @@ -1391,10 +1391,10 @@ func TestServer_AdminGrantPermission(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"set_id":1,"user_id":2,"role":"viewer"}`, true, nil, http.StatusNotImplemented}, @@ -1430,10 +1430,10 @@ func TestServer_AdminRevokePermission(t *testing.T) { cfg := &internal.Config{SessionTimeoutHours: 24} tests := []struct { - name string - body string - svcNil bool - svcErr error + name string + body string + svcNil bool + svcErr error wantCode int }{ {"nil service", `{"set_id":1,"user_id":2}`, true, nil, http.StatusNotImplemented}, @@ -1469,8 +1469,8 @@ func TestServer_AdminRevokePermission(t *testing.T) { type errHasher struct{} -func (e *errHasher) Hash(password string) (string, error) { return "", errors.New("hash err") } -func (e *errHasher) Compare(hash, password string) error { return errors.New("compare err") } +func (e *errHasher) Hash(password string) (string, error) { return "", errors.New("hash err") } +func (e *errHasher) Compare(hash, password string) error { return errors.New("compare err") } // ------------------------------------------------------------------ // parseMediaListQuery diff --git a/internal/api/handlers_test.go b/internal/api/handlers_test.go index 91d30fe..c853140 100644 --- a/internal/api/handlers_test.go +++ b/internal/api/handlers_test.go @@ -13,12 +13,12 @@ import ( "testing/fstest" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) type memFS struct { @@ -297,7 +297,7 @@ type staticHasher struct { fixed string } -func (h *staticHasher) Hash(password string) (string, error) { return h.fixed, nil } +func (h *staticHasher) Hash(password string) (string, error) { return h.fixed, nil } func (h *staticHasher) Compare(hash, password string) error { if hash == h.fixed && password == "correct" { return nil @@ -570,14 +570,14 @@ func TestServer_MediaList(t *testing.T) { wantCode: http.StatusOK, }, { - name: "service error", - listErr: errors.New("boom"), + name: "service error", + listErr: errors.New("boom"), wantCode: http.StatusInternalServerError, }, { - name: "with query params", - query: "?set_id=1&type=video&search=foo&tags=bar,baz&favorites=2&min_duration=10&max_duration=100&sort=name&limit=5&offset=10", - filter: repository.MediaFilter{SetID: intPtr(1), Type: (*model.MediaType)(func() *string { s := "video"; return &s }()), Search: "foo", Tags: []string{"bar", "baz"}, Favorites: intPtr(2), MinDuration: floatPtr(10), MaxDuration: floatPtr(100), Sort: "name", Limit: 5, Offset: 10}, + name: "with query params", + query: "?set_id=1&type=video&search=foo&tags=bar,baz&favorites=2&min_duration=10&max_duration=100&sort=name&limit=5&offset=10", + filter: repository.MediaFilter{SetID: intPtr(1), Type: (*model.MediaType)(func() *string { s := "video"; return &s }()), Search: "foo", Tags: []string{"bar", "baz"}, Favorites: intPtr(2), MinDuration: floatPtr(10), MaxDuration: floatPtr(100), Sort: "name", Limit: 5, Offset: 10}, listResult: []model.Media{}, wantCode: http.StatusOK, }, @@ -613,12 +613,12 @@ func TestServer_MediaList(t *testing.T) { func TestServer_MediaDetail(t *testing.T) { tests := []struct { - name string - id string - result *service.MediaDetail - err error - wantCode int - wantMedia bool + name string + id string + result *service.MediaDetail + err error + wantCode int + wantMedia bool }{ {"ok", "42", &service.MediaDetail{Media: &model.Media{ID: 42, FileName: "a.mp4"}}, nil, http.StatusOK, true}, {"invalid id", "abc", nil, nil, http.StatusBadRequest, false}, diff --git a/internal/api/middleware.go b/internal/api/middleware.go index 5b99cc7..ee1d6c9 100644 --- a/internal/api/middleware.go +++ b/internal/api/middleware.go @@ -5,9 +5,9 @@ import ( "net/http" "strings" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) type ctxKey int diff --git a/internal/api/server.go b/internal/api/server.go index 897add1..370313c 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -6,10 +6,10 @@ import ( "strconv" "time" - "github.com/paul/kiss-media-player/internal" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/service" + "codeberg.org/snonux/play/internal" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/service" ) // Server holds HTTP handlers and dependencies. diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index 14b92ed..ce1ab8f 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func TestBCryptHasher_HashAndCompare(t *testing.T) { diff --git a/internal/auth/session.go b/internal/auth/session.go index 2b5be2a..2b9cea7 100644 --- a/internal/auth/session.go +++ b/internal/auth/session.go @@ -7,9 +7,9 @@ import ( "fmt" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // SessionManager handles session lifecycle. diff --git a/internal/probe/probe.go b/internal/probe/probe.go index 7f5b887..5a081d2 100644 --- a/internal/probe/probe.go +++ b/internal/probe/probe.go @@ -8,7 +8,7 @@ import ( "os/exec" "strconv" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // Prober extracts metadata from a media file. diff --git a/internal/probe/probe_test.go b/internal/probe/probe_test.go index 9c05846..077c88c 100644 --- a/internal/probe/probe_test.go +++ b/internal/probe/probe_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) func TestParseFFprobeOutput(t *testing.T) { @@ -61,9 +61,9 @@ func TestParseFFprobeOutput(t *testing.T) { want: &model.Metadata{Codec: "vp9"}, }, { - name: "no format or streams", + name: "no format or streams", input: `{"format":{},"streams":[]}`, - want: &model.Metadata{}, + want: &model.Metadata{}, }, } diff --git a/internal/repository/favorite.go b/internal/repository/favorite.go index 4d3e0f5..3f1774d 100644 --- a/internal/repository/favorite.go +++ b/internal/repository/favorite.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // ToggleFavorite inserts or deletes a favorite row, returning whether it is now favorited. diff --git a/internal/repository/media.go b/internal/repository/media.go index 3e79d5e..26d69ca 100644 --- a/internal/repository/media.go +++ b/internal/repository/media.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateMedia inserts a new media and returns the generated ID. diff --git a/internal/repository/mock.go b/internal/repository/mock.go index 5959586..849ba9b 100644 --- a/internal/repository/mock.go +++ b/internal/repository/mock.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // compile-time checks. diff --git a/internal/repository/note.go b/internal/repository/note.go index 0b33212..0ae012f 100644 --- a/internal/repository/note.go +++ b/internal/repository/note.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertNote inserts or replaces a note for a user and media. diff --git a/internal/repository/playback_accumulator.go b/internal/repository/playback_accumulator.go index 51b4aa8..ea84086 100644 --- a/internal/repository/playback_accumulator.go +++ b/internal/repository/playback_accumulator.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertAccumulator inserts or replaces a playback accumulator. diff --git a/internal/repository/playback_progress.go b/internal/repository/playback_progress.go index 1d05dcd..63ac129 100644 --- a/internal/repository/playback_progress.go +++ b/internal/repository/playback_progress.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // UpsertProgress inserts or replaces playback progress. diff --git a/internal/repository/repository.go b/internal/repository/repository.go index b93484c..3de011c 100644 --- a/internal/repository/repository.go +++ b/internal/repository/repository.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // Store is the composite interface for all repositories. diff --git a/internal/repository/session.go b/internal/repository/session.go index df24ed0..b1aa7df 100644 --- a/internal/repository/session.go +++ b/internal/repository/session.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateSession inserts a new session. diff --git a/internal/repository/set.go b/internal/repository/set.go index 4f06d30..50e82f0 100644 --- a/internal/repository/set.go +++ b/internal/repository/set.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateSet inserts a new set and returns the generated ID. diff --git a/internal/repository/set_permission.go b/internal/repository/set_permission.go index 26db9fa..9820bbd 100644 --- a/internal/repository/set_permission.go +++ b/internal/repository/set_permission.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // GrantPermission inserts or replaces a set permission. diff --git a/internal/repository/share.go b/internal/repository/share.go index a7c0b8d..cf30373 100644 --- a/internal/repository/share.go +++ b/internal/repository/share.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateShare inserts a new share link. diff --git a/internal/repository/sqlite_test.go b/internal/repository/sqlite_test.go index 1aeb23a..0d5e797 100644 --- a/internal/repository/sqlite_test.go +++ b/internal/repository/sqlite_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) func newTestStore(t *testing.T) *SQLite { @@ -326,9 +326,9 @@ func TestSQLite_MediaRepo(t *testing.T) { {"ab_c", []int64{m1}}, {"de%f", []int64{m2}}, {"gh\\ij", []int64{m3}}, - {"_", []int64{m1}}, // literal underscore must match only ab_c.mp4 - {"%", []int64{m2}}, // literal percent must match only de%f.mp4 - {"\\", []int64{m3}}, // literal backslash must match only gh\ij.mp4 + {"_", []int64{m1}}, // literal underscore must match only ab_c.mp4 + {"%", []int64{m2}}, // literal percent must match only de%f.mp4 + {"\\", []int64{m3}}, // literal backslash must match only gh\ij.mp4 } { res, err := s.ListMedia(ctx, MediaFilter{Search: tc.search}) if err != nil { diff --git a/internal/repository/tag.go b/internal/repository/tag.go index a1ce483..0511c70 100644 --- a/internal/repository/tag.go +++ b/internal/repository/tag.go @@ -5,7 +5,7 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) // CreateTag inserts a tag and returns the generated ID. diff --git a/internal/repository/user.go b/internal/repository/user.go index 073f61d..398c46a 100644 --- a/internal/repository/user.go +++ b/internal/repository/user.go @@ -5,10 +5,9 @@ import ( "database/sql" "fmt" - "github.com/paul/kiss-media-player/internal/model" + "codeberg.org/snonux/play/internal/model" ) - // CreateUser inserts a new user and returns the generated ID. func (s *SQLite) CreateUser(ctx context.Context, user *model.User) (int64, error) { res, err := s.db.ExecContext(ctx, diff --git a/internal/scanner/fs.go b/internal/scanner/fs.go index 8616fde..c4299c5 100644 --- a/internal/scanner/fs.go +++ b/internal/scanner/fs.go @@ -19,7 +19,7 @@ type FS interface { type osFS struct{} func (osFS) ReadDir(name string) ([]os.DirEntry, error) { return os.ReadDir(name) } -func (osFS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) } +func (osFS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) } func (osFS) MkdirAll(path string, perm os.FileMode) error { return os.MkdirAll(path, perm) } diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index ec7638e..a1effd7 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -8,11 +8,11 @@ import ( "path/filepath" "strings" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/probe" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/thumb" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/probe" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/thumb" ) // Scanner defines the filesystem scanning contract. diff --git a/internal/scanner/scanner_test.go b/internal/scanner/scanner_test.go index b924c85..8da32a4 100644 --- a/internal/scanner/scanner_test.go +++ b/internal/scanner/scanner_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/probe" - "github.com/paul/kiss-media-player/internal/repository" - "github.com/paul/kiss-media-player/internal/thumb" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/probe" + "codeberg.org/snonux/play/internal/repository" + "codeberg.org/snonux/play/internal/thumb" ) // mockDirEntry implements os.DirEntry for tests. @@ -23,10 +23,12 @@ type mockDirEntry struct { isDir bool } -func (m mockDirEntry) Name() string { return m.name } -func (m mockDirEntry) IsDir() bool { return m.isDir } -func (m mockDirEntry) Type() os.FileMode { return 0 } -func (m mockDirEntry) Info() (os.FileInfo, error) { return mockFileInfo{name: m.name, isDir: m.isDir}, nil } +func (m mockDirEntry) Name() string { return m.name } +func (m mockDirEntry) IsDir() bool { return m.isDir } +func (m mockDirEntry) Type() os.FileMode { return 0 } +func (m mockDirEntry) Info() (os.FileInfo, error) { + return mockFileInfo{name: m.name, isDir: m.isDir}, nil +} // mockFileInfo implements os.FileInfo for tests. type mockFileInfo struct { @@ -38,11 +40,11 @@ type mockFileInfo struct { } func (m mockFileInfo) Name() string { return m.name } -func (m mockFileInfo) Size() int64 { return m.size } -func (m mockFileInfo) Mode() os.FileMode { return m.mode } +func (m mockFileInfo) Size() int64 { return m.size } +func (m mockFileInfo) Mode() os.FileMode { return m.mode } func (m mockFileInfo) ModTime() time.Time { return m.modTime } -func (m mockFileInfo) IsDir() bool { return m.isDir } -func (m mockFileInfo) Sys() interface{} { return nil } +func (m mockFileInfo) IsDir() bool { return m.isDir } +func (m mockFileInfo) Sys() interface{} { return nil } // walkEntry describes a single path yielded by mockFS.WalkDir. type walkEntry struct { diff --git a/internal/service/admin.go b/internal/service/admin.go index 9b443cb..853ee68 100644 --- a/internal/service/admin.go +++ b/internal/service/admin.go @@ -4,10 +4,10 @@ import ( "context" "fmt" - "github.com/paul/kiss-media-player/internal/auth" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/auth" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // adminService is the concrete implementation of AdminService. diff --git a/internal/service/admin_test.go b/internal/service/admin_test.go index 69a2f7b..c24c82c 100644 --- a/internal/service/admin_test.go +++ b/internal/service/admin_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) type fakeHasher struct { diff --git a/internal/service/gc.go b/internal/service/gc.go index 2cb6a2d..eeba9b2 100644 --- a/internal/service/gc.go +++ b/internal/service/gc.go @@ -9,8 +9,8 @@ import ( "sync" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/repository" ) // GCWorker is a background worker that hard-deletes soft-deleted media older than a threshold. diff --git a/internal/service/gc_test.go b/internal/service/gc_test.go index 84402cc..381cfd4 100644 --- a/internal/service/gc_test.go +++ b/internal/service/gc_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func TestGCWorker_RunOnce(t *testing.T) { diff --git a/internal/service/media.go b/internal/service/media.go index f25c4c1..5cb7772 100644 --- a/internal/service/media.go +++ b/internal/service/media.go @@ -12,9 +12,9 @@ import ( "strings" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // mediaService is the concrete implementation of MediaService. diff --git a/internal/service/media_test.go b/internal/service/media_test.go index 1619e15..937e0ea 100644 --- a/internal/service/media_test.go +++ b/internal/service/media_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func newMockClock() *clock.MockClock { diff --git a/internal/service/mock.go b/internal/service/mock.go index 07786bc..73a4755 100644 --- a/internal/service/mock.go +++ b/internal/service/mock.go @@ -6,34 +6,34 @@ import ( "io" "time" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // MockMediaService is a fake MediaService for testing. type MockMediaService struct { - ListSetsFunc func(ctx context.Context, userID int64) ([]model.Set, error) - GetMediaDetailFunc func(ctx context.Context, mediaID, userID int64) (*MediaDetail, error) - ListMediaFunc func(ctx context.Context, filter repository.MediaFilter) ([]model.Media, error) - StreamMediaFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) - DownloadMediaFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) - GetThumbnailFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) - RegenerateThumbnailFunc func(ctx context.Context, mediaID, userID int64) error - RegenerateSetCoverFunc func(ctx context.Context, setID, userID int64) error - ToggleFavoriteFunc func(ctx context.Context, userID, mediaID int64) (bool, error) - AssignTagFunc func(ctx context.Context, mediaID, userID int64, tagName string) error - RemoveTagFunc func(ctx context.Context, mediaID, userID int64, tagName string) error - SoftDeleteMediaFunc func(ctx context.Context, mediaID, userID int64) error - RestoreMediaFunc func(ctx context.Context, mediaID, userID int64) error - UploadMediaFunc func(ctx context.Context, setID, userID int64, filename string, data io.Reader, size int64) (*model.Media, error) - CreateShareFunc func(ctx context.Context, userID, mediaID int64, expiresAt time.Time) (*model.Share, error) - ListSharesFunc func(ctx context.Context, mediaID, userID int64) ([]model.Share, error) - RevokeShareFunc func(ctx context.Context, token string, userID int64) error - ValidateShareTokenFunc func(ctx context.Context, token string) (*model.Share, error) - StreamSharedMediaFunc func(ctx context.Context, token string) (*FileResult, error) - GetNoteFunc func(ctx context.Context, mediaID, userID int64) (*model.Note, error) - UpsertNoteFunc func(ctx context.Context, note *model.Note) error - DeleteNoteFunc func(ctx context.Context, mediaID, userID int64) error + ListSetsFunc func(ctx context.Context, userID int64) ([]model.Set, error) + GetMediaDetailFunc func(ctx context.Context, mediaID, userID int64) (*MediaDetail, error) + ListMediaFunc func(ctx context.Context, filter repository.MediaFilter) ([]model.Media, error) + StreamMediaFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) + DownloadMediaFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) + GetThumbnailFunc func(ctx context.Context, mediaID, userID int64) (*FileResult, error) + RegenerateThumbnailFunc func(ctx context.Context, mediaID, userID int64) error + RegenerateSetCoverFunc func(ctx context.Context, setID, userID int64) error + ToggleFavoriteFunc func(ctx context.Context, userID, mediaID int64) (bool, error) + AssignTagFunc func(ctx context.Context, mediaID, userID int64, tagName string) error + RemoveTagFunc func(ctx context.Context, mediaID, userID int64, tagName string) error + SoftDeleteMediaFunc func(ctx context.Context, mediaID, userID int64) error + RestoreMediaFunc func(ctx context.Context, mediaID, userID int64) error + UploadMediaFunc func(ctx context.Context, setID, userID int64, filename string, data io.Reader, size int64) (*model.Media, error) + CreateShareFunc func(ctx context.Context, userID, mediaID int64, expiresAt time.Time) (*model.Share, error) + ListSharesFunc func(ctx context.Context, mediaID, userID int64) ([]model.Share, error) + RevokeShareFunc func(ctx context.Context, token string, userID int64) error + ValidateShareTokenFunc func(ctx context.Context, token string) (*model.Share, error) + StreamSharedMediaFunc func(ctx context.Context, token string) (*FileResult, error) + GetNoteFunc func(ctx context.Context, mediaID, userID int64) (*model.Note, error) + UpsertNoteFunc func(ctx context.Context, note *model.Note) error + DeleteNoteFunc func(ctx context.Context, mediaID, userID int64) error } func (m *MockMediaService) ListSets(ctx context.Context, userID int64) ([]model.Set, error) { diff --git a/internal/service/no_rows_test.go b/internal/service/no_rows_test.go index 0369db5..4d512e5 100644 --- a/internal/service/no_rows_test.go +++ b/internal/service/no_rows_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func TestService_NoRows_ReturnsNil(t *testing.T) { diff --git a/internal/service/progress.go b/internal/service/progress.go index 7a6bae4..60d9c25 100644 --- a/internal/service/progress.go +++ b/internal/service/progress.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - "github.com/paul/kiss-media-player/internal/clock" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/clock" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // progressService is the concrete implementation of ProgressService. diff --git a/internal/service/progress_test.go b/internal/service/progress_test.go index 4baf03f..718da31 100644 --- a/internal/service/progress_test.go +++ b/internal/service/progress_test.go @@ -5,28 +5,28 @@ import ( "errors" "testing" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) func TestProgressService_UpdateProgress(t *testing.T) { ctx := context.Background() tests := []struct { - name string - sessionID string - userID int64 - mediaID int64 - position float64 - accLastPosition float64 - accAccumulated float64 - accCounted bool - accErr error + name string + sessionID string + userID int64 + mediaID int64 + position float64 + accLastPosition float64 + accAccumulated float64 + accCounted bool + accErr error upsertProgressErr error - upsertAccErr error - incrementErr error - wantErr bool - wantCounted bool + upsertAccErr error + incrementErr error + wantErr bool + wantCounted bool }{ { name: "fresh accumulator does not reach 60 due to clamp", diff --git a/internal/service/service.go b/internal/service/service.go index edf9f52..28dfdc9 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -6,8 +6,8 @@ import ( "io" "time" - "github.com/paul/kiss-media-player/internal/model" - "github.com/paul/kiss-media-player/internal/repository" + "codeberg.org/snonux/play/internal/model" + "codeberg.org/snonux/play/internal/repository" ) // MediaService handles media and set operations. -- cgit v1.2.3