From 9270a85ba9a3c26a3fd7782b4affa71adc2bac10 Mon Sep 17 00:00:00 2001 From: Ben Garrett Date: Sat, 7 Oct 2023 13:30:11 +1100 Subject: [PATCH] replaced Defacto2.sceners package with Defacto2.releaser. --- go.mod | 2 +- go.sum | 18 ++-------- handler/app/funchtml.go | 6 ++-- handler/app/funcmap.go | 4 +-- handler/app/render_err.go | 6 ++-- handler/app/render_files.go | 6 ++-- handler/app/render_releaser.go | 8 ++--- handler/app/render_search.go | 4 +-- handler/html3/list.go | 4 +-- handler/html3/templates.go | 4 +-- internal/fmts/fmts.go | 66 ---------------------------------- model/releaser.go | 4 +-- model/releaser_test.go | 6 ++-- model/scener.go | 4 +-- model/summary.go | 4 +-- 15 files changed, 33 insertions(+), 113 deletions(-) delete mode 100644 internal/fmts/fmts.go diff --git a/go.mod b/go.mod index 51e0030e..c14c2c67 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Defacto2/server go 1.21 require ( - github.com/Defacto2/sceners v0.0.2 + github.com/Defacto2/releaser v0.5.0 github.com/caarlos0/env/v7 v7.1.0 github.com/carlmjohnson/versioninfo v0.22.5 github.com/evanw/esbuild v0.18.15 diff --git a/go.sum b/go.sum index a904eeb5..74ccae35 100644 --- a/go.sum +++ b/go.sum @@ -63,8 +63,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM= github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Defacto2/sceners v0.0.2 h1:nd3kUJuHKtm24pBxH2Nmg5+vI88jMs2v2z57z22KHJw= -github.com/Defacto2/sceners v0.0.2/go.mod h1:8q8aIZ5C3lCa1PuWE6jcjH4ztye+xDPaEHUmZgDNjr8= +github.com/Defacto2/releaser v0.5.0 h1:0sDQFh7Mquzo6b2KzEDz7cT4MG5PWpFPkGR5l+doXXU= +github.com/Defacto2/releaser v0.5.0/go.mod h1:qotKWtxM+tbp7uQaMX1/EiV+h0JoyujFn+4bxkWSihA= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= @@ -81,8 +81,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -516,8 +514,6 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -535,8 +531,6 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -549,8 +543,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= -golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -628,8 +620,6 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -752,8 +742,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -767,8 +755,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/handler/app/funchtml.go b/handler/app/funchtml.go index a7aff913..fd20a085 100644 --- a/handler/app/funchtml.go +++ b/handler/app/funchtml.go @@ -10,8 +10,8 @@ import ( "strings" "time" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/config" - "github.com/Defacto2/server/internal/fmts" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/tags" "github.com/volatiletech/null/v8" @@ -364,14 +364,14 @@ func LinkRelrs(a, b any) template.HTML { if err != nil { return template.HTML(fmt.Sprintf("error: %s", err)) } - prime = fmt.Sprintf(`%s`, class, ref, fmts.Name(helper.Slug(av))) + prime = fmt.Sprintf(`%s`, class, ref, releaser.Link(helper.Slug(av))) } if bv != "" { ref, err := linkRelr(bv) if err != nil { return template.HTML(fmt.Sprintf("error: %s", err)) } - second = fmt.Sprintf(`%s`, class, ref, fmts.Name(helper.Slug(bv))) + second = fmt.Sprintf(`%s`, class, ref, releaser.Link(helper.Slug(bv))) } if prime != "" && second != "" { s = fmt.Sprintf("%s
+ %s", prime, second) diff --git a/handler/app/funcmap.go b/handler/app/funcmap.go index 1f769c54..b9f82003 100644 --- a/handler/app/funcmap.go +++ b/handler/app/funcmap.go @@ -6,7 +6,7 @@ package app import ( "html/template" - "github.com/Defacto2/server/internal/fmts" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/initialism" ) @@ -31,7 +31,7 @@ func (web Web) TemplateFuncMap() template.FuncMap { "fmtMonth": Month, "fmtPrefix": Prefix, "fmtRoles": helper.FmtSlice, - "fmtURI": fmts.Name, + "fmtURI": releaser.Link, "initialisms": initialism.Join, "lastUpdated": LastUpdated, "linkDownload": LinkDownload, diff --git a/handler/app/render_err.go b/handler/app/render_err.go index fe349649..6a18fe8b 100644 --- a/handler/app/render_err.go +++ b/handler/app/render_err.go @@ -18,7 +18,7 @@ import ( "net/http" "strings" - "github.com/Defacto2/sceners/pkg/rename" + "github.com/Defacto2/releaser" "github.com/labstack/echo/v4" "go.uber.org/zap" ) @@ -164,7 +164,7 @@ func ReleaserErr(z *zap.SugaredLogger, c echo.Context, id string) error { data["description"] = fmt.Sprintf("HTTP status %d error", http.StatusNotFound) data["code"] = http.StatusNotFound data["logo"] = "Releaser not found" - data["alert"] = fmt.Sprintf("Releaser %q cannot be found", rename.DeObfuscateURL(id)) + data["alert"] = fmt.Sprintf("Releaser %q cannot be found", releaser.Humanize(id)) data["probl"] = "The releaser page does not exist, there is probably a typo with the URL." data["uriOkay"] = "g/" data["uriErr"] = id @@ -189,7 +189,7 @@ func ScenerErr(z *zap.SugaredLogger, c echo.Context, id string) error { data["description"] = fmt.Sprintf("HTTP status %d error", http.StatusNotFound) data["code"] = http.StatusNotFound data["logo"] = "Scener not found" - data["alert"] = fmt.Sprintf("Scener %q cannot be found", rename.DeObfuscateURL(id)) + data["alert"] = fmt.Sprintf("Scener %q cannot be found", releaser.Humanize(id)) data["probl"] = "The scener page does not exist, there is probably a typo with the URL." data["uriOkay"] = "p/" data["uriErr"] = id diff --git a/handler/app/render_files.go b/handler/app/render_files.go index e5a985a8..f99c8ff6 100644 --- a/handler/app/render_files.go +++ b/handler/app/render_files.go @@ -11,7 +11,7 @@ import ( "net/http" "strconv" - "github.com/Defacto2/server/internal/fmts" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/initialism" "github.com/Defacto2/server/internal/postgres" @@ -167,7 +167,7 @@ func Sceners(z *zap.SugaredLogger, c echo.Context, uri string) error { } defer db.Close() - s := fmts.Name(uri) + s := releaser.Link(uri) var rel model.Scener fs, err := rel.List(ctx, db, uri) if err != nil { @@ -226,7 +226,7 @@ func Releasers(z *zap.SugaredLogger, c echo.Context, uri string) error { } defer db.Close() - s := fmts.Name(uri) + s := releaser.Link(uri) rel := model.Releasers{} fs, err := rel.List(ctx, db, uri) if err != nil { diff --git a/handler/app/render_releaser.go b/handler/app/render_releaser.go index 187ddf8d..7c37fd2c 100644 --- a/handler/app/render_releaser.go +++ b/handler/app/render_releaser.go @@ -180,16 +180,16 @@ func mag(z *zap.SugaredLogger, c echo.Context, chronological bool) error { // Releaser is the handler for the releaser page ordered by the most files. func Releaser(z *zap.SugaredLogger, c echo.Context) error { - return releaser(z, c, true) + return rel(z, c, true) } // ReleaserAZ is the handler for the releaser page ordered alphabetically. func ReleaserAZ(z *zap.SugaredLogger, c echo.Context) error { - return releaser(z, c, false) + return rel(z, c, false) } -// releaser is the handler for the Releaser page. -func releaser(z *zap.SugaredLogger, c echo.Context, prolific bool) error { +// rel is the handler for the Releaser page. +func rel(z *zap.SugaredLogger, c echo.Context, prolific bool) error { const title, name = "Releaser", "releaser" if z == nil { return InternalErr(z, c, name, ErrZap) diff --git a/handler/app/render_search.go b/handler/app/render_search.go index 64ea99bd..987402fd 100644 --- a/handler/app/render_search.go +++ b/handler/app/render_search.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/Defacto2/server/internal/fmts" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/initialism" "github.com/Defacto2/server/internal/postgres" @@ -141,7 +141,7 @@ func SearchReleaser(z *zap.SugaredLogger, c echo.Context) error { for i, v := range x { id := strings.TrimSpace(v.Name) slug := helper.Slug(id) - name := fmts.Name(slug) + name := releaser.Link(slug) ism := initialism.Initialism(slug) opt := name if len(ism) > 0 { diff --git a/handler/html3/list.go b/handler/html3/list.go index 4da5ae4a..13762843 100644 --- a/handler/html3/list.go +++ b/handler/html3/list.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/Defacto2/sceners" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/postgres" "github.com/Defacto2/server/internal/postgres/models" @@ -90,7 +90,7 @@ func (s *sugared) List(c echo.Context, tt RecordsBy) error { } } - name := sceners.CleanURL(id) + name := releaser.Clean(id) ctx := context.Background() db, err := postgres.ConnectDB() if err != nil { diff --git a/handler/html3/templates.go b/handler/html3/templates.go index 50bef03c..53c794df 100644 --- a/handler/html3/templates.go +++ b/handler/html3/templates.go @@ -7,7 +7,7 @@ import ( "html/template" "strings" - "github.com/Defacto2/server/internal/fmts" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/tags" "github.com/Defacto2/server/model" "go.uber.org/zap" @@ -32,7 +32,7 @@ func TemplateFuncMap(z *zap.SugaredLogger) template.FuncMap { "leading": Leading, "fmtByte": LeadFS, "fmtURI": func(uri string) string { - return fmts.Name(uri) + return releaser.Link(uri) }, "byteInt": LeadFSInt, "leadInt": LeadInt, diff --git a/internal/fmts/fmts.go b/internal/fmts/fmts.go deleted file mode 100644 index c5ef6da6..00000000 --- a/internal/fmts/fmts.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package fmts contains the well-known styled names of releasers. -package fmts - -import ( - "strings" - - "github.com/Defacto2/sceners/pkg/rename" -) - -// URI is a the URL slug of the releaser. -type URI string - -// Names is a map of releasers and their well-known styled names. -type Names map[URI]string - -var names = Names{ - "acid-productions": "ACiD Productions", - "core": "CoRE", - "crackpl": "CrackPL", - "dumptruck": "dumpTruck", - "defacto2net": "defacto2.net", - "dvniso": "DVNiSO", - "esp-pirates": "ESP Pirates", - "linezer0": "LineZer0", - "icon": "iCON", - "imars": "iMARS", - "jrp": "Japanese Release Project", - "oneup": "OneUp", - "orion": "ORiON", - "mmi": "MMi", - "mp2k": "MP2K", - "nc_17": "NC-17", - "nukethis": "NukeThis", - "numbers": "The Numbers", - "nrp": "NoRePack", - "paradox": "Paradox", - "playme": "PlayMe", - "risciso": "RISCiSO", - "seek-n-destroy": "Seek 'n Destroy", - "sma-posse": "SMA Posse", - "shitonlygerman": "ShitOnlyGerman", - "software-pirates-inc": "Software Pirates Inc.", - "surprise-productions": "Surprise! Productions", - "razordox": "RazorDOX", - "team-xtx": "Team XTX", - "tft-team": "TFT Team", - "tpinc": "TPiNC", - "tristar-ampersand-red-sector-inc": "Tristar & Red Sector Inc.", - "the-dvdr-releasing-standards": "The DVDR Releasing Standards", - "the-firm": "The FiRM", - "thg-fx": "THG-FX", - "tdu_jam": "TDU Jam!", - "the-dream-team*tristar-ampersand-red-sector-inc": "The Dream Team + TRSi", - "tport": "tPORt", - "underpl": "UnderPL", - "xdb": "X-db", -} - -// Name returns the well-known styled name of the releaser. -func Name(uri string) string { - if _, ok := names[URI(uri)]; ok { - return names[URI(uri)] - } - s := rename.DeObfuscateURL(uri) - return strings.ReplaceAll(s, ", ", " + ") -} diff --git a/model/releaser.go b/model/releaser.go index fab8a12b..1b7c4bda 100644 --- a/model/releaser.go +++ b/model/releaser.go @@ -7,7 +7,7 @@ import ( "database/sql" "strings" - "github.com/Defacto2/sceners/pkg/rename" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/postgres" "github.com/Defacto2/server/internal/postgres/models" @@ -59,7 +59,7 @@ func (r *Releasers) List(ctx context.Context, db *sql.DB, name string) (models.F if db == nil { return nil, ErrDB } - n := strings.ToUpper(rename.DeObfuscateURL(name)) + n := strings.ToUpper(releaser.Humanize(name)) x := null.StringFrom(n) return models.Files( qm.Where("upper(group_brand_for) = ? OR upper(group_brand_by) = ?", x, x), diff --git a/model/releaser_test.go b/model/releaser_test.go index 7cc6d175..c81c5193 100644 --- a/model/releaser_test.go +++ b/model/releaser_test.go @@ -5,7 +5,7 @@ import ( "log" "testing" - "github.com/Defacto2/sceners" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/postgres" "github.com/Defacto2/server/model" @@ -26,9 +26,9 @@ func TestAllSlugs(t *testing.T) { log.Fatal(err) } for _, x := range g { - og := sceners.CleanURL(x.Unique.Name) + og := releaser.Clean(x.Unique.Name) y := helper.Slug(og) - z := sceners.CleanURL(y) + z := releaser.Clean(y) assert.Equal(t, og, z, "slug is "+y) } } diff --git a/model/scener.go b/model/scener.go index e726786d..34d75b4c 100644 --- a/model/scener.go +++ b/model/scener.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/Defacto2/sceners/pkg/rename" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/helper" "github.com/Defacto2/server/internal/postgres" "github.com/Defacto2/server/internal/postgres/models" @@ -33,7 +33,7 @@ func (s *Scener) List(ctx context.Context, db *sql.DB, name string) (models.File } func ScenerSQL(name string) string { - n := strings.ToUpper(rename.DeObfuscateURL(name)) + n := strings.ToUpper(releaser.Humanize(name)) exact := fmt.Sprintf("(upper(credit_text) = '%s')"+ " OR (upper(credit_program) = '%s')"+ " OR (upper(credit_illustration) = '%s')"+ diff --git a/model/summary.go b/model/summary.go index 249b763e..bd3eab51 100644 --- a/model/summary.go +++ b/model/summary.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/Defacto2/sceners/pkg/rename" + "github.com/Defacto2/releaser" "github.com/Defacto2/server/internal/postgres" "github.com/Defacto2/server/internal/postgres/models" "github.com/volatiletech/null/v8" @@ -104,7 +104,7 @@ func (s *Summary) Releaser(ctx context.Context, db *sql.DB, name string) error { if db == nil { return ErrDB } - n := strings.ToUpper(rename.DeObfuscateURL(name)) + n := strings.ToUpper(releaser.Humanize(name)) x := null.StringFrom(n) return models.NewQuery( qm.Select(postgres.Columns()...),