From fb36dbf71991424879be85950ab508bcdf653902 Mon Sep 17 00:00:00 2001 From: Nadia Santalla Date: Thu, 12 Sep 2024 19:24:09 +0200 Subject: [PATCH 01/42] fix(dockerfile): install abuild key (#526) Without this, abuild refuses to run correctly. --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1204ca..ed4114c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,9 @@ FROM alpine:3.19 AS builder-taglib WORKDIR /tmp COPY alpine/taglib/APKBUILD . RUN apk update && \ - apk add --no-cache abuild && \ - abuild-keygen -a -n && \ + apk add --no-cache abuild doas && \ + echo "permit nopass root" > /etc/doas.conf && \ + abuild-keygen -a -n -i && \ REPODEST=/pkgs abuild -F -r FROM golang:1.21-alpine AS builder From 875a83ad4f88752f8d018158f00768b81983edc3 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 12 Sep 2024 18:30:40 +0100 Subject: [PATCH 02/42] chore: bump to go1.23 --- Dockerfile | 6 +++--- Dockerfile.debug | 2 +- Dockerfile.dev | 4 ++-- go.mod | 22 +++++++++++----------- go.sum | 40 ++++++++++++++++++++-------------------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed4114c..ba3b1b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.19 AS builder-taglib +FROM alpine:3.20 AS builder-taglib WORKDIR /tmp COPY alpine/taglib/APKBUILD . RUN apk update && \ @@ -7,7 +7,7 @@ RUN apk update && \ abuild-keygen -a -n -i && \ REPODEST=/pkgs abuild -F -r -FROM golang:1.21-alpine AS builder +FROM golang:1.23-alpine AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ @@ -27,7 +27,7 @@ RUN go mod download COPY . . RUN GOOS=linux go build -o gonic cmd/gonic/gonic.go -FROM alpine:3.19 +FROM alpine:3.20 LABEL org.opencontainers.image.source https://github.com/sentriz/gonic RUN apk add -U --no-cache \ ffmpeg \ diff --git a/Dockerfile.debug b/Dockerfile.debug index 39f94ea..d1530b8 100644 --- a/Dockerfile.debug +++ b/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.21-alpine AS builder +FROM golang:1.23-alpine AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ diff --git a/Dockerfile.dev b/Dockerfile.dev index e9d915f..71659a9 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:experimental -FROM golang:1.21-alpine AS builder +FROM golang:1.23-alpine AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ @@ -14,7 +14,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ GOOS=linux go build -o gonic cmd/gonic/gonic.go -FROM alpine:3.18 +FROM alpine:3.20 RUN apk add -U --no-cache \ ffmpeg \ mpv \ diff --git a/go.mod b/go.mod index a332edc..a074c5c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.senan.xyz/gonic -go 1.21 +go 1.23.0 require ( github.com/Masterminds/sprig v2.22.0+incompatible @@ -14,10 +14,10 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/google/uuid v1.6.0 github.com/gorilla/securecookie v1.1.2 - github.com/gorilla/sessions v1.3.0 + github.com/gorilla/sessions v1.4.0 github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414 github.com/josephburnett/jd v1.8.1 - github.com/mattn/go-sqlite3 v1.14.22 + github.com/mattn/go-sqlite3 v1.14.23 github.com/mitchellh/mapstructure v1.5.0 github.com/mmcdole/gofeed v1.3.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 @@ -27,8 +27,8 @@ require ( github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/stretchr/testify v1.9.0 go.senan.xyz/flagconf v0.1.9 - golang.org/x/net v0.27.0 - golang.org/x/sync v0.7.0 + golang.org/x/net v0.29.0 + golang.org/x/sync v0.8.0 gopkg.in/gormigrate.v1 v1.6.0 jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056 ) @@ -36,7 +36,7 @@ require ( require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/PuerkitoBio/goquery v1.9.2 // indirect + github.com/PuerkitoBio/goquery v1.10.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect @@ -49,7 +49,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/lib/pq v1.3.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mmcdole/goxpp v1.1.1 // indirect @@ -59,10 +59,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/image v0.18.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/image v0.20.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 86a47da..bff7b82 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE= -github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk= +github.com/PuerkitoBio/goquery v1.10.0 h1:6fiXdLuUvYs2OJSvNRqlNPoBm6YABE226xrbavY5Wv4= +github.com/PuerkitoBio/goquery v1.10.0/go.mod h1:TjZZl68Q3eGHNBA8CWaxAN7rOU1EbDz3CWuolcO5Yu4= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= @@ -57,8 +57,8 @@ github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+ github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/gorilla/sessions v1.3.0 h1:XYlkq7KcpOB2ZhHBPv5WpjMIxrQosiZanfoy1HLZFzg= -github.com/gorilla/sessions v1.3.0/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ= +github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= +github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -92,12 +92,12 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWtuw0= +github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -146,11 +146,11 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= -golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= +golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw= +golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -163,13 +163,13 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -180,8 +180,8 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -191,8 +191,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 120fd7959a8e360fdccc6bd1a47e8cc7ebdbb0d4 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 12 Sep 2024 18:36:35 +0100 Subject: [PATCH 03/42] fix(ci): ignore gosec integer overflow conversion --- .golangci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index d01804f..770413e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,6 +81,9 @@ issues: - text: "weak random number generator" linters: - gosec + - text: "integer overflow conversion" + linters: + - gosec - text: "at least one file in a package should have a package comment" linters: - stylecheck From 453639ee34da28dc47f64865d490445968c23ce8 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 12 Sep 2024 18:32:36 +0100 Subject: [PATCH 04/42] feat(scanner): use wrtag/coverparse for cover selection later, gonic will also use wrtag/tags for tag parsing closes #338 closes #516 --- go.mod | 1 + go.sum | 6 ++++-- scanner/scanner.go | 25 +++---------------------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index a074c5c..29fe3d8 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/stretchr/testify v1.9.0 go.senan.xyz/flagconf v0.1.9 + go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9 golang.org/x/net v0.29.0 golang.org/x/sync v0.8.0 gopkg.in/gormigrate.v1 v1.6.0 diff --git a/go.sum b/go.sum index bff7b82..c12af78 100644 --- a/go.sum +++ b/go.sum @@ -141,6 +141,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= +go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9 h1:cTyJaIbwsL8Wclc4RGFU35IOrD7+zqy+/cVcdJ/2OOs= +go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -197,8 +199,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/scanner/scanner.go b/scanner/scanner.go index adbd8d4..77e8711 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -25,6 +25,7 @@ import ( "go.senan.xyz/gonic/db" "go.senan.xyz/gonic/fileutil" "go.senan.xyz/gonic/tags/tagcommon" + "go.senan.xyz/wrtag/coverparse" ) var ( @@ -277,8 +278,8 @@ func (s *Scanner) scanDir(tx *db.DB, st *State, absPath string) error { continue } - if isCover(item.Name()) { - cover = item.Name() + if coverparse.IsCover(item.Name()) { + coverparse.BestBetween(&cover, item.Name()) continue } if s.tagReader.CanRead(absPath) { @@ -671,26 +672,6 @@ func (s *Scanner) cleanGenres(st *State) error { //nolint:unparam return nil } -//nolint:gochecknoglobals -var coverNames = map[string]struct{}{} - -//nolint:gochecknoinits -func init() { - for _, name := range []string{"cover", "folder", "front", "albumart", "album", "artist"} { - for _, ext := range []string{"jpg", "jpeg", "png", "bmp", "gif"} { - coverNames[fmt.Sprintf("%s.%s", name, ext)] = struct{}{} - for i := 0; i < 3; i++ { - coverNames[fmt.Sprintf("%s.%d.%s", name, i, ext)] = struct{}{} // support beets extras - } - } - } -} - -func isCover(name string) bool { - _, ok := coverNames[strings.ToLower(name)] - return ok -} - // decoded converts a string to it's latin equivalent. // it will be used by the model's *UDec fields, and is only set if it // differs from the original. the fields are used for searching. From 640d872f4c66d21b760590ae9413cc5b63b53cb6 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 12 Sep 2024 18:41:10 +0100 Subject: [PATCH 05/42] fix(ci): bump golangci-lint --- .github/workflows/nightly-release.yaml | 5 ++--- .github/workflows/release.yaml | 5 ++--- .github/workflows/test.yaml | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index d5bf63d..acf7cd9 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -33,11 +33,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.54 + version: v1.60 args: --timeout=5m - install-mode: "goinstall" - name: Test run: go test ./... build-release: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5edd1ad..8a5987b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,11 +19,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.54 + version: v1.60 args: --timeout=5m - install-mode: "goinstall" - name: Test run: go test ./... release-please: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bb25da4..a186d19 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,10 +20,9 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.54 + version: v1.60 args: --timeout=5m - install-mode: "goinstall" - name: Test run: go test ./... From bfa0e130d43479445f0461474f1e6ce6a7065fc0 Mon Sep 17 00:00:00 2001 From: sentriz Date: Fri, 13 Sep 2024 11:52:43 +0100 Subject: [PATCH 06/42] chore(deps): bump --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 29fe3d8..b98219d 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/stretchr/testify v1.9.0 go.senan.xyz/flagconf v0.1.9 - go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9 + go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230 golang.org/x/net v0.29.0 golang.org/x/sync v0.8.0 gopkg.in/gormigrate.v1 v1.6.0 diff --git a/go.sum b/go.sum index c12af78..33a3045 100644 --- a/go.sum +++ b/go.sum @@ -141,8 +141,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= -go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9 h1:cTyJaIbwsL8Wclc4RGFU35IOrD7+zqy+/cVcdJ/2OOs= -go.senan.xyz/wrtag v0.0.0-20240912173011-55fc2821f3f9/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= +go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230 h1:Peeh4dn9T9YD3wFR4ocef74/2GRCRCqRz/Mx8sO9VPw= +go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= From bcb613c79c6a822adeafc802f19b7626bfb64009 Mon Sep 17 00:00:00 2001 From: brian-doherty <76168809+brian-doherty@users.noreply.github.com> Date: Sun, 15 Sep 2024 09:04:28 -0500 Subject: [PATCH 07/42] feat(transcode): add cache pruning and config options * Added config option to set size of transcode cache and cadence to enforce that sizing via ejection. * Added cache eject to contrib/config. * Added error return for CacheEject(). Changed to use WalkDir() instead of Walk(). * Lint fix. * Added universal lock for cache eject. * Removed accidentally committed binary. --- README.md | 2 ++ cmd/gonic/gonic.go | 19 ++++++++++ contrib/config | 4 +++ transcode/transcode_test.go | 2 +- transcode/transcoder_caching.go | 62 +++++++++++++++++++++++++++++++-- 5 files changed, 86 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af2a117..6cafaca 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ password can then be changed from the web interface | `GONIC_MULTI_VALUE_GENRE` | `-multi-value-genre` | **optional** setting for multi-valued genre tags when scanning ([see more](#multi-valued-tags-v016)) | | `GONIC_MULTI_VALUE_ARTIST` | `-multi-value-artist` | **optional** setting for multi-valued artist tags when scanning ([see more](#multi-valued-tags-v016)) | | `GONIC_MULTI_VALUE_ALBUM_ARTIST` | `-multi-value-album-artist` | **optional** setting for multi-valued album artist tags when scanning ([see more](#multi-valued-tags-v016)) | +| `GONIC_TRANSCODE_CACHE_SIZE` | `-transcode-cache-size` | **optional** size of the transcode cache in MB (0 = no limit) | +| `GONIC_TRANSCODE_EJECT_INTERVAL` | `-transcode-eject-interval` | **optional** interval (in minutes) to eject transcode cache (0 = never) | | `GONIC_EXPVAR` | `-expvar` | **optional** enable the /debug/vars endpoint (exposes useful debugging attributes as well as database stats) | ## multi valued tags (v0.16+) diff --git a/cmd/gonic/gonic.go b/cmd/gonic/gonic.go index 4548904..0d0e509 100644 --- a/cmd/gonic/gonic.go +++ b/cmd/gonic/gonic.go @@ -93,6 +93,9 @@ func main() { deprecatedConfGenreSplit := flag.String("genre-split", "", "(deprecated, see multi-value settings)") + confTranscodeCacheSize := flag.Int("transcode-cache-size", 0, "size of the transcode cache in MB (0 = no limit) (optional)") + confTranscodeEjectInterval := flag.Int("transcode-eject-interval", 0, "interval (in minutes) to eject transcode cache (0 = never) (optional)") + flag.Parse() flagconf.ParseEnv() flagconf.ParseConfig(*confConfigPath) @@ -201,6 +204,7 @@ func main() { transcoder := transcode.NewCachingTranscoder( transcode.NewFFmpegTranscoder(), cacheDirAudio, + *confTranscodeCacheSize, ) lastfmClientKeySecretFunc := func() (string, string, error) { @@ -404,6 +408,21 @@ func main() { return nil }) + errgrp.Go(func() error { + if *confTranscodeEjectInterval == 0 || *confTranscodeCacheSize == 0 { + return nil + } + + defer logJob("transcode cache eject")() + + ctxTick(ctx, time.Duration(*confTranscodeEjectInterval)*time.Minute, func() { + if err := transcoder.CacheEject(); err != nil { + log.Printf("error ejecting transcode cache: %v", err) + } + }) + return nil + }) + errgrp.Go(func() error { if *confScanIntervalMins == 0 { return nil diff --git a/contrib/config b/contrib/config index 9031113..f50ed64 100644 --- a/contrib/config +++ b/contrib/config @@ -49,6 +49,10 @@ playlists-path # regenerated. cache-path /var/cache/gonic +# Option to eject least recently used items from transcode cache. +#transcode-cache-size 5000 # in Mb (0 = no limit) +#transcode-eject-interval 1440 # in minutes (0 = never eject) + # Interval (in minutes) to check for new music. Default: don't scan #scan-interval 0 #scan-at-start-enabled false diff --git a/transcode/transcode_test.go b/transcode/transcode_test.go index eecced2..b28b7b6 100644 --- a/transcode/transcode_test.go +++ b/transcode/transcode_test.go @@ -113,7 +113,7 @@ func TestCachingParallelism(t *testing.T) { callback: func() { realTranscodeCount.Add(1) }, } - cacheTranscoder := transcode.NewCachingTranscoder(transcoder, t.TempDir()) + cacheTranscoder := transcode.NewCachingTranscoder(transcoder, t.TempDir(), 1024) var wg sync.WaitGroup for i := 0; i < 5; i++ { diff --git a/transcode/transcoder_caching.go b/transcode/transcoder_caching.go index d402652..b7021e0 100644 --- a/transcode/transcoder_caching.go +++ b/transcode/transcoder_caching.go @@ -5,9 +5,12 @@ import ( "crypto/md5" "fmt" "io" + "io/fs" "os" "path/filepath" + "sort" "sync" + "time" ) const perm = 0o644 @@ -15,16 +18,21 @@ const perm = 0o644 type CachingTranscoder struct { cachePath string transcoder Transcoder + limitMB int locks keyedMutex + cleanLock sync.RWMutex } var _ Transcoder = (*CachingTranscoder)(nil) -func NewCachingTranscoder(t Transcoder, cachePath string) *CachingTranscoder { - return &CachingTranscoder{transcoder: t, cachePath: cachePath} +func NewCachingTranscoder(t Transcoder, cachePath string, limitMB int) *CachingTranscoder { + return &CachingTranscoder{transcoder: t, cachePath: cachePath, limitMB: limitMB} } func (t *CachingTranscoder) Transcode(ctx context.Context, profile Profile, in string, out io.Writer) error { + t.cleanLock.RLock() + defer t.cleanLock.RUnlock() + // don't try cache partial transcodes if profile.Seek() > 0 { return t.transcoder.Transcode(ctx, profile, in, out) @@ -52,6 +60,7 @@ func (t *CachingTranscoder) Transcode(ctx context.Context, profile Profile, in s if i, err := cf.Stat(); err == nil && i.Size() > 0 { _, _ = io.Copy(out, cf) + _ = os.Chtimes(path, time.Now(), time.Now()) // Touch for LRU cache purposes return nil } @@ -64,6 +73,55 @@ func (t *CachingTranscoder) Transcode(ctx context.Context, profile Profile, in s return nil } +func (t *CachingTranscoder) CacheEject() error { + t.cleanLock.Lock() + defer t.cleanLock.Unlock() + + // Delete LRU cache files that exceed size limit. Use last modified time. + type file struct { + path string + info os.FileInfo + } + + var files []file + var total int64 = 0 + + err := filepath.WalkDir(t.cachePath, func(path string, de fs.DirEntry, err error) error { + if err != nil { + return err + } + if !de.IsDir() { + info, err := de.Info() + if err != nil { + return fmt.Errorf("walk cache path for eject: %w", err) + } + files = append(files, file{path, info}) + total += info.Size() + } + return nil + }) + + if err != nil { + return fmt.Errorf("walk cache path for eject: %w", err) + } + + sort.Slice(files, func(i, j int) bool { + return files[i].info.ModTime().Before(files[j].info.ModTime()) + }) + + for total > int64(t.limitMB)*1024*1024 { + curFile := files[0] + files = files[1:] + total -= curFile.info.Size() + err = os.Remove(curFile.path) + if err != nil { + return fmt.Errorf("remove cache file: %w", err) + } + } + + return nil +} + func cacheKey(cmd string, args []string) string { // the cache is invalid whenever transcode command (which includes the // absolute filepath, bit rate args, replay gain args, etc.) changes From ac798ac2d2cdf936b653577d9acd4b7d1e22ecaf Mon Sep 17 00:00:00 2001 From: Nadia Santalla Date: Sun, 15 Sep 2024 16:57:23 +0200 Subject: [PATCH 08/42] fix(playlist): fix non-admin users not being able to create playlists (#524) * fix(playlist): fail early if playlist path is a directory * fix(playlist): check error before assuming playlist loaded --- playlist/playlist.go | 4 ++++ server/ctrlsubsonic/handlers_playlist.go | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/playlist/playlist.go b/playlist/playlist.go index e51dbc1..c3bec6a 100644 --- a/playlist/playlist.go +++ b/playlist/playlist.go @@ -94,6 +94,10 @@ func (s *Store) Read(relPath string) (*Playlist, error) { return nil, fmt.Errorf("stat m3u: %w", err) } + if stat.IsDir() { + return nil, errors.New("path is a directory") + } + var playlist Playlist playlist.UpdatedAt = stat.ModTime() diff --git a/server/ctrlsubsonic/handlers_playlist.go b/server/ctrlsubsonic/handlers_playlist.go index ca0c6e5..8426f8a 100644 --- a/server/ctrlsubsonic/handlers_playlist.go +++ b/server/ctrlsubsonic/handlers_playlist.go @@ -75,8 +75,10 @@ func (c *Controller) ServeCreateOrUpdatePlaylist(r *http.Request) *spec.Response playlistPath := playlistIDDecode(playlistID) var playlist playlistp.Playlist - if pl, _ := c.playlistStore.Read(playlistPath); pl != nil { - playlist = *pl + if playlistPath != "" { + if pl, err := c.playlistStore.Read(playlistPath); err != nil && pl != nil { + playlist = *pl + } } if playlist.UserID != 0 && playlist.UserID != user.ID { From 643ffffa0f5eb3fda589b4224305790111bd1265 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 18 Sep 2024 20:06:45 +0100 Subject: [PATCH 09/42] chore(deps): bump --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index b98219d..4295757 100644 --- a/go.mod +++ b/go.mod @@ -16,18 +16,18 @@ require ( github.com/gorilla/securecookie v1.1.2 github.com/gorilla/sessions v1.4.0 github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414 - github.com/josephburnett/jd v1.8.1 + github.com/josephburnett/jd v1.9.1 github.com/mattn/go-sqlite3 v1.14.23 github.com/mitchellh/mapstructure v1.5.0 github.com/mmcdole/gofeed v1.3.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/philippta/go-template v0.0.0-20220911145045-4556aca435e4 github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be - github.com/sentriz/audiotags v0.0.0-20240713161505-a6bb82b19f54 + github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/stretchr/testify v1.9.0 go.senan.xyz/flagconf v0.1.9 - go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230 + go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7 golang.org/x/net v0.29.0 golang.org/x/sync v0.8.0 gopkg.in/gormigrate.v1 v1.6.0 diff --git a/go.sum b/go.sum index 33a3045..3ecb131 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI= github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/josephburnett/jd v1.8.1 h1:U4wae4kEvduCmf5mlXJ3uKnfHFmGhwttEFkQ6rsoDMk= -github.com/josephburnett/jd v1.8.1/go.mod h1:d9nEP87VBIx8SxhIVraVdEU/IwZ7JH6kHWjZMByRq2M= +github.com/josephburnett/jd v1.9.1 h1:R3PVwhFWFd281E4QRMMeaAo/KFS2T0wXtu/wIy1S0ek= +github.com/josephburnett/jd v1.9.1/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -128,8 +128,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/sentriz/audiotags v0.0.0-20240713161505-a6bb82b19f54 h1:JaJaWCUDLGUbU8AIO+YhQ+Nq4ByCCaApLuHi868uWQw= -github.com/sentriz/audiotags v0.0.0-20240713161505-a6bb82b19f54/go.mod h1:+pmkMFDEXJuu/u4h2OYJVfYF2qIhXJD7kqvWq6q5Zo0= +github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 h1:WCZxu77OR9yzKGZugQC1dHhslXROOJT+UL5JCtJbBq8= +github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6/go.mod h1:+pmkMFDEXJuu/u4h2OYJVfYF2qIhXJD7kqvWq6q5Zo0= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 h1:sLILANWN76ja66/K4k/mBqJuCjDZaM67w+Ru6rEB0s0= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981/go.mod h1:Rx8XB1ck+so+41uu9VY1gMKs1CPQ2NTq0pzf+OCCQHo= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= @@ -141,8 +141,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= -go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230 h1:Peeh4dn9T9YD3wFR4ocef74/2GRCRCqRz/Mx8sO9VPw= -go.senan.xyz/wrtag v0.0.0-20240913105114-298b03ad8230/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= +go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7 h1:3iNed1fsOJAvdiGtE9FKqctnavizPTaeNKNcdT/tZ7I= +go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= From aef5f920d24c57bc5b652891409926ff98458aa0 Mon Sep 17 00:00:00 2001 From: Chad Clark Date: Sat, 16 Nov 2024 07:41:40 -0700 Subject: [PATCH 10/42] fix(podcast): gracefully handle no podcast cover URL (#547) * fix(podcast): nil pointer when podcast has no image * don't download empty cover string --------- Co-authored-by: sentriz --- podcast/podcast.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/podcast/podcast.go b/podcast/podcast.go index 0cf3732..4679c3b 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -82,11 +82,14 @@ func (p *Podcasts) AddNewPodcast(rssURL string, feed *gofeed.Feed) (*db.Podcast, } podcast := db.Podcast{ Description: feed.Description, - ImageURL: feed.Image.URL, + ImageURL: "", Title: feed.Title, URL: rssURL, RootDir: rootDir, } + if feed.Image != nil { + podcast.ImageURL = feed.Image.URL + } if err := os.Mkdir(podcast.RootDir, 0o755); err != nil && !os.IsExist(err) { return nil, err } @@ -316,6 +319,10 @@ func getPodcastEpisodeFilename(podcast *db.Podcast, podcastEpisode *db.PodcastEp } func (p *Podcasts) downloadPodcastCover(podcast *db.Podcast) error { + if podcast.ImageURL == "" { + return nil + } + imageURL, err := url.Parse(podcast.ImageURL) if err != nil { return fmt.Errorf("parse image url: %w", err) From ddf3b574e39609f68516b1551e0e4020cb57adbc Mon Sep 17 00:00:00 2001 From: sentriz Date: Sun, 5 Jan 2025 19:44:51 +0000 Subject: [PATCH 11/42] docs: tested with termsonic closes #553 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6cafaca..508e175 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ - support for the [album-artist](https://mkoby.com/2007/02/18/artist-versus-album-artist/) tag, to not clutter your artist list with compilation album appearances - written in [go](https://golang.org/), so lightweight and suitable for a raspberry pi, etc. (see ARM images below) - newer salt and token auth -- tested on [airsonic-refix](https://github.com/tamland/airsonic-refix), [symfonium](https://symfonium.app), [dsub](https://f-droid.org/en/packages/github.daneren2005.dsub/), [jamstash](http://jamstash.com/), [subsonic.el](https://git.sr.ht/~amk/subsonic.el), [sublime music](https://github.com/sublime-music/sublime-music), [soundwaves](https://apps.apple.com/us/app/soundwaves/id736139596), [stmp](https://github.com/wildeyedskies/stmp), [strawberry](https://www.strawberrymusicplayer.org/), and [ultrasonic](https://gitlab.com/ultrasonic/ultrasonic) +- tested on [airsonic-refix](https://github.com/tamland/airsonic-refix), [symfonium](https://symfonium.app), [dsub](https://f-droid.org/en/packages/github.daneren2005.dsub/), [jamstash](http://jamstash.com/), [subsonic.el](https://git.sr.ht/~amk/subsonic.el), [sublime music](https://github.com/sublime-music/sublime-music), [soundwaves](https://apps.apple.com/us/app/soundwaves/id736139596), [stmp](https://github.com/wildeyedskies/stmp), [termsonic](https://git.sixfoisneuf.fr/termsonic/), [strawberry](https://www.strawberrymusicplayer.org/), and [ultrasonic](https://gitlab.com/ultrasonic/ultrasonic) ## installation From 1c2377189da75c78831955953f25dd09b3cb7bb2 Mon Sep 17 00:00:00 2001 From: sentriz Date: Sun, 5 Jan 2025 19:48:42 +0000 Subject: [PATCH 12/42] fix(ci): use new sqlite package name --- .github/workflows/nightly-release.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index acf7cd9..56c2bae 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | sudo apt update -qq - sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev + sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint uses: golangci/golangci-lint-action@v6 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a5987b..bb9ffe8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - name: Install dependencies run: | sudo apt update -qq - sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev + sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint uses: golangci/golangci-lint-action@v6 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a186d19..9935a02 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | sudo apt update -qq - sudo apt install -y -qq build-essential git sqlite libtag1-dev ffmpeg mpv zlib1g-dev + sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint uses: golangci/golangci-lint-action@v6 with: From c222ecb45cec5282e0ef892db21eb32632a0145d Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 15 Jan 2025 20:06:04 +0000 Subject: [PATCH 13/42] feat(podcast): download most recent episode when switching to download recent mode closes #557 --- podcast/podcast.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/podcast/podcast.go b/podcast/podcast.go index 4679c3b..59786c9 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -118,6 +118,26 @@ func (p *Podcasts) SetAutoDownload(podcastID int, setting db.PodcastAutoDownload if err := p.db.Save(&podcast).Error; err != nil { return fmt.Errorf("save setting: %w", err) } + + // download most recent + if setting == db.PodcastAutoDownloadLatest { + err := p.db. + Model(db.PodcastEpisode{}). + Where("status=?", db.PodcastEpisodeStatusSkipped). + Where("id=?", p.db. + Select("id"). + Model(db.PodcastEpisode{}). + Where("podcast_id=?", podcast.ID). + Order("publish_date DESC"). + Limit(1). + SubQuery(), + ). + Update("status", db.PodcastEpisodeStatusDownloading). + Error + if err != nil { + return fmt.Errorf("update podcast most recent episode: %w", err) + } + } return nil } @@ -462,11 +482,13 @@ func (p *Podcasts) DownloadTick() error { return nil } + log.Printf("starting podcast episode download %q - %q", podcastEpisode.Podcast.Title, podcastEpisode.Title) + if err := p.doPodcastDownload(podcastEpisode.Podcast, &podcastEpisode); err != nil { return fmt.Errorf("do download: %w", err) } - log.Printf("downloaded podcast episode %q - %q", podcastEpisode.Podcast.Title, podcastEpisode.Title) + log.Printf("downloaded podcast episode") return nil } From 718686a93a4341c5b5ccb113a0ed7ae95c0524b4 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 15 Jan 2025 20:26:55 +0000 Subject: [PATCH 14/42] fix(adminui): resolve reverse proxy paths for fonts fixes #543 --- server/ctrladmin/adminui/components.tmpl | 18 ++++++++++++++++++ server/ctrladmin/adminui/static/style.css | 2 +- server/ctrladmin/adminui/style.css | 18 ------------------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/server/ctrladmin/adminui/components.tmpl b/server/ctrladmin/adminui/components.tmpl index af529bf..e7c343b 100644 --- a/server/ctrladmin/adminui/components.tmpl +++ b/server/ctrladmin/adminui/components.tmpl @@ -39,6 +39,24 @@ gonic + diff --git a/server/ctrladmin/adminui/static/style.css b/server/ctrladmin/adminui/static/style.css index 46d6667..847f999 100644 --- a/server/ctrladmin/adminui/static/style.css +++ b/server/ctrladmin/adminui/static/style.css @@ -1 +1 @@ -/*! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:Inconsolata,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }form,input,select{all:unset;-webkit-appearance:none;-moz-appearance:none;appearance:none;display:block}a{text-decoration:none}@font-face{font-family:Inconsolata;font-style:normal;font-weight:500;src:local(""),url(/admin/static/inconsolata-v31-latin-500.woff2) format("woff2"),url(/admin/static/inconsolata-v31-latin-500.woff) format("woff")}@font-face{font-family:Inconsolata;font-style:normal;font-weight:600;src:local(""),url(/admin/static/inconsolata-v31-latin-600.woff2) format("woff2"),url(/admin/static/inconsolata-v31-latin-600.woff) format("woff")}.container{width:100%}@media (min-width:100%){.container{max-width:100%}}@media (min-width:870px){.container{max-width:870px}}.pointer-events-auto{pointer-events:auto}.absolute{position:absolute}.relative{position:relative}.col-span-3{grid-column:span 3/span 3}.col-span-full{grid-column:1/-1}.col-span-2{grid-column:span 2/span 2}.col-auto{grid-column:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mt-3{margin-top:.75rem}.ml-auto{margin-left:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1/1}.h-\[8rem\]{height:8rem}.w-4{width:1rem}.w-\[400px\]{width:400px}.w-full{width:100%}.w-5{width:1.25rem}.w-\[8rem\]{width:8rem}.min-w-min{min-width:-moz-min-content;min-width:min-content}.max-w-\[700px\]{max-width:700px}.grid-cols-\[auto_min-content\]{grid-template-columns:auto min-content}.grid-cols-\[repeat\(3\2c auto\)_max-content\]{grid-template-columns:repeat(3,auto) max-content}.grid-cols-\[1fr\2c auto\]{grid-template-columns:1fr auto}.grid-cols-\[1fr_1fr_auto\]{grid-template-columns:1fr 1fr auto}.grid-cols-\[auto_auto_min-content\]{grid-template-columns:auto auto min-content}.grid-cols-\[1fr_1fr_min-content_min-content\]{grid-template-columns:1fr 1fr min-content min-content}.grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-items-end{justify-items:end}.gap-2{gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-2{row-gap:.5rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem*var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem*var(--tw-space-y-reverse))}.whitespace-nowrap{white-space:nowrap}.border-b-2{border-bottom-width:2px}.border-r-2{border-right-width:2px}.border-gray-300\/80{border-color:#d1d5dbcc}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-gray-900\/30{background-color:#1118274d}.bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:Inconsolata,monospace}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.leading-4{line-height:1rem}.text-gray-500\/80{color:#6b7280cc}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.opacity-0{opacity:0}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}a{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}input[type],select{box-sizing:border-box;height:1.5rem;width:100%;min-width:3rem;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-width:0;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding-left:.5rem;padding-right:.5rem;line-height:1.5;--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);outline-style:solid;outline-width:1px;outline-color:#9ca3af80}@media (min-width:870px){input[type],select{min-width:8rem}}input[type=button],input[type=submit]{width:6rem;text-align:center;font-weight:700}@media (min-width:870px){input[type=button],input[type=submit]{width:8rem}}.ellipsis{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (min-width:870px){.md\:col-auto{grid-column:auto}.md\:col-span-2{grid-column:span 2/span 2}.md\:col-start-2{grid-column-start:2}.md\:block{display:block}.md\:inline{display:inline}.md\:contents{display:contents}.md\:grid-cols-\[auto_repeat\(5\2c min-content\)\]{grid-template-columns:auto repeat(5,min-content)}.md\:grid-cols-\[5fr_3fr_auto_auto\]{grid-template-columns:5fr 3fr auto auto}.md\:grid-cols-\[1fr_1fr_1fr_auto_auto\]{grid-template-columns:1fr 1fr 1fr auto auto}.md\:grid-cols-\[auto_repeat\(3\2c min-content\)\]{grid-template-columns:auto repeat(3,min-content)}.md\:flex-row{flex-direction:row}} \ No newline at end of file +/*! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:Inconsolata,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }form,input,select{all:unset;-webkit-appearance:none;-moz-appearance:none;appearance:none;display:block}a{text-decoration:none}.container{width:100%}@media (min-width:100%){.container{max-width:100%}}@media (min-width:870px){.container{max-width:870px}}.pointer-events-auto{pointer-events:auto}.absolute{position:absolute}.relative{position:relative}.col-span-3{grid-column:span 3/span 3}.col-span-full{grid-column:1/-1}.col-span-2{grid-column:span 2/span 2}.col-auto{grid-column:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mt-3{margin-top:.75rem}.ml-auto{margin-left:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1/1}.h-\[8rem\]{height:8rem}.w-4{width:1rem}.w-\[400px\]{width:400px}.w-full{width:100%}.w-5{width:1.25rem}.w-\[8rem\]{width:8rem}.min-w-min{min-width:-moz-min-content;min-width:min-content}.max-w-\[700px\]{max-width:700px}.grid-cols-\[auto_min-content\]{grid-template-columns:auto min-content}.grid-cols-\[repeat\(3\2c auto\)_max-content\]{grid-template-columns:repeat(3,auto) max-content}.grid-cols-\[1fr\2c auto\]{grid-template-columns:1fr auto}.grid-cols-\[1fr_1fr_auto\]{grid-template-columns:1fr 1fr auto}.grid-cols-\[auto_auto_min-content\]{grid-template-columns:auto auto min-content}.grid-cols-\[1fr_1fr_min-content_min-content\]{grid-template-columns:1fr 1fr min-content min-content}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-items-end{justify-items:end}.gap-2{gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-2{row-gap:.5rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem*var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem*var(--tw-space-y-reverse))}.whitespace-nowrap{white-space:nowrap}.border-b-2{border-bottom-width:2px}.border-r-2{border-right-width:2px}.border-gray-300\/80{border-color:#d1d5dbcc}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-gray-900\/30{background-color:#1118274d}.bg-green-200{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:Inconsolata,monospace}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.leading-4{line-height:1rem}.text-gray-500\/80{color:#6b7280cc}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.opacity-0{opacity:0}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}a{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}input[type],select{box-sizing:border-box;height:1.5rem;width:100%;min-width:3rem;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-width:0;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding-left:.5rem;padding-right:.5rem;line-height:1.5;--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);outline-style:solid;outline-width:1px;outline-color:#9ca3af80}@media (min-width:870px){input[type],select{min-width:8rem}}input[type=button],input[type=submit]{width:6rem;text-align:center;font-weight:700}@media (min-width:870px){input[type=button],input[type=submit]{width:8rem}}.ellipsis{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (min-width:870px){.md\:col-auto{grid-column:auto}.md\:col-span-2{grid-column:span 2/span 2}.md\:col-start-2{grid-column-start:2}.md\:inline{display:inline}.md\:contents{display:contents}.md\:grid-cols-\[auto_repeat\(5\2c min-content\)\]{grid-template-columns:auto repeat(5,min-content)}.md\:grid-cols-\[5fr_3fr_auto_auto\]{grid-template-columns:5fr 3fr auto auto}.md\:grid-cols-\[1fr_1fr_1fr_auto_auto\]{grid-template-columns:1fr 1fr 1fr auto auto}.md\:flex-row{flex-direction:row}} \ No newline at end of file diff --git a/server/ctrladmin/adminui/style.css b/server/ctrladmin/adminui/style.css index b64b7ed..81d900d 100644 --- a/server/ctrladmin/adminui/style.css +++ b/server/ctrladmin/adminui/style.css @@ -12,24 +12,6 @@ a { text-decoration: none; } -@font-face { - font-family: "Inconsolata"; - font-style: normal; - font-weight: 500; - src: local(""), - url("/admin/static/inconsolata-v31-latin-500.woff2") format("woff2"), - url("/admin/static/inconsolata-v31-latin-500.woff") format("woff"); -} - -@font-face { - font-family: "Inconsolata"; - font-style: normal; - font-weight: 600; - src: local(""), - url("/admin/static/inconsolata-v31-latin-600.woff2") format("woff2"), - url("/admin/static/inconsolata-v31-latin-600.woff") format("woff"); -} - @tailwind components; @tailwind utilities; From 018343dc32fd89685ca3eb80ceb3116615a6cbec Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 15 Jan 2025 20:34:26 +0000 Subject: [PATCH 15/42] feat(db): add a covering index on tracks (album_id, length) closes #508 Co-authored-by: Artem Tarasov --- db/migrations.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/db/migrations.go b/db/migrations.go index 447bfdf..b532bfa 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -73,6 +73,8 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202311082304", migrateTemporaryDisplayAlbumArtist), construct(ctx, "202312110003", migrateAddExtraIndexes), construct(ctx, "202405301140", migrateAddReplayGainFields), + construct(ctx, "202501152035", migrateTrackAddIndexOnAlbumID), + construct(ctx, "202501152036", migrateAlbumAddIndexOnParentID), } return gormigrate. @@ -818,3 +820,15 @@ func migrateAddExtraIndexes(tx *gorm.DB, _ MigrationContext) error { func migrateAddReplayGainFields(tx *gorm.DB, _ MigrationContext) error { return tx.AutoMigrate(Track{}).Error } + +func migrateTrackAddIndexOnAlbumID(tx *gorm.DB, _ MigrationContext) error { + return tx.Exec(` + CREATE INDEX idx_tracks_album_id ON "tracks" (album_id, length); + `).Error +} + +func migrateAlbumAddIndexOnParentID(tx *gorm.DB, _ MigrationContext) error { + return tx.Exec(` + CREATE INDEX idx_albums_parent_id ON "albums" (parent_id); + `).Error +} From 5c7d065fd7513f66604d78409859c4028ca9ad70 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 4 Feb 2025 16:51:18 +0000 Subject: [PATCH 16/42] feat(lastfm): paginate loved tracks --- lastfm/client.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lastfm/client.go b/lastfm/client.go index 6cf3d97..dbe07a7 100644 --- a/lastfm/client.go +++ b/lastfm/client.go @@ -148,13 +148,31 @@ func (c *Client) UserGetLovedTracks(userName string) (LovedTracks, error) { params.Add("method", "user.getLovedTracks") params.Add("api_key", apiKey) params.Add("user", userName) - params.Add("limit", "1000") // TODO: paginate - resp, err := c.makeRequest(http.MethodGet, params) - if err != nil { - return LovedTracks{}, fmt.Errorf("making user get loved tracks GET: %w", err) + var ( + page = 1 + limit = 1000 + ) + + var loved LovedTracks + for { + params.Set("page", fmt.Sprint(page)) + params.Set("limit", fmt.Sprint(limit)) + + resp, err := c.makeRequest(http.MethodGet, params) + if err != nil { + return LovedTracks{}, fmt.Errorf("making user get loved tracks GET: %w", err) + } + + loved.Tracks = append(loved.Tracks, resp.LovedTracks.Tracks...) + if len(resp.LovedTracks.Tracks) < limit { + break + } + + page++ } - return resp.LovedTracks, nil + + return loved, nil } func (c *Client) GetSession(token string) (string, error) { From 39df00ef8f683a846efd0da7480c3db6d928d2c4 Mon Sep 17 00:00:00 2001 From: mikuta0407 Date: Sat, 15 Feb 2025 16:15:14 +0000 Subject: [PATCH 17/42] fix(subsonic): order some browse-by-tag responses closes #512 --- server/ctrlsubsonic/handlers_by_folder.go | 3 +++ server/ctrlsubsonic/spec/construct_by_folder.go | 1 + .../testdata/test_get_music_directory_without_tracks | 3 +++ server/ctrlsubsonic/testdata/test_search_two_q_alb | 9 +++++++++ 4 files changed, 16 insertions(+) diff --git a/server/ctrlsubsonic/handlers_by_folder.go b/server/ctrlsubsonic/handlers_by_folder.go index 2f20017..2b3d85f 100644 --- a/server/ctrlsubsonic/handlers_by_folder.go +++ b/server/ctrlsubsonic/handlers_by_folder.go @@ -80,11 +80,13 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response { Where("parent_id=?", id.Value). Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID). + Order("tag_year"). Order("albums.right_path COLLATE NOCASE"). Find(&childFolders) for _, ch := range childFolders { childrenObj = append(childrenObj, spec.NewTCAlbumByFolder(ch)) } + // start looking for child childTracks in the current dir var childTracks []*db.Track c.dbc. @@ -94,6 +96,7 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response { Preload("Artists"). Preload("TrackStar", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID). + Order("tag_track_number"). Order("filename"). Find(&childTracks) diff --git a/server/ctrlsubsonic/spec/construct_by_folder.go b/server/ctrlsubsonic/spec/construct_by_folder.go index f8f35d3..c39b695 100644 --- a/server/ctrlsubsonic/spec/construct_by_folder.go +++ b/server/ctrlsubsonic/spec/construct_by_folder.go @@ -40,6 +40,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild { ParentID: f.ParentSID(), CreatedAt: f.CreatedAt, AverageRating: formatRating(f.AverageRating), + Year: f.TagYear, } if f.AlbumStar != nil { trCh.Starred = &f.AlbumStar.StarDate diff --git a/server/ctrlsubsonic/testdata/test_get_music_directory_without_tracks b/server/ctrlsubsonic/testdata/test_get_music_directory_without_tracks index b4a9721..83b3b0e 100644 --- a/server/ctrlsubsonic/testdata/test_get_music_directory_without_tracks +++ b/server/ctrlsubsonic/testdata/test_get_music_directory_without_tracks @@ -23,6 +23,7 @@ "isVideo": false, "parent": "al-2", "title": "album-0", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -39,6 +40,7 @@ "isVideo": false, "parent": "al-2", "title": "album-1", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -55,6 +57,7 @@ "isVideo": false, "parent": "al-2", "title": "album-2", + "year": 2021, "musicBrainzId": "", "replayGain": null } diff --git a/server/ctrlsubsonic/testdata/test_search_two_q_alb b/server/ctrlsubsonic/testdata/test_search_two_q_alb index 3c449b6..9f1dfa0 100644 --- a/server/ctrlsubsonic/testdata/test_search_two_q_alb +++ b/server/ctrlsubsonic/testdata/test_search_two_q_alb @@ -20,6 +20,7 @@ "isVideo": false, "parent": "al-2", "title": "album-0", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -36,6 +37,7 @@ "isVideo": false, "parent": "al-2", "title": "album-1", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -52,6 +54,7 @@ "isVideo": false, "parent": "al-2", "title": "album-2", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -68,6 +71,7 @@ "isVideo": false, "parent": "al-6", "title": "album-0", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -84,6 +88,7 @@ "isVideo": false, "parent": "al-6", "title": "album-1", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -100,6 +105,7 @@ "isVideo": false, "parent": "al-6", "title": "album-2", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -116,6 +122,7 @@ "isVideo": false, "parent": "al-10", "title": "album-0", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -132,6 +139,7 @@ "isVideo": false, "parent": "al-10", "title": "album-1", + "year": 2021, "musicBrainzId": "", "replayGain": null }, @@ -148,6 +156,7 @@ "isVideo": false, "parent": "al-10", "title": "album-2", + "year": 2021, "musicBrainzId": "", "replayGain": null } From e5f7ef3c86d6a52709336f2dd2d428203e7d9472 Mon Sep 17 00:00:00 2001 From: sentriz Date: Sun, 23 Mar 2025 14:07:33 +0000 Subject: [PATCH 18/42] fix(ci): update .golangci.yml exclude config --- .golangci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 770413e..8f1abde 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,3 @@ -run: - skip-dirs: - - server/assets - skip-dirs-use-default: true - linters: disable-all: true enable: @@ -90,3 +85,6 @@ issues: - text: "should rewrite switch" linters: - gocritic + exclude-dirs: + - server/assets + exclude-dirs-use-default: true From 63a420d2d32b006a92b3aa5d97bc39ad49fc8155 Mon Sep 17 00:00:00 2001 From: Vijay Dubb <13175331+VD39@users.noreply.github.com> Date: Mon, 24 Mar 2025 14:43:06 +0100 Subject: [PATCH 19/42] feat(subsonic): support more podcast metadata and podcast bookmarks (#569) * Migrate podcast episodes database entries. * Expose album, artist, and image for podcast episodes. * Update bookmarks to show podcast episodes. * Fix lint error. * Remove OriginalImageURL field. --- db/db.go | 2 + db/migrations.go | 7 ++++ podcast/podcast.go | 21 +++++----- server/ctrlsubsonic/handlers_bookmark.go | 12 ++++++ .../ctrlsubsonic/spec/construct_by_folder.go | 5 ++- server/ctrlsubsonic/spec/construct_podcast.go | 2 + server/ctrlsubsonic/spec/spec.go | 38 ++++++++++--------- 7 files changed, 58 insertions(+), 29 deletions(-) diff --git a/db/db.go b/db/db.go index ab5a948..7879867 100644 --- a/db/db.go +++ b/db/db.go @@ -508,6 +508,8 @@ type PodcastEpisode struct { Status PodcastEpisodeStatus Error string Podcast *Podcast + Artist string + Album string } func (pe *PodcastEpisode) AudioLength() int { return pe.Length } diff --git a/db/migrations.go b/db/migrations.go index b532bfa..f702cba 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -75,6 +75,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202405301140", migrateAddReplayGainFields), construct(ctx, "202501152035", migrateTrackAddIndexOnAlbumID), construct(ctx, "202501152036", migrateAlbumAddIndexOnParentID), + construct(ctx, "202502012036", migratePodcastEpisode), } return gormigrate. @@ -832,3 +833,9 @@ func migrateAlbumAddIndexOnParentID(tx *gorm.DB, _ MigrationContext) error { CREATE INDEX idx_albums_parent_id ON "albums" (parent_id); `).Error } + +func migratePodcastEpisode(tx *gorm.DB, _ MigrationContext) error { + return tx.AutoMigrate( + PodcastEpisode{}, + ).Error +} diff --git a/podcast/podcast.go b/podcast/podcast.go index 59786c9..f8ec692 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -169,7 +169,7 @@ func (p *Podcasts) RefreshPodcast(podcast *db.Podcast, items []*gofeed.Item) err var episodeErrs []error for _, item := range items { - podcastEpisode, err := p.addEpisode(podcast.ID, item) + podcastEpisode, err := p.addEpisode(podcast.ID, item, podcast.Title) if err != nil { episodeErrs = append(episodeErrs, err) continue @@ -186,7 +186,7 @@ func (p *Podcasts) RefreshPodcast(podcast *db.Podcast, items []*gofeed.Item) err return errors.Join(episodeErrs...) } -func (p *Podcasts) addEpisode(podcastID int, item *gofeed.Item) (*db.PodcastEpisode, error) { +func (p *Podcasts) addEpisode(podcastID int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, error) { var duration int // if it has the media extension use it for _, content := range item.Extensions["media"]["content"] { @@ -200,14 +200,13 @@ func (p *Podcasts) addEpisode(podcastID int, item *gofeed.Item) (*db.PodcastEpis if duration == 0 && item.ITunesExt != nil { duration = getSecondsFromString(item.ITunesExt.Duration) } - - if episode, ok := p.findEnclosureAudio(podcastID, duration, item); ok { + if episode, ok := p.findEnclosureAudio(podcastID, duration, item, podcastTitle); ok { if err := p.db.Save(episode).Error; err != nil { return nil, err } return episode, nil } - if episode, ok := p.findMediaAudio(podcastID, duration, item); ok { + if episode, ok := p.findMediaAudio(podcastID, duration, item, podcastTitle); ok { if err := p.db.Save(episode).Error; err != nil { return nil, err } @@ -224,7 +223,7 @@ func (p *Podcasts) isAudio(rawItemURL string) (bool, error) { return p.tagReader.CanRead(itemURL.Path), nil } -func itemToEpisode(podcastID, size, duration int, audio string, item *gofeed.Item) *db.PodcastEpisode { +func itemToEpisode(podcastID, size, duration int, audio string, item *gofeed.Item, podcastTitle string) *db.PodcastEpisode { return &db.PodcastEpisode{ PodcastID: podcastID, Description: item.Description, @@ -234,21 +233,23 @@ func itemToEpisode(podcastID, size, duration int, audio string, item *gofeed.Ite PublishDate: item.PublishedParsed, AudioURL: audio, Status: db.PodcastEpisodeStatusSkipped, + Artist: item.ITunesExt.Author, + Album: podcastTitle, } } -func (p *Podcasts) findEnclosureAudio(podcastID, duration int, item *gofeed.Item) (*db.PodcastEpisode, bool) { +func (p *Podcasts) findEnclosureAudio(podcastID, duration int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, bool) { for _, enc := range item.Enclosures { if t, err := p.isAudio(enc.URL); !t || err != nil { continue } size, _ := strconv.Atoi(enc.Length) - return itemToEpisode(podcastID, size, duration, enc.URL, item), true + return itemToEpisode(podcastID, size, duration, enc.URL, item, podcastTitle), true } return nil, false } -func (p *Podcasts) findMediaAudio(podcastID, duration int, item *gofeed.Item) (*db.PodcastEpisode, bool) { +func (p *Podcasts) findMediaAudio(podcastID, duration int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, bool) { extensions, ok := item.Extensions["media"]["content"] if !ok { return nil, false @@ -257,7 +258,7 @@ func (p *Podcasts) findMediaAudio(podcastID, duration int, item *gofeed.Item) (* if t, err := p.isAudio(ext.Attrs["url"]); !t || err != nil { continue } - return itemToEpisode(podcastID, 0, duration, ext.Attrs["url"], item), true + return itemToEpisode(podcastID, 0, duration, ext.Attrs["url"], item, podcastTitle), true } return nil, false } diff --git a/server/ctrlsubsonic/handlers_bookmark.go b/server/ctrlsubsonic/handlers_bookmark.go index 7c6822b..d1e4464 100644 --- a/server/ctrlsubsonic/handlers_bookmark.go +++ b/server/ctrlsubsonic/handlers_bookmark.go @@ -48,6 +48,18 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response { return spec.NewError(10, "finding entry: %v", err) } respBookmark.Entry = spec.NewTrackByTags(&track, track.Album) + case specid.PodcastEpisode: + var podcastEpisode db.PodcastEpisode + err := c.dbc. + Preload("Podcast"). + Find(&podcastEpisode, "id=?", bookmark.EntryID). + Error + if err != nil { + return spec.NewError(10, "finding entry: %v", err) + } + respBookmark.Entry = spec.NewTCPodcastEpisode(&podcastEpisode) + default: + continue } sub.Bookmarks.List = append(sub.Bookmarks.List, respBookmark) diff --git a/server/ctrlsubsonic/spec/construct_by_folder.go b/server/ctrlsubsonic/spec/construct_by_folder.go index c39b695..a720f18 100644 --- a/server/ctrlsubsonic/spec/construct_by_folder.go +++ b/server/ctrlsubsonic/spec/construct_by_folder.go @@ -127,6 +127,9 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild { IsDir: false, Type: "podcastepisode", CreatedAt: pe.CreatedAt, + Album: pe.Album, + Artist: pe.Artist, + CoverID: pe.SID(), } if pe.Podcast != nil { trCh.ParentID = pe.Podcast.SID() @@ -136,7 +139,7 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild { } func NewArtistByFolder(f *db.Album) *Artist { - // the db is structued around "browse by tags", and where + // the db is structured around "browse by tags", and where // an album is also a folder. so we're constructing an artist // from an "album" where // maybe TODO: rename the Album model to Folder diff --git a/server/ctrlsubsonic/spec/construct_podcast.go b/server/ctrlsubsonic/spec/construct_podcast.go index bff2555..88e9164 100644 --- a/server/ctrlsubsonic/spec/construct_podcast.go +++ b/server/ctrlsubsonic/spec/construct_podcast.go @@ -42,6 +42,8 @@ func NewPodcastEpisode(pe *db.PodcastEpisode) *PodcastEpisode { BitRate: pe.Bitrate, IsDir: false, Size: pe.Size, + Album: pe.Album, + Artist: pe.Artist, } if pe.Podcast != nil { r.Path = pe.AbsPath() diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index 48055b0..aa5bf95 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -394,24 +394,26 @@ type PodcastChannel struct { } type PodcastEpisode struct { - ID *specid.ID `xml:"id,attr" json:"id"` - StreamID *specid.ID `xml:"streamId,attr" json:"streamId"` - ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"` - Title string `xml:"title,attr" json:"title"` - Description string `xml:"description,attr" json:"description"` - PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"` - Status string `xml:"status,attr" json:"status"` - Parent string `xml:"parent,attr" json:"parent"` - IsDir bool `xml:"isDir,attr" json:"isDir"` - Year int `xml:"year,attr" json:"year"` - Genre string `xml:"genre,attr" json:"genre"` - CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"` - Size int `xml:"size,attr" json:"size"` - ContentType string `xml:"contentType,attr" json:"contentType"` - Suffix string `xml:"suffix,attr" json:"suffix"` - Duration int `xml:"duration,attr" json:"duration"` - BitRate int `xml:"bitRate,attr" json:"bitrate"` - Path string `xml:"path,attr" json:"path"` + ID *specid.ID `xml:"id,attr" json:"id"` + StreamID *specid.ID `xml:"streamId,attr" json:"streamId"` + ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"` + Title string `xml:"title,attr" json:"title"` + Description string `xml:"description,attr" json:"description"` + PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"` + Status string `xml:"status,attr" json:"status"` + Parent string `xml:"parent,attr" json:"parent"` + IsDir bool `xml:"isDir,attr" json:"isDir"` + Year int `xml:"year,attr" json:"year"` + Genre string `xml:"genre,attr" json:"genre"` + CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"` + Size int `xml:"size,attr" json:"size"` + ContentType string `xml:"contentType,attr" json:"contentType"` + Suffix string `xml:"suffix,attr" json:"suffix"` + Duration int `xml:"duration,attr" json:"duration"` + BitRate int `xml:"bitRate,attr" json:"bitrate"` + Path string `xml:"path,attr" json:"path"` + Album string `xml:"album,attr" json:"album"` + Artist string `xml:"artist,attr" json:"artist"` } type Bookmarks struct { From 3252884414baa4b50f014bdda0da22d777db0367 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Thu, 27 Mar 2025 07:50:03 -0300 Subject: [PATCH 20/42] fix transcoding typos (#573) This fixes a typo on a log message, and another on a function name. --- server/ctrlsubsonic/handlers_raw.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/ctrlsubsonic/handlers_raw.go b/server/ctrlsubsonic/handlers_raw.go index 19e72e0..fd19fd8 100644 --- a/server/ctrlsubsonic/handlers_raw.go +++ b/server/ctrlsubsonic/handlers_raw.go @@ -194,7 +194,7 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R } client, _ := params.Get("c") - pref, err := streamGetTransodePreference(c.dbc, user.ID, client) + pref, err := streamGetTranscodePreference(c.dbc, user.ID, client) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return spec.NewError(0, "couldn't find transcode preference: %v", err) } @@ -224,7 +224,7 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R profile = transcode.WithSeek(profile, time.Second*time.Duration(timeOffset)) } - log.Printf("trancoding to %q with at bitrate %d", profile.MIME(), profile.BitRate()) + log.Printf("transcoding to %q with at bitrate %d", profile.MIME(), profile.BitRate()) w.Header().Set("Content-Type", profile.MIME()) if err := c.transcoder.Transcode(r.Context(), profile, file.AbsPath(), w); err != nil && !errors.Is(err, transcode.ErrFFmpegKilled) { @@ -252,7 +252,7 @@ func (c *Controller) ServeGetAvatar(w http.ResponseWriter, r *http.Request) *spe return nil } -func streamGetTransodePreference(dbc *db.DB, userID int, client string) (*db.TranscodePreference, error) { +func streamGetTranscodePreference(dbc *db.DB, userID int, client string) (*db.TranscodePreference, error) { var pref db.TranscodePreference err := dbc. Where("user_id=?", userID). @@ -270,7 +270,7 @@ func streamGetTransodePreference(dbc *db.DB, userID int, client string) (*db.Tra } func streamGetTranscodeMeta(dbc *db.DB, userID int, client string) spec.TranscodeMeta { - pref, _ := streamGetTransodePreference(dbc, userID, client) + pref, _ := streamGetTranscodePreference(dbc, userID, client) if pref == nil { return spec.TranscodeMeta{} } From 19b707c5d4081242825704eed764c257e6161865 Mon Sep 17 00:00:00 2001 From: Vijay Dubb <13175331+VD39@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:04:58 +0200 Subject: [PATCH 21/42] feat(podcast): use podcast author if episode author is not defined (#574) * Use podcast author if episode author is not defined. * Address feedback. --- db/db.go | 1 + db/migrations.go | 1 + podcast/podcast.go | 26 ++++++++++++++------------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/db/db.go b/db/db.go index 7879867..f78e27e 100644 --- a/db/db.go +++ b/db/db.go @@ -475,6 +475,7 @@ type Podcast struct { Episodes []*PodcastEpisode AutoDownload PodcastAutoDownload RootDir string + Author string } func (p *Podcast) SID() *specid.ID { diff --git a/db/migrations.go b/db/migrations.go index f702cba..1105898 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -76,6 +76,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202501152035", migrateTrackAddIndexOnAlbumID), construct(ctx, "202501152036", migrateAlbumAddIndexOnParentID), construct(ctx, "202502012036", migratePodcastEpisode), + construct(ctx, "202504132036", migratePodcast), } return gormigrate. diff --git a/podcast/podcast.go b/podcast/podcast.go index f8ec692..9b2d541 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -1,6 +1,7 @@ package podcast import ( + "cmp" "errors" "fmt" "io" @@ -86,6 +87,7 @@ func (p *Podcasts) AddNewPodcast(rssURL string, feed *gofeed.Feed) (*db.Podcast, Title: feed.Title, URL: rssURL, RootDir: rootDir, + Author: feed.ITunesExt.Author, } if feed.Image != nil { podcast.ImageURL = feed.Image.URL @@ -169,7 +171,7 @@ func (p *Podcasts) RefreshPodcast(podcast *db.Podcast, items []*gofeed.Item) err var episodeErrs []error for _, item := range items { - podcastEpisode, err := p.addEpisode(podcast.ID, item, podcast.Title) + podcastEpisode, err := p.addEpisode(podcast, item) if err != nil { episodeErrs = append(episodeErrs, err) continue @@ -186,7 +188,7 @@ func (p *Podcasts) RefreshPodcast(podcast *db.Podcast, items []*gofeed.Item) err return errors.Join(episodeErrs...) } -func (p *Podcasts) addEpisode(podcastID int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, error) { +func (p *Podcasts) addEpisode(podcast *db.Podcast, item *gofeed.Item) (*db.PodcastEpisode, error) { var duration int // if it has the media extension use it for _, content := range item.Extensions["media"]["content"] { @@ -200,13 +202,13 @@ func (p *Podcasts) addEpisode(podcastID int, item *gofeed.Item, podcastTitle str if duration == 0 && item.ITunesExt != nil { duration = getSecondsFromString(item.ITunesExt.Duration) } - if episode, ok := p.findEnclosureAudio(podcastID, duration, item, podcastTitle); ok { + if episode, ok := p.findEnclosureAudio(podcast, duration, item); ok { if err := p.db.Save(episode).Error; err != nil { return nil, err } return episode, nil } - if episode, ok := p.findMediaAudio(podcastID, duration, item, podcastTitle); ok { + if episode, ok := p.findMediaAudio(podcast, duration, item); ok { if err := p.db.Save(episode).Error; err != nil { return nil, err } @@ -223,9 +225,9 @@ func (p *Podcasts) isAudio(rawItemURL string) (bool, error) { return p.tagReader.CanRead(itemURL.Path), nil } -func itemToEpisode(podcastID, size, duration int, audio string, item *gofeed.Item, podcastTitle string) *db.PodcastEpisode { +func itemToEpisode(podcast *db.Podcast, size, duration int, audio string, item *gofeed.Item) *db.PodcastEpisode { return &db.PodcastEpisode{ - PodcastID: podcastID, + PodcastID: podcast.ID, Description: item.Description, Title: item.Title, Length: duration, @@ -233,23 +235,23 @@ func itemToEpisode(podcastID, size, duration int, audio string, item *gofeed.Ite PublishDate: item.PublishedParsed, AudioURL: audio, Status: db.PodcastEpisodeStatusSkipped, - Artist: item.ITunesExt.Author, - Album: podcastTitle, + Artist: cmp.Or(item.ITunesExt.Author, podcast.Author), + Album: podcast.Title, } } -func (p *Podcasts) findEnclosureAudio(podcastID, duration int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, bool) { +func (p *Podcasts) findEnclosureAudio(podcast *db.Podcast, duration int, item *gofeed.Item) (*db.PodcastEpisode, bool) { for _, enc := range item.Enclosures { if t, err := p.isAudio(enc.URL); !t || err != nil { continue } size, _ := strconv.Atoi(enc.Length) - return itemToEpisode(podcastID, size, duration, enc.URL, item, podcastTitle), true + return itemToEpisode(podcast, size, duration, enc.URL, item), true } return nil, false } -func (p *Podcasts) findMediaAudio(podcastID, duration int, item *gofeed.Item, podcastTitle string) (*db.PodcastEpisode, bool) { +func (p *Podcasts) findMediaAudio(podcast *db.Podcast, duration int, item *gofeed.Item) (*db.PodcastEpisode, bool) { extensions, ok := item.Extensions["media"]["content"] if !ok { return nil, false @@ -258,7 +260,7 @@ func (p *Podcasts) findMediaAudio(podcastID, duration int, item *gofeed.Item, po if t, err := p.isAudio(ext.Attrs["url"]); !t || err != nil { continue } - return itemToEpisode(podcastID, 0, duration, ext.Attrs["url"], item, podcastTitle), true + return itemToEpisode(podcast, 0, duration, ext.Attrs["url"], item), true } return nil, false } From 2d4111dfc5226e99fe9fee23e415806960ea7a5c Mon Sep 17 00:00:00 2001 From: gabe Date: Mon, 26 May 2025 10:38:25 -0400 Subject: [PATCH 22/42] feat(subsonic): allow search with MBID (#579) * feat(search): use search2/3 query to additionally search track MBID * feat(search): use strict equality for MBID search don't compare substrings for now to reduce unwanted results based on MBIDs might also make search more efficient * feat(db): add migration to create index on MBID for MBID search * tweak(search): remove unnecessary trim on query --- db/migrations.go | 7 +++++++ server/ctrlsubsonic/handlers_by_folder.go | 2 +- server/ctrlsubsonic/handlers_by_tags.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/db/migrations.go b/db/migrations.go index 1105898..94f8761 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -77,6 +77,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202501152036", migrateAlbumAddIndexOnParentID), construct(ctx, "202502012036", migratePodcastEpisode), construct(ctx, "202504132036", migratePodcast), + construct(ctx, "202505211202", migrateTrackAddIndexOnBrainzID), } return gormigrate. @@ -840,3 +841,9 @@ func migratePodcastEpisode(tx *gorm.DB, _ MigrationContext) error { PodcastEpisode{}, ).Error } + +func migrateTrackAddIndexOnBrainzID(tx *gorm.DB, _ MigrationContext) error { + return tx.Exec(` + CREATE INDEX idx_tracks_brainz_id ON "tracks" (tag_brainz_id); + `).Error +} diff --git a/server/ctrlsubsonic/handlers_by_folder.go b/server/ctrlsubsonic/handlers_by_folder.go index 2b3d85f..59dca4e 100644 --- a/server/ctrlsubsonic/handlers_by_folder.go +++ b/server/ctrlsubsonic/handlers_by_folder.go @@ -263,7 +263,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response { var tracks []*db.Track q = c.dbc.Preload("Album") for _, s := range queries { - q = q.Where(`filename LIKE ? OR filename LIKE ?`, s, s) + q = q.Where(`filename LIKE ? OR filename LIKE ? OR tag_brainz_id = ?`, s, s, query) } q = q. Preload("Artists"). diff --git a/server/ctrlsubsonic/handlers_by_tags.go b/server/ctrlsubsonic/handlers_by_tags.go index 3f5da91..075adfa 100644 --- a/server/ctrlsubsonic/handlers_by_tags.go +++ b/server/ctrlsubsonic/handlers_by_tags.go @@ -287,7 +287,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { Preload("TrackStar", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID) for _, s := range queries { - q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ?`, s, s) + q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ? OR tracks.tag_brainz_id = ?`, s, s, query) } q = q.Offset(params.GetOrInt("songOffset", 0)). Limit(params.GetOrInt("songCount", 20)) From 7b19101a34702bdeaeacf57dbc3db9226f0169f3 Mon Sep 17 00:00:00 2001 From: sentriz Date: Mon, 26 May 2025 20:30:20 +0100 Subject: [PATCH 23/42] feat(subsonic): allow search albums with MBID --- db/migrations.go | 7 ++++ server/ctrlsubsonic/handlers_by_folder.go | 38 +++++++++++++++------- server/ctrlsubsonic/handlers_by_tags.go | 39 ++++++++++++++++------- server/ctrlsubsonic/handlers_common.go | 4 +-- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/db/migrations.go b/db/migrations.go index 94f8761..c1be333 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -78,6 +78,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202502012036", migratePodcastEpisode), construct(ctx, "202504132036", migratePodcast), construct(ctx, "202505211202", migrateTrackAddIndexOnBrainzID), + construct(ctx, "202505262025", migrateAlbumAddIndexOnBrainzID), } return gormigrate. @@ -847,3 +848,9 @@ func migrateTrackAddIndexOnBrainzID(tx *gorm.DB, _ MigrationContext) error { CREATE INDEX idx_tracks_brainz_id ON "tracks" (tag_brainz_id); `).Error } + +func migrateAlbumAddIndexOnBrainzID(tx *gorm.DB, _ MigrationContext) error { + return tx.Exec(` + CREATE INDEX idx_albums_brainz_id ON "albums" (tag_brainz_id); + `).Error +} diff --git a/server/ctrlsubsonic/handlers_by_folder.go b/server/ctrlsubsonic/handlers_by_folder.go index 59dca4e..2f582d0 100644 --- a/server/ctrlsubsonic/handlers_by_folder.go +++ b/server/ctrlsubsonic/handlers_by_folder.go @@ -1,10 +1,10 @@ package ctrlsubsonic import ( - "fmt" "net/http" "strings" + "github.com/google/uuid" "github.com/jinzhu/gorm" "go.senan.xyz/gonic/db" @@ -201,13 +201,17 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response { params := r.Context().Value(CtxParams).(params.Params) user := r.Context().Value(CtxUser).(*db.User) query, err := params.Get("query") - var queries []string if err != nil { return spec.NewError(10, "please provide a `query` parameter") } - for _, s := range strings.Fields(query) { - queries = append(queries, fmt.Sprintf("%%%s%%", strings.Trim(s, `*"'`))) - } + + var isUUID = uuid.Validate(query) == nil + var isAll = query == `""` + + var fuzzy = query + fuzzy = strings.Join(strings.Fields(fuzzy), "%") + fuzzy = strings.ToLower(fuzzy) + fuzzy = "%" + fuzzy + "%" results := &spec.SearchResultTwo{} @@ -222,8 +226,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response { var artists []*db.Album q := c.dbc.Where(`parent_id IN ?`, rootQ.SubQuery()) - for _, s := range queries { - q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, s, s) + switch { + case isUUID: + q = q.Where(0) + case isAll: + default: + q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, fuzzy, fuzzy) } q = q. Preload("AlbumStar", "user_id=?", user.ID). @@ -241,8 +249,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response { var albums []*db.Album q = c.dbc. Joins("JOIN album_artists ON album_artists.album_id=albums.id") - for _, s := range queries { - q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, s, s) + switch { + case isUUID: + q = q.Where(`tag_brainz_id = ?`, query) + case isAll: + default: + q = q.Where(`right_path LIKE ? OR right_path_u_dec LIKE ?`, fuzzy, fuzzy) } q = q. Preload("AlbumStar", "user_id=?", user.ID). @@ -262,8 +274,12 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response { // search tracks var tracks []*db.Track q = c.dbc.Preload("Album") - for _, s := range queries { - q = q.Where(`filename LIKE ? OR filename LIKE ? OR tag_brainz_id = ?`, s, s, query) + switch { + case isUUID: + q = q.Where(`tag_brainz_id = ?`, query) + case isAll: + default: + q = q.Where(`filename LIKE ?`, fuzzy) } q = q. Preload("Artists"). diff --git a/server/ctrlsubsonic/handlers_by_tags.go b/server/ctrlsubsonic/handlers_by_tags.go index 075adfa..1721319 100644 --- a/server/ctrlsubsonic/handlers_by_tags.go +++ b/server/ctrlsubsonic/handlers_by_tags.go @@ -2,7 +2,6 @@ package ctrlsubsonic import ( "errors" - "fmt" "log" "math" "net/http" @@ -217,13 +216,17 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { params := r.Context().Value(CtxParams).(params.Params) user := r.Context().Value(CtxUser).(*db.User) query, err := params.Get("query") - var queries []string if err != nil { return spec.NewError(10, "please provide a `query` parameter") } - for _, s := range strings.Fields(query) { - queries = append(queries, fmt.Sprintf("%%%s%%", strings.Trim(s, `*"'`))) - } + + var isUUID = uuid.Validate(query) == nil + var isAll = query == `""` + + var fuzzy = query + fuzzy = strings.Join(strings.Fields(fuzzy), "%") + fuzzy = strings.ToLower(fuzzy) + fuzzy = "%" + fuzzy + "%" results := &spec.SearchResultThree{} @@ -232,8 +235,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { q := c.dbc. Select("*, count(albums.id) album_count"). Group("artists.id") - for _, s := range queries { - q = q.Where(`name LIKE ? OR name_u_dec LIKE ?`, s, s) + switch { + case isUUID: + q = q.Where(0) + case isAll: + default: + q = q.Where(`name LIKE ? OR name_u_dec LIKE ?`, fuzzy, fuzzy) } q = q. Joins("JOIN album_artists ON album_artists.artist_id=artists.id"). @@ -261,8 +268,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID). Preload("Play", "user_id=?", user.ID) - for _, s := range queries { - q = q.Where(`tag_title LIKE ? OR tag_title_u_dec LIKE ?`, s, s) + switch { + case isUUID: + q = q.Where(`tag_brainz_id = ?`, query) + case isAll: + default: + q = q.Where(`tag_title LIKE ? OR tag_title_u_dec LIKE ?`, fuzzy, fuzzy) } q = q. Offset(params.GetOrInt("albumOffset", 0)). @@ -286,8 +297,12 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { Preload("Artists"). Preload("TrackStar", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID) - for _, s := range queries { - q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ? OR tracks.tag_brainz_id = ?`, s, s, query) + switch { + case isUUID: + q = q.Where(`tracks.tag_brainz_id = ?`, query) + case isAll: + default: + q = q.Where(`tracks.tag_title LIKE ? OR tracks.tag_title_u_dec LIKE ?`, fuzzy, fuzzy) } q = q.Offset(params.GetOrInt("songOffset", 0)). Limit(params.GetOrInt("songCount", 20)) @@ -418,7 +433,7 @@ func (c *Controller) ServeGetAlbumInfoTwo(r *http.Request) *spec.Response { sub.AlbumInfo.MusicBrainzID = info.MusicBrainzID sub.AlbumInfo.LastFMURL = info.LastFMURL - if _, err := uuid.Parse(album.TagBrainzID); err == nil { + if err := uuid.Validate(album.TagBrainzID); err == nil { sub.AlbumInfo.MusicBrainzID = album.TagBrainzID // prefer db musicbrainz ID over lastfm's } diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index 90ef5df..4545faa 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -75,10 +75,10 @@ func (c *Controller) ServeScrobble(r *http.Request) *spec.Response { scrobbleTrack.AlbumArtist = track.Album.TagAlbumArtist scrobbleTrack.TrackNumber = uint(track.TagTrackNumber) scrobbleTrack.Duration = time.Second * time.Duration(track.Length) - if _, err := uuid.Parse(track.TagBrainzID); err == nil { + if err := uuid.Validate(track.TagBrainzID); err == nil { scrobbleTrack.MusicBrainzID = track.TagBrainzID } - if _, err := uuid.Parse(track.Album.TagBrainzID); err == nil { + if err := uuid.Validate(track.Album.TagBrainzID); err == nil { scrobbleTrack.MusicBrainzReleaseID = track.Album.TagBrainzID } From e3dc1887730cb019a91e74ad8a133a31839dbf56 Mon Sep 17 00:00:00 2001 From: Eric Munson Date: Tue, 27 May 2025 18:17:50 -0400 Subject: [PATCH 24/42] fix(subsonic): skip bookmarks for missing items instead of failing (#580) Currently if a bookmark exists for an item that does not exist in the db, either because it has been removed or it never did, the user is prevented from retrieving any bookmarks. We can be in this state if media has moved or been deleted, but also because the createBookmark endpoint does not verify the item id provided. This patch makes the getBookmarks endpoint ignore bookmarks for missing items. Fixes: https://github.com/sentriz/gonic/issues/578 Signed-off-by: Eric B Munson --- server/ctrlsubsonic/handlers_bookmark.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/ctrlsubsonic/handlers_bookmark.go b/server/ctrlsubsonic/handlers_bookmark.go index d1e4464..d1ea56e 100644 --- a/server/ctrlsubsonic/handlers_bookmark.go +++ b/server/ctrlsubsonic/handlers_bookmark.go @@ -45,7 +45,12 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response { Find(&track, "id=?", bookmark.EntryID). Error if err != nil { - return spec.NewError(10, "finding entry: %v", err) + /* + * We get here if we have a bookmark for a Track that no longer exists, this should be an + * error because tracks can disappear if the files are moved etc. Just skip the not found + * entry and move on. + */ + continue } respBookmark.Entry = spec.NewTrackByTags(&track, track.Album) case specid.PodcastEpisode: @@ -55,7 +60,8 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response { Find(&podcastEpisode, "id=?", bookmark.EntryID). Error if err != nil { - return spec.NewError(10, "finding entry: %v", err) + /* Same as with the missing track above. */ + continue } respBookmark.Entry = spec.NewTCPodcastEpisode(&podcastEpisode) default: From b8dfe1449e1f9ee93193b32b1e9d3e233e23706d Mon Sep 17 00:00:00 2001 From: Eric Munson Date: Thu, 29 May 2025 14:00:08 -0400 Subject: [PATCH 25/42] feat(scanner): cleanup bookmarks on scan (#583) Currently, if a media item (track or podcast episode) is removed the entries in the bookmark table that refer to the now missing media item are left in the table. This commit adds a cleanup method which is part of the scan. Signed-off-by: Eric B Munson --- scanner/scanner.go | 53 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/scanner/scanner.go b/scanner/scanner.go index 77e8711..8b01e72 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -24,6 +24,7 @@ import ( "go.senan.xyz/gonic/db" "go.senan.xyz/gonic/fileutil" + "go.senan.xyz/gonic/server/ctrlsubsonic/specid" "go.senan.xyz/gonic/tags/tagcommon" "go.senan.xyz/wrtag/coverparse" ) @@ -106,6 +107,9 @@ func (s *Scanner) ScanAndClean(opts ScanOptions) (*State, error) { if err := s.cleanGenres(st); err != nil { return nil, fmt.Errorf("clean genres: %w", err) } + if err := s.cleanBookmarks(st); err != nil { + return nil, fmt.Errorf("clean bookmarks: %w", err) + } if err := s.db.SetSetting(db.LastScanTime, strconv.FormatInt(time.Now().Unix(), 10)); err != nil { return nil, fmt.Errorf("set scan time: %w", err) @@ -672,6 +676,37 @@ func (s *Scanner) cleanGenres(st *State) error { //nolint:unparam return nil } +func (s *Scanner) cleanBookmarks(st *State) error { + start := time.Now() + defer func() { + log.Printf("finished clean bookmarks in %s, %d removed", durSince(start), st.BookmarksRemoved()) + }() + + trackMarks := s.db. + Select("bookmarks.id"). + Model(db.Bookmark{}). + Joins("LEFT JOIN tracks ON tracks.id=bookmarks.entry_id"). + Where("tracks.id IS NULL AND bookmarks.entry_id_type=?", specid.Track). + SubQuery() + q := s.db. + Where("bookmards.id IN ?", trackMarks). + Delete(db.Bookmark{}) + st.bookmarksRemoved += int(q.RowsAffected) + + podcastMarks := s.db. + Select("bookmarks.id"). + Model(db.Bookmark{}). + Joins("LEFT JOIN podcast_episodes ON podcast_episodes.id=bookmarks.entry_id"). + Where("podcast_episode.id IS NULL AND bookmarks.entry_id_type=?", specid.PodcastEpisode). + SubQuery() + q = s.db. + Where("bookmarks.id IN ?", podcastMarks). + Delete(db.Bookmark{}) + st.bookmarksRemoved += int(q.RowsAffected) + + return nil +} + // decoded converts a string to it's latin equivalent. // it will be used by the model's *UDec fields, and is only set if it // differs from the original. the fields are used for searching. @@ -694,20 +729,22 @@ type State struct { seenAlbums map[int]struct{} seenTracksNew int - tracksMissing []int64 - albumsMissing []int64 - artistsMissing int - genresMissing int + tracksMissing []int64 + albumsMissing []int64 + artistsMissing int + genresMissing int + bookmarksRemoved int } func (s *State) SeenTracks() int { return len(s.seenTracks) } func (s *State) SeenAlbums() int { return len(s.seenAlbums) } func (s *State) SeenTracksNew() int { return s.seenTracksNew } -func (s *State) TracksMissing() int { return len(s.tracksMissing) } -func (s *State) AlbumsMissing() int { return len(s.albumsMissing) } -func (s *State) ArtistsMissing() int { return s.artistsMissing } -func (s *State) GenresMissing() int { return s.genresMissing } +func (s *State) TracksMissing() int { return len(s.tracksMissing) } +func (s *State) AlbumsMissing() int { return len(s.albumsMissing) } +func (s *State) ArtistsMissing() int { return s.artistsMissing } +func (s *State) GenresMissing() int { return s.genresMissing } +func (s *State) BookmarksRemoved() int { return s.bookmarksRemoved } type MultiValueMode uint8 From 7d095ede6bff2d59a92455a58bd26af7744d3cc1 Mon Sep 17 00:00:00 2001 From: sentriz Date: Mon, 23 Jun 2025 17:49:05 +0100 Subject: [PATCH 26/42] fix cleanBookmarks typo --- scanner/scanner.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scanner/scanner.go b/scanner/scanner.go index 8b01e72..bddf551 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -682,25 +682,25 @@ func (s *Scanner) cleanBookmarks(st *State) error { log.Printf("finished clean bookmarks in %s, %d removed", durSince(start), st.BookmarksRemoved()) }() - trackMarks := s.db. + trackBookmarks := s.db. Select("bookmarks.id"). Model(db.Bookmark{}). Joins("LEFT JOIN tracks ON tracks.id=bookmarks.entry_id"). Where("tracks.id IS NULL AND bookmarks.entry_id_type=?", specid.Track). SubQuery() q := s.db. - Where("bookmards.id IN ?", trackMarks). + Where("bookmarks.id IN ?", trackBookmarks). Delete(db.Bookmark{}) st.bookmarksRemoved += int(q.RowsAffected) - podcastMarks := s.db. + podcastBookmarks := s.db. Select("bookmarks.id"). Model(db.Bookmark{}). Joins("LEFT JOIN podcast_episodes ON podcast_episodes.id=bookmarks.entry_id"). - Where("podcast_episode.id IS NULL AND bookmarks.entry_id_type=?", specid.PodcastEpisode). + Where("podcast_episodes.id IS NULL AND bookmarks.entry_id_type=?", specid.PodcastEpisode). SubQuery() q = s.db. - Where("bookmarks.id IN ?", podcastMarks). + Where("bookmarks.id IN ?", podcastBookmarks). Delete(db.Bookmark{}) st.bookmarksRemoved += int(q.RowsAffected) From 29b754973db9106bf1061a7aadb2b9b93b1fbf17 Mon Sep 17 00:00:00 2001 From: sentriz Date: Sun, 6 Jul 2025 22:01:24 +0100 Subject: [PATCH 27/42] feat(subsonic): expose album `isCompilation` and `releaseTypes` --- db/db.go | 2 + db/migrations.go | 7 + mockfs/mockfs.go | 3 + scanner/scanner.go | 2 + .../ctrlsubsonic/spec/construct_by_folder.go | 1 + server/ctrlsubsonic/spec/construct_by_tags.go | 2 + server/ctrlsubsonic/spec/spec.go | 23 +++ .../testdata/test_get_album_list_alpha_artist | 36 +++- .../testdata/test_get_album_list_alpha_name | 36 +++- .../testdata/test_get_album_list_newest | 36 +++- .../testdata/test_get_album_list_random | 186 ++++++++++-------- .../test_get_album_list_two_alpha_artist | 36 +++- .../test_get_album_list_two_alpha_name | 36 +++- .../testdata/test_get_album_list_two_newest | 36 +++- .../testdata/test_get_album_list_two_random | 186 ++++++++++-------- .../testdata/test_get_album_with_cover | 4 +- .../testdata/test_get_album_without_cover | 4 +- .../testdata/test_get_artist_id_one | 12 +- .../testdata/test_get_artist_id_three | 12 +- .../testdata/test_get_artist_id_two | 12 +- .../testdata/test_search_three_q_alb | 36 +++- tags/tagcommon/tagcommmon.go | 3 + tags/taglib/taglib.go | 9 + 23 files changed, 478 insertions(+), 242 deletions(-) diff --git a/db/db.go b/db/db.go index f78e27e..f4b9ff7 100644 --- a/db/db.go +++ b/db/db.go @@ -339,6 +339,8 @@ type Album struct { TagTitleUDec string `sql:"default: null"` TagBrainzID string `sql:"default: null"` TagYear int `sql:"default: null"` + TagCompilation bool `sql:"default: null"` + TagReleaseType string `sql:"default: null"` Tracks []*Track ChildCount int `sql:"-"` Duration int `sql:"-"` diff --git a/db/migrations.go b/db/migrations.go index c1be333..5c37bc0 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -79,6 +79,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202504132036", migratePodcast), construct(ctx, "202505211202", migrateTrackAddIndexOnBrainzID), construct(ctx, "202505262025", migrateAlbumAddIndexOnBrainzID), + construct(ctx, "202507062103", migrateAlbumCompilationReleaseType), } return gormigrate. @@ -854,3 +855,9 @@ func migrateAlbumAddIndexOnBrainzID(tx *gorm.DB, _ MigrationContext) error { CREATE INDEX idx_albums_brainz_id ON "albums" (tag_brainz_id); `).Error } + +func migrateAlbumCompilationReleaseType(tx *gorm.DB, _ MigrationContext) error { + return tx.AutoMigrate( + Album{}, + ).Error +} diff --git a/mockfs/mockfs.go b/mockfs/mockfs.go index a109f80..949f917 100644 --- a/mockfs/mockfs.go +++ b/mockfs/mockfs.go @@ -363,6 +363,9 @@ func (i *TagInfo) TrackNumber() int { return 1 } func (i *TagInfo) DiscNumber() int { return 1 } func (i *TagInfo) Year() int { return 2021 } +func (i *TagInfo) Compilation() bool { return false } +func (i *TagInfo) ReleaseType() string { return "album" } + func (i *TagInfo) ReplayGainTrackGain() float32 { return 0 } func (i *TagInfo) ReplayGainTrackPeak() float32 { return 0 } func (i *TagInfo) ReplayGainAlbumGain() float32 { return 0 } diff --git a/scanner/scanner.go b/scanner/scanner.go index bddf551..ca0b64a 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -424,6 +424,8 @@ func populateAlbum(tx *db.DB, album *db.Album, trags tagcommon.Info, modTime, cr album.TagAlbumArtist = tagcommon.MustAlbumArtist(trags) album.TagBrainzID = trags.AlbumBrainzID() album.TagYear = trags.Year() + album.TagCompilation = trags.Compilation() + album.TagReleaseType = trags.ReleaseType() album.ModifiedAt = modTime if album.CreatedAt.After(createTime) { diff --git a/server/ctrlsubsonic/spec/construct_by_folder.go b/server/ctrlsubsonic/spec/construct_by_folder.go index a720f18..c86fd3e 100644 --- a/server/ctrlsubsonic/spec/construct_by_folder.go +++ b/server/ctrlsubsonic/spec/construct_by_folder.go @@ -19,6 +19,7 @@ func NewAlbumByFolder(f *db.Album) *Album { Duration: f.Duration, Created: f.CreatedAt, AverageRating: formatRating(f.AverageRating), + ReleaseTypes: []string{}, } if f.AlbumStar != nil { a.Starred = &f.AlbumStar.StarDate diff --git a/server/ctrlsubsonic/spec/construct_by_tags.go b/server/ctrlsubsonic/spec/construct_by_tags.go index 97b8332..3cfd1f3 100644 --- a/server/ctrlsubsonic/spec/construct_by_tags.go +++ b/server/ctrlsubsonic/spec/construct_by_tags.go @@ -22,6 +22,8 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album { Year: a.TagYear, Tracks: []*TrackChild{}, AverageRating: formatRating(a.AverageRating), + IsCompilation: a.TagCompilation, + ReleaseTypes: formatReleaseTypes(a.TagReleaseType), } if a.Cover != "" { ret.CoverID = a.SID() diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index aa5bf95..53a1203 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -5,6 +5,7 @@ import ( "regexp" "strings" "time" + "unicode" "go.senan.xyz/gonic" "go.senan.xyz/gonic/server/ctrlsubsonic/specid" @@ -150,6 +151,9 @@ type Album struct { Year int `xml:"year,attr,omitempty" json:"year,omitempty"` Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"` + IsCompilation bool `xml:"isCompilation" json:"isCompilation"` + ReleaseTypes []string `xml:"releaseTypes" json:"releaseTypes"` + // star / rating Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"` @@ -488,6 +492,25 @@ func formatExt(ext string) string { return strings.TrimPrefix(ext, ".") } +func formatReleaseTypes(types string) []string { + parts := strings.Split(types, ",") + if len(parts) == 0 { + return []string{} + } + for i, part := range parts { + part = strings.TrimSpace(part) + if len(part) == 0 { + continue + } + part = string(unicode.ToUpper([]rune(part)[0])) + string([]rune(part)[1:]) + if part == "Ep" { + part = "EP" + } + parts[i] = part + } + return parts +} + var doublePuncExpr = regexp.MustCompile(`\.\s+\.\s+`) var licenceExpr = regexp.MustCompile(`(?i)\buser-contributed text.*`) var readMoreExpr = regexp.MustCompile(`(?i)\bread more on.*`) diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist index 7654a86..fd56b12 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist +++ b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist @@ -21,7 +21,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-4", @@ -37,7 +39,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-5", @@ -53,7 +57,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-7", @@ -69,7 +75,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-8", @@ -85,7 +93,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-9", @@ -101,7 +111,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-11", @@ -117,7 +129,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-12", @@ -133,7 +147,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-13", @@ -149,7 +165,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name index 438dfaf..ed398d1 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name +++ b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name @@ -21,7 +21,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-7", @@ -37,7 +39,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-11", @@ -53,7 +57,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-4", @@ -69,7 +75,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-8", @@ -85,7 +93,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-12", @@ -101,7 +111,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-5", @@ -117,7 +129,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-9", @@ -133,7 +147,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-13", @@ -149,7 +165,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_newest b/server/ctrlsubsonic/testdata/test_get_album_list_newest index 7654a86..fd56b12 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_newest +++ b/server/ctrlsubsonic/testdata/test_get_album_list_newest @@ -21,7 +21,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-4", @@ -37,7 +39,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-5", @@ -53,7 +57,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-7", @@ -69,7 +75,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-8", @@ -85,7 +93,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-9", @@ -101,7 +111,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-11", @@ -117,7 +129,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-12", @@ -133,7 +147,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-13", @@ -149,7 +165,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_random b/server/ctrlsubsonic/testdata/test_get_album_list_random index e88d80f..0085856 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_random +++ b/server/ctrlsubsonic/testdata/test_get_album_list_random @@ -7,6 +7,24 @@ "openSubsonic": true, "albumList": { "album": [ + { + "id": "al-11", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-2", + "artists": null, + "displayArtist": "", + "title": "album-0", + "album": "album-0", + "parent": "al-10", + "isDir": true, + "coverArt": "al-11", + "name": "album-0", + "songCount": 3, + "duration": 300, + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] + }, { "id": "al-5", "created": "2019-11-30T00:00:00Z", @@ -21,7 +39,9 @@ "name": "album-2", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-7", @@ -37,71 +57,9 @@ "name": "album-0", "songCount": 3, "duration": 300, - "playCount": 0 - }, - { - "id": "al-13", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-2", - "artists": null, - "displayArtist": "", - "title": "album-2", - "album": "album-2", - "parent": "al-10", - "isDir": true, - "coverArt": "al-13", - "name": "album-2", - "songCount": 3, - "duration": 300, - "playCount": 0 - }, - { - "id": "al-3", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-0", - "artists": null, - "displayArtist": "", - "title": "album-0", - "album": "album-0", - "parent": "al-2", - "isDir": true, - "coverArt": "al-3", - "name": "album-0", - "songCount": 3, - "duration": 300, - "playCount": 0 - }, - { - "id": "al-4", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-0", - "artists": null, - "displayArtist": "", - "title": "album-1", - "album": "album-1", - "parent": "al-2", - "isDir": true, - "coverArt": "al-4", - "name": "album-1", - "songCount": 3, - "duration": 300, - "playCount": 0 - }, - { - "id": "al-9", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-1", - "artists": null, - "displayArtist": "", - "title": "album-2", - "album": "album-2", - "parent": "al-6", - "isDir": true, - "coverArt": "al-9", - "name": "album-2", - "songCount": 3, - "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-12", @@ -117,7 +75,81 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] + }, + { + "id": "al-9", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-1", + "artists": null, + "displayArtist": "", + "title": "album-2", + "album": "album-2", + "parent": "al-6", + "isDir": true, + "coverArt": "al-9", + "name": "album-2", + "songCount": 3, + "duration": 300, + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] + }, + { + "id": "al-4", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-0", + "artists": null, + "displayArtist": "", + "title": "album-1", + "album": "album-1", + "parent": "al-2", + "isDir": true, + "coverArt": "al-4", + "name": "album-1", + "songCount": 3, + "duration": 300, + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] + }, + { + "id": "al-3", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-0", + "artists": null, + "displayArtist": "", + "title": "album-0", + "album": "album-0", + "parent": "al-2", + "isDir": true, + "coverArt": "al-3", + "name": "album-0", + "songCount": 3, + "duration": 300, + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] + }, + { + "id": "al-13", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-2", + "artists": null, + "displayArtist": "", + "title": "album-2", + "album": "album-2", + "parent": "al-10", + "isDir": true, + "coverArt": "al-13", + "name": "album-2", + "songCount": 3, + "duration": 300, + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] }, { "id": "al-8", @@ -133,23 +165,9 @@ "name": "album-1", "songCount": 3, "duration": 300, - "playCount": 0 - }, - { - "id": "al-11", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-2", - "artists": null, - "displayArtist": "", - "title": "album-0", - "album": "album-0", - "parent": "al-10", - "isDir": true, - "coverArt": "al-11", - "name": "album-0", - "songCount": 3, - "duration": 300, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist index e9d52e7..50bdb1f 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist @@ -21,7 +21,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-4", @@ -37,7 +39,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-5", @@ -53,7 +57,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-7", @@ -69,7 +75,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -85,7 +93,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -101,7 +111,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-11", @@ -117,7 +129,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-12", @@ -133,7 +147,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -149,7 +165,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name index 253ae22..2534a5e 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name @@ -21,7 +21,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-7", @@ -37,7 +39,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-11", @@ -53,7 +57,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-4", @@ -69,7 +75,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -85,7 +93,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-12", @@ -101,7 +111,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-5", @@ -117,7 +129,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -133,7 +147,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -149,7 +165,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_newest b/server/ctrlsubsonic/testdata/test_get_album_list_two_newest index e9d52e7..50bdb1f 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_newest +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_newest @@ -21,7 +21,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-4", @@ -37,7 +39,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-5", @@ -53,7 +57,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-7", @@ -69,7 +75,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -85,7 +93,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -101,7 +111,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-11", @@ -117,7 +129,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-12", @@ -133,7 +147,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -149,7 +165,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_random b/server/ctrlsubsonic/testdata/test_get_album_list_two_random index dbcad0e..6dc3748 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_random +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_random @@ -21,39 +21,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 - }, - { - "id": "al-7", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-2", - "artist": "artist-1", - "artists": [{ "id": "ar-2", "name": "artist-1" }], - "displayArtist": "artist-1", - "title": "album-0", - "album": "album-0", - "coverArt": "al-7", - "name": "album-0", - "songCount": 3, - "duration": 300, - "playCount": 0, - "year": 2021 - }, - { - "id": "al-11", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-3", - "artist": "artist-2", - "artists": [{ "id": "ar-3", "name": "artist-2" }], - "displayArtist": "artist-2", - "title": "album-0", - "album": "album-0", - "coverArt": "al-11", - "name": "album-0", - "songCount": 3, - "duration": 300, - "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -69,55 +39,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 - }, - { - "id": "al-4", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-1", - "artist": "artist-0", - "artists": [{ "id": "ar-1", "name": "artist-0" }], - "displayArtist": "artist-0", - "title": "album-1", - "album": "album-1", - "coverArt": "al-4", - "name": "album-1", - "songCount": 3, - "duration": 300, - "playCount": 0, - "year": 2021 - }, - { - "id": "al-12", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-3", - "artist": "artist-2", - "artists": [{ "id": "ar-3", "name": "artist-2" }], - "displayArtist": "artist-2", - "title": "album-1", - "album": "album-1", - "coverArt": "al-12", - "name": "album-1", - "songCount": 3, - "duration": 300, - "playCount": 0, - "year": 2021 - }, - { - "id": "al-5", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-1", - "artist": "artist-0", - "artists": [{ "id": "ar-1", "name": "artist-0" }], - "displayArtist": "artist-0", - "title": "album-2", - "album": "album-2", - "coverArt": "al-5", - "name": "album-2", - "songCount": 3, - "duration": 300, - "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -133,7 +57,9 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -149,7 +75,99 @@ "songCount": 3, "duration": 300, "playCount": 0, - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] + }, + { + "id": "al-5", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-1", + "artist": "artist-0", + "artists": [{ "id": "ar-1", "name": "artist-0" }], + "displayArtist": "artist-0", + "title": "album-2", + "album": "album-2", + "coverArt": "al-5", + "name": "album-2", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] + }, + { + "id": "al-12", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-3", + "artist": "artist-2", + "artists": [{ "id": "ar-3", "name": "artist-2" }], + "displayArtist": "artist-2", + "title": "album-1", + "album": "album-1", + "coverArt": "al-12", + "name": "album-1", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] + }, + { + "id": "al-7", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-2", + "artist": "artist-1", + "artists": [{ "id": "ar-2", "name": "artist-1" }], + "displayArtist": "artist-1", + "title": "album-0", + "album": "album-0", + "coverArt": "al-7", + "name": "album-0", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] + }, + { + "id": "al-4", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-1", + "artist": "artist-0", + "artists": [{ "id": "ar-1", "name": "artist-0" }], + "displayArtist": "artist-0", + "title": "album-1", + "album": "album-1", + "coverArt": "al-4", + "name": "album-1", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] + }, + { + "id": "al-11", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-3", + "artist": "artist-2", + "artists": [{ "id": "ar-3", "name": "artist-2" }], + "displayArtist": "artist-2", + "title": "album-0", + "album": "album-0", + "coverArt": "al-11", + "name": "album-0", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_with_cover b/server/ctrlsubsonic/testdata/test_get_album_with_cover index ba80c38..2c3eaf6 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_with_cover +++ b/server/ctrlsubsonic/testdata/test_get_album_with_cover @@ -107,7 +107,9 @@ "musicBrainzId": "", "replayGain": null } - ] + ], + "isCompilation": false, + "releaseTypes": ["Album"] } } } diff --git a/server/ctrlsubsonic/testdata/test_get_album_without_cover b/server/ctrlsubsonic/testdata/test_get_album_without_cover index 0fd0572..7aad8d8 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_without_cover +++ b/server/ctrlsubsonic/testdata/test_get_album_without_cover @@ -16,7 +16,9 @@ "name": "", "songCount": 0, "duration": 0, - "playCount": 0 + "playCount": 0, + "isCompilation": false, + "releaseTypes": [""] } } } diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_one b/server/ctrlsubsonic/testdata/test_get_artist_id_one index 0b02ff1..8fa4d81 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_one +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_one @@ -26,7 +26,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-4", @@ -44,7 +46,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-5", @@ -62,7 +66,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_three b/server/ctrlsubsonic/testdata/test_get_artist_id_three index 389ed9c..79cc850 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_three +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_three @@ -26,7 +26,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-12", @@ -44,7 +46,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -62,7 +66,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_two b/server/ctrlsubsonic/testdata/test_get_artist_id_two index b85d4d4..66003b1 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_two +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_two @@ -26,7 +26,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -44,7 +46,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -62,7 +66,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/server/ctrlsubsonic/testdata/test_search_three_q_alb b/server/ctrlsubsonic/testdata/test_search_three_q_alb index 2d346c8..20d6b61 100644 --- a/server/ctrlsubsonic/testdata/test_search_three_q_alb +++ b/server/ctrlsubsonic/testdata/test_search_three_q_alb @@ -23,7 +23,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-4", @@ -41,7 +43,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-5", @@ -59,7 +63,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-7", @@ -77,7 +83,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-8", @@ -95,7 +103,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-9", @@ -113,7 +123,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-11", @@ -131,7 +143,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-12", @@ -149,7 +163,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] }, { "id": "al-13", @@ -167,7 +183,9 @@ "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], - "year": 2021 + "year": 2021, + "isCompilation": false, + "releaseTypes": ["Album"] } ] } diff --git a/tags/tagcommon/tagcommmon.go b/tags/tagcommon/tagcommmon.go index 10da58d..609f5e4 100644 --- a/tags/tagcommon/tagcommmon.go +++ b/tags/tagcommon/tagcommmon.go @@ -26,6 +26,9 @@ type Info interface { DiscNumber() int Year() int + Compilation() bool + ReleaseType() string + ReplayGainTrackGain() float32 ReplayGainTrackPeak() float32 ReplayGainAlbumGain() float32 diff --git a/tags/taglib/taglib.go b/tags/taglib/taglib.go index ba2ab82..03ea647 100644 --- a/tags/taglib/taglib.go +++ b/tags/taglib/taglib.go @@ -52,6 +52,9 @@ func (i *info) TrackNumber() int { return intSep("/", first(find(i.raw, "t func (i *info) DiscNumber() int { return intSep("/", first(find(i.raw, "discnumber"))) } // eg. 1/2 func (i *info) Year() int { return intSep("-", first(find(i.raw, "originaldate", "date", "year"))) } // eg. 2023-12-01 +func (i *info) Compilation() bool { return bl(first(find(i.raw, "compilation"))) } +func (i *info) ReleaseType() string { return first(find(i.raw, "releasetype")) } + func (i *info) ReplayGainTrackGain() float32 { return dB(first(find(i.raw, "replaygain_track_gain"))) } func (i *info) ReplayGainTrackPeak() float32 { return flt(first(find(i.raw, "replaygain_track_peak"))) } func (i *info) ReplayGainAlbumGain() float32 { return dB(first(find(i.raw, "replaygain_album_gain"))) } @@ -93,6 +96,12 @@ func flt(in string) float32 { f, _ := strconv.ParseFloat(in, 32) return float32(f) } + +func bl(in string) bool { + b, _ := strconv.ParseBool(in) + return b +} + func dB(in string) float32 { in = strings.ToLower(in) in = strings.TrimSuffix(in, " db") From 3fc9d5dcb5af0db8286d7be7c895726cf9b437cc Mon Sep 17 00:00:00 2001 From: sentriz Date: Mon, 7 Jul 2025 13:39:26 +0100 Subject: [PATCH 28/42] fix(subsonic): gracefully handle missing playqueue items --- server/ctrlsubsonic/handlers_common.go | 38 ++++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index 4545faa..3aeb7ac 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -206,30 +206,44 @@ func (c *Controller) ServeGetPlayQueue(r *http.Request) *spec.Response { sub.PlayQueue.ChangedBy = queue.ChangedBy trackIDs := queue.GetItems() - sub.PlayQueue.List = make([]*spec.TrackChild, len(trackIDs)) + sub.PlayQueue.List = make([]*spec.TrackChild, 0, len(trackIDs)) transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", "")) - for i, id := range trackIDs { + for _, id := range trackIDs { switch id.Type { case specid.Track: - track := db.Track{} - c.dbc. + var track db.Track + err := c.dbc. Where("id=?", id.Value). Preload("Album"). Preload("Artists"). Preload("TrackStar", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID). - Find(&track) - sub.PlayQueue.List[i] = spec.NewTCTrackByFolder(&track, track.Album) - sub.PlayQueue.List[i].TranscodeMeta = transcodeMeta + Find(&track). + Error + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return spec.NewError(0, "error finding track") + } + if track.ID != 0 { + tc := spec.NewTCTrackByFolder(&track, track.Album) + tc.TranscodeMeta = transcodeMeta + sub.PlayQueue.List = append(sub.PlayQueue.List, tc) + } case specid.PodcastEpisode: - pe := db.PodcastEpisode{} - c.dbc. + var pe db.PodcastEpisode + err := c.dbc. Where("id=?", id.Value). - Find(&pe) - sub.PlayQueue.List[i] = spec.NewTCPodcastEpisode(&pe) - sub.PlayQueue.List[i].TranscodeMeta = transcodeMeta + Find(&pe). + Error + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + return spec.NewError(0, "error finding podcast episode") + } + if pe.ID != 0 { + tc := spec.NewTCPodcastEpisode(&pe) + tc.TranscodeMeta = transcodeMeta + sub.PlayQueue.List = append(sub.PlayQueue.List, tc) + } } } return sub From c2e5eb3f0fd5f72458d521fdff9a0ef1d7eefd50 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 30 Jul 2025 11:45:36 +0100 Subject: [PATCH 29/42] chore: bump to go1.24 --- Dockerfile | 22 ++++----- Dockerfile.debug | 2 +- Dockerfile.dev | 16 +++---- go.mod | 41 ++++++++-------- go.sum | 113 +++++++++++++++++++++++++++++---------------- scanner/scanner.go | 2 +- 6 files changed, 115 insertions(+), 81 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba3b1b7..e33d7ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.20 AS builder-taglib +FROM alpine:3.22 AS builder-taglib WORKDIR /tmp COPY alpine/taglib/APKBUILD . RUN apk update && \ @@ -7,7 +7,7 @@ RUN apk update && \ abuild-keygen -a -n -i && \ REPODEST=/pkgs abuild -F -r -FROM golang:1.23-alpine AS builder +FROM golang:1.24-alpine3.22 AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ @@ -27,8 +27,8 @@ RUN go mod download COPY . . RUN GOOS=linux go build -o gonic cmd/gonic/gonic.go -FROM alpine:3.20 -LABEL org.opencontainers.image.source https://github.com/sentriz/gonic +FROM alpine:3.22 +LABEL org.opencontainers.image.source=https://github.com/sentriz/gonic RUN apk add -U --no-cache \ ffmpeg \ mpv \ @@ -47,12 +47,12 @@ COPY --from=builder \ /bin/ VOLUME ["/cache", "/data", "/music", "/podcasts"] EXPOSE 80 -ENV TZ "" -ENV GONIC_DB_PATH /data/gonic.db -ENV GONIC_LISTEN_ADDR :80 -ENV GONIC_MUSIC_PATH /music -ENV GONIC_PODCAST_PATH /podcasts -ENV GONIC_CACHE_PATH /cache -ENV GONIC_PLAYLISTS_PATH /playlists +ENV TZ= +ENV GONIC_DB_PATH=/data/gonic.db +ENV GONIC_LISTEN_ADDR=:80 +ENV GONIC_MUSIC_PATH=/music +ENV GONIC_PODCAST_PATH=/podcasts +ENV GONIC_CACHE_PATH=/cache +ENV GONIC_PLAYLISTS_PATH=/playlists ENTRYPOINT ["/sbin/tini", "--"] CMD ["gonic"] diff --git a/Dockerfile.debug b/Dockerfile.debug index d1530b8..f87a070 100644 --- a/Dockerfile.debug +++ b/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.23-alpine AS builder +FROM golang:1.24-alpine3.22 AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ diff --git a/Dockerfile.dev b/Dockerfile.dev index 71659a9..b29f461 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:experimental -FROM golang:1.23-alpine AS builder +FROM golang:1.24-alpine3.22 AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ @@ -14,7 +14,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ GOOS=linux go build -o gonic cmd/gonic/gonic.go -FROM alpine:3.20 +FROM alpine:3.22 RUN apk add -U --no-cache \ ffmpeg \ mpv \ @@ -30,10 +30,10 @@ COPY --from=builder \ /bin/ VOLUME ["/cache", "/data", "/music", "/podcasts"] EXPOSE 80 -ENV GONIC_DB_PATH /data/gonic.db -ENV GONIC_LISTEN_ADDR :80 -ENV GONIC_MUSIC_PATH /music -ENV GONIC_PODCAST_PATH /podcasts -ENV GONIC_PLAYLISTS_PATH /playlists -ENV GONIC_CACHE_PATH /cache +ENV GONIC_DB_PATH=/data/gonic.db +ENV GONIC_LISTEN_ADDR=:80 +ENV GONIC_MUSIC_PATH=/music +ENV GONIC_PODCAST_PATH=/podcasts +ENV GONIC_PLAYLISTS_PATH=/playlists +ENV GONIC_CACHE_PATH=/cache CMD ["gonic"] diff --git a/go.mod b/go.mod index 4295757..46cc0e5 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,23 @@ module go.senan.xyz/gonic -go 1.23.0 +go 1.24 require ( github.com/Masterminds/sprig v2.22.0+incompatible - github.com/andybalholm/cascadia v1.3.2 - github.com/dexterlb/mpvipc v0.0.0-20230829142118-145d6eabdc37 + github.com/andybalholm/cascadia v1.3.3 + github.com/dexterlb/mpvipc v0.0.0-20241005113212-7cdefca0e933 github.com/disintegration/imaging v1.6.2 github.com/djherbis/times v1.6.0 github.com/dustin/go-humanize v1.0.1 github.com/fatih/structs v1.1.0 - github.com/fsnotify/fsnotify v1.7.0 + github.com/fsnotify/fsnotify v1.9.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/google/uuid v1.6.0 github.com/gorilla/securecookie v1.1.2 github.com/gorilla/sessions v1.4.0 github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414 - github.com/josephburnett/jd v1.9.1 - github.com/mattn/go-sqlite3 v1.14.23 + github.com/josephburnett/jd v1.9.2 + github.com/mattn/go-sqlite3 v1.14.29 github.com/mitchellh/mapstructure v1.5.0 github.com/mmcdole/gofeed v1.3.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 @@ -25,11 +25,11 @@ require ( github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 go.senan.xyz/flagconf v0.1.9 - go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7 - golang.org/x/net v0.29.0 - golang.org/x/sync v0.8.0 + go.senan.xyz/wrtag v0.15.0 + golang.org/x/net v0.42.0 + golang.org/x/sync v0.16.0 gopkg.in/gormigrate.v1 v1.6.0 jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056 ) @@ -37,10 +37,10 @@ require ( require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/PuerkitoBio/goquery v1.10.0 // indirect + github.com/PuerkitoBio/goquery v1.10.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/swag v0.23.0 // indirect + github.com/go-openapi/jsonpointer v0.21.1 // indirect + github.com/go-openapi/swag v0.23.1 // indirect github.com/gorilla/context v1.1.2 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -49,22 +49,25 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/lib/pq v1.3.0 // indirect - github.com/mailru/easyjson v0.7.7 // indirect + github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mmcdole/goxpp v1.1.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/olekukonko/tablewriter v1.0.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/image v0.20.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/crypto v0.40.0 // indirect + golang.org/x/image v0.29.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/text v0.27.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// https://github.com/jaytaylor/html2text/issues/67 +replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5 diff --git a/go.sum b/go.sum index 3ecb131..310f11a 100644 --- a/go.sum +++ b/go.sum @@ -6,19 +6,19 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/PuerkitoBio/goquery v1.10.0 h1:6fiXdLuUvYs2OJSvNRqlNPoBm6YABE226xrbavY5Wv4= -github.com/PuerkitoBio/goquery v1.10.0/go.mod h1:TjZZl68Q3eGHNBA8CWaxAN7rOU1EbDz3CWuolcO5Yu4= +github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo= +github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= -github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/denisenkom/go-mssqldb v0.0.0-20181014144952-4e0d7dc8888f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc= github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM= github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= -github.com/dexterlb/mpvipc v0.0.0-20230829142118-145d6eabdc37 h1:s+qNFsO3VsdsKroqapcogQxcQBHrRPDK1nVxGc+HBbg= -github.com/dexterlb/mpvipc v0.0.0-20230829142118-145d6eabdc37/go.mod h1:CXCwawNJCtFDip7gvbaQVgw0cGjldpyHDIp7oA5prOg= +github.com/dexterlb/mpvipc v0.0.0-20241005113212-7cdefca0e933 h1:r4hxcT6GBIA/j8Ox4OXI5MNgMKfR+9plcAWYi1OnmOg= +github.com/dexterlb/mpvipc v0.0.0-20241005113212-7cdefca0e933/go.mod h1:RkQWLNITKkXHLP7LXxZSgEq+uFWU25M5qW7qfEhL9Wc= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c= @@ -29,12 +29,12 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DP github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= -github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic= +github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= +github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= +github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -43,6 +43,7 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -75,8 +76,8 @@ github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI= github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/josephburnett/jd v1.9.1 h1:R3PVwhFWFd281E4QRMMeaAo/KFS2T0wXtu/wIy1S0ek= -github.com/josephburnett/jd v1.9.1/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM= +github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5Y= +github.com/josephburnett/jd v1.9.2/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -89,15 +90,15 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= +github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWtuw0= -github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.29 h1:1O6nRLJKvsi1H2Sj0Hzdfojwt8GiGKm+LOfLaBFaouQ= +github.com/mattn/go-sqlite3 v1.14.29/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -126,8 +127,8 @@ github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDF github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 h1:WCZxu77OR9yzKGZugQC1dHhslXROOJT+UL5JCtJbBq8= github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6/go.mod h1:+pmkMFDEXJuu/u4h2OYJVfYF2qIhXJD7kqvWq6q5Zo0= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 h1:sLILANWN76ja66/K4k/mBqJuCjDZaM67w+Ru6rEB0s0= @@ -136,25 +137,32 @@ github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cma github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= -go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7 h1:3iNed1fsOJAvdiGtE9FKqctnavizPTaeNKNcdT/tZ7I= -go.senan.xyz/wrtag v0.0.0-20240917222925-5e7c76752ed7/go.mod h1:bnHbnDhLgt0ckjAzT/YNJmzHFXf0hHI4BVVS4w4V7S8= +go.senan.xyz/wrtag v0.15.0 h1:eU+kCSw6D2+aXWSrQIiUsX4265qpi8vVjsCTZXZm/5g= +go.senan.xyz/wrtag v0.15.0/go.mod h1:i4ZxTwUkNSXDIhx4/B92VwtJDUaJbj2kNIRUPRtfjRo= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw= -golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM= +golang.org/x/image v0.29.0 h1:HcdsyR4Gsuys/Axh0rDEmlBmB68rW1U9BUdB3UVHsas= +golang.org/x/image v0.29.0/go.mod h1:RVJROnf3SLK8d26OW91j4FrIHGbsJ8QnbEocVTOWQDA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -164,14 +172,22 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -181,26 +197,41 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/scanner/scanner.go b/scanner/scanner.go index ca0b64a..f129a3a 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -283,7 +283,7 @@ func (s *Scanner) scanDir(tx *db.DB, st *State, absPath string) error { } if coverparse.IsCover(item.Name()) { - coverparse.BestBetween(&cover, item.Name()) + cover = coverparse.BestBetween(cover, item.Name()) continue } if s.tagReader.CanRead(absPath) { From fa434cc1761e23592a3e19a4db4c7594529b7ff4 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 30 Jul 2025 12:48:04 +0100 Subject: [PATCH 30/42] chore(ci): bump golangci-lint --- .github/workflows/nightly-release.yaml | 6 +- .github/workflows/release.yaml | 6 +- .github/workflows/test.yaml | 6 +- .golangci.yml | 84 +++++++++++++++----------- db/migrations_old_models.go | 2 +- server/ctrlsubsonic/ctrl_test.go | 4 +- version.go | 2 +- 7 files changed, 63 insertions(+), 47 deletions(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 56c2bae..87e1dd0 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -33,10 +33,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... build-release: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bb9ffe8..f4a3c01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,10 +19,10 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... release-please: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9935a02..c8c56a2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,9 +20,9 @@ jobs: sudo apt update -qq sudo apt install -y -qq build-essential git sqlite3 libtag1-dev ffmpeg mpv zlib1g-dev - name: Lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.60 - args: --timeout=5m + install-mode: goinstall + version: v2.3.0 - name: Test run: go test ./... diff --git a/.golangci.yml b/.golangci.yml index 8f1abde..d14b619 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ +version: "2" linters: - disable-all: true + default: none enable: - asasalint - asciicheck @@ -14,8 +15,6 @@ linters: - errchkjson - errname - errorlint - - execinquery - - exportloopref - forbidigo - ginkgolinter - gocheckcompilerdirectives @@ -24,13 +23,10 @@ linters: - goconst - gocritic - gocyclo - - gofmt - goheader - - goimports - gomodguard - goprintffuncname - gosec - - gosimple - gosmopolitan - govet - grouper @@ -51,40 +47,60 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck - - stylecheck - - tenv - testableexamples - thelper - tparallel - - typecheck - unconvert - unparam - unused - wastedassign - whitespace - zerologlint - -issues: - exclude-rules: - - path: _test\.go - linters: - - errcheck - - gochecknoglobals - - text: "weak cryptographic primitive" - linters: - - gosec - - text: "weak random number generator" - linters: - - gosec - - text: "integer overflow conversion" - linters: - - gosec - - text: "at least one file in a package should have a package comment" - linters: - - stylecheck - - text: "should rewrite switch" - linters: - - gocritic - exclude-dirs: - - server/assets - exclude-dirs-use-default: true + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - errcheck + - gochecknoglobals + path: _test\.go + - linters: + - gosec + text: weak cryptographic primitive + - linters: + - gosec + text: weak random number generator + - linters: + - gosec + text: integer overflow conversion + - linters: + - staticcheck + text: at least one file in a package should have a package comment + - linters: + - gocritic + text: should rewrite switch + paths: + - server/assets + - third_party$ + - builtin$ + - examples$ + settings: + staticcheck: + checks: + - all + - "-QF1001" +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - server/assets + - third_party$ + - builtin$ + - examples$ diff --git a/db/migrations_old_models.go b/db/migrations_old_models.go index 7df9f45..7f398ed 100644 --- a/db/migrations_old_models.go +++ b/db/migrations_old_models.go @@ -2,7 +2,7 @@ package db import "time" -type __OldPlaylist struct { //nolint: revive,stylecheck +type __OldPlaylist struct { //nolint: staticcheck ID int `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time diff --git a/server/ctrlsubsonic/ctrl_test.go b/server/ctrlsubsonic/ctrl_test.go index 2dddea2..227ddd5 100644 --- a/server/ctrlsubsonic/ctrl_test.go +++ b/server/ctrlsubsonic/ctrl_test.go @@ -39,8 +39,8 @@ const ( ) const ( - audioPath5s = "testdata/audio/5s.flac" //nolint:deadcode,varcheck - audioPath10s = "testdata/audio/10s.flac" //nolint:deadcode,varcheck + audioPath5s = "testdata/audio/5s.flac" + audioPath10s = "testdata/audio/10s.flac" ) type queryCase struct { diff --git a/version.go b/version.go index 06c99af..43e12d5 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ -//nolint:gochecknoglobals,golint,stylecheck +//nolint:gochecknoglobals package gonic import ( From c6d87515c6702c3ca22fef6ba1420ffc00eeaa77 Mon Sep 17 00:00:00 2001 From: Richard Samuels <1666322+richardsamuels@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:35:55 -0400 Subject: [PATCH 31/42] fix(subsonic): populate ArtistID and AlbumID for playlists (#567) * fix(playlist): populate ArtistID and AlbumID * update keys for CI lint config * fix lint config again * fix golden samples * prettier testdata * fix merge --- .../ctrlsubsonic/spec/construct_by_folder.go | 4 ++ .../test_get_music_directory_with_tracks | 6 +++ .../testdata/test_search_two_q_tra | 40 +++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/server/ctrlsubsonic/spec/construct_by_folder.go b/server/ctrlsubsonic/spec/construct_by_folder.go index c86fd3e..41aaac0 100644 --- a/server/ctrlsubsonic/spec/construct_by_folder.go +++ b/server/ctrlsubsonic/spec/construct_by_folder.go @@ -88,6 +88,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild { } if t.Album != nil { trCh.Album = t.Album.RightPath + trCh.AlbumID = t.Album.SID() } if t.TrackStar != nil { trCh.Starred = &t.TrackStar.StarDate @@ -102,6 +103,9 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild { trCh.Genres = append(trCh.Genres, &GenreRef{Name: g.Name}) } for _, a := range t.Artists { + if a.Name == t.TagTrackArtist { + trCh.ArtistID = a.SID() + } trCh.Artists = append(trCh.Artists, &ArtistRef{ID: a.SID(), Name: a.Name}) } if t.ReplayGainTrackGain != 0 || t.ReplayGainAlbumGain != 0 { diff --git a/server/ctrlsubsonic/testdata/test_get_music_directory_with_tracks b/server/ctrlsubsonic/testdata/test_get_music_directory_with_tracks index a9468a9..41c5547 100644 --- a/server/ctrlsubsonic/testdata/test_get_music_directory_with_tracks +++ b/server/ctrlsubsonic/testdata/test_get_music_directory_with_tracks @@ -13,7 +13,9 @@ { "id": "tr-1", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -39,7 +41,9 @@ { "id": "tr-2", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -65,7 +69,9 @@ { "id": "tr-3", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, diff --git a/server/ctrlsubsonic/testdata/test_search_two_q_tra b/server/ctrlsubsonic/testdata/test_search_two_q_tra index b1cfd43..8d787f8 100644 --- a/server/ctrlsubsonic/testdata/test_search_two_q_tra +++ b/server/ctrlsubsonic/testdata/test_search_two_q_tra @@ -10,7 +10,9 @@ { "id": "tr-1", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -36,7 +38,9 @@ { "id": "tr-2", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -62,7 +66,9 @@ { "id": "tr-3", "album": "album-0", + "albumId": "al-3", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -88,7 +94,9 @@ { "id": "tr-4", "album": "album-1", + "albumId": "al-4", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -114,7 +122,9 @@ { "id": "tr-5", "album": "album-1", + "albumId": "al-4", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -140,7 +150,9 @@ { "id": "tr-6", "album": "album-1", + "albumId": "al-4", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -166,7 +178,9 @@ { "id": "tr-7", "album": "album-2", + "albumId": "al-5", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -192,7 +206,9 @@ { "id": "tr-8", "album": "album-2", + "albumId": "al-5", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -218,7 +234,9 @@ { "id": "tr-9", "album": "album-2", + "albumId": "al-5", "artist": "artist-0", + "artistId": "ar-1", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "", "albumArtists": null, @@ -244,7 +262,9 @@ { "id": "tr-10", "album": "album-0", + "albumId": "al-7", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -270,7 +290,9 @@ { "id": "tr-11", "album": "album-0", + "albumId": "al-7", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -296,7 +318,9 @@ { "id": "tr-12", "album": "album-0", + "albumId": "al-7", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -322,7 +346,9 @@ { "id": "tr-13", "album": "album-1", + "albumId": "al-8", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -348,7 +374,9 @@ { "id": "tr-14", "album": "album-1", + "albumId": "al-8", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -374,7 +402,9 @@ { "id": "tr-15", "album": "album-1", + "albumId": "al-8", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -400,7 +430,9 @@ { "id": "tr-16", "album": "album-2", + "albumId": "al-9", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -426,7 +458,9 @@ { "id": "tr-17", "album": "album-2", + "albumId": "al-9", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -452,7 +486,9 @@ { "id": "tr-18", "album": "album-2", + "albumId": "al-9", "artist": "artist-1", + "artistId": "ar-2", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "", "albumArtists": null, @@ -478,7 +514,9 @@ { "id": "tr-19", "album": "album-0", + "albumId": "al-11", "artist": "artist-2", + "artistId": "ar-3", "artists": [{ "id": "ar-3", "name": "artist-2" }], "displayArtist": "", "albumArtists": null, @@ -504,7 +542,9 @@ { "id": "tr-20", "album": "album-0", + "albumId": "al-11", "artist": "artist-2", + "artistId": "ar-3", "artists": [{ "id": "ar-3", "name": "artist-2" }], "displayArtist": "", "albumArtists": null, From 465ab8ae26eb734c260cb3f1ce1c3347081ea930 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 21 Aug 2025 23:33:34 +0100 Subject: [PATCH 32/42] chore(deps): bump --- go.mod | 16 ++++++++-------- go.sum | 36 ++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 46cc0e5..039a125 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/gorilla/sessions v1.4.0 github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414 github.com/josephburnett/jd v1.9.2 - github.com/mattn/go-sqlite3 v1.14.29 + github.com/mattn/go-sqlite3 v1.14.32 github.com/mitchellh/mapstructure v1.5.0 github.com/mmcdole/gofeed v1.3.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 @@ -27,8 +27,8 @@ require ( github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/stretchr/testify v1.10.0 go.senan.xyz/flagconf v0.1.9 - go.senan.xyz/wrtag v0.15.0 - golang.org/x/net v0.42.0 + go.senan.xyz/wrtag v0.16.0 + golang.org/x/net v0.43.0 golang.org/x/sync v0.16.0 gopkg.in/gormigrate.v1 v1.6.0 jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056 @@ -39,7 +39,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/PuerkitoBio/goquery v1.10.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-openapi/jsonpointer v0.21.1 // indirect + github.com/go-openapi/jsonpointer v0.21.2 // indirect github.com/go-openapi/swag v0.23.1 // indirect github.com/gorilla/context v1.1.2 // indirect github.com/huandu/xstrings v1.5.0 // indirect @@ -60,10 +60,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect - golang.org/x/crypto v0.40.0 // indirect - golang.org/x/image v0.29.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/text v0.27.0 // indirect + golang.org/x/crypto v0.41.0 // indirect + golang.org/x/image v0.30.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 310f11a..efa2e12 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-openapi/jsonpointer v0.21.1 h1:whnzv/pNXtK2FbX/W9yJfRmE2gsmkfahjMKB0fZvcic= -github.com/go-openapi/jsonpointer v0.21.1/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= +github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA= +github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -97,8 +97,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mattn/go-sqlite3 v1.14.29 h1:1O6nRLJKvsi1H2Sj0Hzdfojwt8GiGKm+LOfLaBFaouQ= -github.com/mattn/go-sqlite3 v1.14.29/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= +github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -142,8 +142,8 @@ github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= -go.senan.xyz/wrtag v0.15.0 h1:eU+kCSw6D2+aXWSrQIiUsX4265qpi8vVjsCTZXZm/5g= -go.senan.xyz/wrtag v0.15.0/go.mod h1:i4ZxTwUkNSXDIhx4/B92VwtJDUaJbj2kNIRUPRtfjRo= +go.senan.xyz/wrtag v0.16.0 h1:Txcl4OXwfLe5PO7agfRGaRD00GLji5wn9qwLFD/aR1E= +go.senan.xyz/wrtag v0.16.0/go.mod h1:XAbiIGbf0DP22RcQBW1n1KeeUTGQU9B6k5A6CGw2j4A= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -153,11 +153,11 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.29.0 h1:HcdsyR4Gsuys/Axh0rDEmlBmB68rW1U9BUdB3UVHsas= -golang.org/x/image v0.29.0/go.mod h1:RVJROnf3SLK8d26OW91j4FrIHGbsJ8QnbEocVTOWQDA= +golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4= +golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -177,8 +177,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -202,8 +202,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -222,16 +222,16 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= -golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 58d54c287cb6711959707b50207ea700df25d1cf Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 21 Aug 2025 23:42:31 +0100 Subject: [PATCH 33/42] feat(subsonic): fallback to filename when title is missing tags closes #541 --- server/ctrlsubsonic/spec/construct_by_folder.go | 3 ++- server/ctrlsubsonic/spec/construct_by_tags.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/ctrlsubsonic/spec/construct_by_folder.go b/server/ctrlsubsonic/spec/construct_by_folder.go index 41aaac0..7f3e549 100644 --- a/server/ctrlsubsonic/spec/construct_by_folder.go +++ b/server/ctrlsubsonic/spec/construct_by_folder.go @@ -1,6 +1,7 @@ package spec import ( + "cmp" "path/filepath" "go.senan.xyz/gonic/db" @@ -62,7 +63,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild { Suffix: formatExt(t.Ext()), Size: t.Size, Artist: t.TagTrackArtist, - Title: t.TagTitle, + Title: cmp.Or(t.TagTitle, t.Filename), TrackNumber: t.TagTrackNumber, DiscNumber: t.TagDiscNumber, Path: filepath.Join( diff --git a/server/ctrlsubsonic/spec/construct_by_tags.go b/server/ctrlsubsonic/spec/construct_by_tags.go index 3cfd1f3..75c4de6 100644 --- a/server/ctrlsubsonic/spec/construct_by_tags.go +++ b/server/ctrlsubsonic/spec/construct_by_tags.go @@ -1,6 +1,7 @@ package spec import ( + "cmp" "path/filepath" "sort" @@ -78,7 +79,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild { Path: filepath.Join(album.LeftPath, album.RightPath, t.Filename), Size: t.Size, Suffix: formatExt(t.Ext()), - Title: t.TagTitle, + Title: cmp.Or(t.TagTitle, t.Filename), TrackNumber: t.TagTrackNumber, DiscNumber: t.TagDiscNumber, Type: "music", From 72376a4568005d7e6f9a464de0e70f399e3829c5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 22:52:30 +0000 Subject: [PATCH 34/42] chore: release 0.17.0 (#497) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 40 ++++++++++++++++++++++++++++++++++++++++ version.txt | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb5c37..5d23fe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## [0.17.0](https://www.github.com/sentriz/gonic/compare/v0.16.4...v0.17.0) (2025-08-21) + + +### Features + +* **db:** add a covering index on tracks (album_id, length) ([018343d](https://www.github.com/sentriz/gonic/commit/018343dc32fd89685ca3eb80ceb3116615a6cbec)), closes [#508](https://www.github.com/sentriz/gonic/issues/508) +* **lastfm:** paginate loved tracks ([5c7d065](https://www.github.com/sentriz/gonic/commit/5c7d065fd7513f66604d78409859c4028ca9ad70)) +* **playlist:** assume playlists in the root dir without a user dir belong to admin ([#499](https://www.github.com/sentriz/gonic/issues/499)) ([f5893ea](https://www.github.com/sentriz/gonic/commit/f5893ea5ea4d47a82212b47e85a15d9defdc5eff)) +* **podcast:** download most recent episode when switching to download recent mode ([c222ecb](https://www.github.com/sentriz/gonic/commit/c222ecb45cec5282e0ef892db21eb32632a0145d)), closes [#557](https://www.github.com/sentriz/gonic/issues/557) +* **podcast:** use podcast author if episode author is not defined ([#574](https://www.github.com/sentriz/gonic/issues/574)) ([19b707c](https://www.github.com/sentriz/gonic/commit/19b707c5d4081242825704eed764c257e6161865)) +* **scanner:** cleanup bookmarks on scan ([#583](https://www.github.com/sentriz/gonic/issues/583)) ([b8dfe14](https://www.github.com/sentriz/gonic/commit/b8dfe1449e1f9ee93193b32b1e9d3e233e23706d)) +* **scanner:** support full scan cleanups in watcher ([#496](https://www.github.com/sentriz/gonic/issues/496)) ([93ce039](https://www.github.com/sentriz/gonic/commit/93ce039963821dbfa0acec6ee9c92134ff479fcc)) +* **scanner:** use wrtag/coverparse for cover selection ([453639e](https://www.github.com/sentriz/gonic/commit/453639ee34da28dc47f64865d490445968c23ce8)), closes [#338](https://www.github.com/sentriz/gonic/issues/338) [#516](https://www.github.com/sentriz/gonic/issues/516) +* **subsonic:** allow search albums with MBID ([7b19101](https://www.github.com/sentriz/gonic/commit/7b19101a34702bdeaeacf57dbc3db9226f0169f3)) +* **subsonic:** allow search with MBID ([#579](https://www.github.com/sentriz/gonic/issues/579)) ([2d4111d](https://www.github.com/sentriz/gonic/commit/2d4111dfc5226e99fe9fee23e415806960ea7a5c)) +* **subsonic:** bump image cache expiration ([bbe16b7](https://www.github.com/sentriz/gonic/commit/bbe16b7555f1d7300f829171f73c8308ae506fd3)) +* **subsonic:** expose album `isCompilation` and `releaseTypes` ([29b7549](https://www.github.com/sentriz/gonic/commit/29b754973db9106bf1061a7aadb2b9b93b1fbf17)) +* **subsonic:** expose replaygain tags ([0e45f5e](https://www.github.com/sentriz/gonic/commit/0e45f5e84cd650211351179edf3eed89a54c6c75)) +* **subsonic:** fallback to filename when title is missing tags ([58d54c2](https://www.github.com/sentriz/gonic/commit/58d54c287cb6711959707b50207ea700df25d1cf)), closes [#541](https://www.github.com/sentriz/gonic/issues/541) +* **subsonic:** support more podcast metadata and podcast bookmarks ([#569](https://www.github.com/sentriz/gonic/issues/569)) ([63a420d](https://www.github.com/sentriz/gonic/commit/63a420d2d32b006a92b3aa5d97bc39ad49fc8155)) +* **transcode:** add cache pruning and config options ([bcb613c](https://www.github.com/sentriz/gonic/commit/bcb613c79c6a822adeafc802f19b7626bfb64009)) + + +### Bug Fixes + +* **admin:** better handing of resolve proxy path escaping ([7b21e82](https://www.github.com/sentriz/gonic/commit/7b21e82aaf511d36300fd9cf2dae32a1196a4f77)), closes [#493](https://www.github.com/sentriz/gonic/issues/493) +* **adminui:** resolve reverse proxy paths for fonts ([718686a](https://www.github.com/sentriz/gonic/commit/718686a93a4341c5b5ccb113a0ed7ae95c0524b4)), closes [#543](https://www.github.com/sentriz/gonic/issues/543) +* **ci:** bump golangci-lint ([640d872](https://www.github.com/sentriz/gonic/commit/640d872f4c66d21b760590ae9413cc5b63b53cb6)) +* **ci:** ignore gosec integer overflow conversion ([120fd79](https://www.github.com/sentriz/gonic/commit/120fd7959a8e360fdccc6bd1a47e8cc7ebdbb0d4)) +* **ci:** update .golangci.yml exclude config ([e5f7ef3](https://www.github.com/sentriz/gonic/commit/e5f7ef3c86d6a52709336f2dd2d428203e7d9472)) +* **ci:** use new sqlite package name ([1c23771](https://www.github.com/sentriz/gonic/commit/1c2377189da75c78831955953f25dd09b3cb7bb2)) +* **dockerfile:** install abuild key ([#526](https://www.github.com/sentriz/gonic/issues/526)) ([fb36dbf](https://www.github.com/sentriz/gonic/commit/fb36dbf71991424879be85950ab508bcdf653902)) +* **playlist:** fix non-admin users not being able to create playlists ([#524](https://www.github.com/sentriz/gonic/issues/524)) ([ac798ac](https://www.github.com/sentriz/gonic/commit/ac798ac2d2cdf936b653577d9acd4b7d1e22ecaf)) +* **podcast:** gracefully handle no podcast cover URL ([#547](https://www.github.com/sentriz/gonic/issues/547)) ([aef5f92](https://www.github.com/sentriz/gonic/commit/aef5f920d24c57bc5b652891409926ff98458aa0)) +* **subsonic:** gracefully handle missing playqueue items ([3fc9d5d](https://www.github.com/sentriz/gonic/commit/3fc9d5dcb5af0db8286d7be7c895726cf9b437cc)) +* **subsonic:** order some browse-by-tag responses ([39df00e](https://www.github.com/sentriz/gonic/commit/39df00ef8f683a846efd0da7480c3db6d928d2c4)), closes [#512](https://www.github.com/sentriz/gonic/issues/512) +* **subsonic:** populate ArtistID and AlbumID for playlists ([#567](https://www.github.com/sentriz/gonic/issues/567)) ([c6d8751](https://www.github.com/sentriz/gonic/commit/c6d87515c6702c3ca22fef6ba1420ffc00eeaa77)) +* **subsonic:** skip bookmarks for missing items instead of failing ([#580](https://www.github.com/sentriz/gonic/issues/580)) ([e3dc188](https://www.github.com/sentriz/gonic/commit/e3dc1887730cb019a91e74ad8a133a31839dbf56)) +* **taglib:** support lower case filenames again ([8a0fa05](https://www.github.com/sentriz/gonic/commit/8a0fa05c7cdcb98066c263fea72af0715864bea5)), closes [#491](https://www.github.com/sentriz/gonic/issues/491) + ### [0.16.4](https://www.github.com/sentriz/gonic/compare/v0.16.3...v0.16.4) (2024-03-20) diff --git a/version.txt b/version.txt index 5f2491c..c5523bd 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.16.4 +0.17.0 From 5916a7fe7bc7ac39ca1975665433da627d214769 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 26 Aug 2025 00:44:56 +0100 Subject: [PATCH 35/42] feat(subsonic): replace html2text with bluemonday fixes #591 Release-As: 0.17.1 --- go.mod | 11 +++-------- go.sum | 18 ++++++------------ server/ctrlsubsonic/spec/spec.go | 8 ++++++-- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 039a125..a341eca 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/jinzhu/gorm v1.9.17-0.20211120011537-5c235b72a414 github.com/josephburnett/jd v1.9.2 github.com/mattn/go-sqlite3 v1.14.32 + github.com/microcosm-cc/bluemonday v1.0.27 github.com/mitchellh/mapstructure v1.5.0 github.com/mmcdole/gofeed v1.3.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 @@ -31,17 +32,18 @@ require ( golang.org/x/net v0.43.0 golang.org/x/sync v0.16.0 gopkg.in/gormigrate.v1 v1.6.0 - jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056 ) require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/PuerkitoBio/goquery v1.10.3 // indirect + github.com/aymerick/douceur v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-openapi/jsonpointer v0.21.2 // indirect github.com/go-openapi/swag v0.23.1 // indirect github.com/gorilla/context v1.1.2 // indirect + github.com/gorilla/css v1.0.1 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/jinzhu/inflection v1.0.0 // indirect @@ -50,16 +52,12 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/lib/pq v1.3.0 // indirect github.com/mailru/easyjson v0.9.0 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mmcdole/goxpp v1.1.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/olekukonko/tablewriter v1.0.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rivo/uniseg v0.4.7 // indirect - github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect golang.org/x/crypto v0.41.0 // indirect golang.org/x/image v0.30.0 // indirect golang.org/x/sys v0.35.0 // indirect @@ -68,6 +66,3 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -// https://github.com/jaytaylor/html2text/issues/67 -replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5 diff --git a/go.sum b/go.sum index efa2e12..2243d43 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7 github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -54,6 +56,8 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o= github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM= +github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= +github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= @@ -92,13 +96,12 @@ github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= +github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -116,25 +119,18 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/philippta/go-template v0.0.0-20220911145045-4556aca435e4 h1:SvVjZyjXBOjqjCdMiC9ndyWb709aP5qU4Qbun40GCxA= github.com/philippta/go-template v0.0.0-20220911145045-4556aca435e4/go.mod h1:Mpa6Hci7lO3vybfdYlWXmH5gEq2vyOmYYjhrlwCTW3w= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHVHGom5hKW5VXNc2xZIkfCKP8iaqOyYtUQ= github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDFMn7db1kT65GmV94GzpX9Qdi7N/pQlwb+AN8wh+Q= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 h1:WCZxu77OR9yzKGZugQC1dHhslXROOJT+UL5JCtJbBq8= github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6/go.mod h1:+pmkMFDEXJuu/u4h2OYJVfYF2qIhXJD7kqvWq6q5Zo0= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 h1:sLILANWN76ja66/K4k/mBqJuCjDZaM67w+Ru6rEB0s0= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981/go.mod h1:Rx8XB1ck+so+41uu9VY1gMKs1CPQ2NTq0pzf+OCCQHo= -github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= -github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= @@ -245,5 +241,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056 h1:6YFJoB+0fUH6X3xU/G2tQqCYg+PkGtnZ5nMR5rpw72g= -jaytaylor.com/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:OxvTsCwKosqQ1q7B+8FwXqg4rKZ/UG9dUW+g/VL2xH4= diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index 53a1203..ef50608 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -2,14 +2,15 @@ package spec import ( "fmt" + "html" "regexp" "strings" "time" "unicode" + "github.com/microcosm-cc/bluemonday" "go.senan.xyz/gonic" "go.senan.xyz/gonic/server/ctrlsubsonic/specid" - "jaytaylor.com/html2text" ) // https://web.archive.org/web/20220707025402/https://www.subsonic.org/pages/api.jsp @@ -515,8 +516,11 @@ var doublePuncExpr = regexp.MustCompile(`\.\s+\.\s+`) var licenceExpr = regexp.MustCompile(`(?i)\buser-contributed text.*`) var readMoreExpr = regexp.MustCompile(`(?i)\bread more on.*`) +var bluemondayPolicy = bluemonday.StrictPolicy() //nolint:gochecknoglobals + func CleanExternalText(text string) string { - text, _ = html2text.FromString(text, html2text.Options{TextOnly: true}) + text = bluemondayPolicy.Sanitize(text) + text = html.UnescapeString(text) text = licenceExpr.ReplaceAllString(text, "") text = readMoreExpr.ReplaceAllString(text, "") text = doublePuncExpr.ReplaceAllString(text, ". ") From db97bc753e1070de12b3907b2b996511140a3259 Mon Sep 17 00:00:00 2001 From: "./daniele" <47982731+danielepintore@users.noreply.github.com> Date: Tue, 26 Aug 2025 12:08:35 +0200 Subject: [PATCH 36/42] feat(subsonic): add support for lyrics (#519) * Add songLyrics extension since the getLyricsBySongId method is implemented * Add support for lyrics * Add check for getLyrics function * fix typo * chore: fix tests * fix(lyrics): if lrc is formatted with empty spaces remove them * fix(lint): use NewError correctly bump ts --- db/db.go | 1 + db/migrations.go | 5 + go.mod | 1 + go.sum | 2 + mockfs/mockfs.go | 1 + scanner/scanner.go | 1 + server/ctrlsubsonic/ctrl.go | 1 + server/ctrlsubsonic/handlers_common.go | 150 ++++++++++++++++++++++++- server/ctrlsubsonic/spec/spec.go | 19 ++++ tags/tagcommon/tagcommmon.go | 1 + tags/taglib/taglib.go | 3 + 11 files changed, 183 insertions(+), 2 deletions(-) diff --git a/db/db.go b/db/db.go index f4b9ff7..7e9ad09 100644 --- a/db/db.go +++ b/db/db.go @@ -235,6 +235,7 @@ type Track struct { TagTrackNumber int `sql:"default: null"` TagDiscNumber int `sql:"default: null"` TagBrainzID string `sql:"default: null"` + TagLyrics string `sql:"default:null"` ReplayGainTrackGain float32 ReplayGainTrackPeak float32 diff --git a/db/migrations.go b/db/migrations.go index 5c37bc0..8c28745 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -80,6 +80,7 @@ func (db *DB) Migrate(ctx MigrationContext) error { construct(ctx, "202505211202", migrateTrackAddIndexOnBrainzID), construct(ctx, "202505262025", migrateAlbumAddIndexOnBrainzID), construct(ctx, "202507062103", migrateAlbumCompilationReleaseType), + construct(ctx, "202508261102", migrateAddLyrics), } return gormigrate. @@ -861,3 +862,7 @@ func migrateAlbumCompilationReleaseType(tx *gorm.DB, _ MigrationContext) error { Album{}, ).Error } + +func migrateAddLyrics(tx *gorm.DB, _ MigrationContext) error { + return tx.AutoMigrate(Track{}).Error +} diff --git a/go.mod b/go.mod index a341eca..a921471 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/disintegration/imaging v1.6.2 github.com/djherbis/times v1.6.0 github.com/dustin/go-humanize v1.0.1 + github.com/env25/mpdlrc v0.7.4 github.com/fatih/structs v1.1.0 github.com/fsnotify/fsnotify v1.9.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 diff --git a/go.sum b/go.sum index 2243d43..e0fbc3a 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,8 @@ github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c= github.com/djherbis/times v1.6.0/go.mod h1:gOHeRAz2h+VJNZ5Gmc/o7iD9k4wW7NMVqieYCY99oc0= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/env25/mpdlrc v0.7.4 h1:A9If5JKVjgJldaIjJztqkXpUKXlsoRIwXqGK3qS38pY= +github.com/env25/mpdlrc v0.7.4/go.mod h1:Zyhq2WfcYeSJUCtx7mhbXwlh4Xt6mR7HDw0qQh7LvyY= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= diff --git a/mockfs/mockfs.go b/mockfs/mockfs.go index 949f917..36dd1b6 100644 --- a/mockfs/mockfs.go +++ b/mockfs/mockfs.go @@ -362,6 +362,7 @@ func (i *TagInfo) Genres() []string { return []string{i.RawGenre} } func (i *TagInfo) TrackNumber() int { return 1 } func (i *TagInfo) DiscNumber() int { return 1 } func (i *TagInfo) Year() int { return 2021 } +func (i *TagInfo) Lyrics() string { return "[00:01.58] Line one\n[00:03.44] Line two\n" } func (i *TagInfo) Compilation() bool { return false } func (i *TagInfo) ReleaseType() string { return "album" } diff --git a/scanner/scanner.go b/scanner/scanner.go index f129a3a..ede6da8 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -468,6 +468,7 @@ func populateTrack(tx *db.DB, album *db.Album, track *db.Track, trags tagcommon. track.FilenameUDec = decoded(basename) track.Size = size track.AlbumID = album.ID + track.TagLyrics = trags.Lyrics() track.TagTitle = trags.Title() track.TagTitleUDec = decoded(trags.Title()) diff --git a/server/ctrlsubsonic/ctrl.go b/server/ctrlsubsonic/ctrl.go index 12d0bab..308cf0c 100644 --- a/server/ctrlsubsonic/ctrl.go +++ b/server/ctrlsubsonic/ctrl.go @@ -127,6 +127,7 @@ func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPa c.Handle("/getSimilarSongs", chain(resp(c.ServeGetSimilarSongs))) c.Handle("/getSimilarSongs2", chain(resp(c.ServeGetSimilarSongsTwo))) c.Handle("/getLyrics", chain(resp(c.ServeGetLyrics))) + c.Handle("/getLyricsBySongId", chain(resp(c.ServeGetLyricsBySongID))) // raw c.Handle("/getCoverArt", chainRaw(respRaw(c.ServeGetCoverArt))) diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index 3aeb7ac..d39cc12 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -8,10 +8,12 @@ import ( "net/http" "os" "path/filepath" + "strings" "sync" "time" "unicode" + "github.com/env25/mpdlrc/lrc" "github.com/google/uuid" "github.com/jinzhu/gorm" @@ -41,6 +43,7 @@ func (c *Controller) ServeGetOpenSubsonicExtensions(_ *http.Request) *spec.Respo sub.OpenSubsonicExtensions = &spec.OpenSubsonicExtensions{ {Name: "transcodeOffset", Versions: []int{1}}, {Name: "formPost", Versions: []int{1}}, + {Name: "songLyrics", Versions: []int{1}}, } return sub } @@ -482,12 +485,155 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go return sub } -func (c *Controller) ServeGetLyrics(_ *http.Request) *spec.Response { +func (c *Controller) ServeGetLyrics(r *http.Request) *spec.Response { + params := r.Context().Value(CtxParams).(params.Params) + artist, _ := params.Get("artist") + title, _ := params.Get("title") + + var track db.Track + err := c.dbc. + Preload("Album"). + Joins("JOIN track_artists ON track_artists.track_id = tracks.id"). + Joins("JOIN artists ON artists.id = track_artists.artist_id"). + Where("tracks.tag_title LIKE ? AND artists.name LIKE ?", title, artist). + First(&track). + Error + if errors.Is(err, gorm.ErrRecordNotFound) { + return spec.NewError(70, "couldn't find a track with that id") + } + if err != nil { + return spec.NewError(0, "lyrics: %v", err) + } + sub := spec.NewResponse() - sub.Lyrics = &spec.Lyrics{} + + if track.TagLyrics != "" { + sub.Lyrics = &spec.Lyrics{ + Value: track.TagLyrics, + Artist: track.TagTrackArtist, + Title: track.TagTitle, + } + return sub + } + + _, text, err := lyricsFile(track) + if os.IsNotExist(err) { + return sub + } + if err != nil { + return spec.NewError(0, "lyricsFile: %v", err) + } + + contents := strings.Join(text, "\n") + + sub.Lyrics = &spec.Lyrics{ + Value: contents, + Artist: track.TagTrackArtist, + Title: track.TagTitle, + } return sub } +func (c *Controller) ServeGetLyricsBySongID(r *http.Request) *spec.Response { + params := r.Context().Value(CtxParams).(params.Params) + id, err := params.GetID("id") + if err != nil { + return spec.NewError(10, "provide an `id` parameter") + } + + var track db.Track + q := c.dbc. + Preload("Album"). + Preload("Album.Artists"). + Preload("Artists"). + Where("id=?", id.Value). + First(&track) + if err := q.Error; err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + return spec.NewError(70, "couldn't find a track with that id") + } else { + return spec.NewError(0, "lyrics: %v", err) + } + } + + sub := spec.NewResponse() + + if track.TagLyrics != "" { + times, lrc, err := lrc.ParseString(track.TagLyrics) + if err != nil { + return spec.NewError(0, "lyricsFile: %v", err) + } + + lines := make([]spec.Lyric, len(times)) + for i, time := range times { + lines[i] = spec.Lyric{ + Start: time.Milliseconds(), + Value: strings.TrimSpace(lrc[i]), + } + } + + structured := spec.StructuredLyrics{ + Lang: "xxx", + Synced: true, + Lines: lines, + DisplayArtist: track.TagTrackArtist, + DisplayTitle: track.TagTitle, + Offset: 0, + } + + sub.LyricsList = &spec.LyricsList{ + StructuredLyrics: []spec.StructuredLyrics{structured}, + } + return sub + } + + times, lrc, err := lyricsFile(track) + if err != nil { + if os.IsNotExist(err) { + sub.LyricsList = &spec.LyricsList{ + StructuredLyrics: []spec.StructuredLyrics{}, + } + return sub + } + return spec.NewError(0, "lyricsFile: %v", err) + } + + lines := make([]spec.Lyric, len(times)) + for i, time := range times { + lines[i] = spec.Lyric{ + Start: time.Milliseconds(), + Value: strings.TrimSpace(lrc[i]), + } + } + + structured := spec.StructuredLyrics{ + Lang: "xxx", + Synced: true, + Lines: lines, + DisplayArtist: track.TagTrackArtist, + DisplayTitle: track.TagTitle, + Offset: 0, + } + + sub.LyricsList = &spec.LyricsList{ + StructuredLyrics: []spec.StructuredLyrics{structured}, + } + return sub +} + +func lyricsFile(file db.Track) ([]lrc.Duration, []lrc.Text, error) { + filePath := file.AbsPath() + fileDir := filepath.Dir(filePath) + fileName := strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath)) + + lrcContent, err := os.ReadFile(filepath.Join(fileDir, fileName+".lrc")) + if err != nil { + return []lrc.Duration{}, []lrc.Text{}, err + } + + return lrc.Parse(lrcContent) +} + func scrobbleStatsUpdateTrack(dbc *db.DB, track *db.Track, userID int, playTime time.Time) error { var play db.Play if err := dbc.Where("album_id=? AND user_id=?", track.AlbumID, userID).First(&play).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index ef50608..933dbdd 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -71,6 +71,7 @@ type Response struct { SimilarSongsTwo *SimilarSongsTwo `xml:"similarSongs2" json:"similarSongs2,omitempty"` InternetRadioStations *InternetRadioStations `xml:"internetRadioStations" json:"internetRadioStations,omitempty"` Lyrics *Lyrics `xml:"lyrics" json:"lyrics,omitempty"` + LyricsList *LyricsList `xml:"lyricsList" json:"lyricsList,omitempty"` } func NewResponse() *Response { @@ -475,6 +476,24 @@ type Lyrics struct { Title string `xml:"title,attr,omitempty" json:"title,omitempty"` } +type Lyric struct { + Start int64 `xml:"start,attr" json:"start"` + Value string `xml:",chardata" json:"value"` +} + +type LyricsList struct { + StructuredLyrics []StructuredLyrics `xml:"structuredLyrics" json:"structuredLyrics"` +} + +type StructuredLyrics struct { + Lang string `xml:"lang,attr" json:"lang"` // ISO 639 (or und, xxx if unknown) + Synced bool `xml:"synced,attr" json:"synced"` + Lines []Lyric `xml:"line" json:"line"` + DisplayArtist string `xml:"displayArtist,attr,omitempty" json:"displayArtist,omitempty"` + DisplayTitle string `xml:"displayTitle,attr,omitempty" json:"displayTitle,omitempty"` + Offset int `xml:"offset,attr,omitempty" json:"offset,omitempty"` +} + type OpenSubsonicExtension struct { Name string `xml:"name,attr" json:"name"` Versions []int `xml:"versions" json:"versions"` diff --git a/tags/tagcommon/tagcommmon.go b/tags/tagcommon/tagcommmon.go index 609f5e4..dd45ee5 100644 --- a/tags/tagcommon/tagcommmon.go +++ b/tags/tagcommon/tagcommmon.go @@ -25,6 +25,7 @@ type Info interface { TrackNumber() int DiscNumber() int Year() int + Lyrics() string Compilation() bool ReleaseType() string diff --git a/tags/taglib/taglib.go b/tags/taglib/taglib.go index 03ea647..9f64384 100644 --- a/tags/taglib/taglib.go +++ b/tags/taglib/taglib.go @@ -51,6 +51,9 @@ func (i *info) Genres() []string { return find(i.raw, "genres") } func (i *info) TrackNumber() int { return intSep("/", first(find(i.raw, "tracknumber"))) } // eg. 5/12 func (i *info) DiscNumber() int { return intSep("/", first(find(i.raw, "discnumber"))) } // eg. 1/2 func (i *info) Year() int { return intSep("-", first(find(i.raw, "originaldate", "date", "year"))) } // eg. 2023-12-01 +func (i *info) Lyrics() string { + return first(find(i.raw, "lyrics", "lyrics:description", "USLT:description", "LYRICS", "Lyrics", "©lyr")) +} func (i *info) Compilation() bool { return bl(first(find(i.raw, "compilation"))) } func (i *info) ReleaseType() string { return first(find(i.raw, "releasetype")) } From 1bf4a5b0c1e209770b060c8b4a08910afb72078f Mon Sep 17 00:00:00 2001 From: sentriz Date: Sat, 6 Sep 2025 23:38:04 +0100 Subject: [PATCH 37/42] chore(deps)!: bump to go1.25 fixes #594 Release-As: 0.18.0 --- .github/workflows/nightly-release.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 2 +- Dockerfile | 2 +- db/db.go | 11 ++++------- go.mod | 12 +++++------- go.sum | 20 ++++++++------------ mockfs/mockfs.go | 8 ++++---- scanner/scanner_benchmark_test.go | 9 ++++----- scanner/scanner_fuzz_test.go | 2 +- scanner/scanner_test.go | 6 +++--- server/ctrladmin/ctrl.go | 2 +- server/ctrlsubsonic/ctrl_test.go | 1 - server/ctrlsubsonic/handlers_raw.go | 6 ++---- server/ctrlsubsonic/params/params.go | 7 +++---- server/ctrlsubsonic/spec/spec.go | 6 +++--- server/ctrlsubsonic/specid/ids_test.go | 1 - transcode/transcode_test.go | 9 +++------ 18 files changed, 45 insertions(+), 63 deletions(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 87e1dd0..68e5991 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -36,7 +36,7 @@ jobs: uses: golangci/golangci-lint-action@v8 with: install-mode: goinstall - version: v2.3.0 + version: v2.4.0 - name: Test run: go test ./... build-release: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f4a3c01..a697215 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,7 +22,7 @@ jobs: uses: golangci/golangci-lint-action@v8 with: install-mode: goinstall - version: v2.3.0 + version: v2.4.0 - name: Test run: go test ./... release-please: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c8c56a2..68fbb98 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,6 +23,6 @@ jobs: uses: golangci/golangci-lint-action@v8 with: install-mode: goinstall - version: v2.3.0 + version: v2.4.0 - name: Test run: go test ./... diff --git a/Dockerfile b/Dockerfile index e33d7ef..933af85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apk update && \ abuild-keygen -a -n -i && \ REPODEST=/pkgs abuild -F -r -FROM golang:1.24-alpine3.22 AS builder +FROM golang:1.25-alpine3.22 AS builder RUN apk add -U --no-cache \ build-base \ ca-certificates \ diff --git a/db/db.go b/db/db.go index 7e9ad09..1261b93 100644 --- a/db/db.go +++ b/db/db.go @@ -67,7 +67,7 @@ func (db *DB) InsertBulkLeftMany(table string, head []string, left int, col []in return nil } var rows []string - var values []interface{} + var values []any for _, c := range col { rows = append(rows, "(?, ?)") values = append(values, left, c) @@ -138,10 +138,7 @@ func (db *DB) TransactionChunked(data []int64, cb func(*DB, []int64) error) erro const size = 999 return db.Transaction(func(tx *DB) error { for i := 0; i < len(data); i += size { - end := i + size - if end > len(data) { - end = len(data) - } + end := min(i+size, len(data)) if err := cb(tx, data[i:end]); err != nil { return err } @@ -643,8 +640,8 @@ func Dump(ctx context.Context, db *gorm.DB, to string) error { } defer connDest.Close() - err = connDest.Raw(func(connDest interface{}) error { - return connSrc.Raw(func(connSrc interface{}) error { + err = connDest.Raw(func(connDest any) error { + return connSrc.Raw(func(connSrc any) error { connDestq := connDest.(*sqlite3.SQLiteConn) connSrcq := connSrc.(*sqlite3.SQLiteConn) bk, err := connDestq.Backup("main", connSrcq, "main") diff --git a/go.mod b/go.mod index a921471..9a50484 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.senan.xyz/gonic -go 1.24 +go 1.25 require ( github.com/Masterminds/sprig v2.22.0+incompatible @@ -27,9 +27,9 @@ require ( github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.11.1 go.senan.xyz/flagconf v0.1.9 - go.senan.xyz/wrtag v0.16.0 + go.senan.xyz/wrtag v0.17.1 golang.org/x/net v0.43.0 golang.org/x/sync v0.16.0 gopkg.in/gormigrate.v1 v1.6.0 @@ -41,18 +41,16 @@ require ( github.com/PuerkitoBio/goquery v1.10.3 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-openapi/jsonpointer v0.21.2 // indirect - github.com/go-openapi/swag v0.23.1 // indirect + github.com/go-openapi/jsonpointer v0.22.0 // indirect + github.com/go-openapi/swag/jsonname v0.24.0 // indirect github.com/gorilla/context v1.1.2 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.2 // indirect - github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/lib/pq v1.3.0 // indirect - github.com/mailru/easyjson v0.9.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mmcdole/goxpp v1.1.1 // indirect diff --git a/go.sum b/go.sum index e0fbc3a..1b93271 100644 --- a/go.sum +++ b/go.sum @@ -35,10 +35,10 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA= -github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= -github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= -github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= +github.com/go-openapi/jsonpointer v0.22.0 h1:TmMhghgNef9YXxTu1tOopo+0BGEytxA+okbry0HjZsM= +github.com/go-openapi/jsonpointer v0.22.0/go.mod h1:xt3jV88UtExdIkkL7NloURjRQjbeUgcxFblMjq2iaiU= +github.com/go-openapi/swag/jsonname v0.24.0 h1:2wKS9bgRV/xB8c62Qg16w4AUiIrqqiniJFtZGi3dg5k= +github.com/go-openapi/swag/jsonname v0.24.0/go.mod h1:GXqrPzGJe611P7LG4QB9JKPtUZ7flE4DOVechNaDd7Q= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -84,8 +84,6 @@ github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5Y= github.com/josephburnett/jd v1.9.2/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -96,8 +94,6 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= -github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= @@ -135,13 +131,13 @@ github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 h1:sLILANWN76ja6 github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981/go.mod h1:Rx8XB1ck+so+41uu9VY1gMKs1CPQ2NTq0pzf+OCCQHo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= -go.senan.xyz/wrtag v0.16.0 h1:Txcl4OXwfLe5PO7agfRGaRD00GLji5wn9qwLFD/aR1E= -go.senan.xyz/wrtag v0.16.0/go.mod h1:XAbiIGbf0DP22RcQBW1n1KeeUTGQU9B6k5A6CGw2j4A= +go.senan.xyz/wrtag v0.17.1 h1:QC40z0rRAZ8zjIwwIrFIhldviP9cW0Jpe9EDh5Bt2J8= +go.senan.xyz/wrtag v0.17.1/go.mod h1:rrC+QaFcZACW/hcsZpQj6kTh69rjhxIoePk3MZG3/rA= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/mockfs/mockfs.go b/mockfs/mockfs.go index 36dd1b6..5d658ae 100644 --- a/mockfs/mockfs.go +++ b/mockfs/mockfs.go @@ -116,12 +116,12 @@ func (m *MockFS) AddItemsWithCovers() { m.addItems("", "", tr func (m *MockFS) AddItemsPrefixWithCovers(prefix string) { m.addItems(prefix, "", true) } func (m *MockFS) addItems(prefix string, onlyGlob string, covers bool) { - p := func(format string, a ...interface{}) string { + p := func(format string, a ...any) string { return filepath.Join(prefix, fmt.Sprintf(format, a...)) } - for ar := 0; ar < 3; ar++ { - for al := 0; al < 3; al++ { - for tr := 0; tr < 3; tr++ { + for ar := range 3 { + for al := range 3 { + for tr := range 3 { path := p("artist-%d/album-%d/track-%d.flac", ar, al, tr) if !match(onlyGlob, path) { continue diff --git a/scanner/scanner_benchmark_test.go b/scanner/scanner_benchmark_test.go index 22149fe..f68545a 100644 --- a/scanner/scanner_benchmark_test.go +++ b/scanner/scanner_benchmark_test.go @@ -9,21 +9,20 @@ import ( func BenchmarkScanIncremental(b *testing.B) { m := mockfs.New(b) - for i := 0; i < 5; i++ { + for i := range 5 { m.AddItemsPrefix(fmt.Sprintf("t-%d", i)) } m.ScanAndClean() - b.ResetTimer() - for i := 0; i < b.N; i++ { + for b.Loop() { m.ScanAndClean() } } func BenchmarkScanFull(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { m := mockfs.New(b) - for i := 0; i < 5; i++ { + for i := range 5 { m.AddItemsPrefix(fmt.Sprintf("t-%d", i)) } b.StartTimer() diff --git a/scanner/scanner_fuzz_test.go b/scanner/scanner_fuzz_test.go index b4fc28b..e88352e 100644 --- a/scanner/scanner_fuzz_test.go +++ b/scanner/scanner_fuzz_test.go @@ -43,7 +43,7 @@ func FuzzScanner(f *testing.F) { }) } -func fuzzStruct(taken int, data []byte, seed int64, dest interface{}) { +func fuzzStruct(taken int, data []byte, seed int64, dest any) { if len(data) == 0 { return } diff --git a/scanner/scanner_test.go b/scanner/scanner_test.go index c49b6f8..50e8640 100644 --- a/scanner/scanner_test.go +++ b/scanner/scanner_test.go @@ -363,7 +363,7 @@ func TestNewAlbumForExistingArtist(t *testing.T) { assert.NoError(t, m.DB().Where("name=?", "artist-2").Find(&artist).Error) // find orig artist assert.Greater(t, artist.ID, 0) - for tr := 0; tr < 3; tr++ { + for tr := range 3 { m.AddTrack(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr)) m.SetTags(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr), func(tags *mockfs.TagInfo) { tags.RawArtist = "artist-2" @@ -552,7 +552,7 @@ func TestCompilationAlbumWithoutAlbumArtist(t *testing.T) { const toAdd = 5 // add tracks to one folder with random artists and no album artist tag - for i := 0; i < toAdd; i++ { + for i := range toAdd { p := fmt.Sprintf("%s/%s/track-%d.flac", pathArtist, pathAlbum, i) m.AddTrack(p) m.SetTags(p, func(tags *mockfs.TagInfo) { @@ -605,7 +605,7 @@ func TestAlbumAndArtistSameNameWeirdness(t *testing.T) { const name = "same" - add := func(path string, a ...interface{}) { + add := func(path string, a ...any) { m.AddTrack(fmt.Sprintf(path, a...)) m.SetTags(fmt.Sprintf(path, a...), func(tags *mockfs.TagInfo) {}) } diff --git a/server/ctrladmin/ctrl.go b/server/ctrladmin/ctrl.go index 063869f..3722f72 100644 --- a/server/ctrladmin/ctrl.go +++ b/server/ctrladmin/ctrl.go @@ -271,7 +271,7 @@ func respRaw(h http.HandlerFunc) http.Handler { type templateData struct { // common - Flashes []interface{} + Flashes []any User *db.User Version string diff --git a/server/ctrlsubsonic/ctrl_test.go b/server/ctrlsubsonic/ctrl_test.go index 227ddd5..603f91e 100644 --- a/server/ctrlsubsonic/ctrl_test.go +++ b/server/ctrlsubsonic/ctrl_test.go @@ -87,7 +87,6 @@ func makeHTTPMockWithAdmin(query url.Values) (*httptest.ResponseRecorder, *http. func runQueryCases(t *testing.T, h handlerSubsonic, cases []*queryCase) { t.Helper() for _, qc := range cases { - qc := qc t.Run(qc.expectPath, func(t *testing.T) { t.Helper() t.Parallel() diff --git a/server/ctrlsubsonic/handlers_raw.go b/server/ctrlsubsonic/handlers_raw.go index fd19fd8..73ee80b 100644 --- a/server/ctrlsubsonic/handlers_raw.go +++ b/server/ctrlsubsonic/handlers_raw.go @@ -155,11 +155,9 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error { if err != nil { return fmt.Errorf("resizing: %w", err) } - width := size - if width > src.Bounds().Dx() { + width := min(size, // don't upscale images - width = src.Bounds().Dx() - } + src.Bounds().Dx()) if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil { return fmt.Errorf("caching %q: %w", cachePath, err) } diff --git a/server/ctrlsubsonic/params/params.go b/server/ctrlsubsonic/params/params.go index 022c4e2..53a5203 100644 --- a/server/ctrlsubsonic/params/params.go +++ b/server/ctrlsubsonic/params/params.go @@ -27,6 +27,7 @@ package params import ( "errors" + "maps" "net/http" "net/url" "strconv" @@ -44,9 +45,7 @@ func New(r *http.Request) Params { params := r.URL.Query() // also if there's any in the post body, use those too if err := r.ParseForm(); err == nil { - for k, v := range r.Form { - params[k] = v - } + maps.Copy(params, r.Form) } return Params(params) } @@ -389,7 +388,7 @@ func parseTime(in string) (time.Time, error) { return time.Unix(0, ns), nil } -func parse(values []string, i interface{}) error { +func parse(values []string, i any) error { if len(values) == 0 { return ErrNoValues } diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index 933dbdd..40c1f38 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -102,7 +102,7 @@ type Error struct { Message string `xml:"message,attr" json:"message"` } -func NewError(code int, message string, a ...interface{}) *Response { +func NewError(code int, message string, a ...any) *Response { r := NewResponse() r.Status = "failed" r.Error = &Error{ @@ -128,7 +128,7 @@ type GenreRef struct { // https://opensubsonic.netlify.app/docs/responses/albumid3/ type Album struct { ID *specid.ID `xml:"id,attr,omitempty" json:"id"` - Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` + Created time.Time `xml:"created,attr,omitempty" json:"created"` // legacy or single tag mode ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` @@ -201,7 +201,7 @@ type TrackChild struct { Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"` ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"` CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` - CreatedAt time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` + CreatedAt time.Time `xml:"created,attr,omitempty" json:"created"` Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"` diff --git a/server/ctrlsubsonic/specid/ids_test.go b/server/ctrlsubsonic/specid/ids_test.go index d3e5303..2841b68 100644 --- a/server/ctrlsubsonic/specid/ids_test.go +++ b/server/ctrlsubsonic/specid/ids_test.go @@ -24,7 +24,6 @@ func TestParseID(t *testing.T) { } for _, tcase := range tcases { - tcase := tcase // pin t.Run(tcase.param, func(t *testing.T) { t.Parallel() diff --git a/transcode/transcode_test.go b/transcode/transcode_test.go index b28b7b6..aadfb3e 100644 --- a/transcode/transcode_test.go +++ b/transcode/transcode_test.go @@ -116,15 +116,12 @@ func TestCachingParallelism(t *testing.T) { cacheTranscoder := transcode.NewCachingTranscoder(transcoder, t.TempDir(), 1024) var wg sync.WaitGroup - for i := 0; i < 5; i++ { - wg.Add(1) - go func() { - defer wg.Done() - + for range 5 { + wg.Go(func() { var buf bytes.Buffer require.NoError(t, cacheTranscoder.Transcode(context.Background(), transcode.PCM16le, "testdata/5s.flac", &buf)) require.Equal(t, 5*bytesPerSec, buf.Len()) - }() + }) } wg.Wait() From 223b7feab467876dc0c659f8eb3f0101d7d73f87 Mon Sep 17 00:00:00 2001 From: sentriz Date: Mon, 8 Sep 2025 13:07:07 +0100 Subject: [PATCH 38/42] readme: mention tagging with wrtag --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 508e175..d1b0bed 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,8 @@ password can then be changed from the web interface | `GONIC_MULTI_VALUE_GENRE` | `-multi-value-genre` | **optional** setting for multi-valued genre tags when scanning ([see more](#multi-valued-tags-v016)) | | `GONIC_MULTI_VALUE_ARTIST` | `-multi-value-artist` | **optional** setting for multi-valued artist tags when scanning ([see more](#multi-valued-tags-v016)) | | `GONIC_MULTI_VALUE_ALBUM_ARTIST` | `-multi-value-album-artist` | **optional** setting for multi-valued album artist tags when scanning ([see more](#multi-valued-tags-v016)) | -| `GONIC_TRANSCODE_CACHE_SIZE` | `-transcode-cache-size` | **optional** size of the transcode cache in MB (0 = no limit) | -| `GONIC_TRANSCODE_EJECT_INTERVAL` | `-transcode-eject-interval` | **optional** interval (in minutes) to eject transcode cache (0 = never) | +| `GONIC_TRANSCODE_CACHE_SIZE` | `-transcode-cache-size` | **optional** size of the transcode cache in MB (0 = no limit) | +| `GONIC_TRANSCODE_EJECT_INTERVAL` | `-transcode-eject-interval` | **optional** interval (in minutes) to eject transcode cache (0 = never) | | `GONIC_EXPVAR` | `-expvar` | **optional** enable the /debug/vars endpoint (exposes useful debugging attributes as well as database stats) | ## multi valued tags (v0.16+) @@ -85,7 +85,7 @@ the available modes are: | value | desc | | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `multi` | gonic will explictly look for multi value fields in your audio metadata such as "genres" or "album_artists". software like [musicbrainz picard](https://picard.musicbrainz.org/), [beets](https://beets.io/) (v1.6.1+ / master), or [betanin](https://github.com/sentriz/betanin/) can set set these | +| `multi` | gonic will explictly look for multi value fields in your audio metadata such as "genres" or "album_artists". software like [musicbrainz picard](https://picard.musicbrainz.org/), [beets](https://beets.io/) (v1.6.1+ / master), [wrtag](https://github.com/sentriz/wrtag/), or [betanin](https://github.com/sentriz/betanin/) can set set these | | `delim ` | gonic will look at your normal audio metadata fields like "genre" or "album_artist", but split them on a delimiter. for example you could set `-multi-value-genre "delim ;"` to split the single genre field on ";". note this mode is not recommended unless you use an uncommon delimiter such as ";" or "\|". using a delimiter like "&" will likely lead to many [false positives](https://musicbrainz.org/artist/ccd4879c-5e88-4385-b131-bf65296bf245) | | `none` (default) | gonic will not attempt to do any multi value processing | From eaa82b00e55dc56dd5f1b7683769c2f30dadcc63 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 9 Sep 2025 18:42:52 +0100 Subject: [PATCH 39/42] feat(readme): document comma escaping in readme closes #596 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d1b0bed..c03b854 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ the available modes are: | `delim ` | gonic will look at your normal audio metadata fields like "genre" or "album_artist", but split them on a delimiter. for example you could set `-multi-value-genre "delim ;"` to split the single genre field on ";". note this mode is not recommended unless you use an uncommon delimiter such as ";" or "\|". using a delimiter like "&" will likely lead to many [false positives](https://musicbrainz.org/artist/ccd4879c-5e88-4385-b131-bf65296bf245) | | `none` (default) | gonic will not attempt to do any multi value processing | +note: `,` is a special character in the environment variable parser. if you wish to use `,` for example for splitting genres, the `,` must be escaped with `\`. for example `"delim \,"`. + ## screenshots | | | | | | From 8ac8779b92ec9c969bf6a26b26454a1c9e49748a Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 18 Sep 2025 12:41:42 +0100 Subject: [PATCH 40/42] fix(subsonic): restore disc/track ordering in getMusicDirectory fixes #597 --- server/ctrlsubsonic/handlers_by_folder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ctrlsubsonic/handlers_by_folder.go b/server/ctrlsubsonic/handlers_by_folder.go index 2f582d0..b6efc54 100644 --- a/server/ctrlsubsonic/handlers_by_folder.go +++ b/server/ctrlsubsonic/handlers_by_folder.go @@ -96,7 +96,7 @@ func (c *Controller) ServeGetMusicDirectory(r *http.Request) *spec.Response { Preload("Artists"). Preload("TrackStar", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID). - Order("tag_track_number"). + Order("tracks.tag_disc_number, tracks.tag_track_number"). Order("filename"). Find(&childTracks) From 3db183bda4b9feda1adf7f4f67218d36eff61a49 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 18 Sep 2025 15:44:58 +0100 Subject: [PATCH 41/42] feat(subsonic): better support for internet radio and podcast episodes in jukebox fixes #572 --- server/ctrlsubsonic/handlers_common.go | 15 ++++++++++----- .../ctrlsubsonic/spec/construct_internet_radio.go | 10 ++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index d39cc12..b97c6ad 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -352,7 +352,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response { return sub } -var errNotATrack = errors.New("not a track") +var errUnknownPlaylistEntry = errors.New("unknown playlist entry") func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:gocyclo if c.jukebox == nil { @@ -394,11 +394,16 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go if err != nil { return nil, fmt.Errorf("fetch track: %w", err) } - track, ok := file.(*db.Track) - if !ok { - return nil, fmt.Errorf("%q: %w", path, errNotATrack) + switch f := file.(type) { + case *db.Track: + ret = append(ret, spec.NewTrackByTags(f, f.Album)) + case *db.InternetRadioStation: + ret = append(ret, spec.NewTCInternetRadioStation(f)) + case *db.PodcastEpisode: + ret = append(ret, spec.NewTCPodcastEpisode(f)) + default: + return nil, fmt.Errorf("%q: %w", path, errUnknownPlaylistEntry) } - ret = append(ret, spec.NewTrackByTags(track, track.Album)) } return ret, nil } diff --git a/server/ctrlsubsonic/spec/construct_internet_radio.go b/server/ctrlsubsonic/spec/construct_internet_radio.go index fda4ff8..8933eb0 100644 --- a/server/ctrlsubsonic/spec/construct_internet_radio.go +++ b/server/ctrlsubsonic/spec/construct_internet_radio.go @@ -10,3 +10,13 @@ func NewInternetRadioStation(irs *db.InternetRadioStation) *InternetRadioStation HomepageURL: irs.HomepageURL, } } + +func NewTCInternetRadioStation(irs *db.InternetRadioStation) *TrackChild { + return &TrackChild{ + ID: irs.SID(), + Title: irs.Name, + IsDir: false, + IsVideo: false, + Type: "internetradio", + } +} From c9f41810af76d6a49c40af274b001f2b5b1d155d Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 18 Sep 2025 16:47:01 +0100 Subject: [PATCH 42/42] feat(docker): use alpine native taglib bumps from 2.0.1 to 2.1.1 --- Dockerfile | 14 +---------- alpine/taglib/APKBUILD | 56 ------------------------------------------ 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 alpine/taglib/APKBUILD diff --git a/Dockerfile b/Dockerfile index 933af85..e8cc222 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,3 @@ -FROM alpine:3.22 AS builder-taglib -WORKDIR /tmp -COPY alpine/taglib/APKBUILD . -RUN apk update && \ - apk add --no-cache abuild doas && \ - echo "permit nopass root" > /etc/doas.conf && \ - abuild-keygen -a -n -i && \ - REPODEST=/pkgs abuild -F -r - FROM golang:1.25-alpine3.22 AS builder RUN apk add -U --no-cache \ build-base \ @@ -14,12 +5,9 @@ RUN apk add -U --no-cache \ git \ sqlite \ zlib-dev \ + taglib-dev \ go -# TODO: delete this block when taglib v2 is on alpine packages -COPY --from=builder-taglib /pkgs/*/*.apk /pkgs/ -RUN apk add --no-cache --allow-untrusted /pkgs/* - WORKDIR /src COPY go.mod . COPY go.sum . diff --git a/alpine/taglib/APKBUILD b/alpine/taglib/APKBUILD deleted file mode 100644 index 6da6c1a..0000000 --- a/alpine/taglib/APKBUILD +++ /dev/null @@ -1,56 +0,0 @@ -# Contributor: Leo -# Maintainer: Natanael Copa -pkgname=taglib2 -pkgver=2.0.1 -pkgrel=0 -pkgdesc="Library for reading and editing metadata of several popular audio formats" -url="https://taglib.github.io/" -arch="all" -license="LGPL-2.1-only OR MPL-1.1" -makedepends="zlib-dev utfcpp cmake samurai" -checkdepends="cppunit-dev" -subpackages=" - $pkgname-dev - libtag:_lib - libtag_c:_lib - " -source="https://taglib.github.io/releases/taglib-$pkgver.tar.gz" -builddir="$srcdir/taglib-$pkgver" - -# secfixes: -# 1.11.1-r2: -# - CVE-2017-12678 -# - CVE-2018-11439 - -build() { - CFLAGS="$CFLAGS -flto=auto" \ - CXXFLAGS="$CXXFLAGS -flto=auto" \ - cmake -B build -G Ninja \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_BUILD_TYPE=MinSizeRel \ - -DWITH_ZLIB=ON \ - -DBUILD_SHARED_LIBS=ON \ - -DBUILD_EXAMPLES=OFF \ - -DBUILD_TESTING="$(want_check && echo ON || echo OFF)" \ - -DVISIBILITY_HIDDEN=ON - CPLUS_INCLUDE_PATH="/usr/include/utf8cpp" \ - cmake --build build -} - -check() { - ctest --test-dir build --output-on-failure -} - -package() { - DESTDIR="$pkgdir" cmake --install build -} - -_lib() { - pkgdesc="$pkgdesc ($subpkgname lib)" - - amove usr/lib/$subpkgname.so.* -} - -sha512sums=" -25ee89293a96d7f8dca6276f822bdaef01fd98503b78c20ffeac8e1d9821de7273a5127146aa798d304c6a995cb2b7229a205aff1cc261b5d4fa9e499dda0439 taglib-2.0.1.tar.gz -"