Compare commits
82
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eccc957fd1
|
||
|
|
6fba25ca0b
|
||
|
|
e5c192c83c
|
||
|
|
d9facdcca6 | ||
|
|
21b562b5fe | ||
|
|
758c4c7279 | ||
|
|
4c5c015190 | ||
|
|
7159e1ca09 | ||
|
|
f812c15fa1 | ||
|
|
dc98b6aa50 | ||
|
|
e2415e944c | ||
|
|
0f7e24b39b | ||
|
|
f5195f15c4 | ||
|
|
fccf01642f | ||
|
|
5638ef5df7 | ||
|
|
6ca68b2c26 | ||
|
|
b36f26e32a | ||
|
|
995c566131 | ||
|
|
6eddc2a1a9 | ||
|
|
6d7c605578 | ||
|
|
6bf39cc0c4 | ||
|
|
8ba05ef14d | ||
|
|
dc3682dc8f | ||
|
|
3cf6d0a28b | ||
|
|
c531666eb6 | ||
|
|
02fd31452d | ||
|
|
9a97fa4b22 | ||
|
|
8d4c22ad2f | ||
|
|
0d85e0ce02 | ||
|
|
8793a36364 | ||
|
|
ac31258f88 | ||
|
|
683525aad2 | ||
|
|
bc62b213a5 | ||
|
|
f6ecd6d39b | ||
|
|
fdceb555bf | ||
|
|
6301cb25bc | ||
|
|
408d325c2c | ||
|
|
e944817f8b | ||
|
|
f8b0fbbfa2 | ||
|
|
90b5324179 | ||
|
|
05149961b5 | ||
|
|
84e29da258 | ||
|
|
7c6e1957fb | ||
|
|
df42923f7b | ||
|
|
4799fb2441 | ||
|
|
322aa0747a | ||
|
|
7558bb3f23 | ||
|
|
e770eaa07a | ||
|
|
a24b7c07cb | ||
|
|
c03e10454c | ||
|
|
a99d63ab12 | ||
|
|
667cf731fd | ||
|
|
38ea72bbc6 | ||
|
|
d6d51ed9f7 | ||
|
|
9e5b8d4ac8 | ||
|
|
238856ad73 | ||
|
|
7de6cf1e9e | ||
|
|
e7d6fdab69 | ||
|
|
94027dcf9b | ||
|
|
46dac6d463 | ||
|
|
fc08e0a171 | ||
|
|
c317046fc9 | ||
|
|
a558947da6 | ||
|
|
e5f815c79e | ||
|
|
80f5facbd2 | ||
|
|
23d23c7c6a | ||
|
|
1fd8c9b2c3 | ||
|
|
9c56bf61ab | ||
|
|
79b28ef653 | ||
|
|
d8338590fd | ||
|
|
fdb2ec66de | ||
|
|
6c8f5fa968 | ||
|
|
6602495032 | ||
|
|
6b2f853b3c | ||
|
|
23e797e62a | ||
|
|
1fab192195 | ||
|
|
98be763e37 | ||
|
|
830ab090fd | ||
|
|
13bb999bd5 | ||
|
|
ae9f95aa75 | ||
|
|
c5b35a6ff1 | ||
|
|
cf3f6666e0 |
No files matched your search
@@ -29,15 +29,15 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
- name: Setup Golang with cache
|
||||
uses: magnetikonline/action-golang-cache@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
install-mode: goinstall
|
||||
version: v2.6.1
|
||||
version: v2.4.0
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
build-docker:
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
|
||||
@@ -10,15 +10,15 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
- name: Setup Golang with cache
|
||||
uses: magnetikonline/action-golang-cache@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
install-mode: goinstall
|
||||
version: v2.6.1
|
||||
version: v2.4.0
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
release-please:
|
||||
@@ -57,8 +57,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
- name: Setup Golang with cache
|
||||
uses: magnetikonline/action-golang-cache@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Build
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login into DockerHub
|
||||
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
|
||||
@@ -11,14 +11,14 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
- name: Setup Golang with cache
|
||||
uses: magnetikonline/action-golang-cache@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
install-mode: goinstall
|
||||
version: v2.6.1
|
||||
version: v2.4.0
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
@@ -1,4 +1,5 @@
|
||||
*.db
|
||||
*.db.*.bak
|
||||
*db-wal
|
||||
*db-shm
|
||||
*.sql
|
||||
|
||||
@@ -1,98 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
### [0.20.1](https://www.github.com/sentriz/gonic/compare/v0.20.0...v0.20.1) (2026-01-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **playlist:** fix regression in playlist ID handling ([103a048](https://www.github.com/sentriz/gonic/commit/103a048e8497597be9b930ea9ef6d57ca755c0eb)), closes [#655](https://www.github.com/sentriz/gonic/issues/655)
|
||||
|
||||
## [0.20.0](https://www.github.com/sentriz/gonic/compare/v0.19.0...v0.20.0) (2026-01-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for playlist cover art on filesystem ([aad729e](https://www.github.com/sentriz/gonic/commit/aad729e3ea79a0a542496802c815851d8e0f702a)), closes [#650](https://www.github.com/sentriz/gonic/issues/650)
|
||||
* **ci:** bump golangci-lint ([79e3898](https://www.github.com/sentriz/gonic/commit/79e3898c3b47d4b3120265fa9aa6ddc22d2fbe7c))
|
||||
* **db:** add an index on albums.created_at ([816e437](https://www.github.com/sentriz/gonic/commit/816e437d44b2feb40f82e8d589e3d17c0bf87b0c)), closes [#620](https://www.github.com/sentriz/gonic/issues/620)
|
||||
* **gonic:** add log-db option to log queries ([75a0918](https://www.github.com/sentriz/gonic/commit/75a0918a7ef8bb6c9506de69dd4e6b6e8c35e567)), closes [#620](https://www.github.com/sentriz/gonic/issues/620)
|
||||
* **scanner:** read multi valued release types ([c752a22](https://www.github.com/sentriz/gonic/commit/c752a22808527a034531418263662261fe83f9d4))
|
||||
* **subsonic:** allow non admins to download podcast episodes ([c2ebe96](https://www.github.com/sentriz/gonic/commit/c2ebe9631300b54f60bf3fd12a4eae526a84d3de)), closes [#623](https://www.github.com/sentriz/gonic/issues/623)
|
||||
* **subsonic:** implement getSimilarSongs for artists and albums ([#649](https://www.github.com/sentriz/gonic/issues/649)) ([db9aa2b](https://www.github.com/sentriz/gonic/commit/db9aa2b2e37903e8cce770d76bed6e568570599e))
|
||||
* **subsonic:** return disc titles ([0377bfa](https://www.github.com/sentriz/gonic/commit/0377bfa696e7f5dc02497bd49b96cebeefd7ef2f))
|
||||
* **taglib:** add `.ape` as a supported filetype ([82642eb](https://www.github.com/sentriz/gonic/commit/82642eb1ca4b9587fe1764bf7efe8bbb2cb28e42)), closes [#615](https://www.github.com/sentriz/gonic/issues/615)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **db:** enable WAL also for Wasm driver ([b67c1c1](https://www.github.com/sentriz/gonic/commit/b67c1c14d2b883f634f7aaecc0367a15ec7dab71)), closes [#620](https://www.github.com/sentriz/gonic/issues/620)
|
||||
* **db:** use separate DSN for both drivers ([4696499](https://www.github.com/sentriz/gonic/commit/469649935e26ef279a4a805cd964d3b010aa8146))
|
||||
* **gonic:** correct typo in command line help ([#640](https://www.github.com/sentriz/gonic/issues/640)) ([99e2ccf](https://www.github.com/sentriz/gonic/commit/99e2ccfb0f7ce038669fef2f9ff281da4174fee6))
|
||||
* **podcast:** truncate filenames longer than 200 chars ([e12ab54](https://www.github.com/sentriz/gonic/commit/e12ab544c21f286ead3c84ead113be6658cef318)), closes [#624](https://www.github.com/sentriz/gonic/issues/624)
|
||||
* **podcast:** validate response status code when fetching podcast audio ([2900ce5](https://www.github.com/sentriz/gonic/commit/2900ce51024e5dafdf23ca0c5a6280bd3bd48059)), closes [#639](https://www.github.com/sentriz/gonic/issues/639)
|
||||
* **scanner:** clear metadata of albums who no longer have tracks ([ca59601](https://www.github.com/sentriz/gonic/commit/ca59601484371d41564f84e33af62642df6de3e5)), closes [#638](https://www.github.com/sentriz/gonic/issues/638)
|
||||
* **scanner:** reset embedded cover for album when toggling `scan-embedded-cover` ([ea5e625](https://www.github.com/sentriz/gonic/commit/ea5e6252a175c6dea688c2910f7cb270b60b1c27)), closes [#619](https://www.github.com/sentriz/gonic/issues/619)
|
||||
* **subsonic:** correct spec typos ([04ff7f3](https://www.github.com/sentriz/gonic/commit/04ff7f3c331445abbbcf6a64465aa523c1775386)), closes [#653](https://www.github.com/sentriz/gonic/issues/653)
|
||||
|
||||
## [0.19.0](https://www.github.com/sentriz/gonic/compare/v0.18.0...v0.19.0) (2025-10-11)
|
||||
|
||||
This release uses WebAssesmby for the [tagging](https://github.com/sentriz/go-taglib) and [database](https://github.com/ncruces/go-sqlite3) backends. This means that gonic no longer requires Cgo or external dependencies to build. As a result, static binaries will be available in the releases page, and Docker images for more architectures. Performance of scanning and tagging should also be improved.
|
||||
|
||||
### Features
|
||||
|
||||
* **build:** add Cgo free database ([505f7d8](https://www.github.com/sentriz/gonic/commit/505f7d8ae6116c5dc1cfa50a5caba6333672be20))
|
||||
* **build:** add Cgo free tagging backend ([7802e20](https://www.github.com/sentriz/gonic/commit/7802e20e7214e1912fc84bb29c877984b99913c9))
|
||||
* **ci:** merge nightly and debug workflows ([ca85eed](https://www.github.com/sentriz/gonic/commit/ca85eed4c156c5370c1e3e4c7fbc31d4c1811f57))
|
||||
* **ci:** remove Cgo dependencies, cross compile without QEMU, upload static binaries ([e3db819](https://www.github.com/sentriz/gonic/commit/e3db819d8fd5ae14332c56ab7cebc01d46a6c76b))
|
||||
* **ffprobe:** add more supported file types ([8e7820a](https://www.github.com/sentriz/gonic/commit/8e7820a72e2360e3b5808299123fd5a686c084e8))
|
||||
* **gonic:** add `scan-embedded-cover-enabled` flag ([c69cb8c](https://www.github.com/sentriz/gonic/commit/c69cb8cf35203c6db15d3c1bd68a86cb91108b40))
|
||||
* **gonic:** use wrtag/normtag for nag normalisation ([aba758f](https://www.github.com/sentriz/gonic/commit/aba758f2ba6e6d20887a36a0cba80127c2b110a9))
|
||||
* **subsonic:** also read unsynced lyrics from .txt files and tag metadata ([eb0d8fd](https://www.github.com/sentriz/gonic/commit/eb0d8fd1c710bf0367348873858662c39515b676)), closes [#593](https://www.github.com/sentriz/gonic/issues/593)
|
||||
* **subsonic:** keep original cover file format when caching ([#609](https://www.github.com/sentriz/gonic/issues/609)) ([1af4ce3](https://www.github.com/sentriz/gonic/commit/1af4ce35873ff17dc6331e0d7c0e0385213b53b3)), closes [#11](https://www.github.com/sentriz/gonic/issues/11)
|
||||
* **subsonic:** return genres for getAlbumListTwo2 ([3909e9b](https://www.github.com/sentriz/gonic/commit/3909e9b5bdbc3deb1b5f48ff6f04b3d865a1b1bc)), closes [#605](https://www.github.com/sentriz/gonic/issues/605)
|
||||
* **subsonic:** support embedded cover art ([ec7cffd](https://www.github.com/sentriz/gonic/commit/ec7cffdd57f235adce93b7faf1998fdc9a164c52)), closes [#11](https://www.github.com/sentriz/gonic/issues/11) [#556](https://www.github.com/sentriz/gonic/issues/556)
|
||||
* **subsonic:** support embedded track level cover art ([d66814b](https://www.github.com/sentriz/gonic/commit/d66814bfd1d39ba92c6c368c0006052451675454)), closes [#11](https://www.github.com/sentriz/gonic/issues/11)
|
||||
* **tags:** add ffprobe reader ([3a9c03a](https://www.github.com/sentriz/gonic/commit/3a9c03ac88b6e6476206a87e3703e247c965e7c9))
|
||||
* **tags:** add Properties.HasCover ([bc0b6c0](https://www.github.com/sentriz/gonic/commit/bc0b6c0da4738c3ee8f40525e2ed1d85c51f927a))
|
||||
* **tags:** add ReadCover interface method ([e413bc3](https://www.github.com/sentriz/gonic/commit/e413bc35ded9463b245ff913fb2d90ee80ea3184))
|
||||
|
||||
### ⚠ Note to package maintainers
|
||||
|
||||
- The `sqlite-dev` and `libtag-dev` (or your distro's equivalents) packages are **no longer required**; please remove them from package dependencies.
|
||||
- Build with `CGO_ENABLED=0` to produce static binaries.
|
||||
|
||||
gonic now vendors reproducible WebAssembly backends for TagLib and SQLite, eliminating Cgo and external system libraries. Builds are fully static, cross-compiling is straightforward, and supply-chain verification is easier.
|
||||
|
||||
Verify the vendored WASM artifacts using Artifact Attestations:
|
||||
- <https://github.com/sentriz/go-taglib/raw/refs/tags/v0.10.4/taglib.wasm> ([Attestations](https://github.com/sentriz/go-taglib/attestations/11402786))
|
||||
- <https://github.com/ncruces/go-sqlite3/raw/refs/tags/v0.29.1/embed/sqlite3.wasm> ([Attestations](https://github.com/ncruces/go-sqlite3/attestations/11344814))
|
||||
|
||||
Example build pipeline:
|
||||
```console
|
||||
$ git clone https://github.com/sentriz/gonic
|
||||
$ cd gonic
|
||||
|
||||
$ sha256sum "$(go list -m -f '{{.Dir}}' go.senan.xyz/taglib)/taglib.wasm"
|
||||
# expected ca5ce04b35f1e6cad8b8d9f00906a4c108ccd004b56e713db5ce69aa69b3805d (https://github.com/sentriz/go-taglib/attestations/11402786)
|
||||
|
||||
$ sha256sum "$(go list -m -f '{{.Dir}}' github.com/ncruces/go-sqlite3)/embed/sqlite3.wasm"
|
||||
# expected 117262b6241d8de78ba564a44383fa1562e52f1a978de269e20a02b3c06c02e3 (https://github.com/ncruces/go-sqlite3/attestations/11344814)
|
||||
|
||||
$ CGO_ENABLED=0 go build ./cmd/gonic/.
|
||||
```
|
||||
|
||||
Opting out of WebAssembly:
|
||||
|
||||
- If you prefer not to use the WebAssembly binaries, you can build with `nowasm`:
|
||||
|
||||
```console
|
||||
$ go build -tags nowasm ./cmd/gonic/.
|
||||
```
|
||||
|
||||
- This mode is not supported, and tagging/scan performance will degrade.
|
||||
- Cgo will be used for sqlite, so sqlite-dev is still required.
|
||||
- `ffprobe` will be used for tagging, so that must be available in `$PATH`. `libtag-dev` is still not used in this mode.
|
||||
|
||||
## [0.18.0](https://www.github.com/sentriz/gonic/compare/v0.17.0...v0.18.0) (2025-09-18)
|
||||
|
||||
|
||||
|
||||
@@ -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), [termsonic](https://git.sixfoisneuf.fr/termsonic/), [tempus](https://github.com/eddyizm/tempus/), [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
|
||||
|
||||
@@ -52,7 +52,6 @@ password can then be changed from the web interface
|
||||
| env var | command line arg | description |
|
||||
| ----------------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) |
|
||||
| `GONIC_DEFAULT_MUSIC_PATH` | `-default-music-path` | default music path for when no folder is selected in client (useful for when client does not support choosing a folder) |
|
||||
| `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory |
|
||||
| `GONIC_PLAYLISTS_PATH` | `-playlists-path` | path to new or existing directory with m3u files for subsonic playlists. items in the directory should be in the format `<userid>/<name>.m3u`. for example the admin user could have `1/my-playlist.m3u`. gonic create and make changes to these playlists over the subsonic api. |
|
||||
| `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc |
|
||||
|
||||
Binary file not shown.
+25
-12
@@ -30,15 +30,14 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"go.senan.xyz/flagconf"
|
||||
|
||||
"go.senan.xyz/gonic"
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/deps"
|
||||
"go.senan.xyz/gonic/handlerutil"
|
||||
"go.senan.xyz/gonic/infocache/albuminfocache"
|
||||
"go.senan.xyz/gonic/infocache/artistinfocache"
|
||||
"go.senan.xyz/gonic/jukebox"
|
||||
"go.senan.xyz/gonic/lastfm"
|
||||
"go.senan.xyz/gonic/ldap"
|
||||
"go.senan.xyz/gonic/listenbrainz"
|
||||
"go.senan.xyz/gonic/playlist"
|
||||
"go.senan.xyz/gonic/podcast"
|
||||
@@ -62,7 +61,6 @@ func main() {
|
||||
|
||||
var confMusicPaths pathAliases
|
||||
flag.Var(&confMusicPaths, "music-path", "path to music")
|
||||
defaultMusicPath := flag.String("default-music-path", "", "interval (in minutes) to automatically scan music (optional)")
|
||||
|
||||
confPlaylistsPath := flag.String("playlists-path", "", "path to your list of new or existing m3u playlists that gonic can manage")
|
||||
|
||||
@@ -84,14 +82,31 @@ func main() {
|
||||
|
||||
confExcludePattern := flag.String("exclude-pattern", "", "regex pattern to exclude files from scan (optional)")
|
||||
|
||||
var ldapConfig ldap.Config
|
||||
flag.StringVar(&ldapConfig.BindUser, "ldap-bind-user", "", "the bind user to bind to LDAP with (required for LDAP)")
|
||||
flag.StringVar(&ldapConfig.BindPass, "ldap-bind-pass", "", "the password of the LDAP bind user (required for LDAP)")
|
||||
flag.StringVar(&ldapConfig.BaseDN, "ldap-base-dn", "", "the base DN for LDAP objects (required for LDAP)")
|
||||
|
||||
flag.StringVar(&ldapConfig.Filter, "ldap-filter", "", "the filter to select LDAP objects with (optional)")
|
||||
flag.StringVar(&ldapConfig.AdminFilter, "ldap-admin-filter", "(memberof=cn=admin)", "the filter to select LDAP objects with (optional)")
|
||||
|
||||
flag.StringVar(&ldapConfig.FQDN, "ldap-fqdn", "", "the name of the server to connect to (required for LDAP)")
|
||||
flag.UintVar(&ldapConfig.Port, "ldap-port", 389, "what port the LDAP server is hosted on (optional)")
|
||||
flag.BoolVar(&ldapConfig.TLS, "ldap-tls", false, "whether gonic will connect to the LDAP server using TLS (optional)")
|
||||
|
||||
if ldapConfig.FQDN != "" {
|
||||
if ldapConfig.BindUser == "" || ldapConfig.BindPass == "" || ldapConfig.BaseDN == "" {
|
||||
log.Fatal("a server was provided for an LDAP connection, but configuration is incomplete")
|
||||
}
|
||||
}
|
||||
|
||||
var confMultiValueGenre, confMultiValueArtist, confMultiValueAlbumArtist multiValueSetting
|
||||
flag.Var(&confMultiValueGenre, "multi-value-genre", "setting for multi-valued genre scanning (optional)")
|
||||
flag.Var(&confMultiValueArtist, "multi-value-artist", "setting for multi-valued track artist scanning (optional)")
|
||||
flag.Var(&confMultiValueAlbumArtist, "multi-value-album-artist", "setting for multi-valued album artist scanning (optional)")
|
||||
flag.Var(&confMultiValueGenre, "multi-value-genre", "setting for mutli-valued genre scanning (optional)")
|
||||
flag.Var(&confMultiValueArtist, "multi-value-artist", "setting for mutli-valued track artist scanning (optional)")
|
||||
flag.Var(&confMultiValueAlbumArtist, "multi-value-album-artist", "setting for mutli-valued album artist scanning (optional)")
|
||||
|
||||
confPprof := flag.Bool("pprof", false, "enable the /debug/pprof endpoint (optional)")
|
||||
confExpvar := flag.Bool("expvar", false, "enable the /debug/vars endpoint (optional)")
|
||||
confLogDB := flag.Bool("log-db", false, "enable database query logging (optional)")
|
||||
|
||||
deprecatedConfGenreSplit := flag.String("genre-split", "", "(deprecated, see multi-value settings)")
|
||||
|
||||
@@ -141,7 +156,7 @@ func main() {
|
||||
log.Fatalf("couldn't create covers cache path: %v\n", err)
|
||||
}
|
||||
|
||||
dbc, err := db.New(*confDBPath, deps.DBDriverOptions(), *confLogDB)
|
||||
dbc, err := db.New(*confDBPath, db.DefaultOptions())
|
||||
if err != nil {
|
||||
log.Fatalf("error opening database: %v\n", err)
|
||||
}
|
||||
@@ -185,8 +200,6 @@ func main() {
|
||||
log.Printf(" %-30s %s\n", f.Name, value)
|
||||
})
|
||||
|
||||
tagReader := deps.TagReader
|
||||
|
||||
scannr := scanner.New(
|
||||
ctrlsubsonic.MusicPaths(musicPaths),
|
||||
dbc,
|
||||
@@ -253,11 +266,11 @@ func main() {
|
||||
return url.String()
|
||||
}
|
||||
|
||||
ctrlAdmin, err := ctrladmin.New(dbc, sessDB, scannr, podcast, lastfmClient, resolveProxyPath)
|
||||
ctrlAdmin, err := ctrladmin.New(dbc, sessDB, scannr, podcast, lastfmClient, resolveProxyPath, ldapConfig)
|
||||
if err != nil {
|
||||
log.Panicf("error creating admin controller: %v\n", err)
|
||||
}
|
||||
ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *defaultMusicPath, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath)
|
||||
ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath, ldapConfig)
|
||||
if err != nil {
|
||||
log.Panicf("error creating subsonic controller: %v\n", err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//go:build !nowasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
// Cgo-free Wasm database
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
|
||||
// Cgo-free Wasm tagger
|
||||
"go.senan.xyz/gonic/tags/taglib"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var tagReader = taglib.Reader{}
|
||||
@@ -0,0 +1,14 @@
|
||||
//go:build nowasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
// Cgo database
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
// Cgo tagger
|
||||
"go.senan.xyz/gonic/tags/ffprobe"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var tagReader = ffprobe.Reader{}
|
||||
@@ -17,40 +17,46 @@ import (
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
)
|
||||
|
||||
func DefaultOptions() url.Values {
|
||||
return url.Values{
|
||||
// with this, multiple connections share a single data and schema cache.
|
||||
// see https://www.sqlite.org/sharedcache.html
|
||||
"cache": {"shared"},
|
||||
// with this, the db sleeps for a little while when locked. can prevent
|
||||
// a SQLITE_BUSY. see https://www.sqlite.org/c3ref/busy_timeout.html
|
||||
"_busy_timeout": {"30000"},
|
||||
"_journal_mode": {"WAL"},
|
||||
"_foreign_keys": {"true"},
|
||||
}
|
||||
}
|
||||
|
||||
func mockOptions() url.Values {
|
||||
return url.Values{
|
||||
"_foreign_keys": {"true"},
|
||||
}
|
||||
}
|
||||
|
||||
type DB struct {
|
||||
*gorm.DB
|
||||
}
|
||||
|
||||
func New(path string, opts url.Values, logQueries bool) (*DB, error) {
|
||||
u := url.URL{
|
||||
Scheme: "file",
|
||||
Opaque: path,
|
||||
RawQuery: opts.Encode(),
|
||||
func New(path string, options url.Values) (*DB, error) {
|
||||
url := url.URL{
|
||||
Scheme: "file",
|
||||
Opaque: path,
|
||||
}
|
||||
|
||||
db, err := gorm.Open("sqlite3", u.String())
|
||||
url.RawQuery = options.Encode()
|
||||
db, err := gorm.Open("sqlite3", url.String())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("with gorm: %w", err)
|
||||
}
|
||||
|
||||
db.SetLogger(log.New(os.Stdout, "gorm ", 0))
|
||||
if logQueries {
|
||||
db.LogMode(true)
|
||||
}
|
||||
|
||||
db.DB().SetMaxOpenConns(4)
|
||||
|
||||
db.DB().SetMaxOpenConns(1)
|
||||
return &DB{DB: db}, nil
|
||||
}
|
||||
|
||||
func NewMock(opts url.Values) (*DB, error) {
|
||||
d, err := New(":memory:", opts, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// in-memory databases can't be shared across multiple connections
|
||||
d.DB.DB().SetMaxOpenConns(1)
|
||||
return d, nil
|
||||
func NewMock() (*DB, error) {
|
||||
return New(":memory:", mockOptions())
|
||||
}
|
||||
|
||||
func (db *DB) InsertBulkLeftMany(table string, head []string, left int, col []int) error {
|
||||
@@ -223,7 +229,7 @@ type Track struct {
|
||||
TagTrackNumber int `sql:"default: null"`
|
||||
TagDiscNumber int `sql:"default: null"`
|
||||
TagBrainzID string `sql:"default: null"`
|
||||
TagLyrics string `sql:"default: null"`
|
||||
TagLyrics string `sql:"default:null"`
|
||||
|
||||
ReplayGainTrackGain float32
|
||||
ReplayGainTrackPeak float32
|
||||
@@ -287,7 +293,7 @@ type User struct {
|
||||
ID int `gorm:"primary_key"`
|
||||
CreatedAt time.Time
|
||||
Name string `gorm:"not null; unique_index" sql:"default: null"`
|
||||
Password string `gorm:"not null" sql:"default: null"`
|
||||
Password string `sql:"default: null"`
|
||||
LastFMSession string `sql:"default: null"`
|
||||
ListenBrainzURL string `sql:"default: null"`
|
||||
ListenBrainzToken string `sql:"default: null"`
|
||||
@@ -340,7 +346,6 @@ type Album struct {
|
||||
AlbumRating *AlbumRating
|
||||
AverageRating float64 `sql:"default: null"`
|
||||
Play *Play
|
||||
DiscTitles []*AlbumDiscTitle
|
||||
}
|
||||
|
||||
func (a *Album) SID() *specid.ID {
|
||||
@@ -418,12 +423,6 @@ type AlbumGenre struct {
|
||||
GenreID int `gorm:"not null; unique_index:idx_album_id_genre_id" sql:"default: null; type:int REFERENCES genres(id) ON DELETE CASCADE"`
|
||||
}
|
||||
|
||||
type AlbumDiscTitle struct {
|
||||
AlbumID int `gorm:"not null; unique_index:idx_album_disc" sql:"type:int REFERENCES albums(id) ON DELETE CASCADE"`
|
||||
DiscNumber int `gorm:"not null; unique_index:idx_album_disc"`
|
||||
Title string `gorm:"not null"`
|
||||
}
|
||||
|
||||
type AlbumStar struct {
|
||||
UserID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
|
||||
AlbumID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
|
||||
|
||||
+2
-3
@@ -7,9 +7,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.senan.xyz/gonic/deps"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -23,7 +22,7 @@ func TestGetSetting(t *testing.T) {
|
||||
key := SettingKey(randKey())
|
||||
value := "howdy"
|
||||
|
||||
testDB, err := NewMock(deps.DBDriverOptions())
|
||||
testDB, err := NewMock()
|
||||
if err != nil {
|
||||
t.Fatalf("error creating db: %v", err)
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ func (db *DB) Migrate(ctx MigrationContext) error {
|
||||
construct(ctx, "202508261102", migrateAddLyrics),
|
||||
construct(ctx, "202509291741", migrateAddAlbumEmbeddedCoverTrackID),
|
||||
construct(ctx, "202509301448", migrateAddTrackEmbeddedCover),
|
||||
construct(ctx, "202512021147", migrateAlbumAddIndexOnCreatedAt),
|
||||
construct(ctx, "202601201000", migrateAddAlbumDiscTitles),
|
||||
}
|
||||
|
||||
return gormigrate.
|
||||
@@ -869,13 +867,3 @@ func migrateAddAlbumEmbeddedCoverTrackID(tx *gorm.DB, _ MigrationContext) error
|
||||
func migrateAddTrackEmbeddedCover(tx *gorm.DB, _ MigrationContext) error {
|
||||
return tx.AutoMigrate(Track{}).Error
|
||||
}
|
||||
|
||||
func migrateAlbumAddIndexOnCreatedAt(tx *gorm.DB, _ MigrationContext) error {
|
||||
return tx.Exec(`
|
||||
CREATE INDEX idx_albums_created_at ON "albums" (created_at);
|
||||
`).Error
|
||||
}
|
||||
|
||||
func migrateAddAlbumDiscTitles(tx *gorm.DB, _ MigrationContext) error {
|
||||
return tx.AutoMigrate(AlbumDiscTitle{}).Error
|
||||
}
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
//go:build !nowasm
|
||||
|
||||
package deps
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
// Cgo-free Wasm database
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
|
||||
// Cgo-free Wasm tagger
|
||||
"go.senan.xyz/gonic/tags/taglib"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var TagReader = taglib.Reader{}
|
||||
|
||||
// DBDriverOptions returns SQLite DSN options for the ncruces driver
|
||||
func DBDriverOptions() url.Values {
|
||||
return url.Values{
|
||||
"_pragma": {
|
||||
"busy_timeout(30000)",
|
||||
"journal_mode(WAL)",
|
||||
"foreign_keys(ON)",
|
||||
},
|
||||
}
|
||||
}
|
||||
Vendored
-25
@@ -1,25 +0,0 @@
|
||||
//go:build nowasm
|
||||
|
||||
package deps
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
// Cgo database
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
// Cgo tagger
|
||||
"go.senan.xyz/gonic/tags/ffprobe"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var TagReader = ffprobe.Reader{}
|
||||
|
||||
// DSNOptions returns SQLite DSN options for the mattn driver
|
||||
func DBDriverOptions() url.Values {
|
||||
return url.Values{
|
||||
"_busy_timeout": {"30000"},
|
||||
"_journal_mode": {"WAL"},
|
||||
"_foreign_keys": {"true"},
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,9 @@ import (
|
||||
|
||||
var nonAlphaNumExpr = regexp.MustCompile("[^a-zA-Z0-9_.]+")
|
||||
|
||||
const maxFilenameLength = 200
|
||||
|
||||
func Safe(filename string) string {
|
||||
filename = nonAlphaNumExpr.ReplaceAllString(filename, "")
|
||||
ext := filepath.Ext(filename)
|
||||
filename = filename[:min(maxFilenameLength, len(filename))-len(ext)]
|
||||
return filename + ext
|
||||
return filename
|
||||
}
|
||||
|
||||
// try to find a unqiue file (or dir) name. incrementing like "example (1)"
|
||||
|
||||
@@ -57,20 +57,3 @@ func TestFirst(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, p("test"), r)
|
||||
}
|
||||
|
||||
func TestSafe(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
longName := "hi_00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
result := Safe(longName)
|
||||
require.Equal(t, 200, len(result))
|
||||
require.Equal(t, longName[:200], result)
|
||||
|
||||
longNameWithExt := "hi_00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.mp3"
|
||||
result = Safe(longNameWithExt)
|
||||
require.Equal(t, 200, len(result))
|
||||
require.Equal(t, ".mp3", result[len(result)-4:])
|
||||
|
||||
require.Equal(t, "test.mp3", Safe("test.mp3"))
|
||||
require.Equal(t, "testing.mp3", Safe("test ing.mp3"))
|
||||
}
|
||||
@@ -13,38 +13,41 @@ require (
|
||||
github.com/env25/mpdlrc v0.7.4
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/fsnotify/fsnotify v1.9.0
|
||||
github.com/go-ldap/ldap/v3 v3.4.6
|
||||
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.2
|
||||
github.com/mattn/go-sqlite3 v1.14.33
|
||||
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/ncruces/go-sqlite3 v0.30.4
|
||||
github.com/ncruces/go-sqlite3 v0.29.1
|
||||
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/gormstore v0.0.0-20220105134332-64e31f7f6981
|
||||
github.com/stretchr/testify v1.11.1
|
||||
go.senan.xyz/flagconf v0.1.11
|
||||
go.senan.xyz/taglib v0.11.1
|
||||
go.senan.xyz/wrtag v0.20.0
|
||||
golang.org/x/net v0.49.0
|
||||
golang.org/x/sync v0.19.0
|
||||
go.senan.xyz/flagconf v0.1.9
|
||||
go.senan.xyz/taglib v0.10.1
|
||||
go.senan.xyz/wrtag v0.18.1-0.20250930121808-19bf03481e5e
|
||||
golang.org/x/net v0.44.0
|
||||
golang.org/x/sync v0.17.0
|
||||
gopkg.in/gormigrate.v1 v1.6.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.11.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.22.4 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.1 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.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
|
||||
@@ -52,7 +55,6 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kr/pretty v0.1.0 // indirect
|
||||
github.com/lib/pq v1.3.0 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
@@ -61,12 +63,11 @@ require (
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/ncruces/julianday v1.0.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/tetratelabs/wazero v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/image v0.35.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/text v0.33.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
github.com/tetratelabs/wazero v1.9.0 // indirect
|
||||
golang.org/x/crypto v0.42.0 // indirect
|
||||
golang.org/x/image v0.31.0 // indirect
|
||||
golang.org/x/sys v0.36.0 // indirect
|
||||
golang.org/x/text v0.29.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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
cloud.google.com/go v0.33.1/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||
@@ -6,8 +8,10 @@ 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.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw=
|
||||
github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ=
|
||||
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA=
|
||||
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||
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=
|
||||
@@ -37,12 +41,14 @@ 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.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4=
|
||||
github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80=
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI=
|
||||
github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag=
|
||||
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
|
||||
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-ldap/ldap/v3 v3.4.6 h1:ert95MdbiG7aWo/oPYp9btL3KJlMPKnP58r09rI8T+A=
|
||||
github.com/go-ldap/ldap/v3 v3.4.6/go.mod h1:IGMQANNtxpsOzj7uUAMjpGBaOVTC4DYyIy8VsTdxmtc=
|
||||
github.com/go-openapi/jsonpointer v0.22.1 h1:sHYI1He3b9NqJ4wXLoJDKmUmHkWy/L7rtEo92JUxBNk=
|
||||
github.com/go-openapi/jsonpointer v0.22.1/go.mod h1:pQT9OsLkfz1yWoMgYFy4x3U5GY5nUlsOn1qSBH5MkCM=
|
||||
github.com/go-openapi/swag/jsonname v0.25.1 h1:Sgx+qbwa4ej6AomWC6pEfXrA6uP2RkaNjA9BR8a1RJU=
|
||||
github.com/go-openapi/swag/jsonname v0.25.1/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo=
|
||||
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=
|
||||
@@ -57,6 +63,7 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
@@ -90,10 +97,8 @@ github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5
|
||||
github.com/josephburnett/jd v1.9.2/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM=
|
||||
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.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
@@ -103,8 +108,8 @@ github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
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.33 h1:A5blZ5ulQo2AtayQ9/limgHEkFreKj1Dv226a1K73s0=
|
||||
github.com/mattn/go-sqlite3 v1.14.33/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/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=
|
||||
@@ -122,8 +127,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/ncruces/go-sqlite3 v0.30.4 h1:j9hEoOL7f9ZoXl8uqXVniaq1VNwlWAXihZbTvhqPPjA=
|
||||
github.com/ncruces/go-sqlite3 v0.30.4/go.mod h1:7WR20VSC5IZusKhUdiR9y1NsUqnZgqIYCmKKoMEYg68=
|
||||
github.com/ncruces/go-sqlite3 v0.29.1 h1:NIi8AISWBToRHyoz01FXiTNvU147Tqdibgj2tFzJCqM=
|
||||
github.com/ncruces/go-sqlite3 v0.29.1/go.mod h1:PpccBNNhvjwUOwDQEn2gXQPFPTWdlromj0+fSkd5KSg=
|
||||
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
|
||||
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
@@ -141,19 +146,22 @@ github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7
|
||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
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/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA=
|
||||
github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU=
|
||||
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
|
||||
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.senan.xyz/flagconf v0.1.11 h1:ApA9DpoSrfVQlLt8spKJC3fOT7oTEZ2/MmBGMnb9mt4=
|
||||
go.senan.xyz/flagconf v0.1.11/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ=
|
||||
go.senan.xyz/taglib v0.11.1 h1:S3mO5e3HRRG0Ehw1jLUodYbAJK8TtqdOoNgqkC0D3uU=
|
||||
go.senan.xyz/taglib v0.11.1/go.mod h1:qyTl978MnGeZ/ny4d/t0ErLXxysA+39X4+SNSCk56Zs=
|
||||
go.senan.xyz/wrtag v0.20.0 h1:Q57ITuEl3TuRuOIkerCL+y4O3WrCqC1lUrewHtluUjc=
|
||||
go.senan.xyz/wrtag v0.20.0/go.mod h1:1h39mVCOu6mqeQGYVToCvMhegBRCpOt6FO7g69EvuSM=
|
||||
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/taglib v0.10.1 h1:ez+lr7APh7BD3ft8PYgRM2Q8HKaiBkWZrZDHWwr4aDw=
|
||||
go.senan.xyz/taglib v0.10.1/go.mod h1:UMXxjvVuML3bZ63elOoUFtY2ZjwH88KB+DKWfF50ln8=
|
||||
go.senan.xyz/wrtag v0.18.1-0.20250930121808-19bf03481e5e h1:Q81nHdKVLExGp7+NosXA63dmPSwhijKZKzAhkC6gY4g=
|
||||
go.senan.xyz/wrtag v0.18.1-0.20250930121808-19bf03481e5e/go.mod h1:iBOnQIdvi55Y47SJxc4e5k1eu1bSeUwsq4hbFZOnXHU=
|
||||
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=
|
||||
@@ -163,11 +171,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.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.35.0 h1:LKjiHdgMtO8z7Fh18nGY6KDcoEtVfsgLDPeLyguqb7I=
|
||||
golang.org/x/image v0.35.0/go.mod h1:MwPLTVgvxSASsxdLzKrl8BRFuyqMyGhLwmC+TO1Sybk=
|
||||
golang.org/x/image v0.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
|
||||
golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
|
||||
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=
|
||||
@@ -187,8 +195,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.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||
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=
|
||||
@@ -196,8 +204,8 @@ 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.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
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=
|
||||
@@ -212,8 +220,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.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
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=
|
||||
@@ -232,21 +240,21 @@ 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.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||
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.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
|
||||
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
|
||||
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
||||
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||
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=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/gormigrate.v1 v1.6.0 h1:XpYM6RHQPmzwY7Uyu+t+xxMXc86JYFJn4nEc9HzQjsI=
|
||||
gopkg.in/gormigrate.v1 v1.6.0/go.mod h1:Lf00lQrHqfSYWiTtPcyQabsDdM6ejZaMgV0OU6JMSlw=
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
|
||||
|
||||
@@ -12,6 +12,9 @@ import (
|
||||
"go.senan.xyz/gonic/lastfm"
|
||||
"go.senan.xyz/gonic/lastfm/mockclient"
|
||||
"go.senan.xyz/gonic/mockfs"
|
||||
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
)
|
||||
|
||||
func TestInfoCache(t *testing.T) {
|
||||
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
package ldap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var ldapStore = make(LDAPStore)
|
||||
|
||||
// LDAPStore maps users to a cached password
|
||||
type LDAPStore map[string]CachedLDAPpassword
|
||||
|
||||
// Add caches a password username set.
|
||||
func (store LDAPStore) Add(username, password string) {
|
||||
store[username] = CachedLDAPpassword{
|
||||
Password: password,
|
||||
ExpiresAt: time.Now().Add(time.Hour * 8), // Keep the password valid for 8 hours.
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid checks if a user's password is stored in the cache and checks if a
|
||||
// given password is valid.
|
||||
func (store LDAPStore) IsValid(username, password string) bool {
|
||||
cached, ok := store[username]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
if cached.Password != password {
|
||||
return false
|
||||
}
|
||||
|
||||
return cached.IsValid()
|
||||
}
|
||||
|
||||
// CachedLDAPpassword stores an LDAP user's password and a time at which the
|
||||
// server should no longer accept it.
|
||||
type CachedLDAPpassword struct {
|
||||
Password string
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
func (password CachedLDAPpassword) IsValid() bool {
|
||||
return password.ExpiresAt.After(time.Now())
|
||||
}
|
||||
|
||||
// Cofig stores the user's LDAP server options.
|
||||
type Config struct {
|
||||
BindUser string
|
||||
BindPass string
|
||||
BaseDN string
|
||||
|
||||
Filter string
|
||||
AdminFilter string
|
||||
|
||||
FQDN string
|
||||
Port uint
|
||||
TLS bool
|
||||
}
|
||||
|
||||
func (c Config) IsSetup() bool {
|
||||
// This is basically checking if LDAP is setup, if ldapFQDN isn't set we can
|
||||
// assume that the user hasn't configured LDAP.
|
||||
return c.FQDN != ""
|
||||
}
|
||||
|
||||
func CheckLDAPcreds(username string, password string, dbc *db.DB, config Config) (bool, error) {
|
||||
if !config.IsSetup() {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if ldapStore.IsValid(username, password) {
|
||||
log.Println("Password authenticated via cache!")
|
||||
return true, nil
|
||||
}
|
||||
|
||||
log.Println("Checking password against LDAP server ...")
|
||||
|
||||
// Now, we can try to connect to the LDAP server.
|
||||
l, err := createLDAPconnection(config)
|
||||
if err != nil {
|
||||
// Return a generic error.
|
||||
log.Println("Failed to connect to LDAP server:", err)
|
||||
return false, errors.New("failed to connect to LDAP server")
|
||||
}
|
||||
defer l.Close()
|
||||
|
||||
// Create the user if it doesn't exist on the database already.
|
||||
err = createUserFromLDAP(username, dbc, config, l)
|
||||
if err != nil {
|
||||
log.Println("Failed to create user from LDAP:", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
// After we have a connection, let's try binding
|
||||
_, err = l.SimpleBind(&ldap.SimpleBindRequest{
|
||||
Username: fmt.Sprintf("uid=%s,%s", username, config.BaseDN),
|
||||
Password: password,
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
// Authentication was OK
|
||||
ldapStore.Add(username, password)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
log.Println("Failed to bind to LDAP server:", err)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// Creates a user from creds
|
||||
func createUserFromLDAP(username string, dbc *db.DB, config Config, l *ldap.Conn) error {
|
||||
user := dbc.GetUserByName(username)
|
||||
if user != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !config.IsSetup() {
|
||||
return nil
|
||||
}
|
||||
|
||||
isAdmin := doesLDAPAdminExist(username, config, l)
|
||||
log.Println(username, isAdmin)
|
||||
|
||||
if !doesLDAPUserExist(username, config, l) {
|
||||
return errors.New("no such user")
|
||||
}
|
||||
|
||||
newUser := db.User{
|
||||
Name: username,
|
||||
Password: "", // no password because we want auth to fail.
|
||||
IsAdmin: isAdmin,
|
||||
}
|
||||
|
||||
err := dbc.Create(&newUser).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Println("User created via LDAP:", username)
|
||||
return nil
|
||||
}
|
||||
|
||||
// doesLDAPAdminExist checks if an admin exists on the server.
|
||||
func doesLDAPAdminExist(username string, config Config, l *ldap.Conn) bool {
|
||||
filter := fmt.Sprintf("(&(uid=%s)%s)", ldap.EscapeFilter(username), config.AdminFilter)
|
||||
|
||||
searchReq := ldap.NewSearchRequest(
|
||||
config.BaseDN,
|
||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||
filter,
|
||||
[]string{"dn"},
|
||||
nil,
|
||||
)
|
||||
|
||||
result, err := l.Search(searchReq)
|
||||
if err != nil {
|
||||
log.Println("failed to query LDAP server:", err)
|
||||
return false
|
||||
}
|
||||
|
||||
if len(result.Entries) == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// doesLDAPUserExist checks if a user exists on the server.
|
||||
func doesLDAPUserExist(username string, config Config, l *ldap.Conn) bool {
|
||||
filter := fmt.Sprintf("(&(uid=%s)%s)", ldap.EscapeFilter(username), config.Filter)
|
||||
|
||||
searchReq := ldap.NewSearchRequest(
|
||||
config.BaseDN,
|
||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||
filter,
|
||||
[]string{"dn"},
|
||||
nil,
|
||||
)
|
||||
|
||||
result, err := l.Search(searchReq)
|
||||
if err != nil {
|
||||
log.Println("failed to query LDAP server:", err)
|
||||
return false
|
||||
}
|
||||
|
||||
if len(result.Entries) == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Creates a connection to an LDAP server.
|
||||
func createLDAPconnection(config Config) (*ldap.Conn, error) {
|
||||
protocol := "ldap"
|
||||
if config.TLS {
|
||||
protocol = "ldaps"
|
||||
}
|
||||
|
||||
// Now, we can try to connect to the LDAP server.
|
||||
l, err := ldap.DialURL(fmt.Sprintf("%s://%s:%d", protocol, config.FQDN, config.Port))
|
||||
if err != nil {
|
||||
// Warn the server and return the error.
|
||||
log.Println("Failed to connect to LDAP server", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// After we have a connection, let's try binding
|
||||
_, err = l.SimpleBind(&ldap.SimpleBindRequest{
|
||||
Username: fmt.Sprintf("uid=%s,%s", config.BindUser, config.BaseDN),
|
||||
Password: config.BindPass,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println("Failed to bind to LDAP:", err)
|
||||
return nil, errors.New("wrong username or password")
|
||||
}
|
||||
|
||||
return l, nil
|
||||
}
|
||||
+1
-17
@@ -11,7 +11,6 @@ import (
|
||||
"time"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/deps"
|
||||
"go.senan.xyz/gonic/scanner"
|
||||
"go.senan.xyz/gonic/tags"
|
||||
"go.senan.xyz/wrtag/tags/normtag"
|
||||
@@ -36,7 +35,7 @@ func NewWithExcludePattern(tb testing.TB, excludePattern string) *MockFS {
|
||||
func newMockFS(tb testing.TB, dirs []string, excludePattern string) *MockFS {
|
||||
tb.Helper()
|
||||
|
||||
dbc, err := db.NewMock(deps.DBDriverOptions())
|
||||
dbc, err := db.NewMock()
|
||||
if err != nil {
|
||||
tb.Fatalf("create db: %v", err)
|
||||
}
|
||||
@@ -161,21 +160,6 @@ func (m *MockFS) RemoveAll(path string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockFS) Move(src, dest string) {
|
||||
srcAbs := filepath.Join(m.dir, src)
|
||||
destAbs := filepath.Join(m.dir, dest)
|
||||
if err := os.MkdirAll(filepath.Dir(destAbs), os.ModePerm); err != nil {
|
||||
m.t.Fatalf("mkdir: %v", err)
|
||||
}
|
||||
if err := os.Rename(srcAbs, destAbs); err != nil {
|
||||
m.t.Fatalf("rename: %v", err)
|
||||
}
|
||||
if info, ok := m.tagReader.paths[srcAbs]; ok {
|
||||
m.tagReader.paths[destAbs] = info
|
||||
delete(m.tagReader.paths, srcAbs)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockFS) Symlink(src, dest string) {
|
||||
if err := os.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil {
|
||||
m.t.Fatalf("mkdir: %v", err)
|
||||
|
||||
@@ -53,10 +53,6 @@ func NewStore(basePath string) (*Store, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Store) BasePath() string {
|
||||
return s.basePath
|
||||
}
|
||||
|
||||
// List finds playlist items in s.basePath.
|
||||
// the expected format is <base path>/<user id>/**/<playlist name>.m3u
|
||||
func (s *Store) List() ([]string, error) {
|
||||
|
||||
+2
-6
@@ -508,16 +508,12 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return fmt.Errorf("fetch podcast audio: unexpected status %s", resp.Status)
|
||||
}
|
||||
|
||||
filename, err := getPodcastEpisodeFilename(podcast, podcastEpisode, resp.Header)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get podcast episode filename: %w", err)
|
||||
}
|
||||
podcastEpisode.Filename = filename
|
||||
if err := p.db.Save(podcastEpisode).Error; err != nil {
|
||||
if err := p.db.Save(&podcastEpisode).Error; err != nil {
|
||||
return fmt.Errorf("save podcast episode: %w", err)
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(filepath.Join(podcast.RootDir, podcastEpisode.Filename)), os.ModePerm); err != nil {
|
||||
@@ -532,7 +528,7 @@ func (p *Podcasts) doPodcastDownload(podcast *db.Podcast, podcastEpisode *db.Pod
|
||||
defer func() {
|
||||
if err != nil {
|
||||
podcastEpisode.Status = db.PodcastEpisodeStatusError
|
||||
_ = p.db.Save(podcastEpisode).Error
|
||||
_ = p.db.Save(&podcastEpisode).Error
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
+11
-109
@@ -2,7 +2,6 @@
|
||||
package scanner
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -105,9 +104,6 @@ func (s *Scanner) ScanAndClean(opts ScanOptions) (*State, error) {
|
||||
if err := s.cleanAlbums(st); err != nil {
|
||||
return nil, fmt.Errorf("clean albums: %w", err)
|
||||
}
|
||||
if err := s.cleanAlbumMetadata(); err != nil {
|
||||
return nil, fmt.Errorf("clean album metadata: %w", err)
|
||||
}
|
||||
if err := s.cleanArtists(st); err != nil {
|
||||
return nil, fmt.Errorf("clean artists: %w", err)
|
||||
}
|
||||
@@ -288,11 +284,6 @@ func (s *Scanner) scanDir(st *State, absPath string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
// skip macOS ._ resource fork files
|
||||
if strings.HasPrefix(item.Name(), "._") {
|
||||
continue
|
||||
}
|
||||
|
||||
if coverparse.IsCover(item.Name()) {
|
||||
cover = coverparse.BestBetween(cover, item.Name())
|
||||
continue
|
||||
@@ -372,33 +363,21 @@ func (s *Scanner) scanDir(st *State, absPath string) error {
|
||||
}
|
||||
|
||||
return s.db.Transaction(func(tx *db.DB) error {
|
||||
var discTitles = map[int]string{}
|
||||
for _, t := range trackUpdates {
|
||||
trprops, trags, err := s.tagReader.Read(t.absPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read %q: %w: %w", t.basename, err, ErrReadingTags)
|
||||
}
|
||||
|
||||
if err := s.populateTrackAndArtists(tx, st, t.i, &album, t.track, t.timeSpec, trprops, trags, t.basename, t.absPath); err != nil {
|
||||
if err := s.populateTrackAndArtists(tx, st, t.i, &album, t.track, t.timeSpec, t.basename, t.absPath); err != nil {
|
||||
return fmt.Errorf("populate track %q: %w", t.basename, err)
|
||||
}
|
||||
|
||||
discNum := cmp.Or(tags.ParseInt(normtag.Get(trags, normtag.DiscNumber)), 1)
|
||||
discSubtitle := normtag.Get(trags, "DISCSUBTITLE")
|
||||
|
||||
if _, exists := discTitles[discNum]; !exists && discSubtitle != "" {
|
||||
discTitles[discNum] = discSubtitle
|
||||
}
|
||||
}
|
||||
|
||||
if err := populateAlbumDiscTitles(tx, &album, discTitles); err != nil {
|
||||
return fmt.Errorf("populate disc titles: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db.Album, track *db.Track, timeSpec times.Timespec, trprops tags.Properties, trags tags.Tags, basename, absPath string) error {
|
||||
func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db.Album, track *db.Track, timeSpec times.Timespec, basename, absPath string) error {
|
||||
trprops, trags, err := s.tagReader.Read(absPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %w", err, ErrReadingTags)
|
||||
}
|
||||
|
||||
genreNames := ParseMulti(s.multiValueSettings[Genre], tags.MustGenres(trags), tags.MustGenre(trags))
|
||||
genreIDs, err := populateGenres(tx, genreNames)
|
||||
if err != nil {
|
||||
@@ -476,7 +455,7 @@ func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db
|
||||
|
||||
// possible album level embedded covers come only from the first track
|
||||
if i == 0 {
|
||||
if err := populateAlbumEmbeddedCover(tx, s.scanEmbeddedCover, album, track, trprops); err != nil {
|
||||
if err := populateAlbumEmbeddedCover(tx, album, track, trprops); err != nil {
|
||||
return fmt.Errorf("populate embedded cover: %w", err)
|
||||
}
|
||||
}
|
||||
@@ -487,9 +466,9 @@ func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateAlbumEmbeddedCover(tx *db.DB, scanEmbeddedCover bool, album *db.Album, track *db.Track, trprops tags.Properties) error {
|
||||
func populateAlbumEmbeddedCover(tx *db.DB, album *db.Album, track *db.Track, trprops tags.Properties) error {
|
||||
var trackID int
|
||||
if scanEmbeddedCover && trprops.HasCover {
|
||||
if trprops.HasCover {
|
||||
trackID = track.ID
|
||||
}
|
||||
var prevTrackID int
|
||||
@@ -518,7 +497,7 @@ func populateAlbum(tx *db.DB, album *db.Album, trags map[string][]string, modTim
|
||||
album.TagBrainzID = normtag.Get(trags, normtag.MusicBrainzReleaseID)
|
||||
album.TagYear = tags.MustYear(trags)
|
||||
album.TagCompilation = tags.ParseBool(normtag.Get(trags, normtag.Compilation))
|
||||
album.TagReleaseType = strings.Join(normtag.Values(trags, normtag.ReleaseType), ", ")
|
||||
album.TagReleaseType = normtag.Get(trags, normtag.ReleaseType)
|
||||
|
||||
album.ModifiedAt = modTime
|
||||
if album.CreatedAt.After(createTime) {
|
||||
@@ -645,24 +624,6 @@ func populateAlbumGenres(tx *db.DB, album *db.Album, genreIDs []int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateAlbumDiscTitles(tx *db.DB, album *db.Album, discTitles map[int]string) error {
|
||||
if err := tx.Where("album_id=?", album.ID).Delete(db.AlbumDiscTitle{}).Error; err != nil {
|
||||
return fmt.Errorf("delete old album disc titles: %w", err)
|
||||
}
|
||||
|
||||
for discNum, title := range discTitles {
|
||||
discTitle := db.AlbumDiscTitle{
|
||||
AlbumID: album.ID,
|
||||
DiscNumber: discNum,
|
||||
Title: title,
|
||||
}
|
||||
if err := tx.Create(&discTitle).Error; err != nil {
|
||||
return fmt.Errorf("create disc title: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateAlbumArtists(tx *db.DB, album *db.Album, albumArtistIDs []int) error {
|
||||
if err := tx.Where("album_id=?", album.ID).Delete(db.AlbumArtist{}).Error; err != nil {
|
||||
return fmt.Errorf("delete old album artists: %w", err)
|
||||
@@ -736,65 +697,6 @@ func (s *Scanner) cleanAlbums(st *State) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Scanner) cleanAlbumMetadata() error {
|
||||
var numModified int
|
||||
|
||||
start := time.Now()
|
||||
defer func() { log.Printf("finished clean album metadata in %s, %d modified", durSince(start), numModified) }()
|
||||
|
||||
subTracks := s.db.Model(db.Track{}).Select("DISTINCT album_id").SubQuery()
|
||||
|
||||
var emptyAlbumIDs []int
|
||||
err := s.db.
|
||||
Model(db.Album{}).
|
||||
Where("id NOT IN ?", subTracks).
|
||||
Where("tag_title != '' OR tag_album_artist != ''").
|
||||
Pluck("id", &emptyAlbumIDs).
|
||||
Error
|
||||
if err != nil {
|
||||
return fmt.Errorf("finding empty albums: %w", err)
|
||||
}
|
||||
if len(emptyAlbumIDs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
numModified = len(emptyAlbumIDs)
|
||||
|
||||
if err := s.db.Where("album_id IN (?)", emptyAlbumIDs).Delete(db.AlbumArtist{}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.db.Where("album_id IN (?)", emptyAlbumIDs).Delete(db.AlbumGenre{}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.db.Where("album_id IN (?)", emptyAlbumIDs).Delete(db.ArtistAppearances{}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.db.Where("album_id IN (?)", emptyAlbumIDs).Delete(db.AlbumDiscTitle{}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
q := s.db.
|
||||
Model(&db.Album{}).
|
||||
Where("id IN (?)", emptyAlbumIDs).
|
||||
Updates(map[string]any{
|
||||
"tag_title": "",
|
||||
"tag_title_u_dec": "",
|
||||
"tag_album_artist": "",
|
||||
"tag_year": 0,
|
||||
"tag_brainz_id": "",
|
||||
"tag_compilation": 0,
|
||||
"tag_release_type": "",
|
||||
"embedded_cover_track_id": nil,
|
||||
})
|
||||
if err := q.Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
numModified = int(q.RowsAffected)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Scanner) cleanArtists(st *State) error {
|
||||
start := time.Now()
|
||||
defer func() { log.Printf("finished clean artists in %s, %d removed", durSince(start), st.ArtistsMissing()) }()
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package scanner_test
|
||||
|
||||
import (
|
||||
@@ -6,6 +9,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.senan.xyz/gonic/mockfs"
|
||||
)
|
||||
|
||||
+1
-33
@@ -10,11 +10,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
_ "go.senan.xyz/gonic/deps"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/mockfs"
|
||||
"go.senan.xyz/gonic/scanner"
|
||||
@@ -124,37 +123,6 @@ func TestCoverBeforeTracks(t *testing.T) {
|
||||
assert.Equal(t, 3, len(tracks)) // album has tracks
|
||||
}
|
||||
|
||||
// https://github.com/sentriz/gonic/issues/638
|
||||
func TestAlbumArtistsClearedWhenFolderLosesTracks(t *testing.T) {
|
||||
t.Parallel()
|
||||
m := mockfs.New(t)
|
||||
|
||||
loosePath := "artist-0/fusion.flac"
|
||||
nestedPath := "artist-0/album-0/track-0.flac"
|
||||
|
||||
m.AddTrack(loosePath)
|
||||
m.SetTags(loosePath, func(tags *mockfs.TagInfo) {
|
||||
normtag.Set(tags.Tags, normtag.Artist, "artist-0")
|
||||
normtag.Set(tags.Tags, normtag.AlbumArtist, "artist-0")
|
||||
normtag.Set(tags.Tags, normtag.Album, "Fusion Firespace")
|
||||
normtag.Set(tags.Tags, normtag.Title, "Fusion Firespace")
|
||||
})
|
||||
|
||||
m.ScanAndClean()
|
||||
|
||||
var albumArtistCount int
|
||||
require.NoError(t, m.DB().Model(db.AlbumArtist{}).Count(&albumArtistCount).Error)
|
||||
require.Equal(t, 1, albumArtistCount)
|
||||
|
||||
m.Move(loosePath, nestedPath)
|
||||
|
||||
m.ScanAndClean()
|
||||
|
||||
var postAlbumArtistCount int
|
||||
require.NoError(t, m.DB().Model(db.AlbumArtist{}).Count(&postAlbumArtistCount).Error)
|
||||
require.Equal(t, 1, postAlbumArtistCount)
|
||||
}
|
||||
|
||||
func TestUpdatedTags(t *testing.T) {
|
||||
t.Parallel()
|
||||
m := mockfs.New(t)
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/handlerutil"
|
||||
"go.senan.xyz/gonic/lastfm"
|
||||
"go.senan.xyz/gonic/ldap"
|
||||
"go.senan.xyz/gonic/podcast"
|
||||
"go.senan.xyz/gonic/scanner"
|
||||
"go.senan.xyz/gonic/server/ctrladmin/adminui"
|
||||
@@ -48,11 +49,12 @@ type Controller struct {
|
||||
podcasts *podcast.Podcasts
|
||||
lastfmClient *lastfm.Client
|
||||
resolveProxyPath ProxyPathResolver
|
||||
ldapConfig ldap.Config
|
||||
}
|
||||
|
||||
type ProxyPathResolver func(in string) string
|
||||
|
||||
func New(dbc *db.DB, sessDB *gormstore.Store, scanner *scanner.Scanner, podcasts *podcast.Podcasts, lastfmClient *lastfm.Client, resolveProxyPath ProxyPathResolver) (*Controller, error) {
|
||||
func New(dbc *db.DB, sessDB *gormstore.Store, scanner *scanner.Scanner, podcasts *podcast.Podcasts, lastfmClient *lastfm.Client, resolveProxyPath ProxyPathResolver, ldapConfig ldap.Config) (*Controller, error) {
|
||||
c := Controller{
|
||||
ServeMux: http.NewServeMux(),
|
||||
|
||||
@@ -62,6 +64,7 @@ func New(dbc *db.DB, sessDB *gormstore.Store, scanner *scanner.Scanner, podcasts
|
||||
podcasts: podcasts,
|
||||
lastfmClient: lastfmClient,
|
||||
resolveProxyPath: resolveProxyPath,
|
||||
ldapConfig: ldapConfig,
|
||||
}
|
||||
|
||||
resp := respHandler(adminui.TemplatesFS, resolveProxyPath)
|
||||
|
||||
@@ -1,28 +1,48 @@
|
||||
package ctrladmin
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/sessions"
|
||||
"go.senan.xyz/gonic/ldap"
|
||||
)
|
||||
|
||||
func (c *Controller) ServeLoginDo(w http.ResponseWriter, r *http.Request) {
|
||||
session := r.Context().Value(CtxSession).(*sessions.Session)
|
||||
username := r.FormValue("username")
|
||||
password := r.FormValue("password")
|
||||
user := c.dbc.GetUserByName(username)
|
||||
if username == "" || password == "" {
|
||||
sessAddFlashW(session, []string{"please provide username and password"})
|
||||
sessLogSave(session, w, r)
|
||||
http.Redirect(w, r, r.Referer(), http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
user := c.dbc.GetUserByName(username)
|
||||
if user == nil || password != user.Password {
|
||||
|
||||
if c.ldapConfig.IsSetup() {
|
||||
ok, err := ldap.CheckLDAPcreds(username, password, c.dbc, c.ldapConfig)
|
||||
if err != nil {
|
||||
log.Println("Failed to check LDAP credentials:", err)
|
||||
sessAddFlashW(session, []string{"failed to check LDAP credentials"})
|
||||
sessLogSave(session, w, r)
|
||||
http.Redirect(w, r, r.Referer(), http.StatusSeeOther)
|
||||
return
|
||||
} else if !ok {
|
||||
sessAddFlashW(session, []string{"invalid username / password"})
|
||||
sessLogSave(session, w, r)
|
||||
http.Redirect(w, r, r.Referer(), http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
} else if user == nil || user.Password != password {
|
||||
sessAddFlashW(session, []string{"invalid username / password"})
|
||||
sessLogSave(session, w, r)
|
||||
http.Redirect(w, r, r.Referer(), http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
user = c.dbc.GetUserByName(username)
|
||||
|
||||
// put the user name into the session. future endpoints after this one
|
||||
// are wrapped with WithUserSession() which will get the name from the
|
||||
// session and put the row into the request context
|
||||
|
||||
+83
-40
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
@@ -18,6 +19,7 @@ import (
|
||||
"go.senan.xyz/gonic/infocache/artistinfocache"
|
||||
"go.senan.xyz/gonic/jukebox"
|
||||
"go.senan.xyz/gonic/lastfm"
|
||||
"go.senan.xyz/gonic/ldap"
|
||||
"go.senan.xyz/gonic/playlist"
|
||||
"go.senan.xyz/gonic/podcast"
|
||||
"go.senan.xyz/gonic/scanner"
|
||||
@@ -53,46 +55,44 @@ type ProxyPathResolver func(in string) string
|
||||
type Controller struct {
|
||||
*http.ServeMux
|
||||
|
||||
dbc *db.DB
|
||||
scanner *scanner.Scanner
|
||||
musicPaths []MusicPath
|
||||
defaultMusicPath string
|
||||
podcastsPath string
|
||||
cacheAudioPath string
|
||||
cacheCoverPath string
|
||||
jukebox *jukebox.Jukebox
|
||||
playlistStore *playlist.Store
|
||||
scrobblers []scrobble.Scrobbler
|
||||
podcasts *podcast.Podcasts
|
||||
transcoder transcode.Transcoder
|
||||
lastFMClient *lastfm.Client
|
||||
artistInfoCache *artistinfocache.ArtistInfoCache
|
||||
albumInfoCache *albuminfocache.AlbumInfoCache
|
||||
tagReader tags.Reader
|
||||
dbc *db.DB
|
||||
scanner *scanner.Scanner
|
||||
musicPaths []MusicPath
|
||||
podcastsPath string
|
||||
cacheAudioPath string
|
||||
cacheCoverPath string
|
||||
jukebox *jukebox.Jukebox
|
||||
playlistStore *playlist.Store
|
||||
scrobblers []scrobble.Scrobbler
|
||||
podcasts *podcast.Podcasts
|
||||
transcoder transcode.Transcoder
|
||||
lastFMClient *lastfm.Client
|
||||
artistInfoCache *artistinfocache.ArtistInfoCache
|
||||
albumInfoCache *albuminfocache.AlbumInfoCache
|
||||
tagReader tags.Reader
|
||||
|
||||
resolveProxyPath ProxyPathResolver
|
||||
}
|
||||
|
||||
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, defaultMusicPath string, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, tagReader tags.Reader, resolveProxyPath ProxyPathResolver) (*Controller, error) {
|
||||
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, tagReader tags.Reader, resolveProxyPath ProxyPathResolver, ldapConfig ldap.Config) (*Controller, error) {
|
||||
c := Controller{
|
||||
ServeMux: http.NewServeMux(),
|
||||
|
||||
dbc: dbc,
|
||||
scanner: scannr,
|
||||
musicPaths: musicPaths,
|
||||
defaultMusicPath: defaultMusicPath,
|
||||
podcastsPath: podcastsPath,
|
||||
cacheAudioPath: cacheAudioPath,
|
||||
cacheCoverPath: cacheCoverPath,
|
||||
jukebox: jukebox,
|
||||
playlistStore: playlistStore,
|
||||
scrobblers: scrobblers,
|
||||
podcasts: podcasts,
|
||||
transcoder: transcoder,
|
||||
lastFMClient: lastFMClient,
|
||||
artistInfoCache: artistInfoCache,
|
||||
albumInfoCache: albumInfoCache,
|
||||
tagReader: tagReader,
|
||||
dbc: dbc,
|
||||
scanner: scannr,
|
||||
musicPaths: musicPaths,
|
||||
podcastsPath: podcastsPath,
|
||||
cacheAudioPath: cacheAudioPath,
|
||||
cacheCoverPath: cacheCoverPath,
|
||||
jukebox: jukebox,
|
||||
playlistStore: playlistStore,
|
||||
scrobblers: scrobblers,
|
||||
podcasts: podcasts,
|
||||
transcoder: transcoder,
|
||||
lastFMClient: lastFMClient,
|
||||
artistInfoCache: artistInfoCache,
|
||||
albumInfoCache: albumInfoCache,
|
||||
tagReader: tagReader,
|
||||
|
||||
resolveProxyPath: resolveProxyPath,
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, defaultMus
|
||||
chain := handlerutil.Chain(
|
||||
withParams,
|
||||
withRequiredParams,
|
||||
withUser(dbc),
|
||||
withUser(dbc, ldapConfig),
|
||||
)
|
||||
chainRaw := handlerutil.Chain(
|
||||
chain,
|
||||
@@ -231,39 +231,82 @@ func withRequiredParams(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func withUser(dbc *db.DB) handlerutil.Middleware {
|
||||
func withUser(dbc *db.DB, ldapConfig ldap.Config) handlerutil.Middleware {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
// ignoring errors here, a middleware has already ensured they exist
|
||||
username, _ := params.Get("u")
|
||||
password, _ := params.Get("p")
|
||||
passwordHex, _ := params.Get("p")
|
||||
token, _ := params.Get("t")
|
||||
salt, _ := params.Get("s")
|
||||
|
||||
passwordAuth := token == "" && salt == ""
|
||||
tokenAuth := password == ""
|
||||
tokenAuth := passwordHex == ""
|
||||
if tokenAuth == passwordAuth {
|
||||
_ = writeResp(w, r, spec.NewError(10,
|
||||
"please provide `t` and `s`, or just `p`"))
|
||||
return
|
||||
}
|
||||
|
||||
var password string
|
||||
if passwordAuth && passwordHex != "" {
|
||||
if strings.HasPrefix(passwordHex, "enc:") {
|
||||
raw := strings.TrimPrefix(passwordHex, "enc:")
|
||||
decoded, err := hex.DecodeString(raw)
|
||||
if err != nil {
|
||||
log.Println("Failed to decode hex password:", err)
|
||||
_ = writeResp(w, r, spec.NewError(40, "invalid password encoding"))
|
||||
return
|
||||
}
|
||||
password = string(decoded)
|
||||
} else {
|
||||
// if not prefixed with "enc:", treat as plain text
|
||||
password = passwordHex
|
||||
}
|
||||
}
|
||||
|
||||
user := dbc.GetUserByName(username)
|
||||
if user == nil {
|
||||
_ = writeResp(w, r, spec.NewError(40,
|
||||
"invalid username %q", username))
|
||||
|
||||
if ldapConfig.IsSetup() {
|
||||
// Complete auth using LDAP
|
||||
log.Println("Authenticating using LDAP ...")
|
||||
|
||||
ok, err := ldap.CheckLDAPcreds(username, password, dbc, ldapConfig)
|
||||
if err != nil {
|
||||
log.Println("Failed to check LDAP creds:", err)
|
||||
_ = writeResp(w, r, spec.NewError(40, "invalid password"))
|
||||
return
|
||||
}
|
||||
|
||||
if !ok {
|
||||
_ = writeResp(w, r, spec.NewError(40, "invalid password"))
|
||||
return
|
||||
}
|
||||
|
||||
withUser := context.WithValue(r.Context(), CtxUser, user)
|
||||
next.ServeHTTP(w, r.WithContext(withUser))
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Authenticating using built-in ...")
|
||||
if user == nil {
|
||||
_ = writeResp(w, r, spec.NewError(40, "invalid password"))
|
||||
return
|
||||
}
|
||||
|
||||
var credsOk bool
|
||||
if tokenAuth {
|
||||
credsOk = checkCredsToken(user.Password, token, salt)
|
||||
} else {
|
||||
credsOk = checkCredsBasic(user.Password, password)
|
||||
}
|
||||
|
||||
if !credsOk {
|
||||
_ = writeResp(w, r, spec.NewError(40, "invalid password"))
|
||||
return
|
||||
}
|
||||
|
||||
withUser := context.WithValue(r.Context(), CtxUser, user)
|
||||
next.ServeHTTP(w, r.WithContext(withUser))
|
||||
})
|
||||
|
||||
@@ -18,8 +18,6 @@ import (
|
||||
jd "github.com/josephburnett/jd/lib"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
_ "go.senan.xyz/gonic/deps"
|
||||
|
||||
"go.senan.xyz/gonic"
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/mockfs"
|
||||
|
||||
@@ -42,8 +42,6 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response {
|
||||
var track db.Track
|
||||
err := c.dbc.
|
||||
Preload("Album").
|
||||
Preload("Album.Artists").
|
||||
Preload("Artists").
|
||||
Find(&track, "id=?", bookmark.EntryID).
|
||||
Error
|
||||
if err != nil {
|
||||
|
||||
@@ -25,7 +25,7 @@ func (c *Controller) ServeGetIndexes(r *http.Request) *spec.Response {
|
||||
Select("id").
|
||||
Model(&db.Album{}).
|
||||
Where("parent_id IS NULL")
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
rootQ = rootQ.
|
||||
Where("root_dir=?", m)
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
|
||||
return spec.NewError(10, "unknown value %q for parameter 'type'", v)
|
||||
}
|
||||
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
}
|
||||
var folders []*db.Album
|
||||
@@ -220,7 +220,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
|
||||
Select("id").
|
||||
Model(&db.Album{}).
|
||||
Where("parent_id IS NULL")
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
rootQ = rootQ.Where("root_dir=?", m)
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
|
||||
Preload("AlbumRating", "user_id=?", user.ID).
|
||||
Offset(params.GetOrInt("albumOffset", 0)).
|
||||
Limit(params.GetOrInt("albumCount", 20))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&albums).Error; err != nil {
|
||||
@@ -287,7 +287,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
|
||||
Preload("TrackRating", "user_id=?", user.ID).
|
||||
Offset(params.GetOrInt("songOffset", 0)).
|
||||
Limit(params.GetOrInt("songCount", 20))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.
|
||||
Joins("JOIN albums ON albums.id=tracks.album_id").
|
||||
Where("albums.root_dir=?", m)
|
||||
@@ -320,56 +320,44 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
|
||||
results := &spec.Starred{}
|
||||
|
||||
// "artists"
|
||||
var artists []*db.Artist
|
||||
q := c.dbc.
|
||||
Select("artists.*, count(albums.id) album_count").
|
||||
Joins("JOIN artist_stars ON artist_stars.artist_id=artists.id").
|
||||
Where("artist_stars.user_id=?", user.ID).
|
||||
Joins("JOIN artist_appearances ON artist_appearances.artist_id=artists.id").
|
||||
Joins("JOIN albums ON albums.id=artist_appearances.album_id").
|
||||
Order("artist_stars.star_date DESC").
|
||||
Preload("ArtistStar", "user_id=?", user.ID).
|
||||
Preload("ArtistRating", "user_id=?", user.ID).
|
||||
Preload("Info").
|
||||
Group("artists.id")
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
rootQ := c.dbc.
|
||||
Select("id").
|
||||
Model(&db.Album{}).
|
||||
Where("parent_id IS NULL")
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
rootQ = rootQ.Where("root_dir=?", m)
|
||||
}
|
||||
|
||||
var artists []*db.Album
|
||||
q := c.dbc.
|
||||
Where(`parent_id IN ?`, rootQ.SubQuery()).
|
||||
Joins("JOIN album_stars ON albums.id=album_stars.album_id").
|
||||
Where("album_stars.user_id=?", user.ID).
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID)
|
||||
if err := q.Find(&artists).Error; err != nil {
|
||||
return spec.NewError(0, "find artists: %v", err)
|
||||
}
|
||||
for _, a := range artists {
|
||||
results.Artists = append(results.Artists, spec.NewArtistByTags(a))
|
||||
results.Artists = append(results.Artists, spec.NewDirectoryByFolder(a, nil))
|
||||
}
|
||||
|
||||
// "albums"
|
||||
var albums []*db.Album
|
||||
q = c.dbc.Where("parent_id IS NOT NULL").
|
||||
Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
|
||||
q = q.Order("album_stars.star_date DESC")
|
||||
|
||||
q = q.
|
||||
q = c.dbc.
|
||||
Joins("JOIN album_artists ON album_artists.album_id=albums.id").
|
||||
Joins("JOIN album_stars ON albums.id=album_stars.album_id").
|
||||
Where("album_stars.user_id=?", user.ID).
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID)
|
||||
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
}
|
||||
|
||||
q.
|
||||
Select("albums.*, count(tracks.id) child_count, sum(tracks.length) duration").
|
||||
Joins("LEFT JOIN tracks ON tracks.album_id=albums.id").
|
||||
Group("albums.id").
|
||||
Joins("JOIN album_artists ON album_artists.album_id=albums.id").
|
||||
Preload("Parent").
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID)
|
||||
|
||||
if err := q.Find(&albums).Error; err != nil {
|
||||
return spec.NewError(0, "find albums: %v", err)
|
||||
}
|
||||
for _, a := range albums {
|
||||
results.Albums = append(results.Albums, spec.NewAlbumByFolder(a))
|
||||
results.Albums = append(results.Albums, spec.NewTCAlbumByFolder(a))
|
||||
}
|
||||
|
||||
// tracks
|
||||
@@ -381,7 +369,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
|
||||
Preload("Artists").
|
||||
Preload("TrackStar", "user_id=?", user.ID).
|
||||
Preload("TrackRating", "user_id=?", user.ID)
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.
|
||||
Joins("JOIN albums ON albums.id=tracks.album_id").
|
||||
Where("albums.root_dir=?", m)
|
||||
|
||||
@@ -3,6 +3,8 @@ package ctrlsubsonic
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
)
|
||||
|
||||
func TestGetIndexes(t *testing.T) {
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/handlerutil"
|
||||
"go.senan.xyz/gonic/lastfm"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/params"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
@@ -28,13 +27,12 @@ func (c *Controller) ServeGetArtists(r *http.Request) *spec.Response {
|
||||
q := c.dbc.
|
||||
Select("*, count(album_artists.album_id) album_count").
|
||||
Joins("JOIN album_artists ON album_artists.artist_id=artists.id").
|
||||
Joins("LEFT JOIN artist_stars ON artist_stars.artist_id=artists.id").
|
||||
Preload("ArtistStar", "user_id=?", user.ID).
|
||||
Preload("ArtistRating", "user_id=?", user.ID).
|
||||
Preload("Info").
|
||||
Group("artists.id").
|
||||
Order("artists.name COLLATE NOCASE")
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.
|
||||
Joins("JOIN albums ON albums.id=album_artists.album_id").
|
||||
Where("albums.root_dir=?", m)
|
||||
@@ -109,7 +107,6 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response {
|
||||
Joins("LEFT JOIN tracks ON tracks.album_id=albums.id").
|
||||
Preload("Artists").
|
||||
Preload("Genres").
|
||||
Preload("DiscTitles").
|
||||
Preload("Tracks", func(db *gorm.DB) *gorm.DB {
|
||||
return db.
|
||||
Order("tracks.tag_disc_number, tracks.tag_track_number").
|
||||
@@ -187,7 +184,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
|
||||
default:
|
||||
return spec.NewError(10, "unknown value %q for parameter 'type'", listType)
|
||||
}
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
}
|
||||
var albums []*db.Album
|
||||
@@ -202,7 +199,6 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
|
||||
Limit(params.GetOrInt("size", 10)).
|
||||
Preload("Artists").
|
||||
Preload("Genres").
|
||||
Preload("DiscTitles").
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID).
|
||||
Preload("Play", "user_id=?", user.ID).
|
||||
@@ -255,7 +251,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
Preload("Info").
|
||||
Offset(params.GetOrInt("artistOffset", 0)).
|
||||
Limit(params.GetOrInt("artistCount", 20))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&artists).Error; err != nil {
|
||||
@@ -270,7 +266,6 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
q = c.dbc.
|
||||
Preload("Artists").
|
||||
Preload("Genres").
|
||||
Preload("DiscTitles").
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID).
|
||||
Preload("Play", "user_id=?", user.ID)
|
||||
@@ -284,7 +279,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
q = q.
|
||||
Offset(params.GetOrInt("albumOffset", 0)).
|
||||
Limit(params.GetOrInt("albumCount", 20))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&albums).Error; err != nil {
|
||||
@@ -312,7 +307,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
|
||||
}
|
||||
q = q.Offset(params.GetOrInt("songOffset", 0)).
|
||||
Limit(params.GetOrInt("songCount", 20))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.
|
||||
Joins("JOIN albums ON albums.id=tracks.album_id").
|
||||
Where("albums.root_dir=?", m)
|
||||
@@ -483,7 +478,7 @@ func (c *Controller) ServeGetSongsByGenre(r *http.Request) *spec.Response {
|
||||
Preload("TrackRating", "user_id=?", user.ID).
|
||||
Offset(params.GetOrInt("offset", 0)).
|
||||
Limit(params.GetOrInt("count", 10))
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
}
|
||||
q = q.Group("tracks.id")
|
||||
@@ -524,7 +519,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
|
||||
Preload("ArtistRating", "user_id=?", user.ID).
|
||||
Preload("Info").
|
||||
Group("artists.id")
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&artists).Error; err != nil {
|
||||
@@ -541,11 +536,10 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
|
||||
Where("album_stars.user_id=?", user.ID).
|
||||
Order("album_stars.star_date DESC").
|
||||
Preload("Artists").
|
||||
Preload("DiscTitles").
|
||||
Preload("AlbumStar", "user_id=?", user.ID).
|
||||
Preload("AlbumRating", "user_id=?", user.ID).
|
||||
Preload("Play", "user_id=?", user.ID)
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&albums).Error; err != nil {
|
||||
@@ -566,7 +560,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
|
||||
Preload("Artists").
|
||||
Preload("TrackStar", "user_id=?", user.ID).
|
||||
Preload("TrackRating", "user_id=?", user.ID)
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.
|
||||
Joins("JOIN albums ON albums.id=tracks.album_id").
|
||||
Where("albums.root_dir=?", m)
|
||||
@@ -665,75 +659,28 @@ func (c *Controller) ServeGetSimilarSongs(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
count := params.GetOrInt("count", 10)
|
||||
id, err := params.GetID("id")
|
||||
if err != nil {
|
||||
return spec.NewError(10, "please provide an `id` parameter")
|
||||
if err != nil || id.Type != specid.Track {
|
||||
return spec.NewError(10, "please provide an track `id` parameter")
|
||||
}
|
||||
|
||||
var tracks []*spec.TrackChild
|
||||
var sub *spec.Response
|
||||
|
||||
switch id.Type {
|
||||
case specid.Track:
|
||||
tracks, sub = getSimilarSongsFromTrack(c, id, params, user, count)
|
||||
case specid.Album:
|
||||
tracks, sub = getSimilarSongsFromAlbum(c, id, params, user, count)
|
||||
case specid.Artist:
|
||||
tracks, sub = getSimilarSongsFromArtist(c, id, params, user, count)
|
||||
default:
|
||||
return spec.NewError(10, "please provide a artist, album or track `id` parameter")
|
||||
}
|
||||
|
||||
if sub != nil {
|
||||
return sub
|
||||
}
|
||||
|
||||
sub = spec.NewResponse()
|
||||
sub.SimilarSongs = &spec.SimilarSongs{
|
||||
Tracks: tracks,
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
count := params.GetOrInt("count", 10)
|
||||
id, err := params.GetID("id")
|
||||
if err != nil || id.Type != specid.Artist {
|
||||
return spec.NewError(10, "please provide an artist `id` parameter")
|
||||
}
|
||||
|
||||
tracks, sub := getSimilarSongsFromArtist(c, id, params, user, count)
|
||||
if sub != nil {
|
||||
return sub
|
||||
}
|
||||
|
||||
sub = spec.NewResponse()
|
||||
sub.SimilarSongsTwo = &spec.SimilarSongsTwo{
|
||||
Tracks: tracks,
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
func getSimilarSongsFromTrack(c *Controller, id specid.ID, params params.Params, user *db.User, count int) ([]*spec.TrackChild, *spec.Response) {
|
||||
var track db.Track
|
||||
err := c.dbc.
|
||||
err = c.dbc.
|
||||
Preload("Album").
|
||||
Where("id=?", id.Value).
|
||||
First(&track).
|
||||
Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, spec.NewError(70, "couldn't find a track with that id")
|
||||
return spec.NewError(70, "couldn't find a track with that id")
|
||||
}
|
||||
|
||||
similarTracks, err := c.lastFMClient.TrackGetSimilarTracks(track.TagTrackArtist, track.TagTitle)
|
||||
if err != nil {
|
||||
log.Printf("error fetching similar songs from lastfm: %v", err)
|
||||
return nil, spec.NewResponse()
|
||||
return spec.NewResponse()
|
||||
}
|
||||
|
||||
if len(similarTracks.Tracks) == 0 {
|
||||
return nil, spec.NewError(70, "no similar songs found for track: %v", track.TagTitle)
|
||||
return spec.NewError(70, "no similar songs found for track: %v", track.TagTitle)
|
||||
}
|
||||
|
||||
similarTrackNames := make([]string, len(similarTracks.Tracks))
|
||||
@@ -754,40 +701,51 @@ func getSimilarSongsFromTrack(c *Controller, id specid.ID, params params.Params,
|
||||
Find(&tracks).
|
||||
Error
|
||||
if err != nil {
|
||||
return nil, spec.NewError(0, "error finding tracks: %v", err)
|
||||
return spec.NewError(0, "error finding tracks: %v", err)
|
||||
}
|
||||
if len(tracks) == 0 {
|
||||
return nil, spec.NewError(70, "no similar song could be match with collection in database: %v", track.TagTitle)
|
||||
return spec.NewError(70, "no similar song could be match with collection in database: %v", track.TagTitle)
|
||||
}
|
||||
|
||||
sub := spec.NewResponse()
|
||||
sub.SimilarSongs = &spec.SimilarSongs{
|
||||
Tracks: make([]*spec.TrackChild, len(tracks)),
|
||||
}
|
||||
|
||||
trackChildren := make([]*spec.TrackChild, len(tracks))
|
||||
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
||||
|
||||
for i, track := range tracks {
|
||||
trackChildren[i] = spec.NewTrackByTags(track, track.Album)
|
||||
trackChildren[i].TranscodeMeta = transcodeMeta
|
||||
sub.SimilarSongs.Tracks[i] = spec.NewTrackByTags(track, track.Album)
|
||||
sub.SimilarSongs.Tracks[i].TranscodeMeta = transcodeMeta
|
||||
}
|
||||
|
||||
return trackChildren, nil
|
||||
return sub
|
||||
}
|
||||
|
||||
func getSimilarSongsFromArtist(c *Controller, id specid.ID, params params.Params, user *db.User, count int) ([]*spec.TrackChild, *spec.Response) {
|
||||
func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
count := params.GetOrInt("count", 10)
|
||||
id, err := params.GetID("id")
|
||||
if err != nil || id.Type != specid.Artist {
|
||||
return spec.NewError(10, "please provide an artist `id` parameter")
|
||||
}
|
||||
|
||||
var artist db.Artist
|
||||
err := c.dbc.
|
||||
err = c.dbc.
|
||||
Where("id=?", id.Value).
|
||||
First(&artist).
|
||||
Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, spec.NewError(70, "artist with id %q not found", id)
|
||||
return spec.NewError(70, "artist with id %q not found", id)
|
||||
}
|
||||
|
||||
similarArtists, err := c.lastFMClient.ArtistGetSimilar(artist.Name)
|
||||
if err != nil {
|
||||
log.Printf("error fetching artist info from lastfm: %v", err)
|
||||
return nil, spec.NewResponse()
|
||||
return spec.NewResponse()
|
||||
}
|
||||
if len(similarArtists.Artists) == 0 {
|
||||
return nil, spec.NewError(0, "no similar artist found for: %v", artist.Name)
|
||||
return spec.NewError(0, "no similar artist found for: %v", artist.Name)
|
||||
}
|
||||
|
||||
artistNames := make([]string, len(similarArtists.Artists))
|
||||
@@ -810,86 +768,23 @@ func getSimilarSongsFromArtist(c *Controller, id specid.ID, params params.Params
|
||||
Find(&tracks).
|
||||
Error
|
||||
if err != nil {
|
||||
return nil, spec.NewError(0, "error finding tracks: %v", err)
|
||||
return spec.NewError(0, "error finding tracks: %v", err)
|
||||
}
|
||||
if len(tracks) == 0 {
|
||||
return nil, spec.NewError(70, "no similar song could be match with collection in database: %v", artist.Name)
|
||||
return spec.NewError(70, "no similar song could be match with collection in database: %v", artist.Name)
|
||||
}
|
||||
|
||||
sub := spec.NewResponse()
|
||||
sub.SimilarSongsTwo = &spec.SimilarSongsTwo{
|
||||
Tracks: make([]*spec.TrackChild, len(tracks)),
|
||||
}
|
||||
|
||||
trackChildren := make([]*spec.TrackChild, len(tracks))
|
||||
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
||||
|
||||
for i, track := range tracks {
|
||||
trackChildren[i] = spec.NewTrackByTags(track, track.Album)
|
||||
trackChildren[i].TranscodeMeta = transcodeMeta
|
||||
sub.SimilarSongsTwo.Tracks[i] = spec.NewTrackByTags(track, track.Album)
|
||||
sub.SimilarSongsTwo.Tracks[i].TranscodeMeta = transcodeMeta
|
||||
}
|
||||
|
||||
return trackChildren, nil
|
||||
}
|
||||
|
||||
func getSimilarSongsFromAlbum(c *Controller, id specid.ID, params params.Params, user *db.User, count int) ([]*spec.TrackChild, *spec.Response) {
|
||||
var album db.Album
|
||||
err := c.dbc.
|
||||
Preload("Tracks").
|
||||
Where("id=?", id.Value).
|
||||
First(&album).
|
||||
Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, spec.NewError(70, "couldn't find an album with that id")
|
||||
}
|
||||
|
||||
var similarTracks lastfm.SimilarTracks
|
||||
|
||||
for _, albumTrack := range album.Tracks {
|
||||
similarTracks, err = c.lastFMClient.TrackGetSimilarTracks(albumTrack.TagTrackArtist, albumTrack.TagTitle)
|
||||
if err != nil {
|
||||
log.Printf("error fetching similar songs from lastfm: %v", err)
|
||||
continue
|
||||
}
|
||||
if len(similarTracks.Tracks) == 0 {
|
||||
log.Printf("no similar songs found for track: %v", albumTrack.TagTitle)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if len(similarTracks.Tracks) == 0 {
|
||||
return nil, spec.NewError(0, "no similar songs found for album: %v", album.TagTitle)
|
||||
}
|
||||
|
||||
similarTrackNames := make([]string, len(similarTracks.Tracks))
|
||||
for i, t := range similarTracks.Tracks {
|
||||
similarTrackNames[i] = t.Name
|
||||
}
|
||||
|
||||
var tracks []*db.Track
|
||||
err = c.dbc.
|
||||
Select("tracks.*").
|
||||
Preload("Album").
|
||||
Preload("Artists").
|
||||
Preload("TrackStar", "user_id=?", user.ID).
|
||||
Preload("TrackRating", "user_id=?", user.ID).
|
||||
Where("tracks.tag_title IN (?)", similarTrackNames).
|
||||
Order(gorm.Expr("random()")).
|
||||
Limit(count).
|
||||
Find(&tracks).
|
||||
Error
|
||||
if err != nil {
|
||||
return nil, spec.NewError(0, "error finding tracks: %v", err)
|
||||
}
|
||||
if len(tracks) == 0 {
|
||||
return nil, spec.NewError(70, "no similar songs could be matched with collection in database: %v", album.TagTitle)
|
||||
}
|
||||
|
||||
trackChildren := make([]*spec.TrackChild, len(tracks))
|
||||
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
||||
|
||||
for i, track := range tracks {
|
||||
trackChildren[i] = spec.NewTrackByTags(track, track.Album)
|
||||
trackChildren[i].TranscodeMeta = transcodeMeta
|
||||
}
|
||||
|
||||
return trackChildren, nil
|
||||
return sub
|
||||
}
|
||||
|
||||
func starIDsOfType(p params.Params, typ specid.IDT) []int {
|
||||
|
||||
@@ -334,7 +334,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
|
||||
q = q.Joins("JOIN track_genres ON track_genres.track_id=tracks.id")
|
||||
q = q.Joins("JOIN genres ON genres.id=track_genres.genre_id AND genres.name=?", genre)
|
||||
}
|
||||
if m := getMusicFolder(c, params); m != "" {
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("albums.root_dir=?", m)
|
||||
}
|
||||
if err := q.Find(&tracks).Error; err != nil {
|
||||
@@ -391,29 +391,17 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
|
||||
return nil, fmt.Errorf("get playlist: %w", err)
|
||||
}
|
||||
for _, path := range playlist {
|
||||
id, err := specidpaths.Lookup(c.dbc, MusicPaths(c.musicPaths), c.podcastsPath, path)
|
||||
file, err := specidpaths.Lookup(c.dbc, MusicPaths(c.musicPaths), c.podcastsPath, path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fetch track: %w", err)
|
||||
}
|
||||
switch id.Type {
|
||||
case specid.Track:
|
||||
var track db.Track
|
||||
if err := c.dbc.Where("id=?", id.Value).Preload("Album").Preload("Album.Artists").Preload("Artists").Find(&track).Error; err != nil {
|
||||
return nil, fmt.Errorf("load track: %w", err)
|
||||
}
|
||||
ret = append(ret, spec.NewTrackByTags(&track, track.Album))
|
||||
case specid.InternetRadioStation:
|
||||
var irs db.InternetRadioStation
|
||||
if err := c.dbc.Where("id=?", id.Value).Find(&irs).Error; err != nil {
|
||||
return nil, fmt.Errorf("load internet radio station: %w", err)
|
||||
}
|
||||
ret = append(ret, spec.NewTCInternetRadioStation(&irs))
|
||||
case specid.PodcastEpisode:
|
||||
var pe db.PodcastEpisode
|
||||
if err := c.dbc.Preload("Podcast").Where("id=?", id.Value).Find(&pe).Error; err != nil {
|
||||
return nil, fmt.Errorf("load podcast episode: %w", err)
|
||||
}
|
||||
ret = append(ret, spec.NewTCPodcastEpisode(&pe))
|
||||
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)
|
||||
}
|
||||
@@ -777,11 +765,10 @@ func scrobbleStatsUpdatePodcastEpisode(dbc *db.DB, peID int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getMusicFolder(c *Controller, p params.Params) string {
|
||||
musicPaths := c.musicPaths
|
||||
func getMusicFolder(musicPaths []MusicPath, p params.Params) string {
|
||||
idx, err := p.GetInt("musicFolderId")
|
||||
if err != nil {
|
||||
return c.defaultMusicPath
|
||||
return ""
|
||||
}
|
||||
if idx < 0 || idx >= len(musicPaths) {
|
||||
return os.DevNull
|
||||
|
||||
@@ -39,7 +39,7 @@ func (c *Controller) ServeGetPlaylists(r *http.Request) *spec.Response {
|
||||
continue
|
||||
}
|
||||
playlistID := playlistIDEncode(path)
|
||||
rendered, err := playlistRender(c, params, playlist, playlistID, false)
|
||||
rendered, err := playlistRender(c, params, playlistID, playlist, false)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "error rendering playlist %q: %v", path, err)
|
||||
}
|
||||
@@ -50,7 +50,7 @@ func (c *Controller) ServeGetPlaylists(r *http.Request) *spec.Response {
|
||||
|
||||
func (c *Controller) ServeGetPlaylist(r *http.Request) *spec.Response {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
playlistID, err := params.GetFirstID("id", "playlistId")
|
||||
playlistID, err := params.GetFirst("id", "playlistId")
|
||||
if err != nil {
|
||||
return spec.NewError(10, "please provide an `id` parameter")
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (c *Controller) ServeGetPlaylist(r *http.Request) *spec.Response {
|
||||
return spec.NewError(70, "playlist with id %s not found", playlistID)
|
||||
}
|
||||
sub := spec.NewResponse()
|
||||
rendered, err := playlistRender(c, params, playlist, playlistID, true)
|
||||
rendered, err := playlistRender(c, params, playlistID, playlist, true)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "error rendering playlist: %v", err)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (c *Controller) ServeCreateOrUpdatePlaylist(r *http.Request) *spec.Response
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
|
||||
playlistID, _ := params.GetFirstID("id", "playlistId")
|
||||
playlistID := params.GetFirstOr( /* default */ "", "id", "playlistId")
|
||||
playlistPath := playlistIDDecode(playlistID)
|
||||
|
||||
var playlist playlistp.Playlist
|
||||
@@ -112,7 +112,7 @@ func (c *Controller) ServeCreateOrUpdatePlaylist(r *http.Request) *spec.Response
|
||||
}
|
||||
|
||||
sub := spec.NewResponse()
|
||||
rendered, err := playlistRender(c, params, &playlist, playlistID, true)
|
||||
rendered, err := playlistRender(c, params, playlistID, &playlist, true)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "error rendering playlist: %v", err)
|
||||
}
|
||||
@@ -124,10 +124,7 @@ func (c *Controller) ServeUpdatePlaylist(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
|
||||
playlistID, err := params.GetFirstID("id", "playlistId")
|
||||
if err != nil {
|
||||
return spec.NewError(10, "please provide an `id` or `playlistId` parameter")
|
||||
}
|
||||
playlistID := params.GetFirstOr( /* default */ "", "id", "playlistId")
|
||||
playlistPath := playlistIDDecode(playlistID)
|
||||
playlist, err := c.playlistStore.Read(playlistPath)
|
||||
if err != nil {
|
||||
@@ -176,29 +173,23 @@ func (c *Controller) ServeUpdatePlaylist(r *http.Request) *spec.Response {
|
||||
|
||||
func (c *Controller) ServeDeletePlaylist(r *http.Request) *spec.Response {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
playlistID, err := params.GetFirstID("id", "playlistId")
|
||||
if err != nil {
|
||||
return spec.NewError(10, "please provide an `id` or `playlistId` parameter")
|
||||
}
|
||||
playlistID := params.GetFirstOr( /* default */ "", "id", "playlistId")
|
||||
if err := c.playlistStore.Delete(playlistIDDecode(playlistID)); err != nil {
|
||||
return spec.NewError(0, "delete playlist: %v", err)
|
||||
}
|
||||
return spec.NewResponse()
|
||||
}
|
||||
|
||||
func playlistIDEncode(path string) specid.ID {
|
||||
return specid.ID{
|
||||
Type: specid.Playlist,
|
||||
StringValue: base64.URLEncoding.EncodeToString([]byte(path)),
|
||||
}
|
||||
func playlistIDEncode(path string) string {
|
||||
return base64.URLEncoding.EncodeToString([]byte(path))
|
||||
}
|
||||
|
||||
func playlistIDDecode(id specid.ID) string {
|
||||
path, _ := base64.URLEncoding.DecodeString(id.StringValue)
|
||||
func playlistIDDecode(id string) string {
|
||||
path, _ := base64.URLEncoding.DecodeString(id)
|
||||
return string(path)
|
||||
}
|
||||
|
||||
func playlistRender(c *Controller, params params.Params, playlist *playlistp.Playlist, playlistID specid.ID, withItems bool) (*spec.Playlist, error) {
|
||||
func playlistRender(c *Controller, params params.Params, playlistID string, playlist *playlistp.Playlist, withItems bool) (*spec.Playlist, error) {
|
||||
user := &db.User{}
|
||||
if err := c.dbc.Where("id=?", playlist.UserID).Find(user).Error; err != nil {
|
||||
return nil, fmt.Errorf("find user by id: %w", err)
|
||||
@@ -221,14 +212,14 @@ func playlistRender(c *Controller, params params.Params, playlist *playlistp.Pla
|
||||
transcodeMeta := streamGetTranscodeMeta(c.dbc, user.ID, params.GetOr("c", ""))
|
||||
|
||||
for _, path := range playlist.Items {
|
||||
id, err := specidpaths.Lookup(c.dbc, MusicPaths(c.musicPaths), c.podcastsPath, path)
|
||||
file, err := specidpaths.Lookup(c.dbc, MusicPaths(c.musicPaths), c.podcastsPath, path)
|
||||
if err != nil {
|
||||
log.Printf("error looking up path %q: %s", path, err)
|
||||
continue
|
||||
}
|
||||
|
||||
var trch *spec.TrackChild
|
||||
switch id.Type {
|
||||
switch id := file.SID(); id.Type {
|
||||
case specid.Track:
|
||||
var track db.Track
|
||||
if err := c.dbc.Where("id=?", id.Value).Preload("Album").Preload("Album.Artists").Preload("Artists").Preload("TrackStar", "user_id=?", user.ID).Preload("TrackRating", "user_id=?", user.ID).Find(&track).Error; errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
|
||||
@@ -44,6 +44,10 @@ func (c *Controller) ServeGetNewestPodcasts(r *http.Request) *spec.Response {
|
||||
}
|
||||
|
||||
func (c *Controller) ServeDownloadPodcastEpisode(r *http.Request) *spec.Response {
|
||||
user := r.Context().Value(CtxUser).(*db.User)
|
||||
if !user.IsAdmin {
|
||||
return spec.NewError(50, "user not admin")
|
||||
}
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
id, err := params.GetID("id")
|
||||
if err != nil || id.Type != specid.PodcastEpisode {
|
||||
|
||||
@@ -5,22 +5,18 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/jinzhu/gorm"
|
||||
"go.senan.xyz/wrtag/coverparse"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/infocache/artistinfocache"
|
||||
"go.senan.xyz/gonic/playlist"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/params"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
@@ -37,18 +33,7 @@ import (
|
||||
|
||||
const (
|
||||
coverDefaultSize = 600
|
||||
)
|
||||
|
||||
var (
|
||||
//nolint:gochecknoglobals
|
||||
// after the image is decoded with image.Decode, we use the "format" param as the extension
|
||||
coverCacheFormats = []string{
|
||||
"jpeg", // from image.RegisterFormat("jpeg") @ image/jpeg/reader.go
|
||||
"png", // from image.RegisterFormat("png") @ image/png/reader.go
|
||||
"gif", // from image.RegisterFormat("gif") @ image/gif/reader.go
|
||||
"bmp", // from image.RegisterFormat("bmp") @ golang.org/x/image/bmp/reader.go
|
||||
"tiff", // from image.RegisterFormat("tiff") @ golang.org/x/image/tiff/reader.go
|
||||
}
|
||||
coverCacheFormat = "png"
|
||||
)
|
||||
|
||||
func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *spec.Response {
|
||||
@@ -57,84 +42,42 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
if err != nil {
|
||||
return spec.NewError(10, "please provide an `id` parameter")
|
||||
}
|
||||
|
||||
size := params.GetOrInt("size", coverDefaultSize)
|
||||
if size <= 0 {
|
||||
return spec.NewError(0, "invalid size")
|
||||
}
|
||||
cachePath := filepath.Join(
|
||||
c.cacheCoverPath,
|
||||
fmt.Sprintf("%s-%d.%s", id.String(), size, coverCacheFormat),
|
||||
)
|
||||
_, err = os.Stat(cachePath)
|
||||
switch {
|
||||
case os.IsNotExist(err):
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, c.tagReader, id)
|
||||
if err != nil {
|
||||
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
// cached cover could exist for any supported format
|
||||
cachePath, err := findCachedCover(c.cacheCoverPath, id.String(), size)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Printf("error checking cache: %v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
serve := func(p string) {
|
||||
w.Header().Set("Cache-Control", "public, max-age=1209600")
|
||||
http.ServeFile(w, r, p)
|
||||
}
|
||||
|
||||
if cachePath != "" {
|
||||
serve(cachePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, c.playlistStore, c.tagReader, id)
|
||||
if err != nil {
|
||||
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
img, format, err := image.Decode(reader)
|
||||
if err != nil {
|
||||
return spec.NewError(0, "decode for cover %q: %v", id, err)
|
||||
}
|
||||
|
||||
// don't upscale
|
||||
minSize := min(size, max(img.Bounds().Dx(), img.Bounds().Dy()))
|
||||
|
||||
cachePath = filepath.Join(c.cacheCoverPath, coverCacheFilename(id.String(), minSize, format))
|
||||
|
||||
if minSize != size {
|
||||
// we down sized, check cache again
|
||||
if _, err := os.Stat(cachePath); err == nil {
|
||||
serve(cachePath)
|
||||
if err := coverScaleAndSave(reader, cachePath, size); err != nil {
|
||||
log.Printf("error scaling cover: %v", err)
|
||||
return nil
|
||||
}
|
||||
case err != nil:
|
||||
log.Printf("error stating %q: %v", cachePath, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
resized := imaging.Fit(img, minSize, minSize, imaging.Lanczos)
|
||||
w.Header().Set("Cache-Control", "public, max-age=1209600")
|
||||
http.ServeFile(w, r, cachePath)
|
||||
|
||||
if err := imaging.Save(resized, cachePath); err != nil {
|
||||
return spec.NewError(10, "saving cover %q: %v", id, err)
|
||||
}
|
||||
|
||||
serve(cachePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
func coverCacheFilename(idStr string, size int, format string) string {
|
||||
return fmt.Sprintf("%s-%d.%s", idStr, size, format)
|
||||
}
|
||||
|
||||
func findCachedCover(cacheDir, idStr string, size int) (string, error) {
|
||||
for _, format := range coverCacheFormats {
|
||||
cachePath := filepath.Join(cacheDir, coverCacheFilename(idStr, size, format))
|
||||
if _, err := os.Stat(cachePath); err == nil {
|
||||
return cachePath, nil
|
||||
}
|
||||
}
|
||||
return "", os.ErrNotExist
|
||||
}
|
||||
|
||||
var (
|
||||
errCoverNotFound = errors.New("could not find a cover with that id")
|
||||
errCoverEmpty = errors.New("no cover found")
|
||||
)
|
||||
|
||||
// TODO: can we use specidpaths.Locate here?
|
||||
func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, playlistStore *playlist.Store, tagReader tags.Reader, id specid.ID) (io.ReadCloser, error) {
|
||||
func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, tagReader tags.Reader, id specid.ID) (io.ReadCloser, error) {
|
||||
switch id.Type {
|
||||
case specid.Album:
|
||||
return coverForAlbum(dbc, id.Value)
|
||||
@@ -146,8 +89,6 @@ func coverFor(dbc *db.DB, artistInfoCache *artistinfocache.ArtistInfoCache, play
|
||||
return coverForPodcastEpisode(dbc, id.Value)
|
||||
case specid.Track:
|
||||
return coverForTrack(dbc, tagReader, id.Value)
|
||||
case specid.Playlist:
|
||||
return coverForPlaylist(playlistStore, id)
|
||||
default:
|
||||
return nil, errCoverNotFound
|
||||
}
|
||||
@@ -235,33 +176,19 @@ func coverForTrack(dbc *db.DB, tagReader tags.Reader, id int) (io.ReadCloser, er
|
||||
return io.NopCloser(bytes.NewReader(cover)), nil
|
||||
}
|
||||
|
||||
func coverForPlaylist(playlistStore *playlist.Store, id specid.ID) (*os.File, error) {
|
||||
playlistPath := playlistIDDecode(id)
|
||||
playlistDir := filepath.Join(playlistStore.BasePath(), filepath.Dir(playlistPath))
|
||||
playlistBase := strings.TrimSuffix(filepath.Base(playlistPath), filepath.Ext(playlistPath))
|
||||
|
||||
entries, err := os.ReadDir(playlistDir)
|
||||
func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
|
||||
src, err := imaging.Decode(reader)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read playlist dir: %w", err)
|
||||
return fmt.Errorf("resizing: %w", err)
|
||||
}
|
||||
|
||||
var cover string
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
name := entry.Name()
|
||||
nameBase := strings.TrimSuffix(name, filepath.Ext(name))
|
||||
if nameBase == playlistBase && coverparse.IsCover(name) {
|
||||
cover = coverparse.BestBetween(cover, name)
|
||||
}
|
||||
}
|
||||
// don't upscale images
|
||||
width := min(size, src.Bounds().Dx())
|
||||
|
||||
if cover == "" {
|
||||
return nil, errCoverEmpty
|
||||
if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
|
||||
return fmt.Errorf("caching %q: %w", cachePath, err)
|
||||
}
|
||||
|
||||
return os.Open(filepath.Join(playlistDir, cover))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.Response {
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
package ctrlsubsonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.senan.xyz/gonic/playlist"
|
||||
)
|
||||
|
||||
func TestCoverForPlaylist(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("cover found jpg", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistDir := filepath.Join(tmp, "1")
|
||||
require.NoError(t, os.MkdirAll(playlistDir, 0o755))
|
||||
require.NoError(t, touch(filepath.Join(playlistDir, "test-playlist.jpg")))
|
||||
|
||||
playlistID := playlistIDEncode("1/test-playlist.m3u")
|
||||
file, err := coverForPlaylist(store, playlistID)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, file)
|
||||
require.NoError(t, file.Close())
|
||||
})
|
||||
|
||||
t.Run("cover found png", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistDir := filepath.Join(tmp, "1")
|
||||
require.NoError(t, os.MkdirAll(playlistDir, 0o755))
|
||||
require.NoError(t, touch(filepath.Join(playlistDir, "test-playlist.png")))
|
||||
|
||||
playlistID := playlistIDEncode("1/test-playlist.m3u")
|
||||
file, err := coverForPlaylist(store, playlistID)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, file)
|
||||
require.NoError(t, file.Close())
|
||||
})
|
||||
|
||||
t.Run("cover not found", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistDir := filepath.Join(tmp, "1")
|
||||
require.NoError(t, os.MkdirAll(playlistDir, 0o755))
|
||||
|
||||
playlistID := playlistIDEncode("1/test-playlist.m3u")
|
||||
file, err := coverForPlaylist(store, playlistID)
|
||||
require.ErrorIs(t, err, errCoverEmpty)
|
||||
require.Nil(t, file)
|
||||
})
|
||||
|
||||
t.Run("nested playlist path", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistDir := filepath.Join(tmp, "1", "subfolder")
|
||||
require.NoError(t, os.MkdirAll(playlistDir, 0o755))
|
||||
require.NoError(t, touch(filepath.Join(playlistDir, "my-nested-playlist.jpg")))
|
||||
|
||||
playlistID := playlistIDEncode("1/subfolder/my-nested-playlist.m3u")
|
||||
file, err := coverForPlaylist(store, playlistID)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, file)
|
||||
require.NoError(t, file.Close())
|
||||
})
|
||||
|
||||
t.Run("playlist directory missing", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistID := playlistIDEncode("1/test-playlist.m3u")
|
||||
file, err := coverForPlaylist(store, playlistID)
|
||||
require.Error(t, err)
|
||||
require.Nil(t, file)
|
||||
})
|
||||
|
||||
t.Run("different playlists different covers", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmp := t.TempDir()
|
||||
store, err := playlist.NewStore(tmp)
|
||||
require.NoError(t, err)
|
||||
|
||||
playlistDir := filepath.Join(tmp, "1")
|
||||
require.NoError(t, os.MkdirAll(playlistDir, 0o755))
|
||||
require.NoError(t, touch(filepath.Join(playlistDir, "playlist-a.jpg")))
|
||||
require.NoError(t, touch(filepath.Join(playlistDir, "playlist-b.png")))
|
||||
|
||||
fileA, err := coverForPlaylist(store, playlistIDEncode("1/playlist-a.m3u"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "playlist-a.jpg", filepath.Base(fileA.Name()))
|
||||
require.NoError(t, fileA.Close())
|
||||
|
||||
fileB, err := coverForPlaylist(store, playlistIDEncode("1/playlist-b.m3u"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "playlist-b.png", filepath.Base(fileB.Name()))
|
||||
require.NoError(t, fileB.Close())
|
||||
})
|
||||
}
|
||||
|
||||
func touch(path string) error {
|
||||
f, err := os.Create(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return f.Close()
|
||||
}
|
||||
@@ -3,25 +3,16 @@ package spec
|
||||
import (
|
||||
"cmp"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"go.senan.xyz/gonic/db"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
)
|
||||
|
||||
func NewAlbumByFolder(f *db.Album) *Album {
|
||||
artist := ""
|
||||
var parentSID *specid.ID
|
||||
if f.Parent != nil {
|
||||
artist = f.Parent.RightPath
|
||||
parentSID = f.ParentSID()
|
||||
}
|
||||
|
||||
a := &Album{
|
||||
Artist: artist,
|
||||
Artist: f.Parent.RightPath,
|
||||
ID: f.SID(),
|
||||
IsDir: true,
|
||||
ParentID: parentSID,
|
||||
ParentID: f.ParentSID(),
|
||||
Album: f.RightPath,
|
||||
Name: f.RightPath,
|
||||
Title: f.RightPath,
|
||||
@@ -72,14 +63,14 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
|
||||
|
||||
func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
|
||||
trCh := &TrackChild{
|
||||
ID: t.SID(),
|
||||
ContentType: t.MIME(),
|
||||
Suffix: formatExt(t.Ext()),
|
||||
Size: t.Size,
|
||||
DisplayArtist: t.TagTrackArtist,
|
||||
Title: cmp.Or(t.TagTitle, t.Filename),
|
||||
TrackNumber: t.TagTrackNumber,
|
||||
DiscNumber: t.TagDiscNumber,
|
||||
ID: t.SID(),
|
||||
ContentType: t.MIME(),
|
||||
Suffix: formatExt(t.Ext()),
|
||||
Size: t.Size,
|
||||
Artist: t.TagTrackArtist,
|
||||
Title: cmp.Or(t.TagTitle, t.Filename),
|
||||
TrackNumber: t.TagTrackNumber,
|
||||
DiscNumber: t.TagDiscNumber,
|
||||
Path: filepath.Join(
|
||||
parent.LeftPath,
|
||||
parent.RightPath,
|
||||
@@ -124,14 +115,10 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
|
||||
for _, g := range t.Genres {
|
||||
trCh.Genres = append(trCh.Genres, &GenreRef{Name: g.Name})
|
||||
}
|
||||
sort.Slice(t.Artists, func(i, j int) bool {
|
||||
return t.Artists[i].ID < t.Artists[j].ID
|
||||
})
|
||||
if len(t.Artists) > 0 {
|
||||
trCh.Artist = t.Artists[0].Name
|
||||
trCh.ArtistID = t.Artists[0].SID()
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -25,7 +25,6 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
|
||||
AverageRating: formatRating(a.AverageRating),
|
||||
IsCompilation: a.TagCompilation,
|
||||
ReleaseTypes: formatReleaseTypes(a.TagReleaseType),
|
||||
DiscTitles: []*DiscTitle{},
|
||||
}
|
||||
if a.Cover != "" {
|
||||
ret.CoverID = a.SID()
|
||||
@@ -60,17 +59,6 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
|
||||
if a.Play != nil {
|
||||
ret.PlayCount = a.Play.Count
|
||||
}
|
||||
if len(a.DiscTitles) > 0 {
|
||||
sort.Slice(a.DiscTitles, func(i, j int) bool {
|
||||
return a.DiscTitles[i].DiscNumber < a.DiscTitles[j].DiscNumber
|
||||
})
|
||||
for _, dt := range a.DiscTitles {
|
||||
ret.DiscTitles = append(ret.DiscTitles, &DiscTitle{
|
||||
Disc: dt.DiscNumber,
|
||||
Title: dt.Title,
|
||||
})
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -79,6 +67,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
|
||||
ID: t.SID(),
|
||||
Album: album.TagTitle,
|
||||
AlbumID: album.SID(),
|
||||
Artist: t.TagTrackArtist,
|
||||
Artists: []*ArtistRef{},
|
||||
DisplayArtist: t.TagTrackArtist,
|
||||
AlbumArtists: []*ArtistRef{},
|
||||
@@ -117,31 +106,21 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
|
||||
if t.TrackRating != nil {
|
||||
ret.UserRating = t.TrackRating.Rating
|
||||
}
|
||||
|
||||
sort.Slice(t.Artists, func(i, j int) bool {
|
||||
return t.Artists[i].ID < t.Artists[j].ID
|
||||
})
|
||||
sort.Slice(album.Artists, func(i, j int) bool {
|
||||
return album.Artists[i].ID < album.Artists[j].ID
|
||||
})
|
||||
|
||||
switch {
|
||||
case len(t.Artists) > 0:
|
||||
ret.Artist = t.Artists[0].Name
|
||||
ret.ArtistID = t.Artists[0].SID()
|
||||
case len(album.Artists) > 0:
|
||||
ret.Artist = album.Artists[0].Name
|
||||
if len(album.Artists) > 0 {
|
||||
sort.Slice(album.Artists, func(i, j int) bool {
|
||||
return album.Artists[i].ID < album.Artists[j].ID
|
||||
})
|
||||
ret.ArtistID = album.Artists[0].SID()
|
||||
}
|
||||
for _, a := range t.Artists {
|
||||
ret.Artists = append(ret.Artists, &ArtistRef{ID: a.SID(), Name: a.Name})
|
||||
}
|
||||
if len(t.Genres) > 0 {
|
||||
ret.Genre = t.Genres[0].Name
|
||||
}
|
||||
for _, g := range t.Genres {
|
||||
ret.Genres = append(ret.Genres, &GenreRef{Name: g.Name})
|
||||
}
|
||||
for _, a := range t.Artists {
|
||||
ret.Artists = append(ret.Artists, &ArtistRef{ID: a.SID(), Name: a.Name})
|
||||
}
|
||||
for _, a := range album.Artists {
|
||||
ret.AlbumArtists = append(ret.AlbumArtists, &ArtistRef{ID: a.SID(), Name: a.Name})
|
||||
}
|
||||
|
||||
@@ -125,11 +125,6 @@ type GenreRef struct {
|
||||
Name string `xml:"name,attr" json:"name"`
|
||||
}
|
||||
|
||||
type DiscTitle struct {
|
||||
Disc int `xml:"disc,attr" json:"disc"`
|
||||
Title string `xml:"title,attr" json:"title"`
|
||||
}
|
||||
|
||||
// https://opensubsonic.netlify.app/docs/responses/albumid3/
|
||||
type Album struct {
|
||||
ID *specid.ID `xml:"id,attr,omitempty" json:"id"`
|
||||
@@ -140,7 +135,7 @@ type Album struct {
|
||||
Artist string `xml:"artist,attr" json:"artist"`
|
||||
|
||||
Artists []*ArtistRef `xml:"artists" json:"artists"`
|
||||
DisplayArtist string `xml:"displayArtist,attr" json:"displayArtist"`
|
||||
DisplayArtist string `xml:"diplayArtist,attr" json:"displayArtist"`
|
||||
|
||||
// folder stuff
|
||||
Title string `xml:"title,attr,omitempty" json:"title"`
|
||||
@@ -158,9 +153,8 @@ 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"`
|
||||
DiscTitles []*DiscTitle `xml:"discTitles" json:"discTitles"`
|
||||
IsCompilation bool `xml:"isCompilation" json:"isCompilation"`
|
||||
ReleaseTypes []string `xml:"releaseTypes" json:"releaseTypes"`
|
||||
|
||||
// star / rating
|
||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||
@@ -199,10 +193,10 @@ type TrackChild struct {
|
||||
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
||||
|
||||
Artists []*ArtistRef `xml:"artists" json:"artists"`
|
||||
DisplayArtist string `xml:"displayArtist,attr" json:"displayArtist"`
|
||||
DisplayArtist string `xml:"diplayArtist,attr" json:"displayArtist"`
|
||||
|
||||
AlbumArtists []*ArtistRef `xml:"albumArtists" json:"albumArtists"`
|
||||
AlbumDisplayArtist string `xml:"displayAlbumArtist,attr" json:"displayAlbumArtist"`
|
||||
AlbumDisplayArtist string `xml:"diplayAlbumArtist,attr" json:"displayAlbumArtist"`
|
||||
|
||||
Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
|
||||
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
|
||||
@@ -326,7 +320,7 @@ type Playlists struct {
|
||||
}
|
||||
|
||||
type Playlist struct {
|
||||
ID specid.ID `xml:"id,attr" json:"id"`
|
||||
ID string `xml:"id,attr" json:"id"`
|
||||
Name string `xml:"name,attr" json:"name"`
|
||||
Comment string `xml:"comment,attr" json:"comment"`
|
||||
Owner string `xml:"owner,attr" json:"owner"`
|
||||
@@ -442,8 +436,8 @@ type Bookmark struct {
|
||||
}
|
||||
|
||||
type Starred struct {
|
||||
Artists []*Artist `xml:"artist,omitempty" json:"artist,omitempty"`
|
||||
Albums []*Album `xml:"album,omitempty" json:"album,omitempty"`
|
||||
Artists []*Directory `xml:"artist,omitempty" json:"artist,omitempty"`
|
||||
Albums []*TrackChild `xml:"album,omitempty" json:"album,omitempty"`
|
||||
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -27,15 +27,13 @@ const (
|
||||
Podcast IDT = "pd"
|
||||
PodcastEpisode IDT = "pe"
|
||||
InternetRadioStation IDT = "ir"
|
||||
Playlist IDT = "pl"
|
||||
separator = "-"
|
||||
)
|
||||
|
||||
//nolint:musttag
|
||||
type ID struct {
|
||||
Type IDT
|
||||
Value int
|
||||
StringValue string
|
||||
Type IDT
|
||||
Value int
|
||||
}
|
||||
|
||||
func New(in string) (ID, error) {
|
||||
@@ -43,17 +41,10 @@ func New(in string) (ID, error) {
|
||||
if !ok {
|
||||
return ID{}, ErrBadSeparator
|
||||
}
|
||||
|
||||
switch IDT(partType) {
|
||||
case Playlist:
|
||||
return ID{Type: Playlist, StringValue: partValue}, nil
|
||||
}
|
||||
|
||||
val, err := strconv.Atoi(partValue)
|
||||
if err != nil {
|
||||
return ID{}, fmt.Errorf("%q: %w", partValue, ErrNotAnInt)
|
||||
}
|
||||
|
||||
switch IDT(partType) {
|
||||
case Artist:
|
||||
return ID{Type: Artist, Value: val}, nil
|
||||
@@ -73,13 +64,10 @@ func New(in string) (ID, error) {
|
||||
}
|
||||
|
||||
func (i ID) String() string {
|
||||
switch {
|
||||
case i.Value != 0:
|
||||
return fmt.Sprintf("%s%s%d", i.Type, separator, i.Value)
|
||||
case i.StringValue != "":
|
||||
return fmt.Sprintf("%s%s%s", i.Type, separator, i.StringValue)
|
||||
if i.Value == 0 {
|
||||
return "-1"
|
||||
}
|
||||
return "-1"
|
||||
return fmt.Sprintf("%s%s%d", i.Type, separator, i.Value)
|
||||
}
|
||||
|
||||
func (i ID) MarshalJSON() ([]byte, error) {
|
||||
|
||||
@@ -37,40 +37,32 @@ func Locate(dbc *db.DB, id specid.ID) (Result, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup maps a location on the filesystem to a specid
|
||||
func Lookup(dbc *db.DB, musicPaths []string, podcastsPath string, path string) (*specid.ID, error) {
|
||||
// Locate maps a location on the filesystem to a specid
|
||||
func Lookup(dbc *db.DB, musicPaths []string, podcastsPath string, path string) (Result, error) {
|
||||
if !strings.HasPrefix(path, "http") && !filepath.IsAbs(path) {
|
||||
return nil, ErrNotAbs
|
||||
}
|
||||
|
||||
if strings.HasPrefix(path, podcastsPath) {
|
||||
podcastPath, episodeFilename := filepath.Split(path)
|
||||
|
||||
q := dbc.
|
||||
Select("podcast_episodes.id").
|
||||
Model(db.PodcastEpisode{}).
|
||||
Joins(`JOIN podcasts ON podcasts.id=podcast_episodes.podcast_id`).
|
||||
Where(`podcasts.root_dir=? AND podcast_episodes.filename=?`, filepath.Clean(podcastPath), filepath.Clean(episodeFilename))
|
||||
|
||||
var id int
|
||||
if err := q.Row().Scan(&id); err != nil {
|
||||
return nil, ErrNotFound
|
||||
var pe db.PodcastEpisode
|
||||
if err := q.First(&pe).Error; err == nil {
|
||||
return &pe, nil
|
||||
}
|
||||
return &specid.ID{Type: specid.PodcastEpisode, Value: id}, nil
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
// probably internet radio
|
||||
if strings.HasPrefix(path, "http") {
|
||||
q := dbc.
|
||||
Select("internet_radio_stations.id").
|
||||
Model(db.InternetRadioStation{}).
|
||||
Where("stream_url=?", path)
|
||||
|
||||
var id int
|
||||
if err := q.Row().Scan(&id); err != nil {
|
||||
return nil, ErrNotFound
|
||||
var irs db.InternetRadioStation
|
||||
if err := dbc.First(&irs, "stream_url=?", path).Error; err == nil {
|
||||
return &irs, nil
|
||||
}
|
||||
return &specid.ID{Type: specid.InternetRadioStation, Value: id}, nil
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
var musicPath string
|
||||
@@ -89,14 +81,13 @@ func Lookup(dbc *db.DB, musicPaths []string, podcastsPath string, path string) (
|
||||
leftPath, rightPath := filepath.Split(filepath.Clean(relDir))
|
||||
|
||||
q := dbc.
|
||||
Select("tracks.id").
|
||||
Model(db.Track{}).
|
||||
Where(`albums.root_dir=? AND albums.left_path=? AND albums.right_path=? AND tracks.filename=?`, musicPath, leftPath, rightPath, filename).
|
||||
Joins(`JOIN albums ON tracks.album_id=albums.id`)
|
||||
Joins(`JOIN albums ON tracks.album_id=albums.id`).
|
||||
Preload("Album")
|
||||
|
||||
var id int
|
||||
if err := q.Row().Scan(&id); err != nil {
|
||||
return nil, ErrNotFound
|
||||
var track db.Track
|
||||
if err := q.First(&track).Error; err == nil {
|
||||
return &track, nil
|
||||
}
|
||||
return &specid.ID{Type: specid.Track, Value: id}, nil
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
@@ -23,8 +23,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -42,8 +41,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -61,8 +59,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -80,8 +77,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -99,8 +95,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -118,8 +113,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -137,8 +131,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -156,8 +149,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -175,8 +167,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+9
-18
@@ -23,8 +23,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -42,8 +41,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -61,8 +59,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -80,8 +77,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -99,8 +95,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -118,8 +113,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -137,8 +131,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -156,8 +149,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -175,8 +167,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+9
-18
@@ -23,8 +23,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -42,8 +41,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -61,8 +59,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -80,8 +77,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -99,8 +95,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -118,8 +113,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -137,8 +131,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -156,8 +149,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -175,8 +167,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+82
-91
@@ -23,46 +23,7 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
},
|
||||
{
|
||||
"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": [],
|
||||
"discTitles": null
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artist": "artist-1",
|
||||
"artists": null,
|
||||
"displayArtist": "",
|
||||
"title": "album-0",
|
||||
"album": "album-0",
|
||||
"parent": "al-6",
|
||||
"isDir": true,
|
||||
"coverArt": "al-7",
|
||||
"name": "album-0",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -80,65 +41,25 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"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": [],
|
||||
"discTitles": null
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
"id": "al-7",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artist": "artist-1",
|
||||
"artists": null,
|
||||
"displayArtist": "",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"title": "album-0",
|
||||
"album": "album-0",
|
||||
"parent": "al-6",
|
||||
"isDir": true,
|
||||
"coverArt": "al-8",
|
||||
"name": "album-1",
|
||||
"coverArt": "al-7",
|
||||
"name": "album-0",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
},
|
||||
{
|
||||
"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": [],
|
||||
"discTitles": null
|
||||
"releaseTypes": []
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -156,8 +77,43 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"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",
|
||||
@@ -175,8 +131,43 @@
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [],
|
||||
"discTitles": null
|
||||
"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",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artist": "artist-1",
|
||||
"artists": null,
|
||||
"displayArtist": "",
|
||||
"title": "album-1",
|
||||
"album": "album-1",
|
||||
"parent": "al-6",
|
||||
"isDir": true,
|
||||
"coverArt": "al-8",
|
||||
"name": "album-1",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -46,8 +45,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -67,8 +65,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -88,8 +85,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -109,8 +105,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -130,8 +125,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -151,8 +145,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -172,8 +165,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -193,8 +185,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -46,8 +45,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -67,8 +65,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -88,8 +85,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -109,8 +105,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -130,8 +125,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -151,8 +145,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -172,8 +165,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -193,8 +185,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+9
-18
@@ -25,8 +25,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -46,8 +45,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -67,8 +65,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -88,8 +85,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -109,8 +105,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -130,8 +125,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -151,8 +145,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -172,8 +165,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -193,8 +185,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+104
-113
@@ -7,27 +7,6 @@
|
||||
"openSubsonic": true,
|
||||
"albumList2": {
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
@@ -46,29 +25,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-9",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-3",
|
||||
@@ -88,50 +45,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
},
|
||||
{
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
},
|
||||
{
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -151,29 +65,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
},
|
||||
{
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -193,8 +85,107 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"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,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
"created": "2019-11-30T00:00:00Z",
|
||||
"artistId": "ar-2",
|
||||
"artist": "artist-1",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"title": "album-2",
|
||||
"album": "album-2",
|
||||
"coverArt": "al-9",
|
||||
"name": "album-2",
|
||||
"songCount": 3,
|
||||
"duration": 300,
|
||||
"playCount": 0,
|
||||
"genre": "Unknown Genre",
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+1
-2
@@ -109,8 +109,7 @@
|
||||
}
|
||||
],
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,7 @@
|
||||
"duration": 0,
|
||||
"playCount": 0,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": [""],
|
||||
"discTitles": []
|
||||
"releaseTypes": [""]
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -28,8 +28,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -49,8 +48,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -70,8 +68,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+3
-6
@@ -28,8 +28,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -49,8 +48,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -70,8 +68,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+3
-6
@@ -28,8 +28,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -49,8 +48,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -70,8 +68,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -45,7 +45,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -73,7 +73,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
|
||||
+9
-18
@@ -25,8 +25,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-4",
|
||||
@@ -46,8 +45,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-5",
|
||||
@@ -67,8 +65,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-7",
|
||||
@@ -88,8 +85,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-8",
|
||||
@@ -109,8 +105,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-9",
|
||||
@@ -130,8 +125,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-11",
|
||||
@@ -151,8 +145,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-12",
|
||||
@@ -172,8 +165,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
},
|
||||
{
|
||||
"id": "al-13",
|
||||
@@ -193,8 +185,7 @@
|
||||
"genres": [{ "name": "Unknown Genre" }],
|
||||
"year": 2021,
|
||||
"isCompilation": false,
|
||||
"releaseTypes": ["Album"],
|
||||
"discTitles": []
|
||||
"releaseTypes": ["Album"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+20
-20
@@ -14,7 +14,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -42,7 +42,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -70,7 +70,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -98,7 +98,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -126,7 +126,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -154,7 +154,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -182,7 +182,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -210,7 +210,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -238,7 +238,7 @@
|
||||
"artist": "artist-0",
|
||||
"artistId": "ar-1",
|
||||
"artists": [{ "id": "ar-1", "name": "artist-0" }],
|
||||
"displayArtist": "artist-0",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -266,7 +266,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -294,7 +294,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -322,7 +322,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -350,7 +350,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -378,7 +378,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -406,7 +406,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -434,7 +434,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -462,7 +462,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -490,7 +490,7 @@
|
||||
"artist": "artist-1",
|
||||
"artistId": "ar-2",
|
||||
"artists": [{ "id": "ar-2", "name": "artist-1" }],
|
||||
"displayArtist": "artist-1",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -518,7 +518,7 @@
|
||||
"artist": "artist-2",
|
||||
"artistId": "ar-3",
|
||||
"artists": [{ "id": "ar-3", "name": "artist-2" }],
|
||||
"displayArtist": "artist-2",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
@@ -546,7 +546,7 @@
|
||||
"artist": "artist-2",
|
||||
"artistId": "ar-3",
|
||||
"artists": [{ "id": "ar-3", "name": "artist-2" }],
|
||||
"displayArtist": "artist-2",
|
||||
"displayArtist": "",
|
||||
"albumArtists": null,
|
||||
"displayAlbumArtist": "",
|
||||
"bitRate": 100,
|
||||
|
||||
@@ -15,7 +15,7 @@ type Reader struct{}
|
||||
|
||||
func (Reader) CanRead(absPath string) bool {
|
||||
switch ext := strings.ToLower(filepath.Ext(absPath)); ext {
|
||||
case ".mp3", ".flac", ".aac", ".m4a", ".m4b", ".ogg", ".opus", ".wma", ".wav", ".wv", ".ape":
|
||||
case ".mp3", ".flac", ".aac", ".m4a", ".m4b", ".ogg", ".opus", ".wma", ".wav", ".wv":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
+3
-12
@@ -51,10 +51,7 @@ func MustArtists(p Tags) []string {
|
||||
if r := normtag.Values(p, normtag.Artists); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
if r := normtag.Values(p, normtag.Artist); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
return []string{FallbackArtist}
|
||||
return []string{MustArtist(p)}
|
||||
}
|
||||
|
||||
func MustAlbumArtist(p Tags) string {
|
||||
@@ -68,10 +65,7 @@ func MustAlbumArtists(p Tags) []string {
|
||||
if r := normtag.Values(p, normtag.AlbumArtists); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
if r := normtag.Values(p, normtag.AlbumArtist); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
return []string{MustArtist(p)}
|
||||
return []string{MustAlbumArtist(p)}
|
||||
}
|
||||
|
||||
func MustGenre(p Tags) string {
|
||||
@@ -85,10 +79,7 @@ func MustGenres(p Tags) []string {
|
||||
if r := normtag.Values(p, normtag.Genres); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
if r := normtag.Values(p, normtag.Genre); len(r) > 0 {
|
||||
return r
|
||||
}
|
||||
return []string{FallbackGenre}
|
||||
return []string{MustGenre(p)}
|
||||
}
|
||||
|
||||
func MustYear(p Tags) int {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0.20.1
|
||||
0.18.0
|
||||
Reference in New Issue
Block a user