Skip to content

Commit

Permalink
Breaking change: Renaming parameters operating-system, language-code …
Browse files Browse the repository at this point in the history
…to use property names (os and lang-code), also renaming exclude-patches to no-patches

Removing external-url parameter
  • Loading branch information
boggydigital committed Nov 15, 2024
1 parent 63482dd commit 78b5000
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 88 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ services:
image: ghcr.io/arelate/vangogh:latest
environment:
# Download lists filters
# - VG_OPERATING-SYSTEM=Windows,macOS
# - VG_LANGUAGE-CODE=en,fr
# - VG_EXCLUDE-PATCHES=true
# External URL for Atom feed
# - VG_EXTERNAL-URL=https://vangogh.arles
# - VG_OS=Windows,macOS
# - VG_LANG-CODE=en,fr
# - VG_NO-PATCHES=true
# debug
# - VG_SYNC_DEBUG=true
volumes:
Expand Down
57 changes: 27 additions & 30 deletions cli-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ cascade-validation
cleanup
id^&
slug&
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
all
test
delete
Expand All @@ -39,10 +39,10 @@ get-data
get-downloads
id^&
slug&
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
missing
force

Expand All @@ -59,11 +59,10 @@ get-items
get-purchases
id^&
since-hours-ago
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
external-url
lang-code&$={language-codes^}
no-patches$
force

get-summary
Expand Down Expand Up @@ -112,9 +111,9 @@ search
serve
port$*
stderr$
operating-system$
language-code$
exclude-patches$
os$
lang-code$
no-patches$
admin-username$
admin-password$
shared-username$
Expand All @@ -123,24 +122,22 @@ serve
size
id^&
slug&
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
missing
all

summarize
since-hours-ago
external-url$

sync
since-hours-ago
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
external-url$
lang-code&$={language-codes^}
no-patches$
debug$
{sync-options^&}

Expand All @@ -151,30 +148,30 @@ tag
tag-name

update-downloads
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
since-hours-ago
updates-only

validate
id^&
slug&
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
all
skip-valid

version

vet
operating-system&$={operating-systems^}
os&$={operating-systems^}
download-type&$={download-types^}
language-code&$={language-codes^}
exclude-patches$
lang-code&$={language-codes^}
no-patches$
fix
{vet-options^&}

Expand Down
4 changes: 2 additions & 2 deletions cli/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func CleanupHandler(u *url.URL) error {
idSet,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "all"),
vangogh_local_data.FlagFromUrl(u, "test"),
vangogh_local_data.FlagFromUrl(u, "delete"))
Expand Down
4 changes: 2 additions & 2 deletions cli/get_downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func GetDownloadsHandler(u *url.URL) error {
idSet,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "missing"),
vangogh_local_data.FlagFromUrl(u, "force"))
}
Expand Down
8 changes: 3 additions & 5 deletions cli/get_purchases.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ func GetPurchasesHandler(u *url.URL) error {
idSet,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValueFromUrl(u, "external-url"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "force"))
}

Expand All @@ -35,7 +34,6 @@ func GetPurchases(
downloadTypes []vangogh_local_data.DownloadType,
langCodes []string,
excludePatches bool,
externalUrl string,
force bool) error {

productTypes := []vangogh_local_data.ProductType{
Expand Down Expand Up @@ -67,7 +65,7 @@ func GetPurchases(
return err
}

if err := Summarize(since, externalUrl); err != nil {
if err := Summarize(since); err != nil {
return err
}

Expand Down
17 changes: 8 additions & 9 deletions cli/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ func ServeHandler(u *url.URL) error {
return err
}

osStrings := vangogh_local_data.ValuesFromUrl(u, "operating-system")
os := vangogh_local_data.ParseManyOperatingSystems(osStrings)
lc := vangogh_local_data.ValuesFromUrl(u, "language-code")
oses := vangogh_local_data.OperatingSystemsFromUrl(u)
langCode := vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty)

if len(os) == 0 {
os = []vangogh_local_data.OperatingSystem{vangogh_local_data.AnyOperatingSystem}
if len(oses) == 0 {
oses = []vangogh_local_data.OperatingSystem{vangogh_local_data.AnyOperatingSystem}
}
if len(lc) == 0 {
lc = []string{"en"}
if len(langCode) == 0 {
langCode = []string{"en"}
}

excludePatches := vangogh_local_data.FlagFromUrl(u, "exclude-patches")
noPatches := vangogh_local_data.FlagFromUrl(u, "no-patches")

rest.SetDefaultDownloadsFilters(os, lc, excludePatches)
rest.SetDefaultDownloadsFilters(oses, langCode, noPatches)

sharedUsername := vangogh_local_data.ValueFromUrl(u, "shared-username")
sharedPassword := vangogh_local_data.ValueFromUrl(u, "shared-password")
Expand Down
4 changes: 2 additions & 2 deletions cli/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func SizeHandler(u *url.URL) error {
idSet,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "missing"),
vangogh_local_data.FlagFromUrl(u, "all"))
}
Expand Down
16 changes: 6 additions & 10 deletions cli/summarize.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ func SummarizeHandler(u *url.URL) error {
return err
}

externalUrl := vangogh_local_data.ValueFromUrl(u, "external-url")

return Summarize(
since,
externalUrl)
return Summarize(since)
}

func Summarize(since int64, externalUrl string) error {
func Summarize(since int64) error {

sa := nod.Begin("summarizing updates...")
defer sa.End()
Expand Down Expand Up @@ -91,7 +87,7 @@ func Summarize(since int64, externalUrl string) error {
was := nod.Begin("publishing atom...")
defer was.End()

if err := publishAtom(externalUrl, rdx, summary); err != nil {
if err := publishAtom(rdx, summary); err != nil {
return was.EndWithError(err)
}

Expand Down Expand Up @@ -121,7 +117,7 @@ func releasedToday(rdx kevlar.ReadableRedux) ([]string, error) {
return rdx.Sort(ids, vangogh_local_data.DefaultDesc, vangogh_local_data.DefaultSort)
}

func publishAtom(externalUrl string, rdx kevlar.ReadableRedux, summary map[string][]string) error {
func publishAtom(rdx kevlar.ReadableRedux, summary map[string][]string) error {

afp, err := vangogh_local_data.AbsAtomFeedPath()
if err != nil {
Expand All @@ -133,8 +129,8 @@ func publishAtom(externalUrl string, rdx kevlar.ReadableRedux, summary map[strin
return err
}

af := atomus.NewFeed(atomFeedTitle, externalUrl)
af.SetEntry(atomEntryTitle, atomEntryAuthor, externalUrl, NewAtomFeedContent(rdx, summary))
af := atomus.NewFeed(atomFeedTitle, "")
af.SetEntry(atomEntryTitle, atomEntryAuthor, "", NewAtomFeedContent(rdx, summary))

return af.Encode(atomFile)
}
Expand Down
15 changes: 6 additions & 9 deletions cli/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ func SyncHandler(u *url.URL) error {
return err
}

externalUrl := vangogh_local_data.ValueFromUrl(u, "external-url")
debug := vangogh_local_data.FlagFromUrl(u, "debug")

return Sync(
since,
syncOpts,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
externalUrl,
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
debug)
}

Expand All @@ -90,8 +88,7 @@ func Sync(
operatingSystems []vangogh_local_data.OperatingSystem,
downloadTypes []vangogh_local_data.DownloadType,
langCodes []string,
excludePatches bool,
gauginUrl string,
noPatches bool,
debug bool) error {

if debug {
Expand Down Expand Up @@ -200,7 +197,7 @@ func Sync(

// summarize sync updates now, since other updates are digital artifacts
// and won't affect the summaries
if err := Summarize(syncStart, gauginUrl); err != nil {
if err := Summarize(syncStart); err != nil {
return sa.EndWithError(err)
}

Expand Down Expand Up @@ -241,7 +238,7 @@ func Sync(
operatingSystems,
downloadTypes,
langCodes,
excludePatches,
noPatches,
since,
false); err != nil {
return sa.EndWithError(err)
Expand All @@ -252,7 +249,7 @@ func Sync(
operatingSystems,
downloadTypes,
langCodes,
excludePatches); err != nil {
noPatches); err != nil {
return sa.EndWithError(err)
}

Expand Down
6 changes: 3 additions & 3 deletions cli/update_downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ func UpdateDownloadsHandler(u *url.URL) error {
return UpdateDownloads(
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
since,
vangogh_local_data.FlagFromUrl(u, "Updates-only"))
vangogh_local_data.FlagFromUrl(u, "updates-only"))
}

func UpdateDownloads(
Expand Down
4 changes: 2 additions & 2 deletions cli/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func ValidateHandler(u *url.URL) error {
idSet,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "all"),
vangogh_local_data.FlagFromUrl(u, "skip-valid"))
}
Expand Down
4 changes: 2 additions & 2 deletions cli/vet.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func VetHandler(u *url.URL) error {
vetOpts,
vangogh_local_data.OperatingSystemsFromUrl(u),
vangogh_local_data.DownloadTypesFromUrl(u),
vangogh_local_data.ValuesFromUrl(u, "language-code"),
vangogh_local_data.FlagFromUrl(u, "exclude-patches"),
vangogh_local_data.ValuesFromUrl(u, vangogh_local_data.LanguageCodeProperty),
vangogh_local_data.FlagFromUrl(u, "no-patches"),
vangogh_local_data.FlagFromUrl(u, "fix"))
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.23.3

require (
github.com/arelate/southern_light v0.1.51
github.com/arelate/vangogh_local_data v0.4.33
github.com/boggydigital/atomus v0.1.9
github.com/arelate/vangogh_local_data v0.4.34
github.com/boggydigital/atomus v0.1.10
github.com/boggydigital/backups v0.1.3
github.com/boggydigital/clo v1.0.4
github.com/boggydigital/compton v0.2.23
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ github.com/arelate/vangogh_local_data v0.4.32 h1:2hP3oQrFyr+OjfUoBwyKWnF3hv9o2CT
github.com/arelate/vangogh_local_data v0.4.32/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw=
github.com/arelate/vangogh_local_data v0.4.33 h1:Dgjjhp710QZplTlzqzBautjGVF2CIR2PY6SnI7YgYMs=
github.com/arelate/vangogh_local_data v0.4.33/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw=
github.com/arelate/vangogh_local_data v0.4.34 h1:DRHk2vH0n2fIdQ7ZydGm1vw7/u2G+HKYybMo0Ny4Ud0=
github.com/arelate/vangogh_local_data v0.4.34/go.mod h1:hXcjRAhGb6tjpOuSc7kN94kZANnybUVZALXfYstrjfw=
github.com/boggydigital/atomus v0.1.9 h1:zAmXtAAXtBzMfz/83nEO4x8/uSLlPOq5wynW1jR/rbk=
github.com/boggydigital/atomus v0.1.9/go.mod h1:mvPDNDMrpFZ7RHbyMrt30hVXFU+VoeCvHnT83Zhj91I=
github.com/boggydigital/atomus v0.1.10 h1:ERmg6ncLOJ/y0B13SSRAIpjDgWQfEqfeQwFBSYgrjg0=
github.com/boggydigital/atomus v0.1.10/go.mod h1:YK4iAWR9/+2rFhfaGLjkfoFiCPY5QNu8d23I/8wuWSY=
github.com/boggydigital/backups v0.1.3 h1:Yq4/2kVxpexc0bAVA5tQPgdcKXPWsqihzgI759VPgVM=
github.com/boggydigital/backups v0.1.3/go.mod h1:xIV5pr0U178hTV3mHfStSU+s1IOJUH4fOU81ad4Cq7Y=
github.com/boggydigital/busan v0.1.0 h1:mUpe4b3vdt9Kcf4Z/C2YSuX5L7ru+J/iZW+IcSfW0cM=
Expand Down
Loading

0 comments on commit 78b5000

Please sign in to comment.