Compare commits

...

2032 commits

Author SHA1 Message Date
Deluan Quintão
2b84c574ba
fix: restore old date display/sort behaviour (#3862)
* fix(server): bring back legacy date mappings

Signed-off-by: Deluan <deluan@navidrome.org>

* reuse the mapDates logic in the legacyReleaseDate function

Signed-off-by: Deluan <deluan@navidrome.org>

* fix mappings

Signed-off-by: Deluan <deluan@navidrome.org>

* show original and release dates in album grid

Signed-off-by: Deluan <deluan@navidrome.org>

* fix tests based on new year mapping

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(subsonic): prefer returning original_year over (recording) year
when sorting albums

Signed-off-by: Deluan <deluan@navidrome.org>

* fix case when we don't have originalYear

Signed-off-by: Deluan <deluan@navidrome.org>

* show all dates in album's info, and remove the recording date from the album page

Signed-off-by: Deluan <deluan@navidrome.org>

* better?

Signed-off-by: Deluan <deluan@navidrome.org>

* add snapshot tests for Album Details

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(subsonic): sort order for getAlbumList?type=byYear

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-30 17:06:58 -04:00
Deluan
88f87e6c4f chore: replace album placeholder
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-30 13:41:32 -04:00
Deluan
cf100c4eb4 chore(subsonic): update snapshot tests to use version 1.16.1 2025-03-27 22:50:22 -04:00
Deluan Quintão
5ab345c83e
chore(server): add more info to scrobble errors logs (#3889)
* chore(server): add more info to scrobble errors

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(server): add more info to scrobble errors

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(server): add more info to scrobble errors

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-27 18:57:06 -04:00
Deluan
46a2ec0ba1 feat(ui): hide absolute paths from regular users
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-25 20:05:24 -04:00
Deluan
3394580413 feat(ui): add Norwegian translation
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-25 17:43:25 -04:00
Michachatz
112ea281d9 feat(ui): add Greek translation (#3892)
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-25 17:33:58 -04:00
Deluan Quintão
c837838d58
fix(ui): update French, Polish, Turkish translations from POEditor (#3834)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2025-03-24 17:52:03 -04:00
matteo00gm
9e9465567d
fix(ui): update Italian translations (#3885) 2025-03-24 17:49:23 -04:00
Deluan
651ce163c7 fix(ui): sort playlist by album_artist, bpm and channels
fix #3878

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-24 16:41:54 -04:00
Deluan Quintão
55ce28b2c6
fix(bfr): force upgrade to read all folders. (#3871)
* chore(scanner): add trace logs

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(bfr): force upgrade to read all folders. It was skipping folders for certain timezones

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-24 15:22:59 -04:00
Deluan
d331ee904b fix(ui): sort playlist by year
fix #3878

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-24 15:08:17 -04:00
Deluan
3a0ce6aafa fix(scanner): elapsed time for folder processing is wrong in the logs
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-23 12:36:38 -04:00
Deluan
1806552ef6 chore: remove more outdated TODOs
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-23 11:53:43 -04:00
Deluan
223e88d481 chore: remove some BFR-related TODOs that are not valid anymore
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-23 11:37:20 -04:00
Deluan Quintão
57e0f6d3ea
feat(server): custom ArtistJoiner config (#3873)
* feat(server): custom ArtistJoiner config

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(ui): organize ArtistLinkField, add tests

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): use display artist

* feat(ui): use display artist

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-23 10:53:21 -04:00
Deluan
1c691ac0e6 feat(docker): automatically loads a navidrome.toml file from /data, if available
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 17:33:56 -04:00
Deluan
264d73d73e fix(server): don't break if the ND_CONFIGFILE does not exist
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 17:08:03 -04:00
Deluan
296259d781 feat(ui): show bitDepth in song info dialog
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 15:48:29 -04:00
Deluan
3f9d173495 fix(scanner): support ID3v2 embedded images in WAV files
Fix #3867

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 15:48:07 -04:00
Deluan
b386981b7f fix(scanner): better log message when AutoImportPlaylists is disabled
Fix #3861

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 15:08:26 -04:00
Deluan Quintão
be7cb59dc5
fix(scanner): allow disabling splitting with the Tags config option (#3869)
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-22 12:34:35 -04:00
Nicolas Derive
63dc0e2062
fix(ui): update Français, reorder translation according to en.json template (#3839)
Update french translation and reorder the file the same way as the en.json template, making comparison easier.
2025-03-22 12:31:32 -04:00
Xabi
1e1dce92b6
fix(ui): update Basque translation (#3864)
* Update Basque localisation

added missing strings

* Update eu.json
2025-03-22 12:29:43 -04:00
Deluan
d78c6f6a04 fix(subsonic): ArtistID3 should contain list of AlbumID3
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-20 22:10:46 -04:00
Deluan Quintão
59ece40393
fix(server): better embedded artwork extraction with ffmpeg (#3860)
- `-map 0:v` selects all video streams from the input
- `-map -0:V` excludes all "main" video streams (capital V)

This combination effectively selects only the attached pictures

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-20 19:26:40 -04:00
Deluan
491210ac12 fix(scanner): ignore NaN ReplayGain values
Fix: https://github.com/navidrome/navidrome/issues/3858
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-20 12:42:09 -04:00
Deluan
cd552a55ef fix(scanner): pass datafolder and cachefolder to scanner subprocess
Fix #3831

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-19 22:15:20 -04:00
Deluan
ee2c2b19e9 fix(dockerfile): remove the healthcheck, it gives more headaches than benefits.
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-19 20:18:56 -04:00
Deluan
0147bb5f12 chore(deps): upgrade viper to 1.20.0, add tests for the supported config formats
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-18 19:16:47 -04:00
Rob Emery
1ed8930107
fix(msi): don't override custom ini config (#3836)
Previously addLine would add-or-update, resulting in the custom settings being overriden on upgrade. createLine will only add to the ini if the key doesn't already exist.
2025-03-18 18:23:04 -04:00
Deluan
e457f21306 chore(server): show square flag in resize artwork logs
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-18 12:43:52 -04:00
Deluan Quintão
b04647309f
chore(deps): upgrade to Go 1.24.1 (#3851)
Some checks failed
Pipeline: Test, Lint, Build / Lint Go code (push) Failing after 2s
Pipeline: Test, Lint, Build / Get version info (push) Successful in 6s
Pipeline: Test, Lint, Build / Test Go code (push) Failing after 5s
Pipeline: Test, Lint, Build / Check Docker configuration (push) Successful in 2s
Pipeline: Test, Lint, Build / Test JS code (push) Successful in 56s
Pipeline: Test, Lint, Build / Build (push) Has been skipped
Pipeline: Test, Lint, Build / Build Windows installers (push) Has been skipped
Pipeline: Test, Lint, Build / Package/Release (push) Has been skipped
Pipeline: Test, Lint, Build / Upload Linux PKG (push) Has been skipped
Pipeline: Test, Lint, Build / Push Docker manifest (push) Has been skipped
Pipeline: Test, Lint, Build / Lint i18n files (push) Successful in 19s
* chore(deps): upgrade to Go 1.24.1

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): add reflex as go.mod tool

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): add wire as go.mod tool

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): add goimports as go.mod tool

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): add ginkgo as go.mod tool

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-17 21:08:10 -04:00
Deluan Quintão
2adb098f32
fix(scanner): fix displayArtist logic (#3835)
* fix displayArtist logic

Signed-off-by: Deluan <deluan@navidrome.org>

* remove unneeded value

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor

Signed-off-by: Deluan <deluan@navidrome.org>

* Use first albumartist if it cannot figure out the display name

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-17 19:21:33 -04:00
Kendall Garner
212887214c
fix(ui): minor icon inconsistencies and "no missing files" translation (#3837)
* chore(ui): Fix minor inconsistencies

1. The icons in the user menu are a mix of MUI and react-icons. Move them all to react-icons, and use a standard size (24px)
2. On missing files page, provide a custom Empty component that just removes 'yet'

* use RA's builtin support for custom empty message

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-03-16 19:39:19 -04:00
Deluan Quintão
beb768cd9c
feat(server): add Role filters to albums (#3829)
* navidrome artist filtering

* address discord feedback

* perPage min 36

* various artist artist_id -> albumartist_id

* artist_id, role_id separate

* remove all ui changes I guess

* Add tests, check for possible SQL injection

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2025-03-14 21:43:52 -04:00
Kendall Garner
ed1109ddb2
fix(subsonic): fix albumCount in artists (#3827)
* only do subsonic instead

* make sure to actually populate response first

* navidrome artist filtering

* address discord feedback

* perPage min 36

* various artist artist_id -> albumartist_id

* artist_id, role_id separate

* remove all ui changes I guess

* Revert role filters

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-03-14 21:21:03 -04:00
Deluan
98808e4b6d docs(scanner): clarifies the purpose of the mappings.yaml file for regular users
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-14 19:32:26 -04:00
Deluan
422ba2284e chore(scanner): add logs to .ndignore processing
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-14 17:44:11 -04:00
Kendall Garner
938c3d44cc
fix(scanner): restore setsubtitle as discsubtitle for non-WMA (#3821)
With old metadata, Disc Subtitle was one of `tsst`, `discsubtitle`, or `setsubtitle`.
With the updated, `setsubtitle` is only available for flac.
Update `mappings.yaml` to maintain prior behavior.
2025-03-14 07:01:07 -04:00
Deluan
2838ac36df feat(scanner): allow disabling tags with Tags.<tag>.Ignore=true
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-13 19:55:30 -04:00
Deluan
b952672877 fix(scanner): add back the Scanner.GenreSeparators as a deprecated option
This allows easy upgrade of containers in PikaPods

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-13 19:25:07 -04:00
Deluan Quintão
5c0b6fb9b7
fix(server): skip non-UTF encoding during the database migration. (#3803)
Fix #3787

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-13 07:10:45 -04:00
Deluan
5fb1db6031 fix(scanner): watcher not working with relative MusicFolder
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-12 18:13:22 -04:00
Deluan
226be78bf5 fix(scanner): full_text not being updated on scan
Fixes #3813

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-12 17:51:36 -04:00
Deluan
7c13878075 fix(subsonic): getRandomSongs with genre filter
fix https://github.com/dweymouth/supersonic/issues/577

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-12 17:35:06 -04:00
Rodrigo Iglesias
0bb4b881e9
fix(ui): update Español translation (#3805)
Corrected "aletorio" and added some more translations
2025-03-11 20:42:09 -04:00
Deluan Quintão
70f536e04d
fix(ui): skip missing files in bulk operations (#3807)
* fix(ui): skip missing files when adding to playqueue

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): skip missing files when adding to playlists

* fix(ui): skip missing files when shuffling songs

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-11 20:19:46 -04:00
Deluan Quintão
2a15a217de
fix(server): db migration does not work for MusicFolders ending with a trailing slash. (#3797)
* fix(server): db migration was not working for MusicFolders ending with a trailing slash.

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): db migration for relative paths

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-11 10:09:09 -04:00
Kendall Garner
a28462a7ab
fix(ui): fix make dev (#3795)
1. For some bizarre reason, importing inflection by itself is undefined. But you can import specific functions
2. Per https://github.com/vite-pwa/vite-plugin-pwa/issues/419, `type: 'module',` is only for non-chromium browsers
2025-03-10 14:50:16 -04:00
Deluan
5c67297dce fix(server): panic when logging tag type. Fix #3790
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-10 07:14:17 -04:00
Deluan Quintão
365df5220b
fix(server): db migration not working when MusicFolder is a relative path (#3766)
* fix(server): db migration not working when MusicFolder is a relative path

Signed-off-by: Deluan <deluan@navidrome.org>

* remove todo

Signed-off-by: Deluan <deluan@navidrome.org>

* fix migration of paths in Windows

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-09 19:14:29 -04:00
Deluan Quintão
b2b5c00331
fix(ui): update Finnish, Hungarian, Russian, Ukrainian translations from POEditor (#3780)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2025-03-09 18:22:20 -04:00
Deluan
ee18489b85 fix(subsonic): don't return empty disctitles for a single disc album
See https://support.symfonium.app/t/hide-disc-header-for-albums-with-only-1-disc/6877/1

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-09 17:22:41 -04:00
Deluan
57d3be8604 feat(subsonic): rename AppendSubtitle conf to Subsonic.AppendSubtitle, for consistency
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-08 19:02:29 -05:00
Deluan
0d42b9a4a5 chore(deps): bump more JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 20:07:15 -05:00
Deluan
a1a6047c37 chore(deps): bump Vite version
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 19:59:35 -05:00
Deluan
2171c44503 chore(deps): bump JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 19:47:08 -05:00
Deluan
fac01ccecb chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 19:36:46 -05:00
Deluan
98a6819390 fix(ui): disable bulk action buttons if transcoding edit is disabled
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 18:01:49 -05:00
Deluan
4156602158 build(ci): show English names for changed languages in POEditor PRs
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-07 12:12:44 -05:00
Deluan
21a5528f5e feat(server): deprecate Scanner.GroupAlbumReleases config option
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-06 23:57:47 -05:00
Deluan
31e003e6f3 feat(ui): use webp for login backgrounds
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-06 23:32:52 -05:00
ChekeredList71
e467e32c06
fix(ui): updated Hungarian translation for BFR (#3773)
* Hungarian translation for v0.54.1 done

* Hungarian translation for v0.54.1 done

* Updated Hugarian translation

* Updated Hugarian translation

---------

Co-authored-by: ChekeredList71 <null@example.com>
Co-authored-by: ChekeredList71 <ads@asd.com>
2025-03-06 22:41:45 -05:00
Kendall Garner
36ed880e61
fix(scanner): always refresh folder image time when adding first image (#3764)
* fix(scanner): Always refresh folder image time when adding first image

Currently, the `images_updated_at` field is only set to the image modification time.
However, in cases where a new image is added _and_ said image is older than the folder mod time, the field is not updated properly.

In this the case where `images_updated_at` is null (no images were ever added) and a new images is found, use the folder modification time instead of image modification time.

**Note**, this doesn't handle cases such as replacing a newer image with an older one.

* simplify image update at

* we don't want to set imagesUpdatedAt when there's no images in the folder

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-03-06 22:16:37 -05:00
Deluan
1c192d8a6d fix(ui): replace bulk "delete" label with "remove" in playlists
Fix #3525

Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-06 07:54:59 -05:00
Kendall Garner
5869f7caaf
feat(subsonic): set sortName for OS AlbumList (#3776)
* feat(subsonic): Set SortName for OS AlbumList, test to JSON/XML

* albumlist2, star2 updated properly

* fix(subsonic): add sort or order name based on config

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-03-05 22:52:15 -05:00
Deluan
8732fc7226 fix(server): change log level for some unimportant messages
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-05 20:54:06 -05:00
Deluan
0372339e1b fix(server): only build core.Agents once
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-05 14:18:27 -08:00
Deluan
a04167672c fix(server): remove misleading "Agent not available" warning.
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-05 14:11:44 -08:00
Deluan
dc4e091622 feat(server): make appending subtitle to song title configurable
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-05 12:36:09 -08:00
Deluan
8ab2a11d22 feat(server): group Subsonic config options together
Signed-off-by: Deluan <deluan@navidrome.org>
2025-03-05 12:29:30 -08:00
Deluan
637c909e93 feat(server): removed GenreSeparator, replaced with Tag.Genre.Split
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-28 15:36:21 -10:00
Deluan
453873fa26 feat(insights): send scanner options
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-28 15:36:21 -10:00
Deluan
de37e0f720 feat(server): rename ScanSchedule conf to Scanner.Schedule, for consistency
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-28 15:36:21 -10:00
Deluan
f3cb85cb0d feat(server): warn users of ffmpeg extractor that it is not available anymore
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-28 12:39:30 -08:00
Deluan Quintão
0c4c223127
fix(server): import absolute paths in m3u (#3756)
* fix(server): import playlists with absolute paths

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): optimize playlist import

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): add test with multiple libraries

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): refactor

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-26 22:26:38 -05:00
Deluan Quintão
3892f70c35
fix(ui): update Deutsch, Español, Euskara, Galego, Bahasa Indonesia, 日本語, Português, Pусский, Türkçe translations from POEditor (#3681)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2025-02-26 22:20:48 -05:00
Deluan Quintão
1468a56808
fix(server): reduce SQLite "database busy" errors (#3760)
* fix(scanner): remove transactions where they are not strictly needed

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): force setStar transaction to start as IMMEDIATE

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): encapsulated way to upgrade tx to write mode

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): use tx immediate for some playlist endpoints

Signed-off-by: Deluan <deluan@navidrome.org>

* make more transactions immediate (#3759)

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2025-02-26 22:01:49 -05:00
Deluan
d6ec52b9d4 fix(subsonic): check errors before setting headers for getCoverArt
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-25 08:22:38 -05:00
Deluan
5fa19f9cfa chore(server): add logs to begin/end transaction
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-24 19:13:42 -05:00
Deluan
15a3d2ca66 fix(server): disallow search engine crawlers in robots.txt
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-23 22:01:01 -05:00
Kendall Garner
efab198d4a
test(server): validate play tracker participants, scrobble buffer (#3752)
* test(server): validate play tracker participants, scrobble buffer

* tests(server): nit: remove duplicated tests and small cleanups

Signed-off-by: Deluan <deluan@navidrome.org>

* tests(server): nit: replace panics with assertions

Signed-off-by: Deluan <deluan@navidrome.org>

* just use random ids, and store it instead

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-02-23 21:52:51 -05:00
Deluan
5ad9f546b2 fix(server): role filters in Smart Playlists.
See https://github.com/navidrome/navidrome/discussions/3676#discussioncomment-12286960

Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-23 14:08:53 -05:00
Deluan
20297c2aea fix(server): send artist mbids when scrobbling to ListenBrainz
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-23 13:30:39 -05:00
Kendall Garner
f6eee65955
feat(ui): Show performer subrole(s) where possible (#3747)
* feat(ui): Show performer subrole(s) where possible

* nit: simplify subrole formatting

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-02-22 12:05:19 -05:00
Kendall Garner
aee19e747c
feat(ui): Improve Artist Album pagination (#3748)
* feat(ui): Improve Artist Album pagination

- use maximum of albumartist/artist credits for determining pagination
- reduce default maxPerPage considerably. This gives values of 36/72/108 at largest size

* enable pagination when over 90

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-02-22 09:31:20 -05:00
Deluan
f34f15ba1c feat(ui): make need for refresh more visible when upgrading server
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-21 18:15:25 -05:00
Deluan
74348a340f feat(server): new option to set the default for ReportRealPath on new players
Implements #3653

Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-20 22:24:09 -05:00
Deluan
09ae41a2da sec(subsonic): authentication bypass in Subsonic API with non-existent username
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-20 20:14:19 -05:00
Deluan
70487a09f4 fix(ui): paginate albums in artist page when needed
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-20 19:21:01 -05:00
Deluan
d4147c2330 fix(scanner): improve refresh artists stats query
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-20 14:55:45 -05:00
Deluan
dd4802c0c6 fix(ui): remove unused term
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-19 22:38:09 -05:00
Deluan
efed7f1b40 chore(deps): bump go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2025-02-19 21:15:35 -05:00
Xabi
6cc95d53a9
fix(ui): update Basque translation (#3666) 2025-02-19 21:01:27 -05:00
Deluan Quintão
c795bcfcf7
feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709)
* fix(server): more race conditions when updating artist/album from external sources

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(scanner): add .gitignore syntax to .ndignore. Resolves #1394

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): null

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): pass configfile option to child process

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): resume interrupted fullScans

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): remove old scanner code

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): rename old metadata package

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): move old metadata package

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: tests

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): update Go to 1.23.4

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: logs

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(test):

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: log level

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: remove log message

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: add config for scanner watcher

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: children playlists

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: replace `interface{}` with `any`

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: smart playlists with genres

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: allow any tags in smart playlists

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: artist names in playlists

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: smart playlist's sort by tags

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add moods to child

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add moods to AlbumID3

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(subsonic): use generic JSONArray for OS arrays

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(subsonic): use https in test

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add releaseTypes to AlbumID3

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add recordLabels to AlbumID3

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(subsonic): rename JSONArray to Array

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add artists to AlbumID3

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add artists to Child

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(scanner): do not pre-populate smart playlists

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): implement a simplified version of ArtistID3.

See https://github.com/opensubsonic/open-subsonic-api/discussions/120

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add artists to album child

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add contributors to mediafile Child

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add albumArtists to mediafile Child

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add displayArtist and displayAlbumArtist

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add displayComposer to Child

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add roles to ArtistID3

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(subsonic): use " • " separator for displayComposer

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor:

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(subsonic):

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(subsonic): respect `PreferSortTags` config option

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(subsonic):

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: optimize purging non-unused tags

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: don't run 'refresh artist stats' concurrently with other transactions

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor:

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: log message

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: add Scanner.ScanOnStartup config option, default true

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: better json parsing error msg when importing NSPs

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't update album's imported_time when updating external_metadata

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: handle interrupted scans and full scans after migrations

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: run `analyze` when migration requires a full rescan

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: run `PRAGMA optimize` at the end of the scan

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't update artist's updated_at when updating external_metadata

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: handle multiple artists and roles in smart playlists

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): dim missing tracks

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: album missing logic

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: error encoding in gob

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: separate warnings from errors

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: mark albums as missing if they were contained in a deleted folder

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: add participant names to media_file and album tables

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: use participations in criteria, instead of m2m relationship

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: rename participations to participants

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add moods to album child

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: albumartist role case

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(scanner): run scanner as an external process by default

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): show albumArtist names

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): dim out missing albums

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: flaky test

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): scrobble buffer mapping. fix #3583

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: more participations renaming

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: listenbrainz scrobbling

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: send release_group_mbid to listenbrainz

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): implement OpenSubsonic explicitStatus field (#3597)

* feat: implement OpenSubsonic explicitStatus field

* fix(subsonic): fix failing snapshot tests

* refactor: create helper for setting explicitStatus

* fix: store smaller values for explicit-status on database

* test: ToAlbum explicitStatus

* refactor: rename explicitStatus helper function

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>

* fix: handle album and track tags in the DB based on the mappings.yaml file

Signed-off-by: Deluan <deluan@navidrome.org>

* save similar artists as JSONB

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: getAlbumList byGenre

Signed-off-by: Deluan <deluan@navidrome.org>

* detect changes in PID configuration

Signed-off-by: Deluan <deluan@navidrome.org>

* set default album PID to legacy_pid

Signed-off-by: Deluan <deluan@navidrome.org>

* fix tests

Signed-off-by: Deluan <deluan@navidrome.org>

* fix SIGSEGV

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't lose album stars/ratings when migrating

Signed-off-by: Deluan <deluan@navidrome.org>

* store full PID conf in properties

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: keep album annotations when changing PID.Album config

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: reassign album annotations

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: use (display) albumArtist and add links to each artist

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: not showing albums by albumartist

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: error msgs

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: hide PID from Native API

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: album cover art resolution

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: trim participant names

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: reduce watcher log spam

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: panic when initializing the watcher

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: various artists

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't store empty lyrics in the DB

Signed-off-by: Deluan <deluan@navidrome.org>

* remove unused methods

Signed-off-by: Deluan <deluan@navidrome.org>

* drop full_text indexes, as they are not being used by SQLite

Signed-off-by: Deluan <deluan@navidrome.org>

* keep album created_at when upgrading

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): null pointer

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: album artwork cache

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't expose missing files in Subsonic API

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: searchable interface

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: filter out missing items from subsonic search

* fix: filter out missing items from playlists

* fix: filter out missing items from shares

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): add filter by artist role

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): only return albumartists in getIndexes and getArtists endpoints

Signed-off-by: Deluan <deluan@navidrome.org>

* sort roles alphabetically

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: artist playcounts

Signed-off-by: Deluan <deluan@navidrome.org>

* change default Album PID conf

Signed-off-by: Deluan <deluan@navidrome.org>

* fix albumartist link when it does not match any albumartists values

Signed-off-by: Deluan <deluan@navidrome.org>

* fix `Ignoring filter not whitelisted` (role) message

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: trim any names/titles being imported

Signed-off-by: Deluan <deluan@navidrome.org>

* remove unused genre code

Signed-off-by: Deluan <deluan@navidrome.org>

* serialize calls to Last.fm's getArtist

Signed-off-by: Deluan <deluan@navidrome.org>

xxx

Signed-off-by: Deluan <deluan@navidrome.org>

* add counters to genres

Signed-off-by: Deluan <deluan@navidrome.org>

* nit: fix migration `notice` message

Signed-off-by: Deluan <deluan@navidrome.org>

* optimize similar artists query

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: last.fm.getInfo when mbid does not exist

Signed-off-by: Deluan <deluan@navidrome.org>

* ui only show missing items for admins

Signed-off-by: Deluan <deluan@navidrome.org>

* don't allow interaction with missing items

Signed-off-by: Deluan <deluan@navidrome.org>

* Add Missing Files view (WIP)

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: merged tag_counts into tag table

Signed-off-by: Deluan <deluan@navidrome.org>

* add option to completely disable automatic scanner

Signed-off-by: Deluan <deluan@navidrome.org>

* add delete missing files functionality

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: playlists not showing for regular users

Signed-off-by: Deluan <deluan@navidrome.org>

* reduce updateLastAccess frequency to once every minute

Signed-off-by: Deluan <deluan@navidrome.org>

* reduce update player frequency to once every minute

Signed-off-by: Deluan <deluan@navidrome.org>

* add timeout when updating player

Signed-off-by: Deluan <deluan@navidrome.org>

* remove dead code

Signed-off-by: Deluan <deluan@navidrome.org>

* fix duplicated roles in stats

Signed-off-by: Deluan <deluan@navidrome.org>

* add `; ` to artist splitters

Signed-off-by: Deluan <deluan@navidrome.org>

* fix stats query

Signed-off-by: Deluan <deluan@navidrome.org>

* more logs

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: support legacy clients (DSub) by removing OpenSubsonic extra fields - WIP

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: support legacy clients (DSub) by removing OpenSubsonic extra fields - WIP

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: support legacy clients (DSub) by removing OpenSubsonic extra fields - WIP

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: support legacy clients (DSub) by removing OpenSubsonic extra fields - WIP

Signed-off-by: Deluan <deluan@navidrome.org>

* add record label filter

Signed-off-by: Deluan <deluan@navidrome.org>

* add release type filter

Signed-off-by: Deluan <deluan@navidrome.org>

* fix purgeUnused tags

Signed-off-by: Deluan <deluan@navidrome.org>

* add grouping filter to albums

Signed-off-by: Deluan <deluan@navidrome.org>

* allow any album tags to be used in as filters in the API

Signed-off-by: Deluan <deluan@navidrome.org>

* remove empty tags from album info

Signed-off-by: Deluan <deluan@navidrome.org>

* comments in the migration

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: Cannot read properties of undefined

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: listenbrainz scrobbling (#3640)

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: remove duplicated tag values

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: don't ignore the taglib folder!

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: show track subtitle tag

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: show artists stats based on selected role

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: inspect

Signed-off-by: Deluan <deluan@navidrome.org>

* add media type to album info/filters

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: change format of subtitle in the UI

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: subtitle in Subsonic API and search

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: subtitle in UI's player

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: split strings should be case-insensitive

Signed-off-by: Deluan <deluan@navidrome.org>

* disable ScanSchedule

Signed-off-by: Deluan <deluan@navidrome.org>

* increase default sessiontimeout

Signed-off-by: Deluan <deluan@navidrome.org>

* add sqlite command line tool to docker image

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: resources override

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: album PID conf

Signed-off-by: Deluan <deluan@navidrome.org>

* change migration to mark current artists as albumArtists

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): Allow filtering on multiple genres (#3679)

* feat(ui): Allow filtering on multiple genres

Signed-off-by: Henrik Nordvik <henrikno@gmail.com>
Signed-off-by: Deluan <deluan@navidrome.org>

* add multi-genre filter in Album list

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Henrik Nordvik <henrikno@gmail.com>
Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Henrik Nordvik <henrikno@gmail.com>

* add more multi-valued tag filters to Album and Song views

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): unselect missing files after removing

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): song filter

Signed-off-by: Deluan <deluan@navidrome.org>

* fix sharing tracks. fix #3687

Signed-off-by: Deluan <deluan@navidrome.org>

* use rowids when using search for sync (ex: Symfonium)

Signed-off-by: Deluan <deluan@navidrome.org>

* fix "Report Real Paths" option for subsonic clients

Signed-off-by: Deluan <deluan@navidrome.org>

* fix "Report Real Paths" option for subsonic clients for search

Signed-off-by: Deluan <deluan@navidrome.org>

* add libraryPath to Native API /songs endpoint

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(subsonic): add album version

Signed-off-by: Deluan <deluan@navidrome.org>

* made all tags lowercase as they are case-insensitive anyways.

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(ui): Show full paths, extended properties for album/song (#3691)

* feat(ui): Show full paths, extended properties for album/song

- uses library path + os separator + path
- show participants (album/song) and tags (song)
- make album/participant clickable in show info

* add source to path

* fix pathSeparator in UI

Signed-off-by: Deluan <deluan@navidrome.org>

* fix local artist artwork (#3695)

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: parse vorbis performers

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: clean function into smaller functions

Signed-off-by: Deluan <deluan@navidrome.org>

* fix translations for en and pt

Signed-off-by: Deluan <deluan@navidrome.org>

* add trace log to show annotations reassignment

Signed-off-by: Deluan <deluan@navidrome.org>

* add trace log to show annotations reassignment

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: allow performers without instrument/subrole

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: metadata clean function again

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: optimize split function

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: split function is now a method of TagConf

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: humanize Artist total size

Signed-off-by: Deluan <deluan@navidrome.org>

* add album version to album details

Signed-off-by: Deluan <deluan@navidrome.org>

* don't display album-level tags in SongInfo

Signed-off-by: Deluan <deluan@navidrome.org>

* fix genre clicking in Album Page

Signed-off-by: Deluan <deluan@navidrome.org>

* don't use mbids in Last.fm api calls.

From 1337574018:

With MBID:
```
GET https://ws.audioscrobbler.com/2.0/?api_key=XXXX&artist=Van+Morrison&format=json&lang=en&mbid=a41ac10f-0a56-4672-9161-b83f9b223559&method=artist.getInfo

{
artist: {
name: "Bee Gees",
mbid: "bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810",
url: "https://www.last.fm/music/Bee+Gees",
}
```

Without MBID:
```
GET https://ws.audioscrobbler.com/2.0/?api_key=XXXX&artist=Van+Morrison&format=json&lang=en&method=artist.getInfo

{
artist: {
name: "Van Morrison",
mbid: "a41ac10f-0a56-4672-9161-b83f9b223559",
url: "https://www.last.fm/music/Van+Morrison",
}
```

Signed-off-by: Deluan <deluan@navidrome.org>

* better logging for when the artist folder is not found

Signed-off-by: Deluan <deluan@navidrome.org>

* fix various issues with artist image resolution

Signed-off-by: Deluan <deluan@navidrome.org>

* hide "Additional Tags" header if there are none.

Signed-off-by: Deluan <deluan@navidrome.org>

* simplify tag rendering

Signed-off-by: Deluan <deluan@navidrome.org>

* enhance logging for artist folder detection

Signed-off-by: Deluan <deluan@navidrome.org>

* make folderID consistent for relative and absolute folderPaths

Signed-off-by: Deluan <deluan@navidrome.org>

* handle more folder paths scenarios

Signed-off-by: Deluan <deluan@navidrome.org>

* filter out other roles when SubsonicArtistParticipations = true

Signed-off-by: Deluan <deluan@navidrome.org>

* fix "Cannot read properties of undefined"

Signed-off-by: Deluan <deluan@navidrome.org>

* fix lyrics and comments being truncated (#3701)

* fix lyrics and comments being truncated

* specifically test for lyrics and comment length

* reorder assertions

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>

* fix(server): Expose library_path for playlist (#3705)

Allows showing absolute path for UI, and makes "report real path" work for playlists (Subsonic)

* fix BFR on Windows (#3704)

* fix potential reflected cross-site scripting vulnerability

Signed-off-by: Deluan <deluan@navidrome.org>

* hack to make it work on Windows

* ignore windows executables

* try fixing the pipeline

Signed-off-by: Deluan <deluan@navidrome.org>

* allow MusicFolder in other drives

* move windows local drive logic to local storage implementation

---------

Signed-off-by: Deluan <deluan@navidrome.org>

* increase pagination sizes for missing files

Signed-off-by: Deluan <deluan@navidrome.org>

* reduce level of "already scanning" watcher log message

Signed-off-by: Deluan <deluan@navidrome.org>

* only count folders with audio files in it

See https://github.com/navidrome/navidrome/discussions/3676#discussioncomment-11990930

Signed-off-by: Deluan <deluan@navidrome.org>

* add album version and catalog number to search

Signed-off-by: Deluan <deluan@navidrome.org>

* add `organization` alias for `recordlabel`

Signed-off-by: Deluan <deluan@navidrome.org>

* remove mbid from Last.fm agent

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: support inspect in ui (#3726)

* inspect in ui

* address round 1

* add catalogNum to AlbumInfo

Signed-off-by: Deluan <deluan@navidrome.org>

* remove dependency on metadata_old (deprecated) package

Signed-off-by: Deluan <deluan@navidrome.org>

* add `RawTags` to model

Signed-off-by: Deluan <deluan@navidrome.org>

* support parsing MBIDs for roles (from the https://github.com/kgarner7/picard-all-mbids plugin) (#3698)


* parse standard roles, vorbis/m4a work for now

* fix djmixer

* working roles, use DJ-mix

* add performers to file

* map mbids

* add a few more tests

* add test

Signed-off-by: Deluan <deluan@navidrome.org>

* try to simplify the performers logic

Signed-off-by: Deluan <deluan@navidrome.org>

* stylistic changes

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>

* remove param mutation

Signed-off-by: Deluan <deluan@navidrome.org>

* run automated SQLite optimizations

Signed-off-by: Deluan <deluan@navidrome.org>

* fix playlists import/export on Windows

* fix import playlists

* fix export playlists

* better handling of Windows volumes

Signed-off-by: Deluan <deluan@navidrome.org>

* handle more album ID reassignments

Signed-off-by: Deluan <deluan@navidrome.org>

* allow adding/overriding tags in the config file

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ui): Fix playlist track id, handle missing tracks better (#3734)

- Use `mediaFileId` instead of `id` for playlist tracks
- Only fetch if the file is not missing
- If extractor fails to get the file, also error (rather than panic)

* optimize DB after each scan.

Signed-off-by: Deluan <deluan@navidrome.org>

* remove sortable from AlbumSongs columns

Signed-off-by: Deluan <deluan@navidrome.org>

* simplify query to get missing tracks

Signed-off-by: Deluan <deluan@navidrome.org>

* mark Scanner.Extractor as deprecated

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Signed-off-by: Henrik Nordvik <henrikno@gmail.com>
Co-authored-by: Caio Cotts <caio@cotts.com.br>
Co-authored-by: Henrik Nordvik <henrikno@gmail.com>
Co-authored-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2025-02-19 20:35:17 -05:00
RTapeLoadingError
46a963a02a
fix(ui): update Spanish translation (#3682)
Disambiguation for:
"recentlyAdded": "Añadidos recientemente",
"recentlyPlayed": "Reproducidos recientemente"
They share the same label: "Recientes".
2025-02-01 13:07:41 -05:00
Matvei Stefarov
195ae56001
fix(ui) Update Russian translation (#3678)
* fix(ui): Update Russian translations

- Adds missing strings added in the past couple releases
- Fixes a few confusing translations in the "share" section

* Add missing comma
2025-01-30 20:17:16 -05:00
Deluan Quintão
f9db449e7e
fix(ui): update ไทย translations from POEditor (#3662)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2025-01-24 18:11:54 -05:00
Deluan
657fe11f53 fix: remove Access-Control-Allow-Origin. closes #3660
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-22 18:24:11 -05:00
Deluan Quintão
47e3fdb1b8
fix(server): do not try to validate credentials if the request is canceled (#3650)
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-16 20:32:11 -05:00
Deluan Quintão
c37583fa9f
feat(server): create M3Us from shares (#3652) 2025-01-16 20:26:16 -05:00
Deluan
9d86f63f15 fix(server): add logs to public image endpoint
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-15 08:47:47 -05:00
Deluan Quintão
73ccfbd839
fix(ui): update Türkçe translations from POEditor (#3636)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2025-01-13 18:07:45 -05:00
Kendall Garner
920fd53e58
fix(ui): remove index.html from service worker cache after creating admin user (#3642) 2025-01-12 18:32:02 -05:00
Kendall Garner
3179966270
fix(metrics): write system metrics on start (#3641)
* fix(metrics): write system metrics on start

* add broken basic auth test

* refactor: simplify Prometheus instantiation

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: basic authentication

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: move magic strings to constants

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: simplify prometheus http handler

Signed-off-by: Deluan <deluan@navidrome.org>

* add artist metadata to aggregrate sql

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-01-11 21:02:36 -05:00
Deluan
537e2fc033 chore(deps): bump go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-09 22:27:59 -05:00
ChekeredList71
f1478d40f5
fix(ui): fix for typo in hu.json (#3635)
* Hungarian translation for v0.54.1 done

* Hungarian translation for v0.54.1 done

* Fix typo in hu.json

`metrikákat` was mistyped as `metrikükat`

---------

Co-authored-by: ChekeredList71 <null@example.com>
2025-01-09 18:30:53 -05:00
Deluan
beff1afad7 fix(subsonic): make Share's lastVisited optional
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-09 16:10:53 -05:00
Deluan
ba2623e3f1 feat(server): add more logs to backup
Signed-off-by: Deluan <deluan@navidrome.org>
2025-01-09 13:25:07 -05:00
Kendall Garner
d60e83176c
feat(cli): support getting playlists via cli (#3634)
* feat(cli): support getting playlists via cli

* address initial nit

* use csv writer and csv instead
2025-01-09 12:01:37 -05:00
Deluan
acce3c97d5 fix(release): make binaries executable before packaging
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-29 23:43:57 -03:00
Deluan Quintão
734eb30ac5
fix(ui): update Suomi, Polski, Türkçe translations from POEditor (#3592)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2024-12-28 20:58:08 -05:00
Deluan
1eedee9086 fix(insights): add more linux fs types
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-27 12:13:15 -05:00
Kendall Garner
51eed74a0e
fix(release): change owner of cache to Navidrome user (#3599) 2024-12-26 22:13:13 -05:00
Deluan
3942275689 chore(deps): bump github.com/andybalholm/cascadia from 1.3.2 to 1.3.3
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-25 17:49:42 -05:00
Deluan
98b038c1fb chore(deps): upgrade golang.org/x/net (CVE-2024-45338)
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-25 17:16:05 -05:00
Kendall Garner
f0302525a7
fix(server): use cancellable context instead of Sleep for initial insights delay (#3593)
* bugfix(server): use cancellable contet instead of sleep for initial insights delay

* fix(server): initial delay time

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-12-24 17:35:19 -05:00
Deluan Quintão
0299e488b5
fix(server): backup and restore issues from the cli (#3579)
* fix(server): backup not working from cli

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(server): make backup-file required for restore

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-22 16:41:40 -05:00
whorfin
630c304080
fix(server): typo in backup prune message (#3582)
probably a copypasta oops
2024-12-22 16:38:59 -05:00
Deluan
0bebd396df build(ci): use the head commit sha in PR versions
Ref: https://stackoverflow.com/a/68068674
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 20:21:13 -05:00
Deluan
0b18489327 build(poeditor): change commit message for translation update PRs
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 17:54:20 -05:00
Deluan Quintão
8880f67035
fix(ui): update Español, Français, Svenska translations from POEditor (#3576)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2024-12-21 17:52:10 -05:00
Deluan
99dfb832eb fix(insights): get Windows version
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 14:54:14 -05:00
Deluan
51c16aa69f chore: add PikaPods to release notes
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 14:39:34 -05:00
ChekeredList71
972229d1e8
fix(ui): update Hungarian translation (#3574)
* Hungarian translation for v0.54.1 done

* Hungarian translation for v0.54.1 done

---------

Co-authored-by: ChekeredList71 <null@example.com>
2024-12-21 14:26:22 -05:00
Deluan
c8f174ea84 fix(server): change log level for some last.fm warnings
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 13:39:39 -05:00
Deluan Quintão
d4dc8180a2
build(ci): fix release version label and package names (#3573)
* fix(ci): fix snapshot label

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(ci): fix package names

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-21 13:36:22 -05:00
Deluan Quintão
851f54ea57
fix(ci): fix linux packages upload (#3569)
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-20 23:38:28 -05:00
Deluan Quintão
72a0f59be3
fix(ui): update translations from POEditor (#3568)
Co-authored-by: navidrome-bot <navidrome-bot@navidrome.org>
2024-12-20 18:48:22 -05:00
Deluan Quintão
c11fd9ce28
feat(ci): add updated language names to the POEditor PR title (#3566)
* refactor(ci): add updated languages to the POEditor PR title

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(ci): add an author to the PR

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-20 18:46:00 -05:00
Deluan
3e47819f7a fix(server): reduce album placeholder image size by converting it to webp
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-19 18:42:31 -05:00
Deluan
906ac635c2 fix(insights): check if running in a container
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-19 18:05:33 -05:00
Deluan
6bc4c0317f fix(insights): better status
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-19 17:21:08 -05:00
Deluan
04f296cc73 fix(ui): show last.fm api-key missing in a FormHelperText
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-19 16:59:26 -05:00
Dany Marcoux
21dd04cb7d
docs: set org.opencontainers.image.source label in Dockerfile (#3564)
As documented in the OCI Image Format,
org.opencontainers.image.source[1] identifies an image's source
repository. This is purely for documentation purposes. It does however
help tools such as Renovate[2] to find the changelogs when a new
Navidrome version is released. The changelogs would then be included in
the PR Renovate creates.

[1]: 5325ec4885/annotations.md (L24)
[2]: https://docs.renovatebot.com/modules/datasource/docker/#description

Signed-off-by: Dany Marcoux <git@dmarcoux.com>
2024-12-19 16:56:33 -05:00
Deluan Quintão
2d8507cfd7
fix(ui): don't hide Last.fm scrobble switch (#3561)
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-19 09:08:28 -05:00
Deluan Quintão
6c11649b06
fix(insights): fix issues and improve reports (#3558)
* fix(insights): show error whn reading library counts

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): wait 30 mins before send first report

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): send number of active players, grouped by client type

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): disable reports when running in dev mode

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): add Dockerfile to the docker build, to avoid `vcs.modified=true`

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): add more linux fs types

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): need admin permissions to retrieve library counts

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): dev flag to disable player insights

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-18 20:37:35 -05:00
Caio Cotts
4f8cd5307c
fix(ui): fix play queue for play button and context menus (#3559) 2024-12-18 17:57:42 -05:00
York
32afe9698c
fix(ui): completed the translation of zh-Hant and zh-Hans (#3450)
* Completed the translation of zh-Hant and zh-Hans

* Update translation terms in zh-Hans and zh-Hant files

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-12-17 17:56:27 -05:00
Deluan Quintão
3e7c4b6f70
fix(ui): update Turkish, Galician and Polish translations from POEditor (#3426)
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
2024-12-17 17:48:02 -05:00
qx100
dcc84e29d9
fix(ui): Update Chinese (simplified) Translation (#3490) 2024-12-17 17:45:53 -05:00
Xabi
0d520dea2d
fix(ui): update Basque (#3542)
* fix(ui): update eu.json

Added:
- lastAccessAt

Updated:
- lastLoginAt

* fix(ui): update eu.json

Updated:
- logout
2024-12-17 17:44:38 -05:00
Deluan
2bb918f8a1 chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-17 17:41:57 -05:00
Deluan Quintão
8e2052ff95
feat(Insights): add anonymous usage data collection (#3543)
* feat(insights): initial code (WIP)

* feat(insights): add more info

* feat(insights): add fs info

* feat(insights): export insights.Data

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): more config info

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(insights): move data struct to its own package

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(insights): omit some attrs if empty

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): send insights to server, add option to disable

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): remove info about anonymous login

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(insights): fix lint

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): disable collector if EnableExternalServices is false

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): fix type casting for 32bit platforms

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): remove EnableExternalServices from the collection (as it will always be false)

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(insights): fix lint

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor(insights): rename function for consistency

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): log the data sent to the collector server

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): add last collection timestamp to the "about" dialog.

Also add opt-out info to the SignUp form

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): only sends the initial data collection after an admin user is created

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): remove dangling comment

Signed-off-by: Deluan <deluan@navidrome.org>

* feat(insights): Translate insights messages

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): reporting empty library

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: move URL to consts.js

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-17 17:10:55 -05:00
Deluan
bc3576e092 chore(deps): bump prettier
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-10 11:17:30 -05:00
Deluan
44bc70b269 chore(deps): bump JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-10 11:14:21 -05:00
Deluan
297f72ff1a chore(deps): bump Alpine version
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-09 16:54:11 -05:00
Deluan
181c29613f chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-09 16:50:52 -05:00
Kendall Garner
1a36f06147
fix(ui): service worker crashing on precacheAndRoute (#3528) 2024-12-08 17:43:34 -05:00
Deluan
9cbdb20a31 fix(server): don't try to save JWT if it fails to encrypt
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-05 22:19:39 -05:00
Deluan
7f030b0859 fix(server): encrypt jwt secret at rest
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-05 21:52:15 -05:00
Deluan
177a1f853f fix(server): more race conditions when updating artist/album from external sources
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-04 17:34:26 -05:00
Deluan
627417dae3 fix(server): add disc number to fake path.
Also revert "feat(server): enable "Report Real Path" by default"

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-02 09:35:39 -05:00
Deluan
2b0bfbd75a fix(server): race condition when updating artist/album from external sources
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-01 20:16:40 -05:00
Deluan
8fb09e71b6 feat(server): get artist images from Last.fm
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-01 17:31:18 -05:00
Deluan
c94def801e feat(server): enable "Report Real Path" by default
Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-01 17:02:15 -05:00
Deluan Quintão
cbf5e3d51b
fix(ui): PWA not updating properly in new Vite config (#3493)
* fix: pwa not updating. use the custom code we had before

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: docker build

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-30 10:33:16 -05:00
Deluan
1c0ebb9460 chore(deps): bump JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-25 17:41:23 -05:00
Deluan
94bc1a1d41 chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-25 17:31:53 -05:00
Kursat Aktas
9ae898d071
feat: add Navidrome Guru on Gurubase.io (#3491)
Signed-off-by: Kursat Aktas <kursat.ce@gmail.com>
2024-11-23 17:29:00 -05:00
Deluan
054946dc42 chore: update sanitize with updated diacritics
See https://github.com/navidrome/navidrome/issues/255#issuecomment-2488595427

Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-20 11:31:13 -05:00
Deluan
ccce1c0f6d fix: pre-cache square images, or else they are not useful for the Album Grid
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:41:50 -05:00
Deluan
81edef925c refactor: when resizing, don't buffer the original image "just in case"
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:41:50 -05:00
Deluan
2d4f483812 refactor: remove unnecessary intermediate buffer for ffmpeg image extraction
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:41:50 -05:00
Deluan
d229ff39e5 refactor: reduce GC pressure by pre-allocating slices
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:41:50 -05:00
Deluan
3982ba7258 revert: separation of write and read DBs
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:41:50 -05:00
Deluan
1bf94531fd refactor: better implementation of newRefreshQueue.
- use pointer references in channel
 - actually exits when context is canceled

Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-19 18:07:03 -05:00
Deluan
6c38dc234f refactor: change toSQL to use ReplaceAllStringFunc, to cause less static allocations
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-18 14:07:41 +02:00
Deluan
c1adf407a1 refactor: load translations with sync.OnceValues
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-18 14:07:31 +02:00
Deluan
c952dc343a chore(deps): bump JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-11 13:47:01 -05:00
Deluan
3671598121 chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-11 13:30:09 -05:00
Deluan Quintão
cd0cf7c12b
feat: cache login background images (#3462)
* feat: use direct links to unsplash for background images

Signed-off-by: Deluan <deluan@navidrome.org>

* feat: cache images from unsplash

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: use cache.HTTPClient to reduce complexity

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: remove magic numbers

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-08 20:23:30 -05:00
Deluan Quintão
6c6223f2f9
fix: forcing transcoding when client does not specify transcoding options (#3455)
* fix: wip

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: revert #3227

It is not respecting the server configured transcoding for the player

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-05 20:39:05 -05:00
Deluan
6ff7ab52f4 chore(deps): bump JS dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-04 12:27:55 -05:00
Deluan
faed2ea8d7 chore(deps): bump Go dependencies
Signed-off-by: Deluan <deluan@navidrome.org>
2024-11-04 12:26:39 -05:00
Deluan
cf69df877a chore(deps): bump js dependencies 2024-10-28 22:07:36 -04:00
Deluan
075a7e2640 chore(deps): bump go dependencies 2024-10-28 22:02:52 -04:00
Deluan Quintão
3fda7445b0
fix(server): try to find proper embedded front cover - only for vorbis comments for now (#3348)
* fix(artwork): get the first image from vorbis comments, not the last. fixes #3254

This uses a fork for now.

* fix(artwork): prioritize getting embedded types that are listed as "front" covers

* fix: cleanup
2024-10-27 21:59:22 -04:00
Deluan Quintão
fcb5e1b806
fix(server): fix case-insensitive sort order and add indexes to improve performance (#3425)
* refactor(server): better sort mappings

* refactor(server): simplify GetIndex

* fix: recreate tables and indexes using proper collation

Also add tests to ensure proper collation

* chore: remove unused method

* fix: sort expressions

* fix: lint errors

* fix: cleanup
2024-10-26 14:06:34 -04:00
Kendall Garner
154e13f7c9
build: add packages for deb and rpm to release (#3202)
* support packing deb/rpm/archlinux

* .-.

* initial test

* fix postinstall, remove execstop

* bash -> sh, create toml manually if it doesn't exist (thanks debian)

* don't forget that newline

* postrm

* comments, contrib -> packaging/linux

* contrib > packaging in .goreleaser

* actually add toml

* openrc/sysv templates

* add apk. nothing else yet

* wait, we have a ntive uninstall

* fix: merge errors, move packaging to release

* chore: remove old goreleaser conf

* ci: remove `release` dependency on `docker push`

* ci: fix release version

* ci: upload packages

* ci: try to fix json file list

* ci: replace the json file list with a txt artifact

* postremove -> preremove, skip install/remove error

* actually do preremove

* better preremove

* ci: fix

* ci: fix?

* ci: clean-up

* ci: try to change labels and filenames

* ci: fix?

* ci: fix?

* ci: add `make package` target

* ci: make labels more readable

hope it doesn't break the pipeline again

* build: remove alpine and archlinux packages, for now.

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-10-26 13:31:45 -04:00
Deluan Quintão
69e2a6d620
build(netgo): make sure the project is always compiled with netgo build tag (#3428)
* build(netgo): make sure the project is always compiled with `netgo` build tag

* docs(netgo): better comments
2024-10-26 13:28:23 -04:00
dependabot[bot]
15b2dc6b48
chore(deps-dev): bump eslint-plugin-jsx-a11y in /ui (#3416)
Bumps [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) from 6.10.0 to 6.10.1.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/compare/v6.10.0...v6.10.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsx-a11y
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 23:24:43 -04:00
dependabot[bot]
1c48a55759
chore(deps-dev): bump eslint-plugin-react-refresh in /ui (#3419)
Bumps [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) from 0.4.12 to 0.4.13.
- [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases)
- [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.4.12...v0.4.13)

---
updated-dependencies:
- dependency-name: eslint-plugin-react-refresh
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 23:16:45 -04:00
dependabot[bot]
a9b301dfc5
chore(deps-dev): bump @testing-library/jest-dom in /ui (#3418)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.6.1 to 6.6.2.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.6.1...v6.6.2)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 23:16:21 -04:00
dependabot[bot]
b86a69567d
chore(deps-dev): bump @types/node from 22.7.6 to 22.7.7 in /ui (#3417)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.7.6 to 22.7.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 23:13:39 -04:00
dependabot[bot]
67474b776c
chore(deps-dev): bump @vitejs/plugin-react from 4.3.2 to 4.3.3 in /ui (#3415)
Bumps [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) from 4.3.2 to 4.3.3.
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/v4.3.3/packages/plugin-react)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 23:13:30 -04:00
Deluan
9d8c49750e ci: ignore refactor commits in release notes 2024-10-23 23:00:32 -04:00
Deluan Quintão
a557f37834
refactor: small improvements and clean up (#3423)
* refactor: replace custom map functions with slice.Map

* refactor: extract StringerValue function

* refactor: removed unnecessary if

* chore: removed invalid comment

* refactor: replace more map functions

* chore: fix FFmpeg typo
2024-10-22 22:54:31 -04:00
Kendall Garner
0a650de357
feat(subsonic): add MusicBrainz ID and Sort Name to getArtists 2024-10-22 22:00:31 -04:00
Rob Emery
9c3b456165
feat(build): MSI installer improvements (#3376)
* feat(build): add a make target to build a msi installer locally

* Testing wrapping the executable in cmd

* build(ci): build msis in parallel

* feat(server): add LogFile config option

* Revert "Testing wrapping the executable in cmd"

This reverts commit be29592254.

* Adding --log-file for service executable

* feat(ini): wip

* feat(ini): parse nested ini section

* fix(conf): fix fatal error messages

* Now navidrome supports INI, we can use the built-in msi ini system
and not require the VBScript to convert it into toml

* File needs to be called .ini to be parsed as an INI and correct filename
needs to be passed to the service

* fix(msi): build msi locally

* fix(msi): pipeline

* fix(msi): pipeline

* fix(msi): pipeline

* fix(msi): pipeline

* fix(msi): pipeline

* fix(msi): Makefile

* fix(msi): more clean up

* fix(log): convert LF to CRLF on Windows

* fix(msi): config filename should be case-insensitive

* fix(msi): make it a little more idiomatic

* Including the latest windows release of ffmpeg into the msi
as built by https://www.gyan.dev/ffmpeg/builds/ (linked
to on the official ffmpeg source)

* This should version independent

* Need bash expansion for the * to work

* This will run twice, once for x86 and once for x64, I'll make it cache
the executable for now as it'll be quicker

* Silencing wget

* Add ffmpeg path to the config so Navidrome knows where to find it

* refactor: download ffmpeg from our repository

* When going back from the "Are you ready to install?" it should go back to the
Settings dialogue that you just came from

* fix: comments

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-10-22 19:32:56 -04:00
Deluan
23bebe4e06 feat(subsonic): getOpenSubsonicExtensions is now public 2024-10-21 17:21:18 -04:00
Deluan
8808eaddda fix(server): allow extra spaces in transcoding commands 2024-10-20 19:35:16 -04:00
Deluan
bbb3182bc9 refactor(server): remove ffmpeg unused code 2024-10-20 19:35:16 -04:00
Caio Cotts
82633d7490
fix(playlists): make the m3u parser case-insensitive again #3410 2024-10-20 14:21:39 -04:00
Deluan
28668782c6 fix(server): FFmpegPath can contain spaces 2024-10-20 13:58:39 -04:00
Deluan
97c06aba1a perf(server): add index for sort tags.
Improves search performance when searching with PreferSortTags=true
2024-10-19 20:46:54 -04:00
Deluan
9c46e2b262 fix: use docker buildx, as required by Linux 2024-10-19 11:55:03 -04:00
Deluan Quintão
3713032f57
fix(ui): update translations from POEditor (#3349)
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
2024-10-17 20:29:54 -04:00
Ivan Pešić
a358d107aa
fix(ui): update Serbian translation (#3361) 2024-10-17 20:24:50 -04:00
jan666
5f6a90e5aa
build: fix build on FreeBSD (#3403)
- vite: use rollup/wasm-node
- use vitejs/plugin-react instead of plugin-react-swc
2024-10-17 19:26:53 -04:00
Deluan Quintão
0232afd98d
fix(ui): service worker does not load new version of ui (#3402)
* fix(pwa): wip

* fix(pwa): wip
2024-10-16 21:39:14 -04:00
Deluan
270ae3549d chore(deps): bump peter-evans/create-pull-request from 6 to 7 2024-10-16 20:31:45 -04:00
Deluan Quintão
8b5af67647
feat(subsonic): support OS clearing play queue (#3399) 2024-10-16 10:59:22 -04:00
Deluan Quintão
00c6a0ed1f
fix: use target platform to build final image (#3397)
* fix: use target platform to build final image

* fix: remove armv5 from supported images
2024-10-15 22:47:05 -04:00
dependabot[bot]
ff79ac4336
chore(deps-dev): bump eslint-plugin-react from 7.37.0 to 7.37.1 in /ui (#3362)
Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.37.0 to 7.37.1.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.37.0...v7.37.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:59:19 -04:00
dependabot[bot]
8d37781a47
chore(deps-dev): bump eslint-plugin-react-hooks in /ui (#3381)
Bumps [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks) from 4.6.2 to 5.0.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/eslint-plugin-react-hooks@5.0.0/packages/eslint-plugin-react-hooks)

---
updated-dependencies:
- dependency-name: eslint-plugin-react-hooks
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:47:38 -04:00
dependabot[bot]
a6fb7fd705
chore(deps-dev): bump typescript from 5.6.2 to 5.6.3 in /ui (#3380)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.6.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.6.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:45:16 -04:00
dependabot[bot]
fd81039f1b
chore(deps-dev): bump @vitest/coverage-v8 from 2.1.1 to 2.1.3 in /ui (#3379)
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 2.1.1 to 2.1.3.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.3/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: "@vitest/coverage-v8"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:32:13 -04:00
dependabot[bot]
bc4aa55de3
chore(deps-dev): bump @types/node from 22.7.4 to 22.7.5 in /ui (#3378)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.7.4 to 22.7.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:31:54 -04:00
dependabot[bot]
6ec6ac1595
chore(deps-dev): bump vite from 5.4.8 to 5.4.9 in /ui (#3382)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.8 to 5.4.9.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.9/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.9/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 19:31:28 -04:00
Deluan
06e38a8024 chore(deps): go mod tidy 2024-10-15 19:29:13 -04:00
Deluan
6e5eea980d chore(deps): bump Go dependencies 2024-10-15 19:24:22 -04:00
Deluan Quintão
943b456d3f
fix: do not try to push to ghcr.io without proper permissions (#3395) 2024-10-15 19:10:44 -04:00
Deluan Quintão
16d1314a68
fix: do not add nil filters (#3394) 2024-10-15 19:03:16 -04:00
Deluan Quintão
ae6499b941
fix: PRs should not try to push to docker (#3393) 2024-10-15 18:28:27 -04:00
Deluan Quintão
214287e00d
build: new pipeline, new way to cross-compile and build docker images locally. (#3388)
* build: new pipeline, new way to cross-compile and build docker images locally. (#3383)

* build: use alternative repositories

* build: fix

* build: validate taglib downloads

* build: control concurrency

* build: validate xx version

* build: remove taglib download validation as the version can be changed as an argument.
2024-10-15 16:46:01 -04:00
Deluan
af1add4312 Revert "build: new pipeline, new way to cross-compile and build docker images locally. (#3383)"
This reverts commit b14c790641.
2024-10-14 18:52:02 -04:00
Deluan Quintão
b14c790641
build: new pipeline, new way to cross-compile and build docker images locally. (#3383)
* refactor(ci): faster pipeline, add support for darwin/arm64 (#26)

* feat: WIP

* feat: WIP - all except windows

* fix: Bump crazymax/osxcross to 14.5

* feat: bundle UI

* fix: works on all 10!

* fix: WIP

* fix: add git sha and tag

* fix: download taglib from cross-taglib

* feat: add more dependabot coverage

* feat: build JS bundle using Docker

* refactor: pipeline

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: wip

* fix: real

* fix: no container

* fix: no container

* fix: pkg-config

* fix: pkg-config

* fix: pkg-config

* fix: pkg-config

* fix: pkg-config

* fix: add lint

* fix: add lint

* fix: add lint

* fix: add lint

* fix: add lint

* fix: add lint

* fix: add js

* fix: gittags

* fix: gittags

* test: is_release

* test: is_release

* test: is_release

* test: push image

* test: push image

* test: push image

* test: push image

* test: push image

* test: push image

* test: push image

* test: push image

* test: push image

* fix: extract download taglib action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: extract prepare docker action

* fix: add msi

* fix: add msi

* fix: add msi

* fix: add msi

* fix: add msi

* test: full

* test: full

* test: disable some platforms to avoid hitting the rate limit

* test: disable some platforms to avoid hitting the rate limit

* fix: use ecr.aws for base images

* test: full release

* test: full release

* fix: clean-up

* refactor: pipeline clean-up (#32)

* fix: clean-up

* fix: clean-up

* fix: clean-up

* fix: fetch all tags

* fix: version

* fix: version

* fix: no need to setup QEMU

* fix: don't try to push images in unauthorized branches

* fix: check push enabled

* fix: change layout?
2024-10-14 18:41:19 -04:00
Deluan
d9fa19dab3 build(ci): bump goreleaser to 2.3.2 2024-10-06 13:20:31 -04:00
Egor
0281d06b01
feat(ui): Allow drag-and-drop song title from player to sidebar playlist (#2435)
* feat(ui): Allow drag-and-drop song title from player to sidebar playlist

Signed-off-by: egor.aristov <egor.aristov@vk.team>

* prettier

---------

Signed-off-by: egor.aristov <egor.aristov@vk.team>
Co-authored-by: egor.aristov <egor.aristov@vk.team>
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-10-02 13:10:24 -04:00
Lokke
de04393b47
fix(ui): update German translation (#3345)
Update German translation with minor adjustments
2024-10-02 08:48:47 -04:00
Kendall Garner
55730514ea
feat(server): provide native backup/restore mechanism (#3194)
* [enhancement]: Provide native backup/restore mechanism

- db.go: add Backup/Restore functions that utilize Sqlite's built-in online backup mechanism
- support automatic backup with schedule, limit number of files
- provide commands to manually backup/restore Navidrome

Notes:
`Step(-1)` results in a read-only lock being held for the entire duration of the backup.
This will block out any other write operation (and may hold additional locks.
An alternate implementation that doesn't block but instead retries is available at https://www.sqlite.org/backup.html#:~:text=of%20a%20Running-,database,-%2F*%0A**%20Perform%20an%20online (easily adaptable to go), but has the potential problem of continually getting restarted by background writes.

Additionally, the restore should still only be called when Navidrome is offline, as the restore process does not run migrations that are missing.

* remove empty line

* add more granular backup schedule

* do not remove files when bypass is set

* move prune

* refactor: small nitpicks

* change commands and flags

* tests, return path from backup

* refactor: small nitpicks

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-10-01 19:58:54 -04:00
Rob Emery
768160b05e
feat: Windows MSI installer and service support (#3125)
* First version/rough layout of the required wix to build an MSI that embeds everything

* Don't need revision number

* produced exe from existing build process is navidrome not Navidrome

* Adding Kardianos wrapper around Cobra so the callbacks are handled
automatically (this is basically only for windows)

* Adding pointless check to shut up lint for now

* make format

* Revert disabling npm tidy

* Using Kardianos always will result in the application hanging so it
needs only be wrapped to handle the callbacks if it's being used in
the service context, otherwise use cobra directly

* Copying in service installation etc from https://github.com/navidrome/navidrome/pull/2295

* Under Linux this installs a user service (I don't think this is
correct, but lets get this working first). User units/services
cannot depends on system units, so previously this bombed out
with Exit Code 5.

* Under Windows we can install both the x86 and x64 builds, they
will install to different folders, but previously they would
overwrite the service as they were both called Navidrome. Now,
it will install 2 services. This will still be weird/broken as
they will attempt to listen on the same port, however uninstalling
the "wrong" arch will not cause the "right" one to be partially
uninstalled anymore

* Reverting changes to the context as they don't really seem necessary anyway

* Need to consistently name the service

* Fixing broken context

* The included files should be removed when the app is uninstalled

* Reverting back to the original context here, I don't think
it makes any difference to running under kardianos

* Let's see what we have immediately available

* OK, the build takes ages so let's just try and do the whole thing in one go, maybe we'll get lucky

* Need -r on directory copy, plus we'll probably need to install wixl

* No sudo cmd, so I assume this runs as root

* WORKSPACE!

* Moving the version to be a single variable, we'll probably be able to pull it from the github tag or whatever

* Might as well put the msi in the right folder, it's tidier

* Writing the version number into the msi, from the output of goreleaser

* Using jq to parse the goreleaser metadata, so need to install it

* MSI only supports numerical version numbers, so I'll make the "snapshot" version .1 minor patch greater

* -r or --raw (on newer versions) means we don't get the "" around the value

* Running as a user service I think makes limited sense for this

* Will now ask for configuration settings during install.

MSI/WiX only supports writing out INI files, Toml is almost
INI compatable, except that the INI needs to write out a section
first, so we need to have a script to strip that off.

We are forced to display a License.rtf file by the UI so I think
the build process should probably rename the default licence file
and that will suffice.

Uninstalling works cleanly, howvever upgrades seem to leave the old
version installed in "programs and features" currently.

Adding the UI has introduced a requirement for WiX 0.103

* Updating the build to include --ext ui for the new config ui

* Configuration dialog should not display for upgrades as the config file
is already written

* Making description consistent with the systemd service and making
the build process produce the required License.rtf

* Fixing " non-constant format string in call to fmt.Errorf (govet)"

* Its a string, not an int; read better.

* Wixl 103 is required for --ext ui, so we need 24.04

* OK this is still installing Wix 0.101, maybe it all needs to be 24.04?

* Switching the builds back to ubuntu-latest (22.04 at current)
as it runs on a custom container, it's actually debian anyway
Moving msi build into its own job so it can run on 24.04 so
we have access to wixl 0.103 for --ext ui support

* Forcing build

* Whitespace fix

* Adding sudo I guess

* Gotta checkout as well

* Adding debugging for when there's soemthing wrong with the paths

* Adding more ls to see if the output has worked

* The msi's are in subdirs

* Actually they're in the ./wix directory

* Still can't find these msi's?

* I think that was being treated literally previously

* No idea why this isn't working, give it a relative path instead?

* Making explicit on the dialogue that the configuration file will be
where the installation dir is

* The lint keeps failing and it's just getting in the way so I'll
turn this off for now and we'll edit out this commit from the merge

* Cutting more out of the build to get more stuff out of the way

* Need to increase the width to fit the text in

* Calling everything License.rtf, presumably one of them is correct

* I am pretty sure the License.rtf loading is broken under Wixl; so
let's just bypass the EULA from the UI which is a nicer experience
for the users anyway

* This needs to be after WelcomeDlg now the Eula isn't displayed

* You're supposed to be able to use <WixVariable> to override the
location that the bmp's are loaded from, I can't get this to work
under wixl so I'm guessing given that the ui extension is new, it
hasn't been implemented with that in mind. So we'll hack it by
overwriting the files installed with the package.

* We should make this less brittle so when wixl is updated it still works

* Re-enabling the lint and tests etc

* Improving the scaling quality and removing borders from images to
tidy them up a tad

* Pretty sure this isn't necessary as MY_PROPERTY will always be false

* Without publishing this event, we can't continue to the next dialogue
however I think we should be able to get away without the property

* Refactoring out the duplication so we only have one service
defined and we can run that either way

* Pushing the Interactive check into the root commmand? Feels like it
is probably getting closer to the right place at least

* go tidy

* OK this didn't work under windows, I'm guessing it's because
it's lacking all the metadata about the service it needs to
report back to Windows on.

* We need to run service execute now so that the windows
service will behave (hopefully)!

* Lint

* go tidy

* Renaming service to "navidrome" rather than "Navidrome" as this
is the filename that systemd writes and it's unusual to have
capital letters in service names under Linux.
Switching to use service execute for Linux to mirror Windows

* Need to provide the arguments to append

* Without passing the context around, the DB isn't closed gracefully
so we end up with with .db-shm and .db-wal files for recovery

* We should log fatal rather than outputting directly to stdout

* go tidy

* refactor: small nitpicks

* fix: terminate service gracefully

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-10-01 19:40:53 -04:00
Deluan
b7285b28cf fix(test): vitest was hanging due to vite-plugin-eslint plugin 2024-10-01 17:12:54 -04:00
Deluan
eab6aadc0f chore(deps): bump Go to 1.23.2 2024-10-01 14:54:22 -04:00
ChekeredList71
640a734896
fix(ui): update Hungarian translation (#3346)
Added new Hungarian translation for "lastAccessAt".
2024-10-01 14:13:15 -04:00
Deluan Quintão
a9334b7787
feat(ui): show user's lastAccess (#3342)
* feat(server): update user's lastAccess

* feat(ui): show user's lastAccess
2024-09-30 20:46:10 -04:00
dependabot[bot]
5e8085bf3c
chore(deps-dev): bump eslint-plugin-react from 7.36.1 to 7.37.0 in /ui (#3334)
Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.36.1 to 7.37.0.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.36.1...v7.37.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:31:58 -04:00
dependabot[bot]
b2eb533082
chore(deps-dev): bump @vitejs/plugin-react-swc in /ui (#3339)
Bumps [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) from 3.7.0 to 3.7.1.
- [Release notes](https://github.com/vitejs/vite-plugin-react-swc/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react-swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react-swc/compare/v3.7.0...v3.7.1)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-react-swc"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:31:41 -04:00
dependabot[bot]
936af2d895
chore(deps-dev): bump @types/node from 22.6.1 to 22.7.4 in /ui (#3335)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.6.1 to 22.7.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:31:25 -04:00
dependabot[bot]
b1c18a428b
chore(deps-dev): bump vite from 5.4.7 to 5.4.8 in /ui (#3340)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.7 to 5.4.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.8/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:31:10 -04:00
Deluan Quintão
1fac9cc3ee
chore: add poeditor logo to readme (#3329) 2024-09-30 13:25:03 -04:00
Deluan
92a1f19271 fix(scanner): make activity panel update rate configurable 2024-09-30 12:06:23 -04:00
crazygolem
06c9c1e64a
feat(server): require explicitly enabling reverse proxy auth for unix sockets (#3062) 2024-09-29 13:28:44 -04:00
Deluan
ed3ab5385d chore(deps): bump rollup from 2.79.1 to 2.79.2 in /ui 2024-09-28 11:56:35 -04:00
Deluan Quintão
fcdd30ba8f
build(ui): migrate from CRA/Jest to Vite/Vitest (#3311)
* feat: create vite project

* feat: it's alive!

* feat: `make dev` working!

* feat: replace custom serviceWorker with vite plugin

* test: replace Jest with Vitest

* fix: run prettier

* fix: skip eslint for now.

* chore: remove ui.old folder

* refactor: replace lodash.pick with simple destructuring

* fix: eslint errors (wip)

* fix: eslint errors (wip)

* fix: display-name eslint errors (wip)

* fix: no-console eslint errors (wip)

* fix: react-refresh/only-export-components eslint errors (wip)

* fix: react-refresh/only-export-components eslint errors (wip)

* fix: react-refresh/only-export-components eslint errors (wip)

* fix: react-refresh/only-export-components eslint errors (wip)

* fix: build

* fix: pwa manifest

* refactor: pwa manifest

* refactor: simplify PORT configuration

* refactor: rename simple JS files

* test: cover playlistUtils

* fix: react-image-lightbox

* feat(ui): add sourcemaps to help debug issues
2024-09-28 11:54:36 -04:00
dependabot[bot]
dd48a23f92
chore(deps): bump github.com/unrolled/secure from 1.15.0 to 1.16.0 (#3327)
Bumps [github.com/unrolled/secure](https://github.com/unrolled/secure) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/unrolled/secure/releases)
- [Commits](https://github.com/unrolled/secure/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/unrolled/secure
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-28 11:32:21 -04:00
dependabot[bot]
6040a50297
chore(deps): bump alpine from 3.18 to 3.20 in /.github/workflows (#3326)
Bumps alpine from 3.18 to 3.20.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-28 11:30:36 -04:00
Deluan
9e5849e4dc build(dependabot): add docker configuration 2024-09-28 10:52:23 -04:00
Kendall Garner
13af8ed43a
fix(server): preserve m3u file order on import (#3314)
* fix(playlist): preserve m3u file order on import - 3307

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>

* test(server): cover playlist order

* refactor(server): micro-optimizations

* refactor(server): micro-optimizations

* fix(server): playlists imported from reader (POST /playlist) are not synced

* refactor(server): only allocate the capacity required to hold a playlist chunk

---------

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-09-27 16:05:12 -04:00
Deluan
825cbcbf53 fix(readme): reddit badge is working again. 2024-09-27 15:52:27 -04:00
Deluan
5be73d404f fix(server): allow changing local login background url 2024-09-27 15:18:20 -04:00
Andy
1fa245d141
fix(ui) update Swedish translation (#3316) 2024-09-27 14:53:11 -04:00
Kendall Garner
782cd26b3d
fix(ui): save play mode for player (#3315)
* fix(ui): save play mode for player - 3019

* redux

* redux
2024-09-27 13:13:22 -04:00
Deluan
10a1b5faf8 test(scanner): remove redundant fixture file 2024-09-27 09:53:08 -04:00
dependabot[bot]
84dc10529d
chore(deps): bump github.com/prometheus/client_golang from 1.20.3 to 1.20.4 (#3301)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.3 to 1.20.4.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.3...v1.20.4)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 18:52:34 -04:00
dependabot[bot]
24d911744e
build(deps): bump github.com/pressly/goose/v3 from 3.22.0 to 3.22.1 (#3302)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.22.0 to 3.22.1.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.22.0...v3.22.1)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 18:45:04 -04:00
dependabot[bot]
6031d97c9d
chore(deps): bump rollup from 2.79.1 to 2.79.2 in /ui (#3319)
Bumps [rollup](https://github.com/rollup/rollup) from 2.79.1 to 2.79.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.79.1...v2.79.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 18:44:23 -04:00
Deluan
80acfc103f fix(server): throttle events sent to UI when scanning. Relates to #1511
See also: https://github.com/navidrome/navidrome/issues/1186#issuecomment-1554818537
2024-09-26 18:19:20 -04:00
Deluan Quintão
76614b8f16
fix(scanner): update lib.LastScanAt on each rescan (#3313) 2024-09-26 06:16:27 -04:00
Deluan
d31952f469 fix(ui): avoid invalid requests after logoff 2024-09-25 15:14:47 -04:00
Xabi
32d2d7c15b
fix(ui): update Basque translation (#3306)
Small, unimportant changes
2024-09-22 12:26:09 -04:00
Deluan Quintão
669c8f4c49
refactor(server): replace RangeByChunks with Go 1.23 iterators (#3292)
* refactor(server): replace RangeByChunks with Go 1.23 iterators

* chore: fix comments re: SQLITE_MAX_VARIABLE_NUMBER

* test: improve playqueue test

* refactor(server): don't create a new iterator when it is not required
2024-09-22 11:47:10 -04:00
Deluan Quintão
3910e77a7a
build(ci): change GitHub release notes (#3300) 2024-09-21 17:00:13 -04:00
Kendall Garner
196557a41a
fix(ui): show effective dB of track when playing (#3293)
* show effective db of track when playing

* tests
2024-09-21 16:46:14 -04:00
Caio Cotts
11d96f1da4
fix(ui): sort mappings (#3296)
* fix(ui): update sort mapping for title in mediafile repository

* fix(ui): create sort mapping for username in share repository

* fix(ui): create sort mapping for owner_name in playlist repository

* fix(ui): create sort mapping for username in player repository

* fix(ui): remove sort mapping for track number in mediafile repository

* chore: add todo to change user_name
2024-09-20 21:36:59 -04:00
Deluan
e628aafa4b build(go): set toolchain to latest version 2024-09-20 18:04:36 -04:00
Deluan
ecf934feab fix(subsonic): random albums not reshuffling.
See: https://github.com/navidrome/navidrome/issues/3277#issuecomment-2364269787
2024-09-20 16:59:46 -04:00
Deluan
5b89bf747f fix(server): play queue should not return empty entries for deleted tracks 2024-09-20 11:22:37 -04:00
Ivan Pešić
7a6845fa5a
feat(ui): add Serbian translation (#3287) 2024-09-20 08:51:40 -04:00
Deluan
b6433057e9 fix(ui): make random albums order stick when coming back to the grid 2024-09-19 20:16:50 -04:00
Deluan
d0784b6a21 chore(ci): change "update translations" PR title 2024-09-19 17:28:01 -04:00
gruneforth
b0e7941abe
fix(ui): fix Nuclear Theme (#3291)
* Add Nuclear Theme

* Fix login screen color & Softened "link" coloring

---------

Co-authored-by: grune <grune@grunk.me>
2024-09-19 17:13:44 -04:00
Deluan Quintão
a02cfbe2a7
fix(ui): update German translation (#3290)
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
2024-09-19 14:08:44 -04:00
naiar
04603a1ea2
fix(subsonic): honour PreferSortTag when building indexes for getArtist and getIndexes (#3286)
* fix(scanner): use sort_artist_name when the config PreferSortTags is true - #3285

* revert unwanted modifications

* refactor(server): use cmp.Or to simplify nested ifs

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-09-19 13:44:29 -04:00
Deluan
50870d3e61 fix(ui): sort by favourited 2024-09-19 13:05:26 -04:00
DDinghoya
27780683aa
feat(ui): update Korean translation (#3288) 2024-09-19 12:13:50 -04:00
Deluan
5baf0b80aa fix(ui): sort playlist by song duration (#3284) 2024-09-19 08:45:49 -04:00
Deluan
46be041e7b fix(scanner): improve M3U playlist import times (#2706) 2024-09-18 20:12:12 -04:00
Kendall Garner
ee2e04b832
fix(ui): random seed for album list on page reload (#3279)
* random seed for album list on page reload

* Nit: inline variable

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-09-18 12:35:13 -04:00
Kendall Garner
1ba390a72a
random -> SEEDRAND (#3274) 2024-09-17 17:03:12 -04:00
Deluan Quintão
8134edb5d1
Fix genre and id filters (#3273) 2024-09-17 16:59:55 -04:00
dependabot[bot]
910a46120b
Bump dompurify from 2.4.5 to 2.5.6 in /ui (#3270)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.4.5 to 2.5.6.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.4.5...2.5.6)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-16 20:04:37 -04:00
dependabot[bot]
8c86d0945c
Bump github.com/mileusna/useragent from 1.3.4 to 1.3.5 (#3269)
Bumps [github.com/mileusna/useragent](https://github.com/mileusna/useragent) from 1.3.4 to 1.3.5.
- [Release notes](https://github.com/mileusna/useragent/releases)
- [Commits](https://github.com/mileusna/useragent/compare/v1.3.4...v1.3.5)

---
updated-dependencies:
- dependency-name: github.com/mileusna/useragent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-16 19:13:29 -04:00
Caio Cotts
42047fde1a Remove shareURL value from config.js 2024-09-15 17:26:58 -04:00
Caio Cotts
2887cd65fc Fix wrong placement of When in test 2024-09-15 17:26:58 -04:00
Caio Cotts
8ac133027d Make the UI use the new ShareURL option 2024-09-15 17:26:58 -04:00
Caio Cotts
f0240280eb Add ShareURL configuration option 2024-09-15 17:26:58 -04:00
Reilly MacKenzie-Cree
d683688b0e
Recursively refresh playlist tracks within smart playlist rules (#3018)
* Recursively refresh playlists within smart playlist rules

Signed-off-by: reillymc <reilly@mackenzie-cree.net>

* Clean up recursive smart playlist functions

Signed-off-by: reillymc <reilly@mackenzie-cree.net>

* Add smart playlist refresh timeout config and tests for nested track refetching

Signed-off-by: reillymc <reilly@mackenzie-cree.net>

* Change SmartPlaylistRefreshTimeout to SmartPlaylistRefreshDelay, increase default value

* Revert `smartPlaylistRefreshDelay` default to 5 seconds

---------

Signed-off-by: reillymc <reilly@mackenzie-cree.net>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-09-15 13:27:54 -04:00
ChekeredList71
180035c1e3
Hungarian patch and typo fix for English (#3263)
* English typo fix

* hungarian-patch

You can find the changes here in detail: https://pastebin.com/GLtmwELv
2024-09-15 11:00:25 -04:00
Deluan
a132755d67 Move update-translations.sh script to workflow directory 2024-09-14 21:37:25 -04:00
Deluan
3107170afd Improve SQL sanitization 2024-09-14 18:53:34 -04:00
dependabot[bot]
d3bb4bb9a1
Bump send and express in /ui (#3260)
Bumps [send](https://github.com/pillarjs/send) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `send` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](https://github.com/pillarjs/send/compare/0.18.0...0.19.0)

Updates `express` from 4.20.0 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.20.0...4.21.0)

---
updated-dependencies:
- dependency-name: send
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-14 12:36:32 -04:00
dependabot[bot]
41f380451c
Bump path-to-regexp and express in /ui (#3255)
Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `path-to-regexp` from 1.8.0 to 1.9.0
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](https://github.com/pillarjs/path-to-regexp/compare/v1.8.0...v1.9.0)

Updates `express` from 4.18.1 to 4.20.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.1...4.20.0)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-14 12:30:29 -04:00
Deluan
e65eb225c8 Small refactoring
- Remove duplication
- Remove warning about builtin keyword `new`
2024-09-13 20:18:00 -04:00
Deluan
e8d0f2ec2c Allow searching songs by filepath, for songs without Title 2024-09-13 18:04:21 -04:00
Deluan
47872c9e8a Fix pipeline 2024-09-13 17:43:50 -04:00
Deluan
9ae2ec1a07 Ignore #snapshot folders when scanning. Fixes #3257 2024-09-13 17:30:08 -04:00
Deluan
a1866c7ff3 Fix log message 2024-09-13 09:13:51 -04:00
Kendall Garner
9f1794b97e
Only refresh smart playlist when fetching first track (#3244)
* Only refresh smart playlist when fetching first track

* res -> w
2024-09-10 20:18:37 -04:00
dependabot[bot]
e1762882e3
Bump github.com/prometheus/client_golang from 1.20.2 to 1.20.3 (#3245)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.2 to 1.20.3.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.3/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.2...v1.20.3)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 18:03:16 -04:00
dependabot[bot]
870b217eb9
Bump github.com/pressly/goose/v3 from 3.21.1 to 3.22.0 (#3247)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.21.1 to 3.22.0.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.21.1...v3.22.0)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 17:59:30 -04:00
dependabot[bot]
53af567b45
Bump golang.org/x/image from 0.19.0 to 0.20.0 (#3248)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.19.0 to 0.20.0.
- [Commits](https://github.com/golang/image/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 17:59:01 -04:00
dependabot[bot]
605aaf87d8
Bump github.com/mattn/go-sqlite3 from 1.14.22 to 1.14.23 (#3249)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.22 to 1.14.23.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.22...v1.14.23)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 17:58:50 -04:00
dependabot[bot]
9950538089
Bump github.com/mattn/go-zglob from 0.0.5 to 0.0.6 (#3231)
Bumps [github.com/mattn/go-zglob](https://github.com/mattn/go-zglob) from 0.0.5 to 0.0.6.
- [Commits](https://github.com/mattn/go-zglob/compare/v0.0.5...v0.0.6)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-zglob
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 13:22:49 -04:00
Vlad Shulcz
4a55a148cf
refactor(core): Refactor selectTranscodingOptions function (#3227)
* refactor(core): Refactor selectTranscodingOptions function - #3226

Signed-off-by: shulcz <vshulcz@gmail.com>

* chore: Fix selectTranscodingOptions function - #3226

Signed-off-by: shulcz <vshulcz@gmail.com>

* Small refactoring to make code more concise

* Fix log message

---------

Signed-off-by: shulcz <vshulcz@gmail.com>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-09-02 12:20:23 -04:00
Deluan
c1b75bca51 Improve change detection for POEditor files 2024-09-02 11:02:24 -04:00
Reilly MacKenzie-Cree
5baab4af77
Update dev container to use Go 1.23 and customizations object (#3228)
Signed-off-by: reillymc <reilly@mackenzie-cree.net>
2024-09-01 22:22:32 -04:00
Xabi
4c87a39242
Add Basque localisation (#3221)
* Add Basque localisation

Initial Basque localisation

* Update eu.json

fixes extra dash

* Update eu.json

fixes

* Update eu.json

653098th time's the charm
2024-09-01 16:03:15 -04:00
Deluan
fc5d18feb7 Change error code type to avoid integer overflow conversion warning 2024-09-01 14:49:48 -04:00
Deluan
4612b0a518 Bump Go dependencies 2024-08-31 19:20:38 -04:00
Deluan Quintão
68ddbf4856
Add i18n lint job 2024-08-31 14:54:04 -04:00
dependabot[bot]
a6d72d8623
Bump webpack from 5.76.1 to 5.94.0 in /ui (#3218)
Bumps [webpack](https://github.com/webpack/webpack) from 5.76.1 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.76.1...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 16:11:25 -04:00
Deluan
1a41525a7e Upgrade go.mod to 1.23, allow override CI_RELEASER_VERSION for make single and make all 2024-08-29 15:14:20 -04:00
Deluan
8ca1aefad6 Change DefaultPlaylistPublicVisibility to false 2024-08-28 19:23:19 -04:00
John White
67d11dd144
feat: imported playlists are public by default (#3143)
* feat: imported playlists are public by default

* chore: make linter happy

---------

Co-authored-by: John White <john@activecode.dev>
2024-08-28 19:20:05 -04:00
Deluan Quintão
9f65f8f5a8
Update translations (#3164)
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
2024-08-28 19:14:27 -04:00
Deluan Quintão
bc06a59919
Upgrade TagLib 2.0.2, GoReleaser 2.2.0 (#3217)
* Upgrade ci-goreleaser

* Fix tests

* Fix taglib lib path in macOS
2024-08-28 19:13:08 -04:00
Sunny
6709ab3c5e
fix(common): Hide Share/Get Info items in disc context menu - #3204 (#3209)
Signed-off-by: Sunny <sunny@sny.sh>
2024-08-26 21:40:05 -04:00
dependabot[bot]
195f2b3f38
Bump @testing-library/jest-dom from 6.4.8 to 6.5.0 in /ui (#3216)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.4.8 to 6.5.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.4.8...v6.5.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:30:56 -04:00
dependabot[bot]
6ea688e720
Bump github.com/prometheus/client_golang from 1.20.0 to 1.20.2 (#3213)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.0 to 1.20.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.0...v1.20.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:30:44 -04:00
dependabot[bot]
496c95fd47
Bump github.com/go-chi/httprate from 0.12.1 to 0.14.0 (#3211)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.12.1 to 0.14.0.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.12.1...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:30:31 -04:00
dependabot[bot]
108bf31148
Bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.3 (#3212)
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.2.2...v2.2.3)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:30:14 -04:00
dependabot[bot]
7c81143ca9
Bump github.com/onsi/ginkgo/v2 from 2.20.0 to 2.20.1 (#3215)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.20.0 to 2.20.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.20.0...v2.20.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:29:39 -04:00
dependabot[bot]
533c394f09
Bump github.com/jellydator/ttlcache/v3 from 3.2.0 to 3.2.1 (#3214)
Bumps [github.com/jellydator/ttlcache/v3](https://github.com/jellydator/ttlcache) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/jellydator/ttlcache/releases)
- [Commits](https://github.com/jellydator/ttlcache/compare/v3.2.0...v3.2.1)

---
updated-dependencies:
- dependency-name: github.com/jellydator/ttlcache/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 21:29:28 -04:00
Deluan
c95fa11a2f Remove potential integer overflow conversion uint64 -> int64 2024-08-22 19:28:22 -04:00
Deluan
5d81849603 Fix lint errors 2024-08-21 12:15:25 -04:00
dependabot[bot]
1a8bef0743
Bump react-icons from 5.2.1 to 5.3.0 in /ui (#3200)
Bumps [react-icons](https://github.com/react-icons/react-icons) from 5.2.1 to 5.3.0.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v5.2.1...v5.3.0)

---
updated-dependencies:
- dependency-name: react-icons
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 18:21:10 -04:00
dependabot[bot]
85bf7b5684
Bump @testing-library/jest-dom from 6.4.6 to 6.4.8 in /ui (#3172)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.4.6 to 6.4.8.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.4.6...v6.4.8)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 18:13:38 -04:00
dependabot[bot]
bdbff1ea38
Bump prettier from 3.3.2 to 3.3.3 in /ui (#3171)
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.2...3.3.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 18:12:45 -04:00
dependabot[bot]
5d58048780
Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.0 (#3199)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.1 to 1.20.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.1...v1.20.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 18:12:29 -04:00
Rob Emery
723f01d98c
Fixing Build/lint error: "non-constant format string in call to fmt.Errorf (govet)" (#3198)
* Fixing " non-constant format string in call to fmt.Errorf (govet)"

* Its a string, not an int; read better.
2024-08-19 17:58:35 -04:00
Deluan Quintão
c4bd0e67fa
Upgrade Go to 1.23 (#3190)
* Upgrade to Golang 1.23rc1

* Fix imports

* Go 1.23 final version

* Fix lint compatibility with ci-goreleaser
2024-08-19 17:47:54 -04:00
Deluan
0c33523f45 Bump dependencies 2024-08-10 12:22:36 -04:00
Deluan
14d085f651 Deprecate buildall 2024-08-07 16:19:44 -04:00
Deluan
4d4c71212f Build UI bundle on demand 2024-08-07 15:36:29 -04:00
Deluan
e1ba152a38 Reduce noise in logs when pre-caching artwork 2024-08-07 13:08:54 -04:00
Deluan
eaa7f7c7e9 Fix Player filter 2024-08-05 18:21:21 -04:00
Kendall Garner
290333ec59
Use same key for replaygain's preAmp (#3184)
Resolves #2933. To prevent this from happening again, make the localstorage keys consts for set/get
2024-08-03 21:18:41 -04:00
Kendall Garner
fa85e2a781
Use userId in player, other fixes (#3182)
* [bugfix] player: use userId, other fixes

This PR primarily resolves #1928 by switching the foreign key of `player` from `user.user_name` to `user.id`.
There are also a few other fixes/changes:

- For some bizarre reason, `ip_address` is never returned from `read`/`get`. Change the field to `ip`, which works. Somehow
- Update `players_test.go` mock to also check for user agent, replicating the actual code
- Update `player_repository.go` `isPermitted` to check user id. I don't know how this worked before...
- tests!
- a few places referred to `typ`, when it is really `userAgent`. Change the field names

* baseRequest -> selectPlayer

* remove comment

* update migration, make all of persistence foreign key enabled

* maybe don't forget to save the file first
2024-08-03 13:37:21 -04:00
dependabot[bot]
5360283bb0
Bump github.com/onsi/gomega from 1.33.1 to 1.34.0 (#3176)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.1 to 1.34.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.33.1...v1.34.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-31 21:35:00 -04:00
dependabot[bot]
e59d81bf78
Bump github.com/microcosm-cc/bluemonday from 1.0.26 to 1.0.27 (#3141)
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.26 to 1.0.27.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.26...v1.0.27)

---
updated-dependencies:
- dependency-name: github.com/microcosm-cc/bluemonday
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-28 15:33:40 -04:00
Deluan
7b2ddfd65a Fix "Cannot read properties of undefined". Closes #3070 2024-07-25 17:22:04 -04:00
Deluan
76c3f5131a Use SHA256 in Gravatar URLs 2024-07-23 17:49:46 -04:00
Soderes
f577704d7a
Add Hungarian language (#3157) 2024-07-22 18:10:41 -04:00
dependabot[bot]
f46ff73c53
Bump github.com/go-chi/httprate from 0.9.0 to 0.10.0 (#3160)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.9.0 to 0.10.0.
- [Commits](https://github.com/go-chi/httprate/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 15:31:46 -04:00
Deluan
d046c180bf Fix race condition 2024-07-22 14:27:02 -04:00
Caio Cotts
9b4abd9e5a Add Auto-Import toggle switch to playlists list view. 2024-07-18 00:07:59 +02:00
Caio Cotts
0de5f594fe Remove unnecessary Fragment component. 2024-07-18 00:07:59 +02:00
Deluan
33717f26d4 Fix album sorting in Artist page 2024-07-04 17:21:31 -04:00
dependabot[bot]
6722395879
Bump github.com/unrolled/secure from 1.14.0 to 1.15.0 (#3127)
Bumps [github.com/unrolled/secure](https://github.com/unrolled/secure) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/unrolled/secure/releases)
- [Commits](https://github.com/unrolled/secure/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/unrolled/secure
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 15:53:01 -04:00
dependabot[bot]
2667ad3921
Bump github.com/go-chi/chi/v5 from 5.0.14 to 5.1.0 (#3126)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.14 to 5.1.0.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.14...v5.1.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 15:52:29 -04:00
Kendall Garner
3e1fa20413
fix background color for nord theme (#3124) 2024-06-29 18:50:33 -04:00
gruneforth
1802015737
Add Nuclear Theme (#3098) 2024-06-29 17:04:30 -04:00
Deluan
47378c6882 Remove unnecessary annotation table primary key 2024-06-29 11:45:41 -04:00
dependabot[bot]
81459cc421
Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 (#3095)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:47:24 -04:00
dependabot[bot]
4cda3a58dc
Bump braces from 3.0.2 to 3.0.3 in /ui (#3085)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:47:00 -04:00
dependabot[bot]
56557bb0f3
Bump @testing-library/jest-dom from 6.4.5 to 6.4.6 in /ui (#3096)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.4.5 to 6.4.6.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.4.5...v6.4.6)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:46:44 -04:00
dependabot[bot]
c60f443179
Bump prettier from 3.3.1 to 3.3.2 in /ui (#3097)
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.1...3.3.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:46:34 -04:00
dependabot[bot]
fa3998d6e1
Bump github.com/pressly/goose/v3 from 3.20.0 to 3.21.1 (#3114)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.20.0 to 3.21.1.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.20.0...v3.21.1)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:45:44 -04:00
dependabot[bot]
8542ac96c0
Bump github.com/go-chi/chi/v5 from 5.0.12 to 5.0.14 (#3115)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.12 to 5.0.14.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.12...v5.0.14)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:45:25 -04:00
dependabot[bot]
4557add7ef
Bump github.com/lestrrat-go/jwx/v2 from 2.0.21 to 2.1.0 (#3113)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.21 to 2.1.0.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.21...v2.1.0)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:45:13 -04:00
dependabot[bot]
004fae43f5
Bump golang.org/x/image from 0.17.0 to 0.18.0 (#3119)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.17.0 to 0.18.0.
- [Commits](https://github.com/golang/image/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:44:58 -04:00
Deluan
7111535963 Don't panic on PostScan errors. Fix #3118 2024-06-25 17:14:17 -04:00
Deluan
3bc9e75b28 Evict expired items from SimpleCache 2024-06-24 17:32:34 -04:00
Deluan
3993c4d17f Upgrade to ttlcache/v3 2024-06-21 18:09:34 -04:00
Deluan
29b7b740ce Also use SimpleCache in cache.HTTPClient 2024-06-21 17:40:18 -04:00
Deluan
29bc17acd7 Wrap ttlcache in our own SimpleCache implementation 2024-06-21 17:21:09 -04:00
Deluan
4044642abf Add http headers to trace log 2024-06-16 22:31:47 -04:00
Kendall Garner
88eac6d7f3
fix album/media file random sort (#3089) 2024-06-12 21:06:59 -04:00
dependabot[bot]
f267f55713 Bump github.com/prometheus/client_golang from 1.19.0 to 1.19.1
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.0 to 1.19.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.0...v1.19.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:56:03 -04:00
dependabot[bot]
58990c4830 Bump @testing-library/jest-dom from 6.4.2 to 6.4.5 in /ui
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.4.2 to 6.4.5.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.4.2...v6.4.5)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:50:38 -04:00
dependabot[bot]
7a20233a35 Bump ejs from 3.1.9 to 3.1.10 in /ui
Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:48:44 -04:00
dependabot[bot]
45679e11c2 Bump clsx from 2.1.0 to 2.1.1 in /ui
Bumps [clsx](https://github.com/lukeed/clsx) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/lukeed/clsx/releases)
- [Commits](https://github.com/lukeed/clsx/compare/v2.1.0...v2.1.1)

---
updated-dependencies:
- dependency-name: clsx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:42:52 -04:00
dependabot[bot]
05f34b0cce Bump golang.org/x/image from 0.16.0 to 0.17.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/image/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:35:02 -04:00
dependabot[bot]
586e725d6c Bump react-icons from 5.1.0 to 5.2.1 in /ui
Bumps [react-icons](https://github.com/react-icons/react-icons) from 5.1.0 to 5.2.1.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v5.1.0...v5.2.1)

---
updated-dependencies:
- dependency-name: react-icons
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:27:47 -04:00
dependabot[bot]
a7c4c72dc6 Bump uuid from 9.0.1 to 10.0.0 in /ui
Bumps [uuid](https://github.com/uuidjs/uuid) from 9.0.1 to 10.0.0.
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.1...v10.0.0)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:17:49 -04:00
Deluan
232c45bd06 Increase artist image url sizes.
See https://support.symfonium.app/t/artist-picture-less-compressed/4447
2024-06-10 16:33:41 -04:00
Caio Cotts
1b77830eb4 Do not use lastFM api key and secret to determine if LastFM.Enabled should be set. 2024-06-10 16:26:39 -04:00
dependabot[bot]
e535f7eb78 Bump prettier from 3.3.0 to 3.3.1 in /ui
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.0...3.3.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 15:31:43 -04:00
Deluan
d8b2f3d2cf Don't expose fullText data in the Native API 2024-06-09 11:19:22 -04:00
kartikynwa
56303cde23
Add R128_{TRACK,ALBUM}_GAIN support to the scanner (#3072)
* Add R128 gain tags support to the scanner

* Add R128 test to metadata_internal_test.go

* Pass explicit tag names to getGainValue function
2024-06-08 13:45:06 -04:00
Deluan
e434ca9372 Change resized image cache key 2024-06-08 13:37:30 -04:00
Deluan
3252fab171 Increase artist image url sizes.
See https://support.symfonium.app/t/artist-picture-less-compressed/4447
2024-06-08 13:32:57 -04:00
Deluan
6d526870b7 Fix race condition in external metadata retrieval 2024-06-06 21:01:35 -04:00
Deluan
34678611c0 Small refactoring 2024-06-06 20:15:34 -04:00
Deluan
0f7d6b5bc4 More micro-optimizations 2024-06-06 07:11:43 -04:00
Deluan
939f3eee97 Initialize Index Groups regex just once 2024-06-05 23:00:36 -04:00
Deluan
b4ef1b1e38 Replace gg.If with cmp.Or 2024-06-05 22:48:00 -04:00
Deluan
11bef060a3 Small refactoring 2024-06-05 22:40:22 -04:00
Deluan
abe5690018 Refactor string utilities into its own package str 2024-06-05 22:09:27 -04:00
Deluan
46fc38bf61 Fix tests expectations 2024-06-05 19:54:25 -04:00
dependabot[bot]
6d8d519807
Bump prettier from 3.2.5 to 3.3.0 in /ui (#3069)
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.5 to 3.3.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.5...3.3.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 14:02:49 -04:00
dependabot[bot]
da9cf22b6b
Bump github.com/spf13/viper from 1.18.2 to 1.19.0 (#3068)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.18.2 to 1.19.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.18.2...v1.19.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 13:25:33 -04:00
Deluan
8c3919d6a0 Simplify dbx wrapper 2024-06-01 15:01:28 -04:00
dependabot[bot]
4df69bd334
Bump github.com/onsi/ginkgo/v2 from 2.17.3 to 2.19.0 (#3054)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.17.3 to 2.19.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.3...v2.19.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-27 14:10:56 -04:00
Deluan
ee73a9d297 Small optimization in MediaFiles.ToAlbum() 2024-05-26 14:28:23 -04:00
Caio Cotts
0488fb92cb
Fix image stuttering (#3035)
* Fix image stuttering.

* Fix docker publishing for PRs

* Write tests for new square parameter.

* Simplify code for createImage.

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-05-24 20:19:26 -04:00
Deluan
61903facdf Revert isDBInitialized 2024-05-22 16:20:57 -04:00
Drew Weymouth
b6fce0e686
Fix XML marshaling of OpenSubsonic structured lyrics (#3041) 2024-05-22 12:15:14 -04:00
Deluan
f88d3f82da Replace panics with log.Fatals 2024-05-21 17:50:02 -04:00
Deluan
55bff343cd Optimize SQLite3 access. Mainly separate read access from write access.
Based on tips from https://archive.is/Xfjh6#selection-257.0-278.0
2024-05-21 17:19:41 -04:00
dependabot[bot]
68f03d0167
Bump github.com/matoous/go-nanoid/v2 from 2.0.0 to 2.1.0 (#3038)
Bumps [github.com/matoous/go-nanoid/v2](https://github.com/matoous/go-nanoid) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/matoous/go-nanoid/releases)
- [Commits](https://github.com/matoous/go-nanoid/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: github.com/matoous/go-nanoid/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 10:45:04 -04:00
Deluan
643c763cb4 Show number of results from a query in the logs 2024-05-20 16:21:41 -04:00
Deluan Quintão
67865512c8
Update Ukrainian translations (#3029)
Co-authored-by: deluan <331353+deluan@users.noreply.github.com>
2024-05-19 22:17:13 -04:00
Deluan
b2ecc1d16f Fix G404 gosec lint error 2024-05-19 21:55:19 -04:00
Deluan
bcaa180fc7 Fix 32 bits builds 2024-05-19 13:03:13 -04:00
Deluan
aeed5a7099 Update caniuse-lite 2024-05-19 12:45:19 -04:00
Deluan
3977ef6e0f Make first WebUI random page stick 2024-05-19 12:35:30 -04:00
Deluan
653b4d97f9 Add missing Test function 2024-05-18 15:05:40 -04:00
Guilherme Souza
98218d045e
Deterministic pagination in random albums sort (#1841)
* Deterministic pagination in random albums sort

* Reseed on first random page

* Add unit tests

* Use rand in Subsonic API

* Use different seeds per user on SEEDEDRAND() SQLite3 function

* Small refactor

* Fix id mismatch

* Add seeded random to media_file (subsonic endpoint `getRandomSongs`)

* Refactor

* Remove unneeded import

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-05-18 14:10:53 -04:00
Deluan
a9feeac793 Revert "Always run docker steps (#3034)"
This reverts commit 5d41165b5b.
2024-05-18 11:54:16 -04:00
Deluan
1c0551f4f7 Revert "Fix docker publishing for PRs"
This reverts commit 15c9a0ded3.
2024-05-18 11:54:15 -04:00
Deluan
15c9a0ded3 Fix docker publishing for PRs 2024-05-17 22:45:54 -04:00
Deluan Quintão
5d41165b5b
Always run docker steps (#3034) 2024-05-17 22:22:47 -04:00
Deluan
0a763b91d5 Fix lint error 2024-05-17 21:46:59 -04:00
Deluan
4d28d534cc Refactor random.WeightedChooser, unsing generics 2024-05-17 15:45:34 -04:00
Deluan
a7a4fb522c Simplify resources.FS 2024-05-16 22:53:51 -04:00
Deluan
7f52ff72dc Simplify image format detection code 2024-05-16 13:49:40 -04:00
Deluan
8ed07333ed Improve resizeImage code readability 2024-05-16 13:49:40 -04:00
Rob Emery
52235c291d
Fix memory leak in CachedGenreRepository (#3031)
that the scanner was run, the ttlcache was also created each time.
This caused (under testing with 166 genres in the database) the
memory consumed by navidrome to 101.18MB over approx 3 days; 96%
of which is in instances of this cache. Swapping to a singleton
has reduced this to down to ~ 2.6MB

Co-authored-by: Rob Emery <git@mintsoft.net>
2024-05-16 12:16:56 -04:00
Fynn Petersen-Frey
de0a08915c
fix bug in jukebox: property unavailable (#3024)
* fix bug in jukebox: property unavailable

* fix lint error
2024-05-15 09:48:09 -04:00
Deluan
45c4583f1b Fix race condition 2024-05-13 09:28:19 -04:00
Deluan
478c709a64 Associate main entities with library 2024-05-12 21:37:42 -04:00
Deluan
477bcaee58 Store MusicFolder as a library in DB 2024-05-12 21:37:42 -04:00
Deluan
081ef85db6 Rename MediaFolder to Library 2024-05-12 21:37:42 -04:00
Deluan
6f2643e55e Refactor to use more Go 1.22 features 2024-05-12 20:04:53 -04:00
Deluan
9ee63b39cb Update Go to 1.22.3 2024-05-12 20:04:53 -04:00
Deluan
c556088820 Change dsf mime-type to audio/x-dsf.
Fix #3021
2024-05-12 11:33:50 -04:00
Deluan
78f554721a Revert "Add download link to PR" workflow 2024-05-11 20:40:12 -04:00
Deluan
2c8c87a980 Remove duplicated test 2024-05-11 20:15:02 -04:00
Deluan
3463d0c208 Simplify random.Int64 usage with generics 2024-05-11 20:10:46 -04:00
Deluan
0ae2944073 Refactor random functions 2024-05-11 20:04:21 -04:00
Deluan
30ae468dc1 Uses Unix milliseconds support from standard Go lib 2024-05-11 19:50:30 -04:00
Deluan
ec68d69d56 Refactor cache.HTTPClient 2024-05-11 19:37:12 -04:00
Deluan
955a9b43af Refactor merge.FS 2024-05-11 19:37:12 -04:00
Deluan
56809419c2 Fix "Add download link to PR" workflow 2024-05-11 18:50:46 -04:00
Deluan
3a2a5e961b Add samplingRate to OpenSubsonic responses 2024-05-11 17:57:45 -04:00
Deluan
f3bb022238 Add sampleRate to the DB 2024-05-11 17:57:45 -04:00
Deluan
472324e280 Read sampleRate from audio files 2024-05-11 17:57:45 -04:00
Deluan
ed83c22632 Do not panic if when updatePlaylist is called with a non-existent ID.
Fix #2876
2024-05-11 15:37:50 -04:00
edthu
2fdc1677f7
Add Catppuccin Macchiato Theme (#3014)
* Added Catppuccin Macchiato theme

* fixed index.js formatting
2024-05-11 13:08:51 -04:00
Deluan
80e68dfbcd Bump actions/github-script to v7 2024-05-10 16:00:21 -04:00
Deluan
a9c745839b Bump actions/stale and dessant/lock-threads versions 2024-05-10 15:51:16 -04:00
Deluan
bb96d455f8 Replace sync.WaitGroup with more appropriate errgroup.Group 2024-05-10 15:27:07 -04:00
Deluan
c0885b55db Fix M3U mimetype on Debian Bullseye 2024-05-09 22:26:15 -04:00
Deluan
00cbe4c357 Update Go to 1.22.3 2024-05-09 22:26:15 -04:00
Valeri Sokolov
2b49c7ff76
fix: languageName for Persian (#3011)
"انگلیسی" is "English"
2024-05-09 17:08:43 -04:00
Deluan
09d1fd0658 Simplify normalized AlbumPlayCountMode calc 2024-05-09 08:13:42 -04:00
Deluan
747069b229 Remove unused code 2024-05-09 07:47:32 -04:00
Deluan
885cd345ab Clean up runNavidrome function 2024-05-09 07:44:08 -04:00
Deluan Quintão
c4b05dac28
Make sorting lists by name/title case-insensitive (#2993)
* Make sort by order_* fields case-insensitive.

* Sort internet radios by name case-insensitive
2024-05-09 07:08:15 -04:00
Deluan Quintão
6408dda948
Terminate all MPV instances when stopping Navidrome (#3008)
* Terminate all mpv instances when stopping Navidrome

* Exit trackSwitcher goroutine when terminating

* Remove potential race condition when starting the Playback device

* Fix lint error

* Removed unused and unneeded vars/functions

* Use device short name in log

* Small refactor

* Small nitpick

* Make start functions more uniform
2024-05-09 06:57:24 -04:00
Deluan
677d9947f3 Make dependency injection more consistent 2024-05-08 22:21:38 -04:00
Deluan
a0290587b9 Fix migration package name mismatch 2024-05-08 19:54:48 -04:00
Deluan
eb93136b3f Change default transcodings to a proper typed struct 2024-05-08 17:39:25 -04:00
Deluan
62cc8a2d4b Fix ambiguous column when sorting media_files by created_at.
Fix #3006
2024-05-08 08:24:26 -04:00
Deluan
dd4374cec6 Limit access to Jukebox for admins only (configurable).
Closes #2849
2024-05-07 19:35:43 -04:00
Deluan
86567f5406 Bump Go dependencies 2024-05-07 19:26:02 -04:00
Matthias Schmidt
ff8dca5abe
Guard against missing active track (#2996)
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-05-07 19:22:39 -04:00
Matthias Schmidt
b3d70e9264
Persist adjusted volume (#2997)
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-05-07 19:21:35 -04:00
Ludovic Fernandez
4d29184998
Improves golangci-lint configuration and workflow (#3004)
* chore: the default Go version is based on the go.mod

* chore: use linter configuration instead of exclude-rules

* chore: update workflow
2024-05-07 18:52:26 -04:00
Deluan
2470471b2b Pin golangci-lint-action version as a workaround to fix the pipeline.
See https://github.com/golangci/golangci-lint/issues/4695
2024-05-06 21:53:47 +02:00
Deluan
544ae90ec1 Fix CollapsibleComment in PlaylistDetails. Closes #2992 2024-05-02 13:48:10 -04:00
Deluan
aef49cb8d6 Add HTTPSecurityHeaders.CustomFrameOptionsValue option.
Requested in https://github.com/navidrome/navidrome/issues/248#issuecomment-1783768985
2024-05-02 12:35:16 -04:00
Deluan
7c5eec715d Fix typo 2024-05-01 23:09:11 -04:00
Kendall Garner
a4c2232041
Sort repeated lyrics that may be out of order (#2989)
With synchronized lyrics with repeated text, there is not a guarantee that the repeat is in order (e.g. `[00:00.00][00:10.00] a\n[00:05.00]b`).
This change will post-process lyrics with repeated timestamps in one line to ensure that it is always sorted.
2024-05-01 21:54:46 -04:00
Deluan
8f11b991d2 Bump Go dependencies 2024-05-01 20:40:34 -04:00
Deluan
d4a9a9e555 Fix PlaylistTracks's loadAllGenres. Fix #2988 2024-05-01 20:17:42 -04:00
Deluan
a8955f24e0 Fix AlbumPlayCountMode. Closes #2984 2024-05-01 20:05:36 -04:00
Deluan
2c06a4234e Fix int types in OpenSubsonic responses.
Refer to https://support.symfonium.app/t/symfonium-sync-crashes-when-tpos-is-not-an-int/4204
2024-05-01 13:57:11 -04:00
Deluan
7ab7b5df5e Fix signaler on Windows 2024-04-28 18:32:28 -04:00
Deluan
3d9fff36f7 Use signal.NotifyContext 2024-04-28 17:44:11 -04:00
Deluan
31fcab07d2 Refactor loadGenres, remove duplication 2024-04-28 17:04:12 -04:00
Deluan
de90152a71 Refactor DB Album mapping to model.Album 2024-04-28 13:51:57 -04:00
Deluan
27875ba2dd Load mime_types from external file 2024-04-28 12:18:24 -04:00
Deluan
28f7ef43c1 Remove AlbumPlayCountMode from command line options 2024-04-27 20:39:16 -04:00
Deluan
92a98cd558 Add tests for AlbumPlayCountMode, change the calc to match the request from #1032 2024-04-27 15:20:46 -04:00
Deluan
5d50558610 Add tests for AlbumPlayCountMode 2024-04-27 15:07:50 -04:00
vvdveen
8bff1ad512 Add AlbumPlayCountMode config option (#2803)
Closes #1032

* feat(album_repository.go): add kodi-style album playcount option - #1032

Signed-off-by: Victor van der Veen <vvdveen@gmail.com>

* fix format issue and remove reference to kodi (now normalized)

Signed-off-by: Victor van der Veen <vvdveen@gmail.com>

* reduced complexity but added rounding

Signed-off-by: Victor van der Veen <vvdveen@gmail.com>

* Use constants for AlbumPlayCountMode values

---------

Signed-off-by: Victor van der Veen <vvdveen@gmail.com>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-04-27 14:10:40 -04:00
crazygolem
1e96b858a9
Add support for Reverse Proxy auth in Subsonic endpoints (#2558)
* feat(subsonic): Add support for Reverse Proxy auth - #2557

Signed-off-by: Jeremiah Menétrey <superjun1@gmail.com>

* Small refactoring

---------

Signed-off-by: Jeremiah Menétrey <superjun1@gmail.com>
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-04-27 13:47:42 -04:00
Deluan
aafd5a952c Bump github.com/spf13/viper from 1.15.0 to 1.18.2 2024-04-26 22:11:43 -04:00
Deluan Quintão
d9cd5efd67
Bump Go dependencies (#2976)
* Fix build

* Bump dependencies
2024-04-26 18:21:10 -04:00
Deluan
affa9c3478 Bump github.com/pressly/goose/v3 from 3.19.2 to 3.20.0 2024-04-26 18:07:06 -04:00
Anna Smith
651a8fdaf9
Fix typo in comment (#2974) 2024-04-26 17:59:39 -04:00
Deluan
f7fc17c0f7 Add OpenSubsonic channelCount 2024-04-26 17:51:04 -04:00
Deluan
f5df948eb1 Fix scrobble error spam in the logs.
Relates to #2831 and #2975
2024-04-26 16:59:14 -04:00
crazygolem
18143fa5a1
Use the RealIP middleware also behind a reverse proxy (#2858)
* Use the RealIP middleware only behind a reverse proxy

* Fix proxy ip source in tests

* Fix test for PR#2087

The PR did not update the test after changing the behavior, but the test still
passed because another condition was preventing the user from being created in
the test.

* Use RealIP even without a trusted reverse proxy

* Use own type for context key

* Fix casing to follow go's conventions

* Do not apply RealIP middleware twice

* Fix IP source in logs

The most interesting data point in the log message is the proxy's IP, but
having the client IP too can help identify integration issues.
2024-04-25 20:43:58 -04:00
Tim
8f9ed1b994
Handling long playlist comments (#2973)
Closes #1737

* wrapping playlist comment in a <Collapse> element

* Extract common collapsible logic into a component

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-04-25 20:28:25 -04:00
dependabot[bot]
cf66594b6d
Bump github.com/onsi/gomega from 1.32.0 to 1.33.0 (#2968)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.32.0 to 1.33.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.32.0...v1.33.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 17:09:51 -04:00
Deluan
ca005f6457 Include MPV in release Docker image. Refers to #2910 2024-04-21 21:02:36 -04:00
Deluan
6dcfe4d455 Fix typo 2024-04-20 13:16:50 -04:00
Deluan
7871d69adb Allow comments in the NSP file.
See comment https://github.com/navidrome/navidrome/issues/1417#issuecomment-2064731407
2024-04-20 12:50:45 -04:00
Deluan
78182f40d6 Block regular users from changing their own playlists ownership 2024-04-20 12:08:07 -04:00
Deluan
9aeaaa6610 Fix issue in https://github.com/navidrome/navidrome/issues/2767#issuecomment-2065636352 2024-04-19 12:38:02 -04:00
dependabot[bot]
068c1e9a23
Bump golang.org/x/net from 0.21.0 to 0.23.0 (#2962)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.21.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.21.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 09:15:08 -04:00
Jonathan
bcec15dc13
Externalize MPV command template (#2948)
* externalise MPVTemplate

* Remove unnecessary comment

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2024-04-15 21:31:54 -04:00
dependabot[bot]
cf6603e3ec
Bump react-icons from 5.0.1 to 5.1.0 in /ui (#2957)
Bumps [react-icons](https://github.com/react-icons/react-icons) from 5.0.1 to 5.1.0.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v5.0.1...v5.1.0)

---
updated-dependencies:
- dependency-name: react-icons
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 14:35:00 -04:00
dependabot[bot]
88d6757121
Bump github.com/pelletier/go-toml/v2 from 2.2.0 to 2.2.1 (#2956)
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.2.0...v2.2.1)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 14:34:33 -04:00
Andrew Katsikas
c2f932c21c
Fix jukebox mode under Windows (#2774)
* bug(core/playback/mpv): jukebox mode under windows - #2767

Use named pipe for socket path under windows during mpv playback, change function name, unexport function

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - #2767

Fix typo

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Early return for Close on Windows

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Update import and run prettier

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Update function name

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Create track_close files for both platforms and move MpvTrack Close into new file

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Create SocketName function for both platforms, restore name of TempFileName

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(core/playback/mpv): jukebox mode under windows - navidrome#2767

Add missing params to SocketName on windows

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* Unexport SocketName, use socketName in NewTrack

---------

Signed-off-by: apkatsikas <apkatsikas@gmail.com>
2024-04-14 13:50:37 -04:00
Deluan
d968f7f530 Remove deprecation warning about notify 2024-04-13 15:27:54 -04:00
dependabot[bot]
5fc78f120c
Bump prettier from 3.2.2 to 3.2.5 in /ui (#2844)
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.2 to 3.2.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.2...3.2.5)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 15:10:03 -04:00
dependabot[bot]
52dfa97262
Bump @testing-library/jest-dom from 6.2.0 to 6.4.2 in /ui (#2845)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.2.0 to 6.4.2.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v6.2.0...v6.4.2)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 15:09:53 -04:00
dependabot[bot]
c1eef058a4
Bump follow-redirects from 1.15.4 to 1.15.6 in /ui (#2911)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 15:09:34 -04:00
Deluan
7f551a7932 Add make target to build docker image 2024-04-13 13:29:45 -04:00
oftenoccur
bcb71b85c0
Fix some typos in comments (#2949)
Signed-off-by: oftenoccur <ezc5@sina.com>
2024-04-11 14:58:14 -04:00
Deluan
8720bd154f Ignore formatting diffs when checking for POEditor changes 2024-04-11 14:55:53 -04:00
Cyrille
699be19bb9
Fix a few mistakes in the French translation (#2872)
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-04-10 19:37:08 -04:00
looklose
22cc9e0cd5
Fix function name in comment (#2947)
Signed-off-by: looklose <shishuaiqun@yeah.net>
2024-04-10 12:53:21 -04:00
dependabot[bot]
6e36abdd62 Bump github.com/go-chi/jwtauth/v5 from 5.3.0 to 5.3.1
Bumps [github.com/go-chi/jwtauth/v5](https://github.com/go-chi/jwtauth) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/go-chi/jwtauth/releases)
- [Commits](https://github.com/go-chi/jwtauth/compare/v5.3.0...v5.3.1)

---
updated-dependencies:
- dependency-name: github.com/go-chi/jwtauth/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-09 20:45:43 -04:00
dependabot[bot]
e98c7374a9 Bump github.com/pelletier/go-toml/v2 from 2.1.1 to 2.2.0
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.1.1 to 2.2.0.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.1.1...v2.2.0)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-09 20:45:27 -04:00
Deluan Quintão
de7f553526
Update Go to 1.22.2 and TagLib to 2.0.1 (#2946) 2024-04-09 19:00:38 -04:00
dependabot[bot]
9cc0cc2e93 Bump github.com/pressly/goose/v3 from 3.18.0 to 3.19.2
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.18.0 to 3.19.2.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.18.0...v3.19.2)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 19:52:34 -04:00
dependabot[bot]
24298605d4 Bump github.com/onsi/ginkgo/v2 from 2.15.0 to 2.17.1
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.15.0 to 2.17.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.15.0...v2.17.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 19:46:24 -04:00
Deluan
4865d04ec6 Fix DiscTitle OpenSubsonic compatibility. Closes #2929 2024-04-08 19:05:36 -04:00
dependabot[bot]
81770351de Bump github.com/onsi/gomega from 1.31.1 to 1.32.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.31.1 to 1.32.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.31.1...v1.32.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 19:03:15 -04:00
dependabot[bot]
b6bbba754a Bump golang.org/x/sync from 0.6.0 to 0.7.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.6.0 to 0.7.0.
- [Commits](https://github.com/golang/sync/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 18:57:52 -04:00
deluan
4f6121fae1 Update translations 2024-04-03 07:31:54 -04:00
Kendall Garner
f12dfb485a
Expose OpenSubsonic release date for album (#2906)
* [enhancement]: OS expose release date for album, make original optional

* not optional

* remove omitempty
2024-04-03 07:30:01 -04:00
Deluan
e81bf5125f Bump actions versions 2024-04-02 19:37:59 -04:00
dependabot[bot]
a47acb6674 Bump github.com/lestrrat-go/jwx/v2 from 2.0.20 to 2.0.21
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.20 to 2.0.21.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.20...v2.0.21)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 11:54:28 -04:00
dependabot[bot]
4a15677474 Bump google.golang.org/protobuf from 1.32.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 11:53:51 -04:00
Deluan
859cdda0bd Bump Go dependencies 2024-03-03 21:30:28 -05:00
Deluan
87ecd118bb Bump goose to 3.18.0.
To fix the ambiguous import issue, I used:
go get -u google.golang.org/genproto/googleapis/rpc
2024-03-03 21:27:33 -05:00
Deluan
5abe156777 Logs don't panic when receiving a nil *time.Time 2024-02-18 13:06:01 -05:00
Deluan
fa72aaa462 Move TempFileName to utils 2024-02-18 12:52:06 -05:00
Deluan
6eb13c9f79 Run Test job in ci-goreleaser container 2024-02-18 12:52:06 -05:00
Deluan
b67d1c0830 Show taglib and ffmpeg versions in the log 2024-02-18 12:52:06 -05:00
Deluan
effd588406 Stop using deprecated TagLib method length 2024-02-18 12:52:06 -05:00
Deluan
6f4c55dbde Use new ci-goreleaser (with TagLib 2) 2024-02-18 12:52:06 -05:00
Deluan
176329343a Send Subsonic formatted response on marshalling errors 2024-02-17 10:39:29 -05:00
Deluan
97c7e5daaf Use new slices package from Go standard lib 2024-02-16 22:00:44 -05:00
Deluan
166eb37787 Use Go builtin min/max func 2024-02-16 21:53:16 -05:00
Deluan
f7a4387d0e Bump github.com/jellydator/ttlcache/v2 to v2.11.1 2024-02-16 21:42:22 -05:00
Deluan
71e5b271fb Bump github.com/xrash/smetrics version 2024-02-16 20:52:23 -05:00
Deluan
d51148ea4c Bump github.com/go-chi/chi/v5 to v5.0.12 2024-02-16 20:51:30 -05:00
Deluan
7cb8cc115e Bump github.com/mattn/go-sqlite3 to v1.14.22 2024-02-16 20:50:45 -05:00
Deluan
69d91189c2 Upgrade ginkgo and gomega 2024-02-16 20:49:37 -05:00
Deluan
88063fc189 Upgrade ginkgo and gomega 2024-02-16 20:47:53 -05:00
Deluan
912e144b71 Bump github.com/google/uuid to 1.6.0 2024-02-16 20:46:41 -05:00
Deluan
87484fe7a9 Bump github.com/google/wire to 0.6.0 2024-02-16 20:45:11 -05:00
Deluan
58f64355c2 Bump golang.org/x/exp version 2024-02-16 20:43:12 -05:00
Deluan Quintão
7167e5ac87
Upgrade to Go 1.22 and Node v20 (#2861)
* Remove workaround for missing `context.WithoutCancel` in Go 1.20

* Upgrade to Go 1.22

* Upgrade GitHub Actions

* Upgrade Node to v20
2024-02-16 20:29:16 -05:00
Deluan
d8e1748928 Return 500 in case of Subsonic response marshalling errors 2024-02-16 19:59:24 -05:00
Deluan
9a051967f6 Handle "Infinity" values for ReplayGain. Fix #2862 2024-02-16 18:44:58 -05:00
Deluan
0b2cf30096 Don't swallow marshalling errors in the Subsonic API 2024-02-16 18:43:36 -05:00
Deluan
6d253225de Use order/sort album/artist when sorting tracks in playlists. Fixes #2819 2024-02-15 21:52:00 -05:00
Caio Cotts
bf2bcb1279
Fix null values in DB (#2840)
* Fix album image_files being null.

* Fix small nitpick.

* Use ExecContext instead of Exec.

* Change more columns to not null and set default values.

* Remove columns that don't need to be changed from migration.

* Fix typo.

* Remove unnecessary select statements.

* Remove duplicate code.

* Do not apply changes to radio table.

* Do not apply changes full_text columns and respective indexes.

* Fix musicbrainz columns.

* Rename migration.

* Make ExternalInfoUpdatedAt nullable

* Make Share's timestamps nullable

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2024-02-07 20:45:08 -05:00
Deluan Quintão
ac4ceab143
Update French translation (#2834)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2024-02-05 20:10:21 -05:00
Deluan
6226741517 Create resources.FS only once 2024-02-03 12:05:19 -05:00
Deluan
79a4d8f6ad Simplify ShortDur code and tests 2024-02-02 21:07:27 -05:00
Deluan Quintão
61257f89d2
Update translations (#2832)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2024-01-30 07:25:42 -05:00
Deluan
1f71e56741 Don't expose Last.fm API Key in the index.html 2024-01-29 21:42:27 -05:00
Kendall Garner
3a9b3452a2
Set rating value to 0 when value is null (#2824) 2024-01-29 06:26:15 -05:00
Deluan
5125558f52 Make Subsonic search query default to "" if not present.
See https://github.com/orgs/music-assistant/discussions/414#discussioncomment-8265985
2024-01-27 20:00:02 -05:00
Deluan
5f9b6b632d Add a "upgrading schema" log message to the DB initialization when there are pending migrations. 2024-01-27 19:44:49 -05:00
Deluan
fa7cc40d23 Add tests for toSQL 2024-01-27 12:16:38 -05:00
caiocotts
58218e6dc4 Fix fields not being sent on getPlaylist.view responses. 2024-01-26 12:41:55 -05:00
Deluan
67c82f524b "Fix" Reddit badge 2024-01-24 20:24:13 -05:00
Deluan
fb7fd21984 Don't add empty TIPL roles 2024-01-24 19:22:25 -05:00
Deluan
a6fc84a2e1 Parse the ID3v2.4 TIPL frame 2024-01-23 20:50:43 -05:00
Deluan
1e5e8be192 Import ID3 sort_* tags 2024-01-23 18:07:11 -05:00
Deluan
fd61b29a84 Small readability improvement in MergeFS tests 2024-01-21 16:20:47 -05:00
Deluan
2b33ef72e3 Remove offset and limit from count queries. Fixes #2443 2024-01-20 22:02:05 -05:00
Deluan
2fb913f5c9 Add log message to try to capture error in #2735 2024-01-20 20:18:59 -05:00
Deluan
6c05493cda Improve some Jukebox error messages 2024-01-20 20:10:32 -05:00
Deluan
3ca4f44118 Simplify default middlewares setup 2024-01-20 19:17:21 -05:00
Deluan
34c29a156f Simplify RealIP middleware setup 2024-01-20 18:58:12 -05:00
dependabot[bot]
b442736a0f
Bump connected-react-router from 6.9.1 to 6.9.3 in /ui (#2741)
Bumps [connected-react-router](https://github.com/supasate/connected-react-router) from 6.9.1 to 6.9.3.
- [Release notes](https://github.com/supasate/connected-react-router/releases)
- [Commits](https://github.com/supasate/connected-react-router/compare/v6.9.1...v6.9.3)

---
updated-dependencies:
- dependency-name: connected-react-router
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:42:43 -05:00
dependabot[bot]
90fccf00d1
Bump workbox-cli from 6.5.4 to 7.0.0 in /ui (#2737)
Bumps [workbox-cli](https://github.com/googlechrome/workbox) from 6.5.4 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/compare/v6.5.4...v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:38:44 -05:00
dependabot[bot]
bcd4a52616
Bump golang.org/x/sync from 0.5.0 to 0.6.0 (#2779)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.5.0 to 0.6.0.
- [Commits](https://github.com/golang/sync/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:37:46 -05:00
dependabot[bot]
84cffa6b94
Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#2759)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:37:01 -05:00
dependabot[bot]
a51b1b25d2
Bump uuid from 8.3.2 to 9.0.1 in /ui (#2740)
Bumps [uuid](https://github.com/uuidjs/uuid) from 8.3.2 to 9.0.1.
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v8.3.2...v9.0.1)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:36:14 -05:00
dependabot[bot]
9f317c054b
Bump @testing-library/user-event from 14.5.1 to 14.5.2 in /ui (#2757)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 14.5.1 to 14.5.2.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v14.5.1...v14.5.2)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:35:20 -05:00
dependabot[bot]
5f8d01a207
Bump clsx from 2.0.0 to 2.1.0 in /ui (#2758)
Bumps [clsx](https://github.com/lukeed/clsx) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/lukeed/clsx/releases)
- [Commits](https://github.com/lukeed/clsx/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: clsx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:35:08 -05:00
dependabot[bot]
8a648d717a
Bump github.com/go-chi/chi/v5 from 5.0.10 to 5.0.11 (#2742)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.10 to 5.0.11.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.10...v5.0.11)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:34:58 -05:00
dependabot[bot]
a0dc2ee051
Bump github.com/pelletier/go-toml/v2 from 2.0.6 to 2.1.1 (#2760)
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.0.6 to 2.1.1.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.0.6...v2.1.1)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:32:53 -05:00
dependabot[bot]
ffb4de1e27
Bump github.com/unrolled/secure from 1.13.0 to 1.14.0 (#2761)
Bumps [github.com/unrolled/secure](https://github.com/unrolled/secure) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/unrolled/secure/releases)
- [Commits](https://github.com/unrolled/secure/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/unrolled/secure
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:31:50 -05:00
dependabot[bot]
e1fc7983a5
Bump golang.org/x/image from 0.14.0 to 0.15.0 (#2778)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.14.0 to 0.15.0.
- [Commits](https://github.com/golang/image/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:31:18 -05:00
dependabot[bot]
2a43f54eb1
Bump follow-redirects from 1.15.2 to 1.15.4 in /ui (#2786)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:30:55 -05:00
dependabot[bot]
f654e92113
Bump github.com/lestrrat-go/jwx/v2 from 2.0.18 to 2.0.19 (#2792)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.18 to 2.0.19.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.18...v2.0.19)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 18:29:46 -05:00
flyingOwl
dfa453cc4a
Add (not)inplaylist operator to smart playlists (#1884)
Closes #1417 

A smart playlist can use the playlist id for filtering. This can be
used to create combined playlists or to filter multiple playlists.

To filter by a playlist id, a subquery is created that will match the
media ids with the playlists within the playlist_tracks table.

Signed-off-by: flyingOwl <ofenfisch@googlemail.com>
2024-01-20 18:22:17 -05:00
Johannes Engl
8f03454312
Make server unix socket file permission configurable via flag UnixSocketPerm (#2763)
* feat(any): Add flag unixsocketperm with default 0017 - #2625

Signed-off-by: johannesengl <hello@johannesengl.com>

* feat(server): Update unix socket file perm based on config - #2625

Signed-off-by: johannesengl <hello@johannesengl.com>

* Fix default value of socket.

* Refactor unix socket file creation.

* Remove misplaced comment

---------

Signed-off-by: johannesengl <hello@johannesengl.com>
Co-authored-by: Caio Cotts <caio@cotts.com.br>
Co-authored-by: Deluan <deluan@navidrome.org>
2024-01-20 14:50:30 -05:00
dependabot[bot]
8570773b90 Bump prettier from 3.1.1 to 3.2.2 in /ui
Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-18 09:23:10 -05:00
caiocotts
6cff91e17d Use the default import path for jest-dom. 2024-01-17 17:07:43 -05:00
dependabot[bot]
d0df81a8df Bump @testing-library/jest-dom from 5.16.5 to 6.2.0 in /ui
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 6.2.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v6.2.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-17 17:07:43 -05:00
dependabot[bot]
75f3ef64e2 Bump react-icons from 4.4.0 to 5.0.1 in /ui
Bumps [react-icons](https://github.com/react-icons/react-icons) from 4.4.0 to 5.0.1.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v4.4.0...v5.0.1)

---
updated-dependencies:
- dependency-name: react-icons
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-17 16:10:00 -05:00
dependabot[bot]
170ac93926 Bump github.com/onsi/ginkgo/v2 from 2.13.2 to 2.14.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.13.2 to 2.14.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.13.2...v2.14.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-17 15:58:57 -05:00
Deluan
6f7b48202e Make the GetInstance concurrent test more readable 2023-12-28 16:50:07 -05:00
Deluan
6e2be7f95f Don't force a full scan after upgrading the lyrics 2023-12-28 04:55:45 -05:00
Deluan
0d8f8e3afd Optimize Singleton (sometimes a simple lock is a better solution) 2023-12-27 22:12:34 -05:00
Deluan
e50382e3bf Fix ReplayGain values not being retrieved from DB 2023-12-27 21:14:54 -05:00
Kendall Garner
814161d78d
Add OS Lyrics extension (#2656)
* draft commit

* time to fight pipeline

* round 2 changes

* remove unnecessary line

* fight taglib. again

* make taglib work again???

* add id3 tags

* taglib 1.12 vs 1.13

* use int instead for windows

* store as json now

* add migration, more tests

* support repeated line, multiline

* fix ms and support .m, .mm, .mmm

* address some concerns, make cpp a bit safer

* separate responses from model

* remove [:]

* Add trace log

* Try to unblock pipeline

* Fix merge errors

* Fix SIGSEGV error (proper handling of empty frames)

* Add fallback artist/title to structured lyrics

* Rename conflicting named vars

* Fix tests

* Do we still need ffmpeg in the pipeline?

* Revert "Do we still need ffmpeg in the pipeline?"

Yes we do.

This reverts commit 87df7f6df7.

* Does this passes now, with a newer ffmpeg version?

* Revert "Does this passes now, with a newer ffmpeg version?"

No, it does not :(

This reverts commit 372eb4b0ae.

* My OCD made me do it :P

---------

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2023-12-27 20:20:29 -05:00
Deluan
130ab76c79 go mod tidy 2023-12-27 13:04:26 -05:00
Deluan
a186a795f6 Omit empty Genre attributes 2023-12-27 12:44:25 -05:00
Deluan
798b03eabd Add "inspect" command to CLI 2023-12-27 12:41:28 -05:00
Deluan
ea7ba22699 Discard duplicated tags 2023-12-26 19:35:14 -05:00
Andrew Katsikas
b4815ecee5
Add TAK support (#2745)
* bug(consts/mime_types): tak-support - 2514

Add tak to mime_types audioFormats

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* bug(scanner): tak-support - 2514

Add tak test fixture file and add fixes for tag_scanner and walk_dir_tree tests

Signed-off-by: apkatsikas <apkatsikas@gmail.com>

* Remove comment

---------

Signed-off-by: apkatsikas <apkatsikas@gmail.com>
2023-12-26 18:39:15 -05:00
Deluan
51e07d4cb5 Add log.IsGreaterOrEqualTo, that take into consideration path-scoped log levels 2023-12-25 16:35:16 -05:00
Deluan
03119e5ccf Add more trace log to TagLib Wrapper 2023-12-23 14:10:38 -05:00
Deluan Quintão
15e1394fa3
Implement originalReleaseDate in OpenSubsonic responses. (#2733)
See https://github.com/opensubsonic/open-subsonic-api/pull/80
2023-12-22 21:03:55 -05:00
Deluan
3f349b1b58 Add todo as a reminder to replace min/max in Go 1.22 2023-12-21 19:19:46 -05:00
Deluan
dfcc189cff Replace all utils.Param* with req.Params 2023-12-21 17:41:09 -05:00
Deluan
00597e01e9 Add req.Params to replace utils.Param* 2023-12-21 16:32:37 -05:00
Dany Marcoux
965fc9d9be
Remove beep and the files where it was imported (#2731)
Beep isn't needed anymore since we rely on MPV instead.

The changes to `go.mod` and `go.sum` were done with:
```
go get github.com/faiface/beep@none
go mod tidy
```

Signed-off-by: Dany Marcoux <git@dmarcoux.com>
2023-12-21 08:00:31 -05:00
Deluan Quintão
781ff40464
Bump Go version to 1.21.5 (#2729) 2023-12-20 20:02:40 -05:00
Deluan
a6ed0442f2 Name mapDates return values 2023-12-20 16:29:39 -05:00
dependabot[bot]
515efe37f0 Bump @testing-library/user-event from 13.5.0 to 14.5.1 in /ui
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.5.0 to 14.5.1.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.5.0...v14.5.1)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 13:18:13 -05:00
dependabot[bot]
6c28c111bb Bump @adobe/css-tools from 4.3.1 to 4.3.2 in /ui
Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 12:34:13 -05:00
dependabot[bot]
92a88ad4d9
Bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#2722)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-18 17:45:37 -05:00
dependabot[bot]
4ccc0a92bf
Bump jwt-decode from 3.1.2 to 4.0.0 in /ui (#2714)
* Bump jwt-decode from 3.1.2 to 4.0.0 in /ui

Bumps [jwt-decode](https://github.com/auth0/jwt-decode) from 3.1.2 to 4.0.0.
- [Release notes](https://github.com/auth0/jwt-decode/releases)
- [Changelog](https://github.com/auth0/jwt-decode/blob/main/CHANGELOG.md)
- [Commits](https://github.com/auth0/jwt-decode/compare/v3.1.2...v4.0.0)

---
updated-dependencies:
- dependency-name: jwt-decode
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Make jwt-decode a named import.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Caio Cotts <caio@cotts.com.br>
2023-12-18 17:28:42 -05:00
dependabot[bot]
df3de047ca Bump clsx from 1.1.1 to 2.0.0 in /ui
Bumps [clsx](https://github.com/lukeed/clsx) from 1.1.1 to 2.0.0.
- [Release notes](https://github.com/lukeed/clsx/releases)
- [Commits](https://github.com/lukeed/clsx/compare/v1.1.1...v2.0.0)

---
updated-dependencies:
- dependency-name: clsx
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 15:15:00 -05:00
Caio Cotts
86757663d6 Reformat code with Prettier's new rules. 2023-12-18 15:12:24 -05:00
dependabot[bot]
735d670a5b Bump prettier from 2.8.2 to 3.1.1 in /ui
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.2 to 3.1.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.2...3.1.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 15:12:24 -05:00
dependabot[bot]
30179146c3 Bump deepmerge from 4.2.2 to 4.3.1 in /ui
Bumps [deepmerge](https://github.com/TehShrike/deepmerge) from 4.2.2 to 4.3.1.
- [Changelog](https://github.com/TehShrike/deepmerge/blob/master/changelog.md)
- [Commits](https://github.com/TehShrike/deepmerge/compare/v4.2.2...v4.3.1)

---
updated-dependencies:
- dependency-name: deepmerge
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 14:22:11 -05:00
dependabot[bot]
03a9f22ed9 Bump @material-ui/icons from 4.11.2 to 4.11.3 in /ui
Bumps [@material-ui/icons](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-icons) from 4.11.2 to 4.11.3.
- [Release notes](https://github.com/mui-org/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v4.11.3/CHANGELOG.md)
- [Commits](https://github.com/mui-org/material-ui/commits/v4.11.3/packages/material-ui-icons)

---
updated-dependencies:
- dependency-name: "@material-ui/icons"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 14:17:25 -05:00
dependabot[bot]
39e92a1918 Bump github.com/mattn/go-sqlite3 from 1.14.18 to 1.14.19
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.18 to 1.14.19.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.18...v1.14.19)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 14:07:07 -05:00
Deluan
421ce91a9e Fix mpvipc dependency 2023-12-17 13:57:15 -05:00
Deluan
12aae5e951 Some cleanup in the jukebox code, specially log messages 2023-12-17 13:15:47 -05:00
Deluan
932152eb7e Change required fields in Subsonic Jukebox endpoint
See discussion here: https://gitlab.com/ultrasonic/ultrasonic/-/issues/1266#note_1621953651
2023-12-17 13:15:47 -05:00
Deluan
0e3175ea17 Better workaround for Go 1.20 missing context.WithoutCancel 2023-12-16 13:33:03 -05:00
Deluan
d3f6b4692d Temporary fix for scan context cancellation for Go 1.20 2023-12-15 07:59:34 -05:00
Deluan
70effa09e8 Don't cancel Scan on context cancellation 2023-12-14 22:52:48 -05:00
Deluan
7ccf685973 Fix PreferSortTags 2023-12-14 21:45:47 -05:00
Deluan
2aef227572 Add context to SQL queries, enabling cancellation 2023-12-14 17:13:09 -05:00
Deluan
d80e1a260b Fix possible authentication bypass 2023-12-13 19:32:05 -05:00
dependabot[bot]
fd4605d7dc
Bump github.com/mattn/go-zglob from 0.0.3 to 0.0.4 (#2015)
Bumps [github.com/mattn/go-zglob](https://github.com/mattn/go-zglob) from 0.0.3 to 0.0.4.
- [Release notes](https://github.com/mattn/go-zglob/releases)
- [Commits](https://github.com/mattn/go-zglob/compare/v0.0.3...v0.0.4)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-zglob
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-13 17:27:42 -05:00
Deluan
a6493c4c36 Bump github.com/google/uuid to v1.5.0 2023-12-13 16:47:05 -05:00
Kendall Garner
54597bd575
Allow reverse proxy auth for unix socket (#2701) 2023-12-12 06:06:27 -05:00
Deluan Quintão
ab53313273
Add new PrefSortTags option (#2696) 2023-12-11 20:37:11 -05:00
Deluan
d3669f46a9 go mod tidy 2023-12-11 19:03:27 -05:00
Deluan
d89de9060a Bump Go dependencies 2023-12-11 17:25:14 -05:00
Deluan
ac3668a33e Removed unused diodes package 2023-12-11 17:22:10 -05:00
dependabot[bot]
6d924ad742
Bump github.com/go-chi/jwtauth/v5 from 5.2.0 to 5.3.0 (#2699)
Bumps [github.com/go-chi/jwtauth/v5](https://github.com/go-chi/jwtauth) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/go-chi/jwtauth/releases)
- [Commits](https://github.com/go-chi/jwtauth/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/jwtauth/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 13:41:03 -05:00
Deluan
78d557c185 Remove LastFM shared key 2023-12-10 21:11:40 -05:00
Deluan
546aa26a0a Removed duplicated code 2023-12-09 14:11:07 -05:00
dependabot[bot]
fc677f7951
Bump github.com/lestrrat-go/jwx/v2 from 2.0.17 to 2.0.18 (#2684)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.17 to 2.0.18.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.17...v2.0.18)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-09 14:04:56 -05:00
Deluan
aed0309161 Return AlbumID3 in search3 results 2023-12-09 14:01:22 -05:00
Deluan
465cc091b0 Convert internal disc number representation to int 2023-12-09 13:53:38 -05:00
Deluan
2c9035fdd0 Add discTitles to OpenSubsonic responses 2023-12-09 13:53:38 -05:00
Deluan
af7eead037 Add discs to album 2023-12-09 13:53:38 -05:00
Deluan Quintão
0ca0d5da22
Replace beego/orm with dbx (#2693)
* Start migration to dbx package

* Fix annotations and bookmarks bindings

* Fix tests

* Fix more tests

* Remove remaining references to beego/orm

* Add PostScanner/PostMapper interfaces

* Fix importing SmartPlaylists

* Renaming

* More renaming

* Fix artist DB mapping

* Fix playlist updates

* Remove bookmarks at the end of the test

* Remove remaining `orm` struct tags

* Fix user timestamps DB access

* Fix smart playlist evaluated_at DB access

* Fix search3
2023-12-09 13:52:17 -05:00
dependabot[bot]
7074455e0e Bump github.com/onsi/ginkgo/v2 from 2.13.1 to 2.13.2
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.13.1 to 2.13.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.13.1...v2.13.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 21:35:42 -05:00
caiocotts
2f2fbeb009 Fix ld warnings on taglib_wrapper. 2023-12-04 15:19:12 -05:00
Kendall Garner
742fd16a01
Parse more itunes keys, optimize taglib wrapper (#2680)
* parse more itunes keys

* Move special iTunes M4A logic to Go code

* Simplify ASF/WMA tags handling

* Simplify ASF/WMA tags handling even more, moving compilation logic to `metadata` normalizer

* Remove strdups from C++ code, `C.GoString` already duplicates the strings

* reduced set

* remove strdup

* Small nitpick

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2023-12-03 14:19:16 -05:00
Deluan Quintão
7766ee069c
Return http form post extension (OpenSubsonic) (#2676) 2023-12-02 19:46:57 -05:00
Deluan
4cd7c7f39f Fix FileHaunter tests 2023-12-02 19:40:59 -05:00
Deluan
81daee3b9b Fix FileHaunter tests 2023-12-02 18:43:24 -05:00
Deluan
9b434d743f Ignore flaky FileHaunter tests 2023-12-02 18:32:48 -05:00
Deluan
4641dc0b2b Add ReplayGain to OpenSubsonic API Child response 2023-12-02 15:28:44 -05:00
Deluan
812dc2090f Add support for timeOffset in /stream endpoint 2023-12-02 13:10:36 -05:00
Deluan
a9cf54afef Return genres in bookmark endpoints (OpenSubsonic) 2023-12-02 11:36:16 -05:00
Deluan
595186b1b2 Coalesce null annotation values, to better rank them against annotations with value 0 2023-12-02 11:35:54 -05:00
Deluan
cdccdc56c9 Add more OpenSubsonic fields
- isCompilation
- sortName
2023-11-28 21:26:00 -05:00
Deluan
f580c5b8bc Add more OpenSubsonic fields
- mediaType
- musicBrainzId (Child)
2023-11-28 21:12:28 -05:00
deluan
f0e25c251d Update translations 2023-11-28 06:10:03 -05:00
Deluan
abde399e7b Upgrade to Goose 3.15.1 2023-11-27 14:46:44 -05:00
Deluan
1b4483d32b Remove tools.go 2023-11-27 14:06:00 -05:00
Deluan
f7fe8ba938 npx update-browserslist-db@latest 2023-11-27 13:56:16 -05:00
Deluan
f543e7accc Fix getOpenSubsonicExtensions endpoint
Match the current doc: https://opensubsonic.netlify.app/docs/endpoints/getopensubsonicextensions/

openSubsonicExtensions must be an array, not a struct
2023-11-27 13:27:10 -05:00
Deluan Quintão
60a5fbe1fe
Optimize search3, by removing OFFSET when paginating (#2655)
* Optimize pagination, removing offset

* For search, don't add `where` clause for empty queries

* Revert "Replace `COUNT(DISTINCT primary_key)` with `COUNT(*)`"

Genres are required as part of the count queries, so filter by genres work

* Optimize search3 query, using order by id if it is a "" query.

Also fix the optimizePagination query logic

* Allow offset optimizer threshold to be configured
2023-11-27 13:06:23 -05:00
Deluan
28dc98dec4 Revert "Replace COUNT(DISTINCT primary_key) with COUNT(*)"
Genres are required as part of the count queries, so filter by genres work
2023-11-25 23:08:20 -05:00
Deluan
8c8e1ea701 Replace COUNT(DISTINCT primary_key) with COUNT(*) 2023-11-25 22:46:15 -05:00
Deluan
b964018cd7 Show SQL errors in queryAll 2023-11-25 13:54:38 -05:00
Deluan
9aa7b80d0d Generalize BreakUp/RangByChunks functions 2023-11-25 12:13:36 -05:00
Deluan
c3efc57259 Use TagLib 1.13.1 for snapshots/releases 2023-11-24 20:35:38 -05:00
Deluan
27a92b05e7 Fixed deprecated GoReleaser options 2023-11-24 18:08:34 -05:00
Deluan
21f1354cd1 Revert "Bump golang.org/x/exp, change slices.SortFunc function call"
This reverts commit 474f32f1
2023-11-24 17:57:22 -05:00
Deluan
069da5d91c Bump Go to 1.21.4 2023-11-24 17:51:36 -05:00
Deluan
69d2ced852 Bump Go dependencies 2023-11-24 16:45:52 -05:00
Deluan
17ac8d25cb Bump dependencies 2023-11-24 16:40:20 -05:00
Deluan
474f32f1b8 Bump golang.org/x/exp, change slices.SortFunc function call 2023-11-24 16:38:47 -05:00
Deluan
ecadcfb403 Make ParamInt generic (any int type) 2023-11-23 13:40:06 -05:00
Caio Cotts
f69c27d146 Return genres in search3 endpoint. 2023-11-21 21:34:03 -05:00
Caio Cotts
bb7186ce2f Fix marshaling for genres. 2023-11-21 21:34:03 -05:00
dependabot[bot]
5d1493e845 Bump @adobe/css-tools from 4.0.1 to 4.3.1 in /ui
Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.0.1 to 4.3.1.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-21 08:47:14 -05:00
Deluan
d0fe406800 Fix Go 1.20 build 2023-11-21 08:32:22 -05:00
Deluan
c8fbf6b60e Bump dependencies 2023-11-21 08:22:02 -05:00
deluan
e5bc3ca200 Update translations 2023-11-21 08:15:32 -05:00
tarokeitaro
6d88dd2c66 Add Indonesian Language 2023-11-21 08:06:51 -05:00
caiocotts
eebfbc5381 Revert walk_dir_tree.go back to using the os package. 2023-11-21 07:17:22 -05:00
Deluan
a5dfd2d4a1 Format subsonic response snapshots 2023-11-18 14:43:40 -05:00
Drew Weymouth
7773522803
Expose OpenSubsonic fields Genres, MusicBrainzId, Bpm, Comment (#2597)
* add Genres to subsonic responses

* add genres in GetAlbum response

* add musicBrainzId

* add Bpm and Comment OpenSubsonic fields

* remove omitempty on OpenSubsonic fields

* add custom JSON marshalers to ensure genres attribute is non-nil

* regenerate snapshots to capture now-mandatory fields
2023-11-18 14:40:00 -05:00
Deluan
53607fe114 Publish all new images to Docker Registry 2023-11-16 23:21:20 -05:00
Caio Cotts
fee0f40a52 Bump dependencies 2023-11-16 20:38:45 -05:00
Caio Cotts
9d2aaff8cb Bump golang.org/x/tools from 0.13.0 to 0.15.0 2023-11-16 20:19:29 -05:00
Caio Cotts
2ff4023cce Bump golang.org/x/image from 0.12.0 to 0.14.0 2023-11-16 20:16:25 -05:00
Kendall Garner
79870b1090
Do not empty old artist metadata (#2423) 2023-11-16 19:20:37 -05:00
Kendall Garner
7a858a2db3
Fix external link for artist page if LastFM is missinb but Musicbrainz is not (#2533)
* fix mbz link if lastfm does not exist

* use lastfmUrl field

* fix artist info undefined
2023-11-16 19:07:52 -05:00
dependabot[bot]
9cefaf66a4 Bump github.com/onsi/gomega from 1.29.0 to 1.30.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.29.0 to 1.30.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.29.0...v1.30.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-16 18:45:21 -05:00
Kendall Garner
3debd31b12
Add more replaygain tests, fix wma (#2356)
* add more replaygain tests, fix wma

* Convert individual specs to a table spec

* Fix pipeline, by commenting incompatible tests

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2023-11-14 20:25:18 -05:00
Deluan Quintão
24d9fb5b48
Update translations (#2409)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2023-11-14 19:21:26 -05:00
certuna
40841ab917
Small date mapping fix (#2584)
* Update mapping.go

fallback in the case there's no Date tagged but Original Date or Release Date are tagged

* Add tests

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2023-11-11 17:13:07 -05:00
certuna
bae5fc946b
Fix hardcoded IPv4 literals (#2602)
* Update server_test.go

no hardcoded IPv4 literals

* Update package.json

no hardcoded IPv4 literals
2023-11-11 16:46:53 -05:00
Deluan
e055826068 Fix devcontainer for Go 1.21 2023-11-09 18:23:44 -05:00
dependabot[bot]
54bde266b4 Bump github.com/mattn/go-sqlite3 from 1.14.16 to 1.14.18
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.16 to 1.14.18.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.16...v1.14.18)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-07 18:24:08 -05:00
dependabot[bot]
3a7376901b Bump golang.org/x/sync from 0.3.0 to 0.5.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.3.0 to 0.5.0.
- [Commits](https://github.com/golang/sync/compare/v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-07 18:19:32 -05:00
dependabot[bot]
de3d870100 Bump github.com/spf13/cobra from 1.7.0 to 1.8.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-07 18:08:13 -05:00
certuna
03175e1a9d
Use file creation date for Date Added/CreatedAt (#2553)
* Update mapping.go

CreatedAt = BirthTime

* Update metadata.go

Add BirthTime() function

* Update spread_fs.go

Replacing djherbis/atime package with djherbis/times, as times includes the functionality of atime

* Update go.mod

remove djherbis/atime, add djherbis/times

* Update mapping.go

time package not used anymore

* Update go.sum

removed djherbis/atime, added djherbis/times

* Update spread_fs.go

revert to previous, cannot get rid of /atime after all since it's a dependency of /fscache

* Update go.mod

djherbis/times 1.6.0 now released

* Update go.sum

new sums

* Update metadata.go

Inverted if statement, more readable

* Update go.mod

format fix

* Update go.sum

format fix

* Update go.sum

format fix

* Update go.sum

format fix

* Update metadata.go

variable name times -> fileProperties
check for errors

* Update metadata.go

reverse order of error check

* Update metadata.go

typo

* Update metadata.go

https://github.com/navidrome/navidrome/pull/2553#issuecomment-1787967615
2023-11-01 16:41:07 -04:00
Sam Watson
26472f46fe
POST endpoint for importing m3u playlists - #2078 (#2273)
* wip: API endpoint for creating playlists from m3u files

* wip: get user id from context

* temporarily disable failing test

* custom logic for playlist route to accomodate m3u content type

* incorporate playlist parsing into existing logic in core

* re-enable test

* fix locally failing test

* Address requested changes.

* Improve ImportFile tests.

* Remove ownerID as a parameter of ImportM3U.

* Write tests for ImportM3U.

* Separate ImportM3U test into two.

* Test OwnerID and playlist Name.

---------

Co-authored-by: Sam Watson <SwatsonCodes@users.noreply.github.com>
Co-authored-by: caiocotts <caio@cotts.com.br>
2023-11-01 14:59:47 -04:00
dependabot[bot]
6bca7531aa Bump @babel/traverse from 7.19.3 to 7.23.2 in /ui
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.19.3 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 17:46:10 -04:00
dependabot[bot]
68d1d5c99f Bump github.com/lestrrat-go/jwx/v2 from 2.0.12 to 2.0.16
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.12 to 2.0.16.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.12...v2.0.16)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 17:27:45 -04:00
dependabot[bot]
db6c46091e Bump github.com/beego/beego/v2 from 2.0.7 to 2.1.3
Bumps [github.com/beego/beego/v2](https://github.com/beego/beego) from 2.0.7 to 2.1.3.
- [Release notes](https://github.com/beego/beego/releases)
- [Changelog](https://github.com/beego/beego/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/beego/beego/compare/v2.0.7...v2.1.3)

---
updated-dependencies:
- dependency-name: github.com/beego/beego/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 17:24:55 -04:00
dependabot[bot]
4cd916bb78 Bump react-router-dom from 5.3.0 to 5.3.4 in /ui
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 5.3.0 to 5.3.4.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/v5.3.4/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 16:55:59 -04:00
dependabot[bot]
c40e83efab Bump github.com/go-chi/chi/v5 from 5.0.8 to 5.0.10
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.8 to 5.0.10.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.8...v5.0.10)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 16:44:35 -04:00
Stephan Wahlen
9094f41f25
Improve TopSongs findMatchingTrack by de-prioritizing compilations (#2532)
in reference to https://github.com/navidrome/navidrome/issues/1701
2023-10-31 16:00:53 -04:00
dependabot[bot]
9ff95b6ced Bump github.com/onsi/gomega from 1.27.10 to 1.29.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.10 to 1.29.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.10...v1.29.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 15:48:16 -04:00
Kendall Garner
77ace8570c
Coalesce genre to null for smart playlist (#2573) 2023-10-31 13:22:57 -04:00
Matthias Schmidt
59f0c487e7
Jukebox cleanup (#2554)
* Fixing typo FFmpegPath -> MPVPath

* Fixing panic by applying afontenot patch

* Using mpv audio-device flag and naming for config and playback
2023-10-17 18:12:48 -04:00
Deluan
2cd4358172 Make Jukebox available to Subsonic clients 2023-09-14 20:15:39 -04:00
dependabot[bot]
248bf232ff
Bump github.com/lestrrat-go/jwx/v2 from 2.0.11 to 2.0.12 (#2480)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.11 to 2.0.12.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.11...v2.0.12)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 18:06:51 -04:00
dependabot[bot]
b5664ab905
Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 (#2497)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.11.0 to 2.12.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.11.0...v2.12.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 12:28:43 -04:00
Lukas H
ac7f94e620
Fix text being unreadable with Ligera theme (#2517)
Change MuiFormGroup color to make it readable.
2023-09-10 12:28:21 -04:00
dependabot[bot]
d45f9f172d
Bump github.com/google/uuid from 1.3.0 to 1.3.1 (#2489)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 12:05:58 -04:00
dependabot[bot]
250107d668
Bump golang.org/x/image from 0.9.0 to 0.12.0 (#2507)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.9.0 to 0.12.0.
- [Commits](https://github.com/golang/image/compare/v0.9.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 12:05:28 -04:00
BoniK
64b14db55a
Add Korean Language (#2463) 2023-09-10 11:52:18 -04:00
dependabot[bot]
73d1851c0d
Bump golang.org/x/tools from 0.9.1 to 0.13.0 (#2516)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.9.1 to 0.13.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.9.1...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 11:48:33 -04:00
Matthias Schmidt
1b16e1140f
Jukebox mode (#2289)
* Adding cache directory to ignore-list

* Adding jukebox-related config options

* Adding DevEnableJukebox config option pls. dummy server

* Adding types and routers

* Now without panic

* First draft on parsing the action

* Some cleanups

* Adding playback server

* Verify audio device configuration

* Adding debug-build target to have full symbol support

* Adding beep sound library pls some example code. Not working yet

* Play a fixed mp3 on any interface access for testing purposes

* Put action code into separate file, adding stringer, more debug output, prepare structs, validation

* Put action parameter parser code where it belongs

* Have a single Action transporting all information

* User fmt.Errorf for error-generation

* Adding wide playback interface

* Use action map for parsing, stringer instead switch stmt.

* Use but only one switch case and direct dispatch, refactoring

* Add error handling and pushing to client

* send decent errormessage, no internal server error

* Adding playback devices slice and load it from config

* Combine config-verification and structure init

* Return user-specific device

* Separate playback server from device

* Use dataStore to retrieve mediafile by id

* WIP: Playlist and start/stop handling. Doing start/stop the hard way as of now

* WIP: set, start and stop work on one single song. More to come

* Dont need to wait for the end

* Merge jukebox_action.go into jukebox.go

* Remove getParameterAsInt64(). Use existing requiredParamInt() instead

* Dont need to call newFailure() explicitly

* Remove int64, use int instead.

* Add and set action now accept multiple ids

* Kickout copy of childFromMediaFile(). It is not needed here.

* Refactoring devices and playbackServer

* Turn (internal) playback.DeviceStatus into subsonic JukeboxStatus when rendering output. Indexes int64 -> int

* Now we have a position and playing status

* Switching gain to float32, xs:float is defined as 32 bit. Fixing nasty copy/pointer bug

* Now with volume control

* Start working the queue

* Remove user from device interface

* Rename function GetDevice -> GetDeviceForUser to make intention clearer

* Have a nice stringer for the queue

* User Prepared boolean for now to allow pause/unpause

* Skipping works, but without offsets

* Make ChildFromMediaFile public to be used in jukebox get() implementation

* Return position in seconds and implement offset-skip in seconds

* Default offset to 0

* Adding a simple setGain implementation

* Prepare for transcoding AAC

* WIP: transcode to WAV to use beeps wav decoder. Not done yet.

* WIP: out of sheer desparation: convert to MP3 (which works) rather than WAV to troubleshoot issue.

* Use FLAC as intermediate format to play Apple AAC

* A bit of cleanup

* Catching the end-of-stream event for further reactions

* Have a trackSwitching goroutine waiting on channel when track ends

* Move decoder code into own file. Restructure code a bit

* Now with going on to play the next song in the playlist

* Adding shuffle feature

* Implementing remove action

* Cleanup code

* Remove templates for ffmpeg mp3 generation. Not needed anymore.

* Adding some documentation

* Check whether offset into track is in range. Fixing potential remove track bug. Documentation

* Make golangci-lint happy: handling return values

* Adding test suite and example dummy for playback package

* Adding some basic queue tests

* Only use Jukebox.Enabled config option

* Adding stream closing handling

* Pass context.Context to all PlaybackDevice methods

* Remove unneeded function

* Correct spelling

* Reduce visibility of ChildFromMediaFile

* Decomplicate action-parsing

* Adding simple tempfile-based AAC->FLAC transcoding. No parallel reading and writing yet.

* Try to optimize pipe-writing, tempfile-handling and reading. Not done yet.

* Do a synchronous copy of the tempfile. Racecondition detected

* More debugging statements and fixing the play/pause bug. More work needed

* Start the trackSwitcher() with each device once. Return JSON position even if its 0. More debug-output

* Moving all track-handling code into own module

* Fix typo. Do not pass ctx around when not applicable

* WIP: More refactoring, debugging output

* Fix nil pointer

* Repairing MP3 playback by pinning indirect dependencies: hajimehoshi/go-mp3 and hajimehoshi/oto

* Do not forget to cleanup after a skip action

* Make resync with master easy

* Adding missing mocks

* Adding missing error-handling found by linter

* Updating github.com/hajimehoshi/oto

* Removing duplicate function

* Move BEEP-related code into own package

* Juggle beep-related code around as preparation for interface access

* More refactoring for interface separation

* Gather CloseDevice() behind Track interface.

* Adding skeleton, draft audio-interface using mpv.io

* Adding majority of interface commands using messages to mpv socket.

* Adding end-of-stream handling

* MPV: start/stop are working

* postition is given in float in mpv

* Unify Close() and CloseDevice(). Using temp filename for controlling socket

* Wait until control-socket shows up. Cleanup socket in Close()

* Use canceable command. Rename to Executor

* Skipping tracks works now

* Now with actually setting the position

* Fix regain

* Add missing error-handling found by linter

* Adding retry mode on time-pos property getter

* Remove unneeded code on queue

* Putting build-tag beep onto beep files

* Remove deprecated call to rand.Seed()

"As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator."

* Using int32 to conform to Subsonic API spec

* Fix merge error

* Minor style changes

* Get username from context

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2023-09-10 11:25:22 -04:00
Deluan Quintão
f941347cf1
Upgrade to Go 1.21 (#2475)
* Upgrade to Go 1.21

* Remove 'replacements' from goreleaser config
2023-08-09 11:39:49 -04:00
dependabot[bot]
1b5cefdada
Bump github.com/onsi/gomega from 1.27.8 to 1.27.9 (#2450)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.8 to 1.27.9.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.8...v1.27.9)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 19:21:39 -04:00
dependabot[bot]
4cf25fc611
Bump github.com/microcosm-cc/bluemonday from 1.0.24 to 1.0.25 (#2449)
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.24...v1.0.25)

---
updated-dependencies:
- dependency-name: github.com/microcosm-cc/bluemonday
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 19:11:15 -04:00
dependabot[bot]
14ba83ea1b
Bump github.com/go-chi/chi/v5 from 5.0.8 to 5.0.10 (#2444)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.8 to 5.0.10.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.8...v5.0.10)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 19:12:56 -04:00
dependabot[bot]
08f3fd1343
Bump github.com/pressly/goose/v3 from 3.13.1 to 3.13.4 (#2442)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.13.1 to 3.13.4.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.13.1...v3.13.4)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2023-07-21 19:11:59 -04:00
dependabot[bot]
3d66f58725
Bump tough-cookie from 4.1.2 to 4.1.3 in /ui (#2441)
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.1.2...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 19:04:32 -04:00
dependabot[bot]
5b1ba3df05
Bump word-wrap from 1.2.3 to 1.2.4 in /ui (#2446)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 19:02:10 -04:00
Deluan
a002830775 Fix EnableMediaFileCoverArt option default value 2023-07-10 18:07:58 -04:00
dependabot[bot]
7b600bed05
Bump golang.org/x/tools from 0.10.0 to 0.11.0 (#2432)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:38:32 -04:00
dependabot[bot]
7d0a1916d8
Bump golang.org/x/image from 0.8.0 to 0.9.0 (#2430)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/image/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:34:58 -04:00
dependabot[bot]
c7fe311c7f
Bump github.com/go-chi/jwtauth/v5 from 5.1.0 to 5.1.1 (#2427)
Bumps [github.com/go-chi/jwtauth/v5](https://github.com/go-chi/jwtauth) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/go-chi/jwtauth/releases)
- [Commits](https://github.com/go-chi/jwtauth/compare/v5.1.0...v5.1.1)

---
updated-dependencies:
- dependency-name: github.com/go-chi/jwtauth/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:31:38 -04:00
dependabot[bot]
4520a34648
Bump github.com/pressly/goose/v3 from 3.11.2 to 3.13.1 (#2428)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.11.2 to 3.13.1.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pressly/goose/compare/v3.11.2...v3.13.1)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-05 16:31:22 -04:00
BenzLeung
3e14c3c4f8
Add support for lyrics tag unsynced lyrics (#2391)
* Add support for lyrics tag `unsynced_lyrics`

* Update metadata.go

* Update metadata.go

resolve lint issue

* format the code with `goimports`

format the code with `goimports`
2023-06-20 09:32:49 -04:00
dependabot[bot]
1e891d6b07
Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 (#2408)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.15.1...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 14:23:36 -04:00
dependabot[bot]
caf9b22d35
Bump golang.org/x/image from 0.7.0 to 0.8.0 (#2407)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.7.0 to 0.8.0.
- [Commits](https://github.com/golang/image/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 14:23:01 -04:00
Deluan Quintão
4f8742bcd1
Update translations (#2329)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2023-06-19 12:27:56 -04:00
Deluan
26aa0f4fff Fix typo 2023-06-19 11:19:43 -04:00
Deluan
4898f31f6d Add format target to Makefile 2023-06-19 11:15:51 -04:00
Philipp Wolfer
9da013f339
Submit duration to ListenBrainz (#2405) 2023-06-17 12:27:00 -04:00
Deluan
5af67c78af Upgrade Go dependencies 2023-06-16 22:34:02 -04:00
Philipp Wolfer
c8608956be
Fix listenbrainz submission and clarify MusicBrainz recording ID field (#2279)
* Fix MB recording ID parameter name for ListenBrainz submission

This follows the ListenBrainz API documentation.

Fixes #1657

* Rename MediaFile.MbzTrackID to MbzRecordingID

This better reflects the actual data. That the MusicBrainz
recording ID is stored in file metadata as musicbrainz_trackid
is a historical artifact.

* Rename database column mbz_track_id to mbz_recording_id
2023-06-16 18:00:01 -04:00
Deluan
36eda871f6 Fix locale-dependent tests. Closes #2402 2023-06-16 16:38:03 -04:00
David Casado
7c92a73208
Ignore playlists starting with a dot - #2367 (#2390) 2023-06-16 15:55:17 -04:00
Deluan
f5d97823e8 Fix original date (TDOR) mapping for ffmpeg extractor 2023-06-06 19:13:45 -04:00
Deluan
d6083dab6e Re-apply "Refactor walkDirTree to use fs.FS" but remove context cancelation logic.
This reverts commit 6b3b4d83ff.
2023-06-04 15:06:19 -04:00
Deluan
6b3b4d83ff Revert "Refactor walkDirTree to use fs.FS"
This reverts commit 3853c3318f.
2023-06-04 14:13:33 -04:00
Deluan
3853c3318f Refactor walkDirTree to use fs.FS 2023-06-03 22:25:19 -04:00
tomleb
257ccc5f43
Allow configuring cache folder (#2357)
* Set all clients to dev_download for make get-music

* Use multiple TranscodingCache instances in tests

This fixes flaky tests. The issue is that the TranscodingCache object
was being reused in tests from media_stream_Internal_test.go and
media_stream_test.go. If tests from the former was run first, the cache
would be filled up, so that when running tests from the latter, the `NON
seekable` test would fail.

* Allow configuring cache folder

This commit introduces a new configuration option to configure the cache
folder. This allows the cache to be in a separate folder such as
/var/cache/navidrome on Linux distributions.

* Fix tests

* Removed unused test setup code

---------

Co-authored-by: Deluan <deluan@deluan.com>
Co-authored-by: Deluan <deluan@navidrome.org>
2023-06-02 17:14:11 -04:00
Deluan
cec5fb0d6c Fix lint errors 2023-06-02 16:44:12 -04:00
Deluan
3fc4313e89 Move string slice functions to slice package as generic functions 2023-06-02 16:30:20 -04:00
Deluan
c4c99b7f75 Make GroupAlbumReleases false by default 2023-05-31 15:40:20 -04:00
Deluan
a984bbbc7a Make SmartPlaylists to always be seen as changed for Subsonic clients. 2023-05-25 09:14:00 -04:00
Deluan
ba067667c9 Fix date formatting to use UTC 2023-05-24 14:47:51 -04:00
Deluan
e38a690632 Order albums by full original date (this time is for real). Fixes #1452 2023-05-23 09:51:02 -04:00
Deluan
7d0656f44a Order albums by full original date. Fixes #1452 2023-05-22 23:50:16 -04:00
Deluan
11f33ff8b6 Update dependencies 2023-05-22 17:26:49 -04:00
Deluan
611363fca7 Add missing translation 2023-05-20 17:35:09 -04:00
Deluan
85d43d2366 Add tests to date roll-ups 2023-05-19 21:22:23 -04:00
Deluan
8faaa3cf91 Use table specs in getDate tests 2023-05-19 17:03:14 -04:00
Deluan
20462c52a5 Restore album "year" translation string 2023-05-19 15:29:30 -04:00
certuna
52b77e4194
Support for Original Date, Release Date & splitting/grouping of album editions (#2162)
* Update AlbumGridView.js

* Update AlbumDetails.js

* Update AlbumDetails.js

* Create DoubleRangeField.js

* Update and rename DoubleRangeField.js to RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update AlbumGridView.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update index.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update en.json

* Update en.json

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update AlbumGridView.js

* Update AlbumDetails.js

* Update AlbumSongs.js

* Update ContextMenus.js

* Update SongDatagrid.js

* Update AlbumSongs.js

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update AlbumSongs.js

* Update SongList.js

* Update playlist_track_repository.go

* Update 20230113000000_release_year.go

* Update PlayButton.js

* Update mediafile_repository.go

* Update album.go

* Update playlist_track_repository.go

* Update playlist_track_repository.go

* Update SongDatagrid.js

* Update 20230113000000_release_year.go

* Update SongDatagrid.js

* Update AlbumSongs.js

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update AlbumDetails.js

* Update AlbumSongs.js

* Update AlbumSongs.js

* Update RangeFieldDouble.js

* Update SongDatagrid.js

* Update 20230113000000_release_year.go

* Update 20230113000000_release_year.go

* Update 20230113000000_release_year.go

* Update 20230113000000_release_year.go

* Update AlbumSongs.js

* Update AlbumSongs.js

* Update mapping.go

* Update RangeFieldDouble.js

* Update AlbumGridView.js

* Update AlbumSongs.js

* Update en.json

* Update SongDatagrid.js

* Update SongDatagrid.js

* Update metadata.go

* Update mapping.go

* Update AlbumDetails.js

* Update AlbumGridView.js

* Update RangeFieldDouble.js

* Update mapping.go

* Update metadata.go

* Update mapping.go

* Update AlbumDetails.js

* Update 20230113000000_release_year.go

* Update AlbumDetails.js

* Update en.json

* Update configuration.go

* Update mapping.go

* Update configuration.go

* Update mediafile.go

* Update metadata.go

* Update RangeFieldDouble.js

* Update 20230113000000_release_year.go

* Update configuration.go

* Update mapping.go

* Update mediafile.go

* Update mapping.go

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update RangeFieldDouble.js

* Update 20230113000000_release_year.go

* Update AlbumDetails.js

* Update RangeFieldDouble.js

* Update mapping.go

* Update metadata.go

* Update album.go

* Update mediafile.go

* Update mediafile.go

* Update album.go

* Update fields.go

* Update mediafile_repository.go

* Update playlist_track_repository.go

* Update AlbumSongs.js

* Update SongDatagrid.js

* Update PlayButton.js

* Update SongList.js

* Update ContextMenus.js

* Update SongDatagrid.js

* Update metadata.go

* Update ArtistShow.js

* Update mapping.go

* Update configuration.go

* Update mapping.go

* Update metadata.go

* Update metadata.go

* Update mapping.go

* Update metadata.go

* Update metadata.go

* Update mapping.go

* Update 20230113000000_release_year.go

* Update 20230113000000_release_year.go

* Update mapping.go

* Update metadata.go

* Update metadata.go

* Update album.go

* Update mediafile.go

* Update AlbumDetails.js

* Update AlbumSongs.js

* Update album.go

* Update mediafile.go

* Update metadata.go

* Update mediafile.go

* Update 20230113000000_release_year.go

* Update 20230113000000_release_year.go

* Update album.go

* Update mediafile.go

* Update RangeFieldDouble.js

* Update AlbumDetails.js

* Update AlbumGridView.js

* Update en.json

* Update AlbumGridView.js

* Update RangeFieldDouble.js

* Update and rename 20230113000000_release_year.go to 20230113000000_release_date.go

* Update album.go

* Update mediafile.go

* Update fields.go

* Update playlist_track_repository.go

* Update mediafile_repository.go

* Update mapping.go

* Update metadata.go

* Update mapping.go

* Update SongDatagrid.js

* Update RangeFieldDouble.js

* Update index.js

* Update ContextMenus.js

* Update PlayButton.js

* Create FormatDate.js

* Update SongList.js

* Update AlbumDetails.js

* Update AlbumSongs.js

* Update AlbumSongs.js

* Update en.json

* Update AlbumDetails.js

* Update album.go

fixed conflict I think?

* Update mediafile.go

fixed conflict

* Format with goimports

* Update SongDatagrid.js

only show Cat # in desktop view

* Update metadata_internal_test.go

* Update metadata_test.go

* Delete test.mp3

* Add files via upload

mp3 test file with Date, Original Date and Release Date

* Update metadata_test.go

* Update metadata_test.go

* Update metadata_test.go

* Update metadata_test.go

* Update taglib_test.go

* Delete test.mp3

* Add files via upload

file with replaygain & dates

* Update AlbumGridView.js

* Update AlbumDetails.js

* Update AlbumSongs.js

* Update ContextMenus.js

* Update FormatDate.js

* Update PlayButton.js

* Update RangeFieldDouble.js

* Update SongDatagrid.js

* Update AlbumSongs.js

* Update SongDatagrid.js

* Update AlbumSongs.js

* Fix formatting

* Update mapping.go

* Update AlbumSongs.js

* Update SongDatagrid.js

* Update SongDatagrid.js

prettier

* Create RangeDoubleField.js

rename of RangeFieldDouble.js

* Update AlbumGridView.js

RangeFieldDouble -> RangeDoubleField

* Update mediafile.go

AllOrNothing() -> allOrNothing()

* Update metadata_internal_test.go

getYear -> getDate

* Update AlbumDetails.js

wrote suggested changes

* Update en.json

Editions -> Releases & fixed the field name

* Update configuration.go

Rename Editions -> Releases

* Update 20230113000000_release_date.go

Editions -> Releases

* Update album.go

Editions -> Releases

* Update mediafile.go

Editions -> Releases

* Update AlbumDetails.js

Editions -> Releases

* Update AlbumSongs.js

Editions -> Releases

* Update RangeDoubleField.js

Editions -> Releases

* Update SongDatagrid.js

Editions -> Releases

* Update index.js

FormatFullDate and RangeDoubleField

* Rename FormatDate.js to FormatFullDate.js

* Delete RangeFieldDouble.js

* Update mediafile.go

AllOrNothing -> allOrNothing

* Update mapping.go

Editions -> Releases

* Update AlbumDetails.js

prettier

* Update SongDatagrid.js

showReleaseRow -> showReleaseDivider

* Update AlbumSongs.js

showReleaseRow -> showReleaseDivider for clarity

* Update and rename 20230113000000_release_date.go to 20230515184510_add_release_date.go

- rename the migration file
- fixed the import to goose/v3
- additional db fields for original date & year

* Update 20230515184510_add_release_date.go

* Update fields.go

* Update album.go

* Update mediafile.go

* Update mapping.go

* Update AlbumDetails.js

* Update en.json

* Update AlbumDetails.js

* Update AlbumDetails.js

now hopefully prettier

* Update mapping.go

---------

Co-authored-by: Deluan <deluan@navidrome.org>
2023-05-19 15:27:47 -04:00
Deluan
010ba0d15c Use table specs in ReplayGain tests.
Also use test.mp3 file from Release Date PR, trying to fix a conflict.
2023-05-19 14:49:15 -04:00
Zane van Iperen
9b7fac5147
Update default transcoding commands (#2325)
Changes the default transcoding commands to only use the first audio
stream, instead of the first arbitrary stream.

Co-authored-by: Deluan Quintão <deluan@navidrome.org>
2023-05-19 10:49:29 -04:00
Deluan
be12c12b28 Remove unused Badge component from ActivityPanel icon 2023-05-17 16:29:19 -04:00
Kendall Garner
a19a643c65
Manually add replaygain tags for m4a (#2346)
* manually add replaygain tags for m4a

* Add replaygain tests for m4a, mp4, ogg

* add new valye for bitrate
2023-05-17 16:00:16 -04:00
Deluan
f9b060af18 Removed onBackdropClick deprecated property 2023-05-17 15:48:22 -04:00
Deluan
a3d78e95f2 Fix Monokai theme. Closes #2353 2023-05-17 15:36:30 -04:00
Deluan
d85b06332c Fix build 2023-05-17 13:49:45 -04:00
Deluan
bfa10cab62 Upgrade to Node v18 2023-05-17 13:41:36 -04:00
Deluan
08fcb430e6 Upgrade React-Admin to 3.19.12 2023-05-17 13:18:58 -04:00
Deluan
5d02df62d0 Fix eslint error 2023-05-17 11:57:43 -04:00
Deluan
c3a2e084b3 Update caniuse-lite 2023-05-17 11:54:22 -04:00
Deluan
4296741ec0 Simplify EventStream handling 2023-05-17 11:53:09 -04:00
Deluan
6bee4ed147 Sanitize filenames inside zip files. Fixes #1763 2023-05-16 18:34:15 -04:00
Deluan
e62c3edc1c Revert: Change fix formatting command 2023-05-16 12:34:09 -04:00
Deluan
0a08d0af3b Change fix formatting command 2023-05-16 12:31:09 -04:00
Deluan
ad513354b9 Disable POEditor import job in forks 2023-05-16 10:33:06 -04:00
dependabot[bot]
a70b81f931
Bump github.com/onsi/ginkgo/v2 from 2.9.4 to 2.9.5 (#2352)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.9.4 to 2.9.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.9.4...v2.9.5)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 15:12:31 -04:00
dependabot[bot]
0d920c7832
Bump github.com/prometheus/client_golang from 1.14.0 to 1.15.1 (#2342)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.14.0 to 1.15.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.14.0...v1.15.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:34:11 -04:00
dependabot[bot]
957a73e052
Bump github.com/mileusna/useragent from 1.2.1 to 1.3.2 (#2319)
Bumps [github.com/mileusna/useragent](https://github.com/mileusna/useragent) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/mileusna/useragent/releases)
- [Commits](https://github.com/mileusna/useragent/compare/v1.2.1...v1.3.2)

---
updated-dependencies:
- dependency-name: github.com/mileusna/useragent
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:32:01 -04:00
dependabot[bot]
abc418eaa2
Bump github.com/onsi/ginkgo/v2 from 2.9.2 to 2.9.4 (#2343)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.9.2 to 2.9.4.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.9.2...v2.9.4)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:28:27 -04:00
dependabot[bot]
1128322011
Bump golang.org/x/tools from 0.8.0 to 0.9.1 (#2350)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.8.0 to 0.9.1.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.8.0...v0.9.1)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:28:05 -04:00
dependabot[bot]
2e479defd5
Bump github.com/go-chi/httprate from 0.7.1 to 0.7.4 (#2320)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.7.1 to 0.7.4.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.7.1...v0.7.4)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:24:37 -04:00
dependabot[bot]
8311a7f215
Bump golang.org/x/sync from 0.1.0 to 0.2.0 (#2344)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.1.0 to 0.2.0.
- [Commits](https://github.com/golang/sync/compare/v0.1.0...v0.2.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:23:40 -04:00
dependabot[bot]
6ec8f78076
Bump github.com/pressly/goose/v3 from 3.10.0 to 3.11.2 (#2341)
Bumps [github.com/pressly/goose/v3](https://github.com/pressly/goose) from 3.10.0 to 3.11.2.
- [Release notes](https://github.com/pressly/goose/releases)
- [Changelog](https://github.com/pressly/goose/blob/master/.goreleaser.yml)
- [Commits](https://github.com/pressly/goose/compare/v3.10.0...v3.11.2)

---
updated-dependencies:
- dependency-name: github.com/pressly/goose/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 14:23:17 -04:00
Logan Marchione
3e879d2a8c
Add K8s manifest (#2330)
* Add K8s manifest

* Update README.md
2023-04-29 16:14:44 -04:00
Jeff Henson
6d3d005fca
Allow the setrlimit syscall - #1961 (#2333)
This appears to be used by newer go versions and navidrome fails to
start unless it's allowed.

Signed-off-by: Jeff Henson <jeff@henson.io>
2023-04-27 21:30:43 -04:00
Deluan
c12510d6e2 Update README 2023-04-11 14:00:44 -04:00
Deluan
0bd73bd3f4 Better GH Action names 2023-04-11 09:16:25 -04:00
Deluan
8c120ee3c9 Better GH Action names 2023-04-11 09:15:08 -04:00
Deluan
9590b3c25d Use the highest resolution artist image from Spotify 2023-04-10 15:34:22 -04:00
Deluan
4887c33053 Bump golang.org/x packages 2023-04-10 14:07:12 -04:00
Subhajit Ghosh
da21acba92
Give page the right lang attribute (#2299)
* Fixed issue no #2174

Signed-off-by: Subhajit Ghosh <subhajitstd07@gmail.com>

* Fixed issue no #2174

---------

Signed-off-by: Subhajit Ghosh <subhajitstd07@gmail.com>
2023-04-08 13:39:59 -04:00
Deluan Quintão
9154e44eb4
Add initial support for OpenSubsonic. (#2302) 2023-04-08 13:25:37 -04:00
Deluan Quintão
2e01063429
Update translations (#2198)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2023-04-06 22:09:49 -04:00
Deluan
597e5abed6 Fix push develop to Docker Hub 2023-04-06 20:11:35 -04:00
Deluan Quintão
92994efe48
Publish docker images to ghcr.io (#2298)
* Publish all images (including PRs) to GHCR, only releases and `develop` to Docker Hub
2023-04-06 19:53:31 -04:00
Deluan
9628b1389d Add help msg for JS formatting errors 2023-04-06 11:45:32 -04:00
Deluan
347424009d Show Player name, not client, in mobile view. Fix #1659. 2023-04-05 22:48:33 -04:00
Deluan
ecac74c2bd Fix getSongsByGenre pagination. Fix #1640 2023-04-05 22:39:32 -04:00
Deluan
ddfde7bfc8 Run lint on latest Go 1.20.x 2023-04-04 19:13:24 -04:00
Deluan
96c50d369a Upgrade to Go 1.20.3 and GoRelease 1.16.1 2023-04-04 19:10:03 -04:00
Deluan
310c816cdd Use Go 1.20 for local cross-compilation 2023-04-04 15:33:42 -04:00
Deluan
bd402fb2a8 Fix IntelliJ warning 2023-04-04 13:01:32 -04:00
dependabot[bot]
8bb141b730
Bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (#2293)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 11:04:18 -04:00
Deluan
f25b91b4d8 Remove any previous UNIX socket file 2023-04-04 11:03:37 -04:00
dependabot[bot]
f959701d9d
Bump github.com/onsi/gomega from 1.27.5 to 1.27.6 (#2292)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.5 to 1.27.6.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.5...v1.27.6)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-04 10:55:36 -04:00
Deluan
61dd8d55ca Fix data race in scanner 2023-04-04 10:51:43 -04:00
Deluan
bbb9461000 Increase max Server-Sent Events' ID 2023-04-04 10:46:57 -04:00
Deluan
95016f687e Fix SQL migrations 2023-04-04 10:45:55 -04:00
Deluan
c3cc7dee01 Enable SQL migrations 2023-04-04 10:30:28 -04:00
Deluan
7847f19c9d Upgrade goose 2023-04-04 10:05:31 -04:00
dependabot[bot]
7a0df4429e
Bump github.com/onsi/gomega from 1.27.5 to 1.27.6 (#2288)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.5 to 1.27.6.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.5...v1.27.6)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 21:01:39 -04:00
Deluan
6a8d2dc87d Only use valid images for artist.* artwork 2023-04-03 18:07:15 -04:00
Deluan
de816e8e5d Fix lint error 2023-04-03 11:15:46 -04:00
Deluan
b22d0366d5 Use channels for EventStream instead of diodes 2023-04-03 10:51:24 -04:00
Deluan
fea2de8f90 Add Galician translation. 2023-04-02 18:58:44 -04:00
Deluan
d6dd0aaae7 Close SSE connection on write error 2023-04-02 18:40:58 -04:00
Fadeeeeeeee
458017b112
Update Chinese translations (#2260)
* Update Chinese translations

* Update Chinese translations

* Update Chinese translations
2023-04-02 18:40:48 -04:00
Deluan
e6bfa2bb0b Convert our usage of go-diodes into a simplified, generic version 2023-04-01 21:53:45 -04:00
Deluan
1c7fb74a1d Fix writeEvents race condition.
This required removing the compress middleware from the /events route.
2023-04-01 20:54:15 -04:00
Deluan
83ae2ba3e6 Fix race condition 2023-04-01 18:40:37 -04:00
Joakim Repomaa
2ccc5bc941
Implement artist art priority (#2266)
* implement artist art priority

* add tests
2023-03-30 18:28:05 -04:00
Deluan
406554f1c4 Remove some tools from dependencies, reducing the modules dependencies 2023-03-30 15:33:47 -04:00
Deluan
e89cdf6199 Fix flaky tests 2023-03-30 09:25:18 -04:00
Deluan
cf804a52ef Add support for listening on Unix socket.
For that to work, specify the config option `Address` with `unix:/path/to/socket/file`.

Closes #1477
2023-03-29 16:05:59 -04:00
Deluan
628fd69d3d Fix race condition 2023-03-29 15:17:34 -04:00
Deluan
1d00d1e986 Fix writeEvent function.
It would not send anything if the `ResponseWriter` was not a `http.Flusher`, and it was leaking channels with `time.After`
2023-03-29 15:04:40 -04:00
Deluan
607c4067b8 Show translation changes on pipeline 2023-03-29 13:03:37 -04:00
Deluan
e3079d81ea More tests 2023-03-27 20:36:23 -04:00
Deluan
3bedd89c17 Bump dependencies 2023-03-27 14:48:20 -04:00
dependabot[bot]
57829bfa4c
Bump github.com/lestrrat-go/jwx/v2 from 2.0.8 to 2.0.9 (#2282)
Bumps [github.com/lestrrat-go/jwx/v2](https://github.com/lestrrat-go/jwx) from 2.0.8 to 2.0.9.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/develop/v2/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v2.0.8...v2.0.9)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-27 14:47:32 -04:00
Deluan
b998c05ca0 Some refactorings 2023-03-26 21:28:37 -04:00
Deluan
05d381c26f Add more middleware tests 2023-03-26 21:28:36 -04:00
zayedalsaidi
59a9c056b4
Add Arabic translation (#2277) 2023-03-26 19:56:59 -04:00
Deluan
0de81b8352 Bump caniuse-lite 2023-03-26 19:38:09 -04:00
Deluan
91785ecf36 Add tests for core.Archiver 2023-03-26 19:34:12 -04:00
Deluan
65eeb5ec1a Add tests for serverAddressMiddleware 2023-03-26 13:29:57 -04:00
Julien Voisin
17e0cd5504
Shuffle the tests, just in case (#2272) 2023-03-22 20:12:12 -04:00
Deluan
3a6d2dcd49 More log redaction 2023-03-21 11:16:00 -04:00
Deluan
183b462fed Fix zip comments in Share downloads. 2023-03-21 10:34:04 -04:00
Deluan
16fc4eb792 Fix missing extensions in Share downloads.
See https://github.com/navidrome/navidrome/pull/2246#issuecomment-1476996397
2023-03-21 10:31:00 -04:00
dependabot[bot]
6fee744d99
Bump github.com/onsi/gomega from 1.27.3 to 1.27.4 (#2268)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.3 to 1.27.4.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.3...v1.27.4)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-20 14:15:32 -04:00
dependabot[bot]
74d5c7bc82
Bump github.com/golangci/golangci-lint from 1.51.2 to 1.52.0 (#2270)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.51.2 to 1.52.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.51.2...v1.52.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-20 14:15:18 -04:00
dependabot[bot]
880fc9e195
Bump github.com/Masterminds/squirrel from 1.5.3 to 1.5.4 (#2269)
Bumps [github.com/Masterminds/squirrel](https://github.com/Masterminds/squirrel) from 1.5.3 to 1.5.4.
- [Release notes](https://github.com/Masterminds/squirrel/releases)
- [Commits](https://github.com/Masterminds/squirrel/compare/v1.5.3...v1.5.4)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/squirrel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-20 14:15:01 -04:00
Xidorn Quan
1430aa108d
Update play_date on scrobble only when newer - #2262 (#2263)
* fix(persistence): Update play_date on scrobble only when newer - #2262

Signed-off-by: Xidorn Quan <me@upsuper.org>

* expand iff

---------

Signed-off-by: Xidorn Quan <me@upsuper.org>
2023-03-18 18:28:01 -04:00
Deluan
673880d661 Add option to load TLS cert/key, and use HTTPS 2023-03-17 16:32:13 -04:00
Deluan
7ea111322b Don't pump the volume up to 100% if it is not in a mobile device. Fix #2255
This detection method is not bullet-proof, but should work for now.

Ref: https://stackoverflow.com/a/3540295
2023-03-16 17:25:07 -04:00
Deluan
377e7ebd52 Disable share downloading when EnableDownloads is false.
Fixes https://github.com/navidrome/navidrome/pull/2246#issuecomment-1472341635
2023-03-16 13:11:26 -04:00
Deluan
23c483da10 Only freezes issues/prs after 120 days 2023-03-15 17:53:54 -04:00
Deluan
c380139606 Fix lint 2023-03-15 13:10:14 -04:00
Deluan
63fbccf5a9 Enable memory profiling 2023-03-15 12:43:25 -04:00
Deluan
1f6ec1d9f5 Add pprof endpoint, disabled by default 2023-03-15 10:56:16 -04:00
dependabot[bot]
cad8156353
Bump webpack from 5.74.0 to 5.76.1 in /ui (#2256)
Bumps [webpack](https://github.com/webpack/webpack) from 5.74.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.74.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 09:13:22 -04:00
Deluan Quintão
f7d4fcdcc1
Convert all Subsonic API ints to int32 as per specification (#2252)
* Fix Genre

* Fix ArtistID3

* Fix AlbumID3

* Fix Child

* Fix NowPlayingEntry

* Fix Playlist

* Fix Share

* Fix User

* Fix Artist

* Fix Directory

* Fix Error
2023-03-14 09:48:52 -04:00
Deluan Quintão
002cb4ed71
Update README.md 2023-03-13 19:34:47 -04:00
Deluan Quintão
e13eaebbde
Update README.md 2023-03-13 19:32:13 -04:00
dependabot[bot]
539c0faedb
Bump github.com/onsi/ginkgo/v2 from 2.9.0 to 2.9.1 (#2251)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.9.0 to 2.9.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.9.0...v2.9.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 14:42:40 -04:00
Moink
4ccb6ccb09
Update Chinese translations (#2250) 2023-03-12 20:24:31 -04:00
Deluan
ec0eb2866b Hide Love button on Artist Page when EnableFavourites=false. Fix #2245 2023-03-10 23:34:02 -05:00
Deluan
b520d8827a Add download button in the SharePlayer 2023-03-10 23:33:29 -05:00
Deluan
a7d3e6e1f1 Add option to allow share to be downloaded 2023-03-10 23:33:29 -05:00
Deluan
a22eef39f7 Add share download endpoint 2023-03-10 23:33:29 -05:00
Torsten Curdt
50d9838652
Add docker compose examples, with traefik or caddy and without, fixes #476 (#2240)
* add docker compose examples, with traefik or caddy and without, fixes #476

* ignore the docker-compose in root, but not the one in contrib
2023-03-10 18:57:09 -05:00
Deluan
016454c217 Bump golangci-lint version 2023-03-10 17:46:05 -05:00
Deluan
41a5db72e7 Update more dependencies 2023-03-10 17:31:13 -05:00
Deluan
6e6ec58429 Update sanitize and golang.org/x dependencies 2023-03-10 17:21:08 -05:00
Deluan
c88e1baa7c Make playlist tracks match case-insensitive. Fix #1720 2023-03-10 12:29:38 -05:00
Deluan
e16e3d2e7b Fix pipeline. 2023-03-09 22:25:56 -05:00
Deluan
339a6239fd Ignore Recycle Bins in Windows. Fix #1074 2023-03-09 22:14:58 -05:00
Deluan
47f15ccbc3 Make AlbumArtists clickable in AlbumSongs view. Fixes #1627 2023-03-09 18:04:07 -05:00
Deluan
9667f3cd48 Add file path to toggleable columns in SongList view. Fix #1719 2023-03-09 17:47:20 -05:00
Deluan
5773fa0349 Fix discussions links 2023-03-08 14:14:42 -05:00
Deluan
527c378c41 Add feature request link to About dialog 2023-03-08 12:41:51 -05:00
Deluan
caa0788853 Fine tune issue templates 2023-03-08 12:27:28 -05:00
Deluan
40b14e6d81 Add log-output to lock-threads bot 2023-03-06 20:12:46 -05:00
Deluan
becd50eb68 Remove debug-only option from stale bot 2023-03-06 20:08:02 -05:00
Deluan
15b5aa9143 Add stale/lock-threads bot 2023-03-06 20:01:42 -05:00
Deluan
7987d982cf Fix pipeline's lint error message 2023-03-06 19:38:20 -05:00
Deluan
1dd074bbb4 Add new issue templates 2023-03-06 17:15:36 -05:00
Deluan
7eac9d2bbe Bump dependencies 2023-03-05 21:09:45 -05:00
dependabot[bot]
362d8c50fe
Bump github.com/onsi/gomega from 1.26.0 to 1.27.1 (#2204)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.26.0 to 1.27.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.26.0...v1.27.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-05 20:25:16 -05:00
dependabot[bot]
01c604ba7b
Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (#2216)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-05 20:23:36 -05:00
dependabot[bot]
2c129a2890
Bump golang.org/x/image from 0.0.0-20191009234506-e7c1f5e7dbb8 to 0.5.0 (#2217)
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.0.0-20191009234506-e7c1f5e7dbb8 to 0.5.0.
- [Release notes](https://github.com/golang/image/releases)
- [Commits](https://github.com/golang/image/commits/v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-05 20:23:04 -05:00
Deluan
5fc4076aec Fix translation key 2023-02-16 21:05:11 -05:00
Deluan
d303ad2676 Bump dependencies 2023-02-15 22:46:56 -05:00
Deluan
c4a68c8a0a Fix build pipeline 2023-02-15 22:27:16 -05:00
Deluan
ad9ce98cc2 Use GoLang 1.20.1 in pipeline 2023-02-15 22:21:50 -05:00
Deluan
a134b1b608 Use sync/atomic package, now that we are at Go 1.19 2023-02-15 21:21:59 -05:00
Deluan
6dce4b2478 Remove custom atomic.Bool, we are now at Go 1.19 2023-02-15 21:18:24 -05:00
Deluan
10108c63c9 Allow BaseURL to contain full server url, including scheme and host. Fix #2183 2023-02-15 21:13:38 -05:00
Deluan
aac6e2cb07 Add path to cookies. Fix #1580 2023-02-15 20:23:32 -05:00
Deluan
0ffdb2eee0 Bump minimum Go version to 1.19 2023-02-15 20:20:08 -05:00
Kendall Garner
8b93962fad
Limit share size while handling theme properly (#2171)
* limit player to 768 px

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>

* fix size limitation

---------

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2023-02-13 20:00:39 -05:00
Kendall Garner
b129cae0d8
Only create context if gain mode active (#2173) 2023-02-13 19:57:23 -05:00
Deluan
2400e4f60d Fix DB migration. Fix #2168 2023-02-12 14:58:33 -05:00
Deluan Quintão
3cd934abd7
Update translations (#2159)
Co-authored-by: deluan <deluan@users.noreply.github.com>
2023-02-11 20:25:01 -05:00
Deluan
727632b616 Refactor play tracking 2023-02-11 18:52:28 -05:00
Kendall Garner
9e268678f2
Limit Share player to 768 px (#2164)
Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2023-02-11 12:38:35 -05:00
RTapeLoadingError
bb29ad3b12
Update Spanish translation (#2165)
Updated some empty fields.
2023-02-11 12:33:59 -05:00
Deluan
b68ed2e4f9 Fix album's image_files 2023-02-09 18:29:08 -05:00
Deluan
0c3ac906b8 Enable ReplayGain by default and always import RG tags 2023-02-09 17:45:38 -05:00
Deluan
b0e58cb885 Use Navidrome's own public images endpoint for getAlbumInfo's imageURLs 2023-02-08 20:03:31 -05:00
Deluan
806713719f Add lastUpdated to coverArt ids. Helps with invalidating art cache client-side. 2023-02-08 20:03:31 -05:00
Deluan
a3b8682d44 Fix polling of buffered scrobbles 2023-02-07 19:18:26 -05:00
Deluan
0bbb54934b Use Go 1.20 in pipeline, drop support for 1.18 2023-02-07 14:28:02 -05:00
Deluan
759ff844e2 Make ffmpeg path configurable, also finds it automatically in current folder. Fixes #1932 2023-02-07 13:46:09 -05:00
Deluan
b8c5e49dd3 Close stream when downloading files, fix fd leak 2023-02-07 09:58:50 -05:00
Deluan
05c6cdea1a Don't cancel transcoding session if context is canceled 2023-02-07 09:58:50 -05:00
Daniel Hammer
fc8462dc8a
"Spell-Jacking" mitigation ~ prevent sensitive data leak from spell checker. (#2091)
@see https://www.otto-js.com/news/article/chrome-and-edge-enhanced-spellcheck-features-expose-pii-even-your-passwords

Co-authored-by: Daniel Hammer <daniel.hammer+oss@gmail.com>
2023-02-06 16:29:28 -05:00
Deluan
9d459fbd0a Abort start-up if config file is invalid 2023-02-06 13:00:07 -05:00
Deluan
9b2dd1bb06 Fix playlist delete and reorder actions 2023-02-06 10:41:33 -05:00
Deluan
bfaf4a3388 Add logs to cache hunter 2023-02-06 10:41:33 -05:00
Deluan
a7f15facf9 Bump github.com/golangci/golangci-lint to 1.51.1 2023-02-06 10:41:33 -05:00
Deluan
ee8f6447eb Add option to disable Cache Warmer. Related to #2142 2023-02-06 10:41:33 -05:00
Deluan
dad4949a6d Refactor Subsonic search to make it a bit more readable 2023-02-05 00:58:34 -05:00
Deluan
3ce3185118 Don't retrieve Various Artists and Unknown Artist info from Last.fm 2023-02-04 21:18:51 -05:00
Deluan
a50d9c8b67 Use the latest sanitize, to fix some diacritics 2023-02-04 19:09:14 -05:00
Kendall Garner
f8dfb3ad86
Clearer lyrics in Nord theme (#2146) 2023-02-04 13:02:15 -05:00
Deluan
255f8e4a76 Update react-player, fix #2117 2023-02-04 12:49:47 -05:00
Deluan
eba70ab826 Change throttling log messages 2023-02-04 12:37:47 -05:00
Deluan
ee6b10db72 Replace custom code with errgroup 2023-02-04 12:37:47 -05:00
Deluan
797cc87141 Enqueue external metadata refreshes 2023-02-04 12:37:47 -05:00
dependabot[bot]
bfbe980637
Bump http-cache-semantics from 4.1.0 to 4.1.1 in /ui (#2139)
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/commits)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-03 16:33:50 -05:00
Deluan
d9d0a97674 Better log message 2023-02-03 11:35:10 -05:00
Deluan
c031167bb1 Don't retrieve all artist external metadata if we just want artist images 2023-02-03 11:06:53 -05:00
Deluan
4a25e6d3d8 Fix Mapped Similar Artists log 2023-02-03 09:57:29 -05:00
Deluan
ad2ad514b3 Add dev option to increase external metadata cache expiration. More logs 2023-02-02 16:55:12 -05:00
Deluan
588ee94f7c Discard request for image canceled by the client before any further processing 2023-02-02 14:55:07 -05:00
Deluan
3c5032a3e8 Add migration to rebuild albums paths 2023-02-02 14:42:01 -05:00
Deluan
bcab3cc0f9 Add throttling to /share/img endpoint.
See: https://github.com/navidrome/navidrome/issues/2130#issuecomment-1414152343
2023-02-02 13:59:04 -05:00
Deluan
9b81aa4403 Fix artwork resolution when paths contains :. Fix #2137 2023-02-02 12:18:55 -05:00
Deluan
f904784e67 Bump dependencies 2023-02-02 11:20:52 -05:00
Deluan
0ce750d469 Update golangci-lint and fix lint errors 2023-02-02 11:10:28 -05:00
Deluan
cf04db7a98 Don't try to connect to external services if artist is Unknown 2023-02-02 10:57:37 -05:00
Deluan
f4b50c493c When retrieving images from external sources, avoid calling it again if data is already cached locally.
Relates to https://github.com/navidrome/navidrome/issues/2130#issuecomment-1412742918
2023-02-02 10:38:17 -05:00
Deluan
4a7e86e989 Fix file descriptor leaking. 2023-02-02 10:36:49 -05:00
vlfldr
a1a5b2fc30
Fix invisible checkboxes in Gruvbox theme (#2135)
* Added Gruvbox Dark color theme

* Correct formatting by running prettier

* Fixed invisible checkboxes and tweaked colors in Gruvbox theme
2023-02-01 13:33:55 -05:00
Deluan
f00e6117ff Invalidate artist cache (by changing cache key format) 2023-02-01 10:34:55 -05:00
Deluan
d8e794317f Return 404 when artwork is not available in /share/img endpoint 2023-02-01 10:34:02 -05:00
Deluan
128b626ec9 Add option to change max playlists shown in UI's sidebar, MaxSidebarPlaylists. Fix #2077 2023-02-01 10:25:25 -05:00
Deluan
d683297fa7 Better behaviour of Prev/Next buttons when share has only one song:
- Allow Prev to restart the song
- Disable Next
2023-01-31 21:27:47 -05:00
Deluan
aaf58bbd32 Handle nil pointer dereference. Fix #2133 2023-01-31 20:54:15 -05:00
deluan
58c46827cd Update translations 2023-01-31 10:05:55 -05:00
Deluan
712d8f9fcc Add trace logs to calls to external services 2023-01-31 09:37:09 -05:00
Deluan
b6fcfa9fc8 Add a fallback when the browser does not support copying the share link to clipboard (not a secure origin)
See: https://stackoverflow.com/a/51823007
2023-01-30 12:09:01 -05:00
Deluan
762a1ba998 Fix downloading and sharing from a playlist. Fix #2123 2023-01-30 11:20:22 -05:00
deluan
25374b3bbe Update translations 2023-01-30 08:42:01 -05:00
Deluan
68e6115789 Rename DevEnableShare to EnableSharing 2023-01-29 20:33:10 -05:00
Deluan
a651d65a5b Add a comment to the generated zip 2023-01-29 17:08:18 -05:00
Deluan
dc56c52557 Refactor zip archiver.
Add `disc` to path when downloading albums. Fix #2121
2023-01-29 15:25:20 -05:00
Deluan
5163df6531 Rollback changes to Chinese translations
Were not updated in POEditor
2023-01-27 11:09:42 -05:00
deluan
fc693e5601 Update translations 2023-01-27 11:00:43 -05:00
Deluan
731bd7ee73 Fix update translations job 2023-01-27 10:26:03 -05:00
Deluan
9f684e5a69 Add job to create translations PRs 2023-01-27 10:15:04 -05:00
Deluan
e2ea5eba8c Disable creation of shares when feature is disabled.
Fix https://github.com/navidrome/navidrome/pull/2106#issuecomment-1404731388
2023-01-26 10:12:52 -05:00
Deluan Quintão
b825d3cfac
Fix versioning releases in the pipeline (#2101)
* Revert "Disable buildvcs flag"

This reverts commit 1374dab087.

* Config /github/workspace folder as trusted
2023-01-25 15:35:01 -05:00
Deluan
1950c07b1d Disable external links when EnableExternalServices is false. Fix #2022 2023-01-25 10:28:03 -05:00
Deluan
e0fc997adb Fix Share dialog titles for Album and Playlist 2023-01-25 10:20:28 -05:00
Deluan
5eefb265e5 Simplify radio CRUD code 2023-01-25 10:03:55 -05:00
paradajz
39161fdf47
Playlist view: optionally show comment column (#2073)
* playlist view: optionally show genre and comment columns

* Remove genre from Playlist columns, as it is not a valid attribute of playlist

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-24 21:15:41 -05:00
selfhoster1312
1e24809ed6
Create accounts automatically when authenticating from HTTP header (#2087)
* Create accounts automatically when authenticating from HTTP header

* Disable password check when header auth is enabled

* Formatting

* Password change is valid when no password (old or new) is provided

* Test suite runs with header auth disabled (mock config)
Prevents nil pointer access (panic) while testing password validating logic

* Use a constant prefix for autogenerated passwords (header auth case)

* Add tests

* Add context to log messages

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-24 20:18:10 -05:00
Deluan
9721ef8974 Fix download translation key 2023-01-24 20:14:51 -05:00
Deluan
16850a9be0 Revert "Replace the LoveButton with ArtistContextMenu in the artist page - #1979"
see https://github.com/navidrome/navidrome/issues/1979#issuecomment-1402904870
2023-01-24 20:14:51 -05:00
Aleksey Lobanov
457e1fc97b
Base SQL metrics in MetricsWorker (#2002)
* feat: Add metrics worker

* refactor: Add todos for useful for metrics methods

* feat: Run MetricsWorker is Prometheus is Enabled

* refactor: Unused low-level variable was removed in metrics

* feat: No worker for metrics, add more

* refactor: Unnecessary todo removed

* refactor: Remove dead unused constant

* Reduce metrics public interface

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-24 19:26:07 -05:00
Deluan
d31faf5249 Bump github.com/onsi/gomega from 1.25.0 to 1.26.0 2023-01-24 19:04:33 -05:00
Deluan
2082948144 Fix downloadOriginalFormat term in English translation 2023-01-24 18:41:43 -05:00
Deluan
39dc9c4310 Disable Subsonic Share endpoints if feature is disabled 2023-01-24 18:36:47 -05:00
Deluan
0c263cf234 Make AlbumSongs BulkActionsToolbar more responsive 2023-01-24 18:36:47 -05:00
Deluan
85084cda57 Add button to share selected songs 2023-01-24 18:36:47 -05:00
Deluan
69b36c75a5 Add meta tags to show cover and share description in social platforms 2023-01-24 18:36:47 -05:00
Deluan
cab43c89e6 Mark Share.LastVisited optional in Subsonic API 2023-01-24 18:36:47 -05:00
Deluan
433da37982 Add Share to Context menus, also share artist 2023-01-24 18:36:47 -05:00
Deluan
051e9c556d Use redux for ShareDialog 2023-01-24 18:36:47 -05:00
Deluan
17d9573f4d Refactor dialogs, make it simple to add a new dialog to all views 2023-01-24 18:36:47 -05:00
Deluan
26be5b8396 Keep order of shared mediafiles 2023-01-24 18:36:47 -05:00
Deluan
c770229154 Add Share capability to Subsonic user's info 2023-01-24 18:36:47 -05:00
Deluan
ef4765c768 Fix getShares sort order 2023-01-24 18:36:47 -05:00
Deluan
6c05fcb699 Create contents label for group of shared mediafiles 2023-01-24 18:36:47 -05:00
Deluan
63e67bd502 Make Share list responsive 2023-01-24 18:36:47 -05:00
Deluan
230f2fdc02 Reduce spacing between album buttons, to avoid breaking the toolbar in two 2023-01-24 18:36:47 -05:00
Deluan
d639da9eb5 Enable sharing only selected songs with the Subsonic API 2023-01-24 18:36:47 -05:00
Deluan
e34f26588e Fix empty entry collection in Shares 2023-01-24 18:36:47 -05:00
Deluan
c994ed70ea Fix expireAt update error 2023-01-24 18:36:46 -05:00
Deluan
40cac5c367 Fix JS console warning 2023-01-24 18:36:46 -05:00
Deluan
34277f238c Make Share icon dynamic 2023-01-24 18:36:46 -05:00
Deluan
dbf80d8592 Change public/share path to /share - DSub does not use the URL from the API response... :( 2023-01-24 18:36:46 -05:00
Deluan
d5df102f9f Implement updateShare and deleteShare Subsonic endpoints 2023-01-24 18:36:46 -05:00
Deluan
20271df4fb Workaround to detect empty dates in some Subsonic clients 2023-01-24 18:36:46 -05:00
Deluan
d4c1d2ece4 Handle expired shares 2023-01-24 18:36:46 -05:00
Deluan
d0dceae094 Add getShares and createShare Subsonic endpoints 2023-01-24 18:36:46 -05:00
Deluan
94cc2b2ac5 Fix tests and lint errors, plus a bit of refactor 2023-01-24 18:36:46 -05:00
Deluan
72a12e344e More share translations 2023-01-24 18:36:46 -05:00
Deluan
12bb6c3847 Don't expose empty dates in share info 2023-01-24 18:36:46 -05:00
Deluan
58fc271864 Share playlists 2023-01-24 18:36:46 -05:00
Deluan
65174d3fb2 Refactor DownloadMenuDialog to use useTranscodingOptions hook 2023-01-24 18:36:46 -05:00
Deluan
c8293fcdd8 Extract transcoding options to its own hook 2023-01-24 18:36:46 -05:00
Deluan
d9c42b3183 Add share's contents and description to the DB 2023-01-24 18:36:46 -05:00
Deluan
364fdfbd8d Use defaultDownsamplingFormat in share options 2023-01-24 18:36:45 -05:00
Deluan
63b4a12a93 Fine tune SharePlayer 2023-01-24 18:36:45 -05:00
Deluan
357c0e1e19 Refactor URL builders in UI 2023-01-24 18:36:45 -05:00
Deluan
84aa094e56 More work on Shares 2023-01-24 18:36:45 -05:00
Deluan
ab04e33da6 Initial work on Shares 2023-01-24 18:36:45 -05:00
Kendall Garner
5331de17c2
Fixes the slide bar clickable area (#2113) 2023-01-24 11:15:14 -05:00
dependabot[bot]
199f66b8de
Bump @testing-library/react from 12.1.2 to 12.1.5 in /ui (#2109)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 12.1.2 to 12.1.5.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v12.1.2...v12.1.5)

---
updated-dependencies:
- dependency-name: "@testing-library/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 12:19:47 -05:00
dependabot[bot]
535171faf8
Bump github.com/onsi/gomega from 1.24.2 to 1.25.0 (#2111)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.24.2 to 1.25.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.24.2...v1.25.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 12:19:21 -05:00
dependabot[bot]
bee39ad28e
Bump github.com/spf13/viper from 1.14.0 to 1.15.0 (#2110)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 12:18:51 -05:00
Kendall Garner
2de570fe72
Fix order of gain menu options (#2105) 2023-01-22 11:08:54 -05:00
Deluan
33f033beba Fix artist image not caching on browser 2023-01-20 21:28:44 -05:00
Deluan
b9934799ec Increase size of artist image 2023-01-20 20:55:17 -05:00
Deluan
adea15ab93 Use constant 2023-01-20 16:01:16 -05:00
Corrado Primier
0c27e7a43b
Fix Illumos build - #2067 (#2069)
Build currently fails on Illumos with error `Undefined symbol sendfile`. Fix it by linking `sendfile` explicitly.
2023-01-19 12:52:01 -05:00
Deluan
8956f5e7fd Fix Album.MaxYear calculation 2023-01-19 09:34:58 -05:00
Deluan
7073d18b54 Make private methods unpublished 2023-01-19 09:34:39 -05:00
Deluan
7fc964aec5 Don't wake CacheWarmer every 10 seconds, let it sleep :) 2023-01-18 19:31:15 -05:00
Deluan
136d5f9a83 Add config option to show album participations under artists in Subsonic clients 2023-01-18 14:20:06 -05:00
vlfldr
8ae0bcb459
Add Gruvbox Dark color theme (#2092)
* Added Gruvbox Dark color theme

* Correct formatting by running prettier
2023-01-18 13:23:36 -05:00
Deluan
127c75e34b Don't try to downsample if requested bitrate is equal or greater than original. Fix #2066 2023-01-18 13:20:51 -05:00
Deluan
d5c9cf07bd Fix Playlist show 2023-01-18 09:43:07 -05:00
Deluan
701e301d48 Increase timeout for obtaining login background image list 2023-01-17 22:57:14 -05:00
Deluan
580e9ae4bd Fix timer going awry 2023-01-17 22:04:09 -05:00
Zane van Iperen
feb774a149
Change genre.Put() to upsert. Fix #1918 and #1564 (#1920)
* persistence/genre: change Put() to upsert

Absolutely disgusting hack to work around [1]. Try to insert the genre,
but if it conflicts, ignore it and update the genre with the existing
ID.

[1]: https://github.com/navidrome/navidrome/issues/1918.

* scanner: remove cached genre repository

Not needed anytmore. And remember:

  "Many Small Queries Are Efficient In SQLite" [1].

[1]: https://www.sqlite.org/np1queryprob.html

* Revert "scanner: remove cached genre repository"

This reverts commit c5d900aa43.

* Use squirrel to build SQL, to reduce risk of SQL injection

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-17 21:04:18 -05:00
Deluan
17eab6a88d Fix resized image cache key 2023-01-17 20:58:38 -05:00
Deluan
bedd2b2074 Implement better artwork cache keys 2023-01-17 20:37:10 -05:00
Kendall Garner
93adda66d9
Get album info (when available) from Last.fm, add getAlbumInfo endpoint (#2061)
* lastfm album.getInfo, getAlbuminfo(2) endpoints

* ... for description and reduce not found log level

* address first comments

* return all images

* Update migration timestamp

* Handle a few edge cases

* Add CoverArtPriority option to retrieve albumart from external sources

* Make agents methods more descriptive

* Use Last.fm name consistently

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-17 20:22:54 -05:00
Deluan
5564f00838 Some refactor, log message changes 2023-01-17 17:26:48 -05:00
Kendall Garner
1324a16fc5 ReplayGain support + audio normalization (web player) (#1988)
* ReplayGain support

- extract ReplayGain tags from files, expose via native api
- use metadata to normalize audio in web player

* make pre-push happy

* remove unnecessary prints

* remove another unnecessary print

* add tooltips, see metadata

* address comments, use settings instead

* remove console.log

* use better language for gain modes
2023-01-17 15:57:19 -05:00
Deluan
9ae156dd82 Remove unused prop 2023-01-17 14:31:17 -05:00
Deluan
438d45c176 Change Internet Radio UX 2023-01-17 14:22:10 -05:00
Deluan
e76080809d Fix pipeline lint error help message 2023-01-17 11:02:07 -05:00
Deluan
0a65bf171b Change Players icon, to distinguish it from Internet Radios 2023-01-16 20:51:18 -05:00
Deluan
e40da183bb Move artwork id encoding to public package 2023-01-16 15:24:25 -05:00
Deluan
13ba08157a Add Size column to Album Songs view 2023-01-16 15:13:05 -05:00
Deluan
7682fddec0 Add Size column to Artist and Album views 2023-01-16 15:00:50 -05:00
Deluan
4a054de3d5 Hide togglable columns when in Album Grid view mode. Fixes #2064 2023-01-16 15:00:33 -05:00
dependabot[bot]
b6233e57b3
Bump @material-ui/styles from 4.11.4 to 4.11.5 in /ui (#2093)
Bumps [@material-ui/styles](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-styles) from 4.11.4 to 4.11.5.
- [Release notes](https://github.com/mui-org/material-ui/releases)
- [Commits](https://github.com/mui-org/material-ui/commits/HEAD/packages/material-ui-styles)

---
updated-dependencies:
- dependency-name: "@material-ui/styles"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-16 12:17:12 -05:00
dependabot[bot]
c00040d94e
Bump github.com/dustin/go-humanize from 1.0.0 to 1.0.1 (#2094)
Bumps [github.com/dustin/go-humanize](https://github.com/dustin/go-humanize) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/dustin/go-humanize/releases)
- [Commits](https://github.com/dustin/go-humanize/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/dustin/go-humanize
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-16 12:16:39 -05:00
Deluan
c748d669d6 Sort radio stations by name 2023-01-15 16:12:22 -05:00
Deluan
d319b66ff3 Make Radio Create and Edit forms consistent 2023-01-15 15:43:46 -05:00
Deluan
a8478ca74c Fix Subsonic XML Internet Radio response 2023-01-15 15:38:38 -05:00
Kendall Garner
8877b1695a
Add Internet Radio support (#2063)
* add internet radio support

* Add dynamic sidebar icon to Radios

* Fix typos

* Make URL suffix consistent

* Fix typo

* address feedback

* Don't need to preload when playing Internet Radios

* Reorder migration, or else it won't be applied

* Make Radio list view responsive

Also added filter by name, removed RadioActions and RadioContextMenu, and added a default radio icon, in case of favicon is not available.

* Simplify StreamField usage

* fix button, hide progress on mobile

* use js styles over index.css

Co-authored-by: Deluan <deluan@navidrome.org>
2023-01-15 15:11:37 -05:00
Gil Desmarais
aa21a2a305
Respect prefers-reduced-motion browser configuration (#2090)
Signed-off-by: Gil Desmarais <git@desmarais.de>

Signed-off-by: Gil Desmarais <git@desmarais.de>
2023-01-14 18:42:23 -05:00
Deluan
e3496c7eea Fix artist folder detection. Now works when the artist has only one album. 2023-01-14 14:36:27 -05:00
Deluan
d3e4a5287d "Touch" playlists to force some clients to reload cover art 2023-01-14 12:21:31 -05:00
Deluan
12dd219e16 Don't refresh artistInfo when setting artist's love/rating 2023-01-14 10:52:03 -05:00
bornav
1d6b04e3ad Replace the LoveButton with ArtistContextMenu in the artist page - #1979 2023-01-14 10:52:03 -05:00
Deluan
dfbf86c577 Allow any HTTP methods for public images endpoint. Fix artist covers in Subtracks 2023-01-14 10:17:21 -05:00
Deluan
16c869ec86 Optimize playlist cover generation 2023-01-13 22:18:34 -05:00
Deluan
c46a2a5f5f New dev options to control getCoverArt throttling 2023-01-13 22:18:34 -05:00
Deluan
ab7668f562 Use a custom artist image cache key.
Invalidate when `Agents` config changes. This should solve https://github.com/navidrome/navidrome/issues/1601#issuecomment-1241702797
2023-01-13 22:18:34 -05:00
Deluan
94c6d47181 More descriptive error when artist.jpg not found 2023-01-13 22:18:34 -05:00
Deluan
0ffef05cc3 Remove "Biography not available" when agents are not available 2023-01-13 22:18:34 -05:00
Deluan
3f2d24695e PreCache artist images 2023-01-13 22:18:34 -05:00
Deluan
cbe3adf987 Don't show error when it is nil 2023-01-13 22:18:34 -05:00
Deluan
c90468b895 Find artist.* image in Artist folder 2023-01-13 22:18:34 -05:00
Deluan
69e0a266f4 Remove size from public image ID JWT 2023-01-13 22:18:34 -05:00
Deluan
8f0d002922 Add local TopSongs 2023-01-13 22:18:34 -05:00
Deluan
77a99a735b Always access artist images through Navidrome (proxy calls to external URLs) 2023-01-13 22:18:34 -05:00
Deluan
918fee3ea3 Artwork reader for Artist 2023-01-13 22:18:34 -05:00
Deluan
bf461473ef Add local agent, only for images 2023-01-13 22:18:34 -05:00
Deluan
387acc5f63 Add public endpoint to expose images 2023-01-13 22:18:34 -05:00
Deluan
7fbcb2904a Add function number.RandomInt64 2023-01-13 21:40:24 -05:00
Deluan
7a617d3a1d Remove unused "embed" build tag 2023-01-13 21:35:54 -05:00
Deluan
769e8bedba Rename WeightedChooser's method Put to Add, a better name 2023-01-13 19:43:27 -05:00
Deluan
291455f0b7 Fix Download Dialog not showing in Artist page 2023-01-13 19:40:43 -05:00
Deluan
b1b081e3d8 Move react-scripts to devDependencies 2023-01-13 09:33:10 -05:00
dependabot[bot]
9ea9b48891 Bump golang.org/x/tools from 0.4.0 to 0.5.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 09:15:58 -05:00
dependabot[bot]
e6e9260648 Bump decode-uri-component from 0.2.0 to 0.2.2 in /ui
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 09:15:30 -05:00
dependabot[bot]
224e3b3089 Bump json5 from 1.0.1 to 1.0.2 in /ui
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 09:14:55 -05:00
dependabot[bot]
023e103720 Bump prettier from 2.4.1 to 2.8.2 in /ui
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.1 to 2.8.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.4.1...2.8.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 09:14:10 -05:00
dependabot[bot]
53ef50d980 Bump golang.org/x/text from 0.5.0 to 0.6.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 09:11:48 -05:00
Deluan
feabcdfe9f Show help message when goimports/go mod tidy breaks the build 2023-01-13 08:58:41 -05:00
Deluan
1374dab087 Disable buildvcs flag 2023-01-12 22:18:50 -05:00
dependabot[bot]
18aac7c729 Bump github.com/onsi/ginkgo/v2 from 2.6.1 to 2.7.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.6.1 to 2.7.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.6.1...v2.7.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 21:33:06 -05:00
dependabot[bot]
c8ecf3b495 Bump github.com/go-chi/httprate from 0.7.0 to 0.7.1
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.7.0...v0.7.1)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 21:32:34 -05:00
Deluan
7e03f8ca82 Upgrade to Go 1.19.5 2023-01-12 21:20:45 -05:00
Deluan
fdbece5c92 Use custom sanitize package, fix #2070 2023-01-12 13:39:05 -05:00
Deluan
df0f140f9f Don't refresh smart playlists when generating covers 2023-01-01 20:28:03 -05:00
Deluan
950cc28e67 Add coverArt to Subsonic playlist response 2023-01-01 19:35:19 -05:00
Deluan
6260927074 Serve artist placeholder directly, instead of using LastFM's CDN 2022-12-30 20:14:03 -05:00
Celyn Walters
b8c171d3d4
Hide LastFM icons if config.lastFMEnabled is false (#1935)
Hide LastFM icons if `config.lastFMEnabled` is false
2022-12-30 17:15:14 -05:00
Deluan
80ded63d35 Add test for mapTrackTitle 2022-12-30 15:13:04 -05:00
Deluan
cc14485194 When trying to PreCache, wait for ImageCache to be available 2022-12-28 23:26:39 -05:00
Deluan
0c7c6ba020 PreCache Playlists CoverArt 2022-12-28 15:31:56 -05:00
Deluan
14032a524b Reduce retention in CacheWarmer 2022-12-28 15:31:56 -05:00
Deluan
61e5523457 Handle "naked" CoverArtIDs (IDs of album, mediafiles and playlists) 2022-12-28 15:31:56 -05:00
Deluan
bc09de6640 Better error handling 2022-12-28 15:31:56 -05:00
Deluan
949331ed24 GetCoverArt generates a tiled (2x2) image for playlists 2022-12-28 15:31:56 -05:00
Deluan
501386b11f Parse correctly playlist CoverArt ids 2022-12-28 15:31:56 -05:00
Deluan
8f3387a894 Fix tests and clean up code a bit 2022-12-28 15:31:56 -05:00
Deluan
332900774d Rename DevFastAccessCoverArt to EnableMediaFileCoverArt 2022-12-28 15:31:56 -05:00
Deluan
722a00cacf Fix artwork caching 2022-12-28 15:31:56 -05:00
Deluan
92ddae4a65 Created dedicated artwork readers 2022-12-28 15:31:56 -05:00
Deluan
c1c4645501 Move artwork handling to its own package 2022-12-28 15:31:56 -05:00
Deluan
8cf78efb9c Add timeout for artwork extraction 2022-12-28 15:31:56 -05:00
Deluan
52a4721c91 Remove empty (invalid) entries from the cache 2022-12-28 15:31:56 -05:00
Deluan
e89d99aee0 Also caches resized images 2022-12-28 15:31:56 -05:00
Deluan
dc16ccdb93 Make tests compatible with GoLang 1.18 2022-12-28 15:31:56 -05:00
Deluan
b6eb60f019 Add new Artwork Cache Warmer 2022-12-28 15:31:56 -05:00
Deluan
8c1cd9c273 Refactor file type functions 2022-12-28 15:31:56 -05:00
Deluan
9ec349dce0 Make sure album is updated if external cover changes 2022-12-28 15:31:56 -05:00
Deluan
f5719a7571 Fix spaces in CoverArtPriority, more trace logs in artwork resolution 2022-12-28 15:31:56 -05:00
Deluan
3dbd5c8d31 Remove unnecessary cache invalidator, as ID nows contains the updatedAt value 2022-12-28 15:31:56 -05:00
Deluan
73bb0104f0 Cache original images 2022-12-28 15:31:56 -05:00
Deluan
26a7adae5f Change Image cache key format 2022-12-28 15:31:56 -05:00
Deluan
04eab5666a Add back CoverArtPriority 2022-12-28 15:31:56 -05:00
Deluan
045b023b35 Fix DevFastAccessCoverArt flag 2022-12-28 15:31:56 -05:00
Deluan
57c3334ea0 Remove unused DevPreCacheAlbumArtwork config option 2022-12-28 15:31:56 -05:00
Deluan
847a0432ea If resize fails, send the artwork as is. Closes #1102 2022-12-28 15:31:56 -05:00
Deluan
8e640bb858 Implement new Artist refresh 2022-12-28 15:31:56 -05:00
Deluan
bce7b163ba Skip trying to read cover art from mediafile if it does not have one 2022-12-28 15:31:56 -05:00
Deluan
2923f01cd9 Fix UI artwork id creation 2022-12-28 15:31:56 -05:00
Deluan
a087f57d2d Handle request (context) cancellation 2022-12-28 15:31:56 -05:00
Deluan
9fcd1c9354 Make internal method unexported 2022-12-28 15:31:56 -05:00
Deluan
2814c818bd go mod tidy 2022-12-28 15:31:56 -05:00
Deluan
73719c3abd Fix cover detection on M4A containers 2022-12-28 15:31:56 -05:00
Deluan
e0da1d1589 Log artwork origin (tag, file, etc...) 2022-12-28 15:31:56 -05:00
Deluan
92b42b35b3 Fallback extracting tags using ffmpeg 2022-12-28 15:31:56 -05:00
Deluan
abd3274250 Handle empty cover art ID in subsonic API 2022-12-28 15:31:56 -05:00
Deluan
0da27e8a3f Add image cache back 2022-12-28 15:31:56 -05:00
Deluan
40bb211b39 Small test refactor 2022-12-28 15:31:56 -05:00
Deluan
87d4db7638 Handle mediafile covers 2022-12-28 15:31:56 -05:00
Deluan
213ceeca78 Resize if requested 2022-12-28 15:31:56 -05:00
Deluan
7b87386089 Load artwork from embedded 2022-12-28 15:31:56 -05:00
Deluan
c36e77d41f Remove CoverArtID, fix tests 2022-12-28 15:31:56 -05:00
Deluan
38bde0ddba Remove current Image Cache implementation 2022-12-28 15:31:56 -05:00
Deluan
c430401ea9 Remove current artwork implementation 2022-12-28 15:31:56 -05:00
Deluan
0130c6dc13 Add all images found for each album in the database 2022-12-28 15:31:56 -05:00
Deluan
2f90fc9bd4 Move album refresh to scanner 2022-12-28 15:31:56 -05:00
Deluan
566ae93950 Remove old refresh code 2022-12-28 15:31:56 -05:00
Deluan
83ff44f5f4 Move cover art discovery (temporarily) to model 2022-12-28 15:31:56 -05:00
Deluan
28e7371d93 Moved logic of collapsing songs into albums to model package
(it should really be called domain.... maybe will rename it later)
2022-12-28 15:31:56 -05:00
Deluan
e03ccb3166 Replace MinInt/MaxInt with generic versions 2022-12-28 15:31:56 -05:00
Deluan
6f5aaa1ec4 Move alternative tag names mapping to metadata 2022-12-28 15:31:56 -05:00
Deluan
0c22af3585 Invert dependency of metadata and extractors 2022-12-28 15:31:56 -05:00
Kendall Garner
55b0227494
Add Date Added column in Album and Song lists (#2055) 2022-12-22 22:44:07 -05:00
Deluan
db6e8e45b7 Fix build badge: https://github.com/badges/shields/issues/8671 2022-12-21 18:41:22 -05:00
Deluan
5943e8f953 Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
Deluan
28389fb05e Add command line M3U exporter. Closes #1914 2022-12-21 14:39:40 -05:00
Deluan
5d8318f7b3 Change "Go to current song" hotkey.
It was blocking Cmd-C (copy on macOS)
2022-12-18 20:58:01 -05:00
dependabot[bot]
75596a6b64
Bump github.com/onsi/gomega from 1.24.1 to 1.24.2 (#2048)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.24.1 to 1.24.2.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.24.1...v1.24.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-18 12:41:42 -05:00
dependabot[bot]
a9ddb2db6b
Bump github.com/beego/beego/v2 from 2.0.6 to 2.0.7 (#2047)
Bumps [github.com/beego/beego/v2](https://github.com/beego/beego) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/beego/beego/releases)
- [Changelog](https://github.com/beego/beego/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/beego/beego/compare/v2.0.6...v2.0.7)

---
updated-dependencies:
- dependency-name: github.com/beego/beego/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-18 12:38:55 -05:00
dependabot[bot]
fe1a6a7dd5
Bump github.com/onsi/ginkgo/v2 from 2.5.1 to 2.6.1 (#2046)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.5.1 to 2.6.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.5.1...v2.6.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-18 12:38:33 -05:00
dependabot[bot]
9cb1fc4fa1
Bump github.com/go-chi/chi/v5 from 5.0.7 to 5.0.8 (#2040)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.7 to 5.0.8.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.7...v5.0.8)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-18 12:38:20 -05:00
Deluan Quintão
24d520882e
Don't cache transcoded files if the request was cancelled (#2041)
* Don't cache transcoded files if the request was cancelled (or there was a transcoding error)

* Add context to logs

* Simplify Wait error handling

* Fix flaky test

* Change log level for "populating cache" error message

* Small cleanups
2022-12-18 12:22:12 -05:00
Kendall Garner
54395e7e6a
Enable transcoding of downlods (#1667)
* feat(download): Enable transcoding of downlods - #573

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>

* feat(download): Make automatic transcoding of downloads optional

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>

* Fix spelling

* address changes

* prettier

* fix config

* use previous name

Signed-off-by: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
2022-12-18 12:12:37 -05:00
Deluan
6489dd4478 Fix overriding previous logger in context 2022-12-14 11:50:16 -05:00
Deluan
6c4a0be6ff Add endpoints in Subsonic API logs 2022-12-14 10:52:46 -05:00
Deluan
982b604500 Add username to authenticated log messages 2022-12-14 09:35:30 -05:00
Deluan
f206d81afd Some cleanup, fixes typos and grammar errors 2022-12-06 20:09:03 -05:00
Deluan
c5f7cf97f4 Some cleanup, adding missing context handling 2022-12-06 19:57:47 -05:00
gauth-fr
55ba39cb79
Add global Downsampling feature (#1575)
* Add global downsampling feature

* Default to Opus &  consider player transcoder

* Add a test case for DefaultDownsamplingFormat

Co-authored-by: Deluan <deluan@navidrome.org>
2022-12-06 19:41:16 -05:00
Deluan
0cc1db54d4 Bump github.com/bradleyjkemp/cupaloy to v2.8.0 2022-12-05 22:45:02 -05:00
Deluan
879992eb33 Change "current song" hotkey English label 2022-12-05 13:50:19 -05:00
Robert Sammelson
b5b01f78db
Keyboard shortcut to go to current song (#2029)
* feat(hotkeys): keyboard-shortcut-for-current-song - #1336

Signed-off-by: Pavithra Nair <pmpavithranair@gmail.com>

* Fix previously mentioned bugs

Signed-off-by: Pavithra Nair <pmpavithranair@gmail.com>
Co-authored-by: Pavithra Nair <pmpavithranair@gmail.com>
2022-12-05 13:37:49 -05:00
dependabot[bot]
cdddd4ce30
Bump golang.org/x/text from 0.4.0 to 0.5.0 (#2030)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-05 13:24:42 -05:00
Reo
4489c34757
Fix Misleading Error Message on unreadable Media due to Permission (#1873)
* fix(taglib): Fix misleading error message on unreadable media - #1576

Signed-off-by: reo <reo_999@proton.me>

* fix(taglib): Add unit test and exclude scan for only unreadable file - #1576

Signed-off-by: reo <reo_999@proton.me>

* fix(taglib): Add unit test and exclude scan for only unreadable file - #1576

Signed-off-by: reo <reo_999@proton.me>

* fix(taglib): Add unit test and exclude scan for only unreadable file - #1576

Signed-off-by: reo <reo_999@proton.me>

* fix(taglib): Add unit test and exclude scan for only unreadable file - #1576

Signed-off-by: reo <reo_999@proton.me>

* fix(taglib): Add unit test and exclude scan for only unreadable file - #1576

Signed-off-by: reo <reo_999@proton.me>

* Fix test and simplify code a bit

We don't need to expose the type of error: `taglib.Parse()` always return nil

* Fix comment

Signed-off-by: reo <reo_999@proton.me>
Co-authored-by: Deluan <deluan@navidrome.org>
2022-12-04 12:48:21 -05:00
Deluan
51b67d18d3 Increase number of "Shuffle All" songs 2022-12-03 20:54:23 -05:00
Robert Sammelson
c4d1569441
Fix bug in duration format logic (#2026) 2022-12-03 20:31:02 -05:00
Deluan
68ceeb9ea1 Fix build for non-unix 2022-12-03 10:42:36 -05:00
Deluan
4549b91ae0 Fix build for non-unix 2022-12-02 20:39:44 -05:00
Deluan
9ffd145e82 Add log for signal received 2022-12-02 20:30:30 -05:00
dependabot[bot]
5713010984
Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (#2019)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-02 18:28:43 -05:00
Deluan
00c6545cb1 Bump github.com/go-chi/jwtauth/v5 from 5.0.2 to 5.1.0 2022-12-02 17:58:53 -05:00
dependabot[bot]
3f45a4ed98
Bump github.com/beego/beego/v2 from 2.0.5 to 2.0.6 (#2016)
Bumps [github.com/beego/beego/v2](https://github.com/beego/beego) from 2.0.5 to 2.0.6.
- [Release notes](https://github.com/beego/beego/releases)
- [Changelog](https://github.com/beego/beego/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/beego/beego/compare/v2.0.5...v2.0.6)

---
updated-dependencies:
- dependency-name: github.com/beego/beego/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-02 17:40:08 -05:00
dependabot[bot]
46c09e4b11
Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0 (#2018)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-02 17:39:52 -05:00
Deluan
40395f47f0 Use forked react-player. May fix issue #1472 2022-12-02 17:20:16 -05:00
Deluan
2c214154dc Add nakedret linter 2022-11-30 14:16:30 -05:00
Deluan
03640ca93d Fix background images when BaseURL is specified 2022-11-29 14:48:05 -05:00
Deluan
d8c5944ef1 Fix race condition in scanner 2022-11-29 11:08:47 -05:00
Deluan
10cd3152ba Remove misplaced import 2022-11-27 22:01:07 -05:00
Deluan
950b5dc1ce Remove math/rand and only use crypto/rand 2022-11-27 21:53:13 -05:00
Deluan
195f39182d Host default login background images in Navidrome's own website 2022-11-27 21:37:33 -05:00
Deluan Quintão
334ccac643
Spotify-ish Improvement (#2012)
* spotify-improvement

* fixing the issue of applying styles to filter fields too

* Remove scrollbar styling.

Maybe we should simulate macOS's scrollbar behaviour, with something like this: https://gist.github.com/spemer/a0e218bbb45433bd611e68446523a00b

Co-authored-by: Rishabh Malhotra <rishabhmalhotraa01@gmail.com>
2022-11-27 12:13:00 -05:00
Garvit Galgat
676de79fb3
Don't abort scan if all audio files are in the MediaFolder's root. Fix #868 (#893)
* fixed #868

* Make sure we only abort scanning if it is not a fullScan

Co-authored-by: Deluan <deluan@navidrome.org>
2022-11-27 11:45:37 -05:00
Raghd Hamzeh
d5fe0f214c
fix: send content type header in listenbrainz requests - #1944 (#1994)
fixes #1944

Signed-off-by: Raghd Hamzeh <raghd@rhamzeh.com>

Signed-off-by: Raghd Hamzeh <raghd@rhamzeh.com>
2022-11-27 09:47:13 -05:00
Deluan
6ae6e023ea Bump some NPM dependencies 2022-11-27 09:28:47 -05:00
Deluan
7bafbce816 Reduce number of goroutines in test, to avoid hitting the hard limit of 8128 2022-11-26 15:28:30 -05:00
Deluan
a69a31a3bf Use custom atomic.Bool, as it is not supported in Go 1.18 2022-11-26 15:14:19 -05:00
Deluan
88823fca76 Fix race conditions in tests 2022-11-26 15:07:53 -05:00
Deluan
0bb133a6ac Kill ffmpeg if context is cancelled 2022-11-26 15:06:59 -05:00
Deluan Quintão
76a94ecb70
Update GH actions
* Update GH actions

* Fix

* Fix "Cannot open: File exists" messages
2022-11-26 14:11:39 -05:00
Deluan
1b5f855bff Compress more http content-types.
Also, some minor refactoring
2022-11-26 13:13:05 -05:00
Zane van Iperen
472f99b2b5
Add AAC default transcoding (#2010) 2022-11-23 10:20:40 -05:00
dependabot[bot]
4d660a2ba7
Bump github.com/golangci/golangci-lint from 1.49.0 to 1.50.1 (#1954)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.49.0 to 1.50.1.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.49.0...v1.50.1)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 10:57:27 -05:00
dependabot[bot]
398101896f
Bump golang.org/x/tools from 0.1.12 to 0.3.0 (#1991)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.12 to 0.3.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.12...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 10:04:30 -05:00
dependabot[bot]
d76985e3f7
Bump github.com/kr/pretty from 0.3.0 to 0.3.1 (#1924)
Bumps [github.com/kr/pretty](https://github.com/kr/pretty) from 0.3.0 to 0.3.1.
- [Release notes](https://github.com/kr/pretty/releases)
- [Commits](https://github.com/kr/pretty/compare/v0.3.0...v0.3.1)

---
updated-dependencies:
- dependency-name: github.com/kr/pretty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 10:03:06 -05:00
dependabot[bot]
e17e4ef146
Bump github.com/microcosm-cc/bluemonday from 1.0.20 to 1.0.21 (#1905)
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.20...v1.0.21)

---
updated-dependencies:
- dependency-name: github.com/microcosm-cc/bluemonday
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 10:02:42 -05:00
dependabot[bot]
0a4a9d485e
Bump github.com/mattn/go-sqlite3 from 1.14.15 to 1.14.16 (#1965)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.15 to 1.14.16.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.15...v1.14.16)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 09:43:05 -05:00
dependabot[bot]
ce2c579235
Bump github.com/spf13/cobra from 1.5.0 to 1.6.1 (#1966)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 09:42:48 -05:00
dependabot[bot]
4e19c5e078
Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 (#1951)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 09:42:26 -05:00
jan666
ab6be8d2dc
Listenbrainz Scrobble (#2009)
- send SubmissionClient and SubmissionClientVersion
2022-11-22 09:32:46 -05:00
dependabot[bot]
586f5c413d
Bump github.com/onsi/ginkgo/v2 from 2.2.0 to 2.5.1 (#2007)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.2.0 to 2.5.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.2.0...v2.5.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 22:57:34 -05:00
dependabot[bot]
e6a93da75f
Bump github.com/onsi/gomega from 1.20.2 to 1.24.1 (#1990)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.20.2 to 1.24.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.20.2...v1.24.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 21:08:07 -05:00
Deluan
fcb891e704 Add an id attribute to Search boxes. Should fix #1998 2022-11-21 13:44:16 -05:00
Deluan
19af11efbe Simplify Subsonic API handler implementation 2022-11-21 12:57:56 -05:00
Deluan
cd41d9a419 Shutdown gracefully, close DB connection 2022-11-21 12:28:09 -05:00
Deluan
5f3f7afb90 Add note about unstable state of master branch 2022-11-11 21:23:07 -05:00
Deluan
1467036efd Add DefaultUIVolume option. Closes #1679 2022-11-11 16:31:28 -05:00
dependabot[bot]
ff6c8f7e9d
Bump loader-utils from 2.0.0 to 2.0.3 in /ui (#1978)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.0 to 2.0.3.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.3/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.0...v2.0.3)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-07 19:28:02 -05:00
Deluan
3a462c7f07 Fix ARM v5 and v6 builds, by going back to armel.
Also upgrades Go to 1.19.3. Closes #1968
2022-11-07 17:16:30 -05:00
Deluan
9c433b5d68 Add missing context to logger calls 2022-11-04 11:30:12 -04:00
YaoFeng Ruan
daa428ede7
Update Chinese translations (#1945)
* Corrected some Simplified Chinese translations

* Fix wrong expression symbols in Traditional Chinese translation

* Modify punctuation to Chinese punctuation in Chinese translation
Add spaces between Chinese and English words in Chinese translation

* Added missing Traditional Chinese translation

* Improve some Chinese translations

* Remove redundant punctuation in Traditional Chinese translation

* Adjust the order of fields in `zh-Hans` and `zh-Hant` to be consistent with `en`
2022-11-04 10:44:32 -04:00
Deluan
76517cab12 Fix potential nil pointer dereference 2022-11-04 10:39:25 -04:00
Deluan
8f02daf337 Reduce spurious error/warn messages, if loglevel != debug 2022-11-03 12:38:05 -04:00
Deluan
80b7311453 Add TrackNumber to "fake" generated filenames. Fixes #1912 2022-11-02 12:11:01 -04:00
Deluan
ca2cb26d8e Add played field to Subsonic API responses. Fix #1971
This is not an "official" field in the specification, but I guess it does not hurt to expose this ;)
2022-11-02 11:20:51 -04:00
Deluan
081cfe5a9f Fix build badge 2022-10-31 10:35:07 -04:00
Deluan
5f38d9dca2 Fix 60 seconds (again). Fixes #1956 2022-10-26 09:10:01 -04:00
Aleksey Lobanov
64e2a0bcd4
Optimize static images (#1941)
.png files were processed with `optipng -o7` command
2022-10-20 10:51:31 -04:00
Deluan
aab4925dfc Restore DefaultLanguage case-sensitiveness by reverting commit bfeb8ef6b3.
Language code should be case-sensitive. Fix #1946. Supersedes #1947.
2022-10-19 09:14:02 -04:00
Deluan
af5c2b5a42 Round song duration (instead of truncating it). Relates to #1926 2022-10-10 21:33:00 -04:00
Deluan
62e7492357 Add Linkify test 2022-10-07 17:44:16 -04:00
Deluan
53a4ea673b Linkify urls in playlist comments 2022-10-07 16:12:07 -04:00
Deluan
c530ccf138 Linkify urls in album comments. Fixes #1053, supersedes #1570 and #1169
Simple approach, may be extended/enhanced in the future.
2022-10-06 23:46:30 -04:00
Deluan
fa5dc5af10 Fix adding songs to plain playlists 2022-10-06 19:45:31 -04:00
Deluan
bbd3882a75 Some clean-up in criteria package 2022-10-04 15:24:29 -04:00
Deluan
12b4a48842 Fix get info dialog in artist page. Closes #1909 2022-10-04 12:30:04 -04:00
dependabot[bot]
37f7625c7d
Bump github.com/prometheus/client_golang from 1.12.1 to 1.13.0 (#1902)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.13.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.1...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-02 20:34:29 -04:00
dependabot[bot]
7612a55859
Bump github.com/mileusna/useragent from 1.2.0 to 1.2.1 (#1901)
Bumps [github.com/mileusna/useragent](https://github.com/mileusna/useragent) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/mileusna/useragent/releases)
- [Commits](https://github.com/mileusna/useragent/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/mileusna/useragent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-02 20:34:01 -04:00
Deluan
3d5a1cef92 Don't allow adding songs to smart playlists 2022-10-02 20:14:15 -04:00
Aleksey Lobanov
552989a05b
Add basic Prometheus metrics handler (#1830)
* feat: Add Prometheus configuration options

* feat: Add Prometheus metrics handler

* build: prometheus became direct dependency

* docs: change description for prometheus metrics path
2022-10-02 19:59:53 -04:00
Renere
6a6fa3e3b5
Nord Theme - Make links have a different colour (#1900) 2022-10-01 22:23:33 -04:00
Zane van Iperen
c7ef4bd803
Capture "musicbrainz_releasetrackid" tag (#1827)
* db/migration: typo fix

* model: add MbzReleaseTrackID field

* scanner: capture the musicbrainz_releasetrackid tag
2022-10-01 12:13:47 -04:00
Renere
22507c9789
Add Nord Theme. Closes #1158 and supersedes #1159 (#1899).
* Re-add tpbnick's Nord theme

* Run Prettier formatter on Nord theme

* Update themes index

* Fix button margins

* Modernise the look of switches

* Adjust margins and padding

* Fix sidebar's background colour not applying to all of sidebar when scrolling down

* Adjust App Bar box shadow

* Adjust roundedness

* Adjust shadows

* Adjust outlined inputs

* Add transitions to items in sidebar when hovered / losing hover

* Adjust border radiuses

* Adjust pagination buttons

* Add big play button from Spotify theme

* Remove playlist background gradient

* Adjust colour of MuiChip elelments

* Adjust table borders

* Remove duplicate MuiTableRow key

* Attempt to make switches in both the playlist section and settings section visable against background & the toggle. Not ideal.

* Style the player

* Format CSS to Prettier standards

* Fix mobile player style

* Make play button in album grid view blue

* Make main view background lighter
2022-10-01 12:01:21 -04:00
Deluan
87feac041b Add make target to download some music for development purposes. Closes #1703 2022-09-30 23:10:33 -04:00
Deluan
f82df70302 Add nilerr linter 2022-09-30 20:18:14 -04:00
Deluan
364e699ac1 Add asciicheck, bidichk, and durationcheck linters 2022-09-30 20:17:59 -04:00
Deluan
0798959be8 Add asasalint linter 2022-09-30 19:55:44 -04:00
William Lohan
4209e14208
Add theme Electric Purple (#1889)
* add theme file

add theme file electricPurple.js

* import theme file 

import theme file  electricPurple

* add electricPurple.css.js
2022-09-30 19:54:00 -04:00
Deluan
77dbafff0f Add errorlint linter 2022-09-30 19:33:39 -04:00
Deluan
db67c1277e Fix error comparisons 2022-09-30 18:54:25 -04:00
Deluan
7b0a8f47de Add exportloopref linter 2022-09-30 18:23:47 -04:00
William Lohan
16865f0fca
remove deprecated linters (#1898) 2022-09-30 18:11:44 -04:00
Deluan
5965459bb9 Update browserlist db 2022-09-30 13:33:42 -04:00
Steve Richter
66818b25ec
Allow ExternalLink icons to be styled (#1503)
* Allow ArtistExternalLink icons to be styled

* Allow AlbumExternalLink icons to be styled

* Standardize external links' classes to kebab-case

Co-authored-by: Deluan <deluan@navidrome.org>
2022-09-30 13:33:35 -04:00
Deluan
e7fab8bb7b Show AlbumArtist in Album table view. Fixes #1626 2022-09-29 16:47:44 -04:00
joaomqc
8befe10ee6
fix(UI): Warn if track is already present when adding to playlist - 1604 (#1897)
* fix(UI): Warn if track is already present when adding to playlist - 1604

Signed-off-by: joaomqc <joaomqc@hotmail.com>

* fix tests

Signed-off-by: joaomqc <joaomqc@hotmail.com>

Signed-off-by: joaomqc <joaomqc@hotmail.com>
Co-authored-by: João Coelho <1120458@isep.ipp.pt>
2022-09-29 13:19:14 -04:00
Deluan
218d14727a Bump redux and react-redux versions 2022-09-29 11:05:05 -04:00
Evan.Shu
50a4ce6ba2
Fix add playlist dialog (#1758) 2022-09-28 22:15:39 -04:00
henning mueller
8130c05ccc
Mount devcontainer workspace SELinux compatible (#1816) 2022-09-28 22:10:06 -04:00
Deluan
15952a3c7f npm audit fix 2022-09-28 22:01:13 -04:00
Nemo Xiong
9a99a2bd49
Update Chinese (simplified) translations (#1633)
* add new translations

* translation: fix improper full width character usage in zh-Hans translation

Full width % messed up with format strings.

* translation: fix two machine translations in zh-Hans

* translation: fix one mistranslation in zh-Hans

* translation: fix format in zh-Hans

* translation: fix format and two translations in zh-Hans

* translation: fix format in zh-Hans
2022-09-28 21:47:48 -04:00
dependabot[bot]
c7b65509ae
Bump @testing-library/jest-dom from 5.15.0 to 5.16.5 in /ui (#1836)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.15.0 to 5.16.5.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.15.0...v5.16.5)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-28 21:43:26 -04:00
Deluan
6b09dc7198 Fix new test-library eslint errors 2022-09-28 21:30:20 -04:00
Deluan
86ab35069d Upgrade react-scripts to 5.0.1
This also upgrades WebPack to v5, which should fix the issue #1768
2022-09-28 21:03:22 -04:00
Deluan
413292da6b Reduce go mod download verbosity 2022-09-28 20:27:53 -04:00
Deluan
694968c607 Bump dependencies 2022-09-28 13:25:08 -04:00
Deluan
6dc70d6810 Don't reset language to default after logout 2022-09-28 13:06:32 -04:00
Deluan
bfeb8ef6b3 DefaultLanguage is now case-insensitive 2022-09-28 11:30:22 -04:00
Deluan Quintão
ba28e9a109
Update README. Fixes #1834 2022-09-27 21:32:23 -04:00
Andy Klimczak
2f7a3c5eda
feat: Add listenbrainz base url configuration (#1774)
* feat: Add listenbrainz base url configuration

- ListenBrainz.BaseURL config value

* Don't need to store baseUrl

* Use `url.JoinPath` to concatenate url paths

* Replace url.JoinPath (Go 1.19 only) with custom function

Co-authored-by: Deluan <deluan@navidrome.org>
2022-09-27 21:06:28 -04:00
Deluan
cb3ba23fce New config DefaultLanguage. Closes #1561 2022-09-27 19:31:09 -04:00
Manuel
72cde6dfde
fix:(middlewares.go) - Set Cookie SameSite mode to Strict - 1776 (#1777)
* None is deprecated and will fallback to Lax in the future.
* Using Strict is future proof and provides additional CSR protection

Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com>

Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com>
2022-09-27 17:58:47 -04:00
Kendall Garner
751e42c705
Fix creating server (#1894) 2022-09-27 16:53:40 -04:00
Deluan
ded9ab53e5 Use armhf for ARM builds 2022-09-27 16:47:47 -04:00
Deluan
416b5c7d13 Fix Linux 32 bits build 2022-09-26 23:54:03 -04:00
Deluan
afb31c3eae Fix invalid option in pipeline 2022-09-26 22:56:17 -04:00
Deluan
dd57278ba2 Upgrade to GoLang 1.19 and bump golangci-lint version 2022-09-26 22:44:54 -04:00
Deluan
2a3cd08f20 Fix GO-S2114 security issue
See https://deepsource.io/directory/analyzers/go/issues/GO-S2114
2022-09-26 22:33:42 -04:00
Deluan
a7a0e23956 Fix formatting 2022-09-26 21:28:10 -04:00
Deluan
4cf43ed735 Only compute version once 2022-09-14 21:09:39 -04:00
Deluan
ebad96b8a4 Fix warning about mixing value and pointer receivers 2022-08-21 14:42:17 -04:00
Deluan
e981ee27c0 Add test for WithTx 2022-07-30 13:07:38 -04:00
Deluan
965dbccd48 Upgrade to latest go-sqlite3 (it's v1.14, not v2!) 2022-07-30 12:46:20 -04:00
Deluan
695f82a1a0 Upgrade to Beego 2's orm 2022-07-30 12:43:48 -04:00
Deluan
16afd3a490 Remove //+build tags, as the code does not compile on older versions of Go anymore 2022-07-29 08:41:28 -04:00
Deluan
67f2a89d89 Fix tracks never "loved" to be selected in Smart Playlists. Refer to https://github.com/navidrome/navidrome/issues/1417#issuecomment-1163423575 2022-07-27 21:09:39 -04:00
dependabot[bot]
bf1f93ef1a
Bump github.com/go-chi/httprate from 0.5.2 to 0.6.0 (#1828)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.5.2 to 0.6.0.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.5.2...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-27 15:29:30 -04:00
Deluan
ebf7354df4 Add more info in search log message 2022-07-27 14:59:01 -04:00
Deluan
c0066ebd85 Add log warn when request is cancelled/interrupted 2022-07-27 14:27:18 -04:00
Deluan
cd5bce7b16 Speed up /search subsonic endpoints by parallelizing the queries 2022-07-27 13:56:04 -04:00
Deluan
d613b19306 Simplify Singleton usage by leveraging Go 1.18's generics 2022-07-27 12:15:05 -04:00
Deluan
a2d9aaeff8 Fix Quality translation in Spanish 2022-07-27 10:42:04 -04:00
Deluan
49392e06a7 Update caniuse-lite 2022-07-26 17:48:29 -04:00
Deluan
181cb8a2b7 Remove interfacer linter, as it does not work with Go 1.18 and will not be updated (it is deprecated) 2022-07-26 16:59:52 -04:00
Deluan
31882abf6f Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
Deluan
0d8eaa2878 Remove experimental version of context package 2022-07-26 16:41:10 -04:00
Deluan
f4bffb1676 Update @djherbis's packages 2022-07-26 15:16:56 -04:00
Deluan
f21847308c Remove hardcoded github.com/dhowden/tag branch. Fix #1764 2022-07-26 15:10:16 -04:00
Deluan
9c3b14c5c4 Return 501 for "not implemented". Fixes #1785 2022-07-26 13:18:08 -04:00
Deluan
8cd405d15e Add IP to Subsonic API's invalid login log messages. Closes #1814 2022-07-25 23:54:49 -04:00
Deluan
35bec14d4d Add missing test case for #1778 2022-07-25 23:34:09 -04:00
Deluan
321b3c5a64 Fix fscache key mapping. Closes #1778 2022-07-25 23:01:19 -04:00
Deluan
b7e50f7731 Fix docker build in pipeline 2022-07-25 10:54:19 -04:00
dependabot[bot]
2e9c81c3de
Bump github.com/mileusna/useragent from 1.0.2 to 1.1.0 (#1819)
Bumps [github.com/mileusna/useragent](https://github.com/mileusna/useragent) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/mileusna/useragent/releases)
- [Commits](https://github.com/mileusna/useragent/compare/v1.0.2...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/mileusna/useragent
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-25 10:43:45 -04:00
dependabot[bot]
49647423aa
Bump github.com/sirupsen/logrus from 1.8.1 to 1.9.0 (#1821)
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-25 10:42:51 -04:00
dependabot[bot]
9f62533bb0
Bump github.com/go-chi/cors from 1.2.0 to 1.2.1 (#1822)
Bumps [github.com/go-chi/cors](https://github.com/go-chi/cors) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/go-chi/cors/releases)
- [Commits](https://github.com/go-chi/cors/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/go-chi/cors
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-25 10:08:48 -04:00
dependabot[bot]
7d58f4469a
Bump github.com/lestrrat-go/jwx from 1.2.17 to 1.2.25 (#1742)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.17 to 1.2.25.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/v1.2.25/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.17...v1.2.25)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-25 10:08:06 -04:00
dependabot[bot]
974816f0a2
Bump github.com/onsi/gomega from 1.18.1 to 1.20.0 (#1817)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.18.1 to 1.20.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.18.1...v1.20.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-24 20:35:38 -04:00
Deluan
7665478a52 Upgrade golangci-lint and fix new lint error 2022-07-24 19:30:23 -04:00
Deluan
bde5be347b Build with GoLang 1.18.4 2022-07-24 19:02:09 -04:00
Deluan
aae79b4561 Upgrade to GoLang 1.18 2022-07-24 15:31:22 -04:00
Ian Kerins
ce0db8344b
Fix signaler not exiting on cancel (#1638)
* fix: make signaler exit on cancel

`break` is incorrect here, as it just breaks out of the select.
`return` to exit the function instead.

Fixes #1636.

Signed-off-by: Ian Kerins <ianskerins@gmail.com>

* fix: exit non-zero on fatal error

Signed-off-by: Ian Kerins <ianskerins@gmail.com>
2022-03-30 10:04:17 -04:00
Matt Doyle
5987cd0c08
Fixes a coloring glitch with the Monokai theme "unauthorized" popup (#1670)
* Fixes the coloring on the Monokai theme auth popup

* Indentation fix
2022-03-26 22:41:29 -04:00
Matt Doyle
e7cf74d863
Adds a Monokai theme (#1669)
* Adds a new Monokai theme

* Deletes a commented-out line
2022-03-26 21:14:13 -04:00
Deluan
2ddd3acba6 Fix translatable label 2022-02-10 18:18:03 -05:00
Deluan
028723f721 Fix loading overridden translations from ${DataFolder}/resources/i18n 2022-02-10 14:56:39 -05:00
Deluan
50ff8bcce7 Add "random" sort option for Smart Playlists 2022-02-09 09:39:42 -05:00
Deluan
e966d94c0b Force correct mime-type for JS and CSS files 2022-02-08 15:17:35 -05:00
dependabot[bot]
86fe1e3b2c
Bump github.com/ReneKroon/ttlcache/v2 from 2.9.0 to 2.11.0 (#1529)
Bumps [github.com/ReneKroon/ttlcache/v2](https://github.com/ReneKroon/ttlcache) from 2.9.0 to 2.11.0.
- [Release notes](https://github.com/ReneKroon/ttlcache/releases)
- [Changelog](https://github.com/ReneKroon/ttlcache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ReneKroon/ttlcache/compare/v2.9.0...v2.11.0)

---
updated-dependencies:
- dependency-name: github.com/ReneKroon/ttlcache/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-21 19:35:19 -05:00
dependabot[bot]
eed54d7e10
Bump github.com/lestrrat-go/jwx from 1.2.11 to 1.2.17 (#1574)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.11 to 1.2.17.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/main/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.11...v1.2.17)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-21 19:26:28 -05:00
dependabot[bot]
ab36344d76
Bump github.com/microcosm-cc/bluemonday from 1.0.16 to 1.0.17 (#1560)
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.16...v1.0.17)

---
updated-dependencies:
- dependency-name: github.com/microcosm-cc/bluemonday
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-21 19:26:11 -05:00
dependabot[bot]
e5d03a3bdb
Bump github.com/Masterminds/squirrel from 1.5.1 to 1.5.2 (#1501)
Bumps [github.com/Masterminds/squirrel](https://github.com/Masterminds/squirrel) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/Masterminds/squirrel/releases)
- [Commits](https://github.com/Masterminds/squirrel/compare/v1.5.1...v1.5.2)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/squirrel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-21 19:25:38 -05:00
Deluan Quintão
30813cd34b
Update translations (#1578)
* Add Catalan translation

* Move Bulgarian translation to correct path

* Update zh-Hans.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update da.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update eo.json (POEditor.com)

* Update fi.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update de.json (POEditor.com)

* Update it.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update fa.json (POEditor.com)

* Update pl.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update ru.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update th.json (POEditor.com)

* Update tr.json (POEditor.com)

* Update uk.json (POEditor.com)

* Update bg.json (POEditor.com)

* Update ca.json (POEditor.com)
2022-01-21 19:21:19 -05:00
MrEddX
6164f37c9e
Added Bulgarian Translation (#1577)
Initial Release
2022-01-21 19:09:48 -05:00
Deluan
9e79b5cbf2 Fix potential SQL injection in Smart Playlists 2022-01-18 21:36:29 -05:00
Steve Richter
8c707b4e0c
Handle invalid theme in ui state (#1504) 2022-01-05 18:47:14 -05:00
Deluan
910091f1f1 Fix playCount casing 2021-12-14 09:33:34 -05:00
Deluan
2e1b985d30 Revert "Direct link to dev build"
This reverts commit a99b9b4d44.
2021-12-10 12:41:19 -05:00
Deluan Quintão
100b80528e
Update README.md 2021-12-09 12:24:43 -05:00
Deluan
bde9d5f954 Fix TypeError: Cannot read property 'id' of undefined 2021-12-03 17:15:39 -05:00
Deluan
69615f1aa1 Trying to fix multiple EventStream connections, one more time 2021-12-02 10:49:32 -05:00
Deluan
a99b9b4d44 Direct link to dev build 2021-11-29 22:57:26 -05:00
Deluan
9892524ab8 Connect eventStream after login 2021-11-29 18:49:29 -05:00
Deluan
9fe978953c Try to avoid creating multiple eventStreams 2021-11-29 17:47:34 -05:00
Deluan Quintão
5425c1a4d7
Update translations (#1489)
* Update fi.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update de.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update es.json (POEditor.com)
2021-11-26 12:34:22 -05:00
Deluan
afe1e4cfcd Fix lint for public credentials 2021-11-25 15:55:53 -05:00
Deluan
20cdd38fc4 Better logging for agents configuration 2021-11-25 15:48:32 -05:00
dependabot[bot]
913a4cf546
Bump github.com/onsi/gomega from 1.16.0 to 1.17.0 (#1459)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 23:43:32 -05:00
dependabot[bot]
121ada5acd
Bump @testing-library/jest-dom from 5.14.1 to 5.15.0 in /ui (#1456)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.14.1 to 5.15.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.14.1...v5.15.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 23:13:22 -05:00
dependabot[bot]
e59a95c9eb
Bump github.com/golangci/golangci-lint from 1.42.1 to 1.43.0 (#1460)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.42.1 to 1.43.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.42.1...v1.43.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-23 23:12:27 -05:00
Mahoo Huang
d75f286ae8
Update zh-Hans.json (#1478) 2021-11-23 23:11:49 -05:00
Deluan
30d3f1eda0 Add userRating to Subsonic Album/Artist responses. Closes #1486 2021-11-23 21:50:57 -05:00
dependabot[bot]
6a1f9678b1
Bump github.com/ReneKroon/ttlcache/v2 from 2.8.1 to 2.9.0 (#1414)
Bumps [github.com/ReneKroon/ttlcache/v2](https://github.com/ReneKroon/ttlcache) from 2.8.1 to 2.9.0.
- [Release notes](https://github.com/ReneKroon/ttlcache/releases)
- [Changelog](https://github.com/ReneKroon/ttlcache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ReneKroon/ttlcache/compare/v2.8.1...v2.9.0)

---
updated-dependencies:
- dependency-name: github.com/ReneKroon/ttlcache/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-22 12:50:42 -05:00
dependabot[bot]
a0977ce48a
Bump github.com/go-chi/chi/v5 from 5.0.4 to 5.0.7 (#1484)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.4 to 5.0.7.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.4...v5.0.7)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-22 12:29:10 -05:00
dependabot[bot]
b3d8038686
Bump github.com/lestrrat-go/jwx from 1.2.7 to 1.2.11 (#1485)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.7 to 1.2.11.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/main/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.7...v1.2.11)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-22 12:28:23 -05:00
Deluan
0714f08274 Recover from SIGSEGVs in taglib's code 2021-11-20 12:33:06 -05:00
Deluan
cbeaadf8e2 Fix logging smart playlist's song count 2021-11-20 12:29:09 -05:00
Deluan
3e282df639 Set volume to 100% when web player is in mobile mode.
Fix #1429
2021-11-19 19:45:18 -05:00
Deluan
ce7940bbfc Allow overriding name and comment when importing NSP playlists 2021-11-19 19:14:38 -05:00
Deluan
92c31c961d Fix values from annotation table cannot be compared to 0
Solves this issue: https://github.com/navidrome/navidrome/issues/1417#issuecomment-974052454
2021-11-19 18:22:33 -05:00
Deluan
4bf4765442 Bot that adds a download link on pull requests 2021-11-19 13:07:55 -05:00
Brice Johnson
6d947f6f7e
Allowing 3rd party UIs to access x-total-count http header (#1470)
* Adding 'x-content-duratin' and 'x-total-count' to CORS exposed headers

* Moving cors setup to middlewares.go

* adding x-nd-authorization to exposed headers
2021-11-19 10:07:54 -05:00
Deluan Quintão
8c7d95c135
Update Translations (#1471)
* Update zh-Hans.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update da.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update eo.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update de.json (POEditor.com)

* Update it.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update fa.json (POEditor.com)

* Update pl.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update ru.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update th.json (POEditor.com)

* Update tr.json (POEditor.com)

* Update uk.json (POEditor.com)

* Update fi.json (POEditor.com)
2021-11-18 17:52:12 -05:00
Deluan
d4447e373f Fix sorting albums by year (should use name as secondary sort field).
Relates to https://github.com/navidrome/navidrome/issues/961#issuecomment-967624681
2021-11-17 21:47:14 -05:00
Steve Richter
3bd6f82c80
Rename ListenBrainz config flag and enable by default (#1443) 2021-11-17 21:11:53 -05:00
BIKI DAS
da26c5cfe0
Combined multiple appends into a single one (#1464) 2021-11-17 19:51:44 -05:00
Deluan
023d7bfa8a Remove link from songs to artist (when artist has no albums) 2021-11-17 18:47:54 -05:00
Deluan
48a627885c Simplify prototype definition for taglib_read 2021-11-13 12:18:42 -05:00
Deluan
91b470c93b Show artist link in Songs lists 2021-11-05 20:25:12 -04:00
Deluan
1c82bf5179 Remove non-album artist_ids from the DB 2021-11-05 20:24:50 -04:00
Deluan
0d9dcebf32 Fix playlist cannot be empty via Subsonic API 2021-11-05 10:23:45 -04:00
Deluan
5994c31f4c Fix migration to support null values 2021-11-04 21:23:41 -04:00
Deluan
804fb716db Show in the logs how long it took to startup 2021-11-04 13:49:05 -04:00
Deluan
d3a2f769b7 Better logging of GetSimilar call 2021-11-03 15:59:16 -04:00
Deluan
68a84ec832 Smarter cache of external info calls (last.fm / spotify) 2021-11-03 14:13:50 -04:00
Deluan
9e48d87f84 Add a new index for album, to optimize the getAlbumList?type=alphabeticalByArtist Subsonic query 2021-11-02 22:08:21 -04:00
Deluan
9712a5b1c6 Fix error codes for required parameters in getAlbumList 2021-11-02 21:38:08 -04:00
Deluan
9422373be0 Optimize AlbumRepository.GetAll and add a GetAllWithoutGenres method specifically for Subsonic API, where multiple-genres are not required 2021-11-02 21:19:49 -04:00
dependabot[bot]
bc8132ef1f Bump @testing-library/user-event from 13.2.1 to 13.5.0 in /ui
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.2.1 to 13.5.0.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.2.1...v13.5.0)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 15:54:18 -04:00
dependabot[bot]
82bc8cd0aa Bump github.com/go-chi/httprate from 0.5.1 to 0.5.2
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.5.1...v0.5.2)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 15:53:53 -04:00
dependabot[bot]
1e5ab59df8 Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 15:52:39 -04:00
dependabot[bot]
28ad91a9d6 Bump github.com/Masterminds/squirrel from 1.5.0 to 1.5.1
Bumps [github.com/Masterminds/squirrel](https://github.com/Masterminds/squirrel) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/Masterminds/squirrel/releases)
- [Commits](https://github.com/Masterminds/squirrel/compare/v1.5.0...v1.5.1)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/squirrel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 15:52:15 -04:00
dependabot[bot]
e40e86590c Bump github.com/microcosm-cc/bluemonday from 1.0.15 to 1.0.16
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.15...v1.0.16)

---
updated-dependencies:
- dependency-name: github.com/microcosm-cc/bluemonday
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 15:49:33 -04:00
Deluan
12818fb590 Make song/album/artist endpoints read-only 2021-11-02 14:44:50 -04:00
Deluan
aaeaa3c590 Fix playlist filter 2021-11-02 12:56:43 -04:00
Deluan
053909196c More info in scrobbling logs 2021-11-02 12:25:29 -04:00
Deluan
6a87fc88f7 Ignores invalid timestamps in requests (use current time)
Fix this issue: https://www.reddit.com/r/navidrome/comments/ql3imf/scrobbling_fails_when_using_substreamer/
2021-11-02 10:33:40 -04:00
Deluan
975986ab16 Add bulk action to make playlists private/public
Better responsiveness
2021-11-01 21:27:36 -04:00
Deluan
778f474d26 Use new rest lib (Update receives all columns that need to be updated) 2021-11-01 21:27:36 -04:00
Deluan
b2acec0a09 When externals services are disabled, only disable UILoginBackgroundURL if it is not set by the user 2021-11-01 09:11:32 -04:00
Deluan
e7202339af Ignore empty lines in M3U files 2021-10-31 20:43:30 -04:00
Deluan
8c2e4da396 Fix dateLoved in criteria. Now log invalid field names in criteria 2021-10-31 20:31:11 -04:00
Deluan
a4d3bf42a7 Remove some duplicated code 2021-10-31 15:08:06 -04:00
Deluan
765557d739 Remove "Show" button from PlaylistEdit view 2021-10-31 15:08:06 -04:00
Deluan
86afd16cc8 Allow changing playlist's owner. Relates to #698 2021-10-31 15:08:06 -04:00
Deluan
133fed344f Add owner_id to playlist 2021-10-31 15:08:06 -04:00
Deluan
84bbcdbfc2 Add artist image lightbox 2021-10-30 20:05:01 -04:00
Deluan
1823159b25 New config to disable all external integrations. Closes #102 2021-10-30 18:03:46 -04:00
Deluan
0b5ed9eb80 Update ListenBrainz Portuguese translations 2021-10-30 16:19:39 -04:00
Steve Richter
a56d5bc850
Listenbrainz scrobbling (#1424)
* Refactor session_keys to its own package

* Adjust play_tracker

- Don't send external NowPlaying/Scrobble for tracks with unknown artist
- Continue to the next agent on error

* Implement ListenBrainz Agent and Auth Router

* Implement frontend for ListenBrainz linking

* Update listenBrainzRequest

- Don't marshal Player to json
- Rename Track to Title

* Return ErrRetryLater on ListenBrainz server errors

* Add tests for listenBrainzAgent

* Add tests for ListenBrainz Client

* Adjust ListenBrainzTokenDialog to handle errors better

* Refactor listenbrainz.formatListen and listenBrainzRequest structs

* Refactor agent auth_routers

* Refactor session_keys to agents package

* Add test for listenBrainzResponse

* Add tests for ListenBrainz auth_router

* Update ListenBrainzTokenDialog and auth_router

* Adjust player scrobble toggle
2021-10-30 12:17:42 -04:00
Steve Richter
ccc871d1f7
Only reset player scrobbled state on track change or end (#1432)
* Only reset player scrobbled state on track change or end

* Only reset player start time on track change or end
2021-10-30 12:09:40 -04:00
Deluan
d3e142233b Fix TypeError: Cannot read properties of undefined (reading 'length') 2021-10-29 18:10:17 -04:00
Deluan
a42aeff88d Optimize queries by path, should speed up the scanner a bit 2021-10-29 13:11:51 -04:00
Deluan
7cdbc04c5e Update caniuse-lite 2021-10-29 11:49:10 -04:00
Deluan
f3fae7e233 Optimize basic media_file query, avoiding adding "group by" or joining with genres if not required 2021-10-29 09:50:22 -04:00
Deluan
074732b1dc Filter playlists by names and comments 2021-10-28 13:58:06 -04:00
Deluan
66a9cbb7d9 Remove temp folders after tests 2021-10-28 10:40:31 -04:00
Deluan
fa3471f527 Simplify resources code, enabling any resource to be overridden (not just translations) 2021-10-28 10:25:25 -04:00
Deluan
9072412812 Fix translations on Windows 2021-10-28 09:41:37 -04:00
Deluan
cca32360db Use refetch when changing the playlist (as opposed to a full refresh) 2021-10-27 20:53:58 -04:00
Deluan
85d48478e8 Add .mka file format. Only works with ffmpeg extractor 2021-10-27 15:00:32 -04:00
Deluan
2183eb6498 Should not allow changing sort order in Album songs view 2021-10-27 14:35:58 -04:00
Deluan
ea435d0f60 Fix error on empty playlists. Simplify code for some operations 2021-10-27 09:50:24 -04:00
Deluan
f645c4769c Fix double escaped lyrics and comments 2021-10-26 19:33:21 -04:00
Deluan
5e87280750 Load playlist track genres 2021-10-26 18:46:08 -04:00
Deluan
526b6597c8 Remove duplication for loading tracks 2021-10-26 18:34:21 -04:00
Deluan
5dce499d6d Fix/Optimized Playlist tracks deletion 2021-10-26 14:05:28 -04:00
Deluan
fbd87ba577 Fix console error "Cannot convert undefined or null to object PlaylistsSubMenu" 2021-10-26 14:05:05 -04:00
Deluan
63b5191ea7 Fix lint 2021-10-26 10:57:59 -04:00
Deluan
af00503b77 Optimize playlist updates 2021-10-26 10:45:14 -04:00
Steve Richter
85185e3b98
Misc small changes (#1433)
* Fix React key warning in HelpDialog

* Change "lyric" to "lyrics" in en.json
2021-10-26 08:57:20 -04:00
Deluan
83eaafcbfb Add dateLoved Criteria field 2021-10-25 16:44:59 -04:00
Deluan
93ce0b5683 Fix Genre field and Contains/NotContains/StartsWith/EndsWith in Criteria (Smart Playlists) 2021-10-25 16:17:03 -04:00
Deluan
47549ecfc1 Increase updatePlaylist chunk to 100 tracks 2021-10-25 13:00:46 -04:00
Deluan
ed1ca65ad5 Show hotkeys as chips, for easier reading 2021-10-25 11:14:43 -04:00
Deluan
8d6b5f9d02 Speed up Subsonic GetPlaylist (by optimizing loadTracks) 2021-10-25 11:14:20 -04:00
Deluan
76fdcd112b Tweak SimilarSongs algorithm to prioritize the requested main artist 2021-10-24 18:04:40 -04:00
Deluan
18e1c169f9 Don't read the whole smart playlist file in memory 2021-10-24 14:41:08 -04:00
whorfin
4bc4daa68f
Improve git-vs-tarball detection (#1423)
* Extract version from directory name if .git dir is missing

* Avoid using shell

* Remove .gitinfo build from pipeline

* Fix git-detecting rule to be robust in presence of setup-git
2021-10-23 21:27:19 -04:00
Deluan
cc1659aa73 Better way to match top songs from external sources (Last.fm) 2021-10-23 20:26:30 -04:00
Deluan
31c598de07 Fix drag-n-drop from a playlist, also fix useDrag memoization 2021-10-23 20:25:28 -04:00
Deluan
2e2a647e67 Make SmartPlaylists read-only 2021-10-23 20:25:28 -04:00
Deluan
d169f54e7d Rename hasCoverArt field in criteria 2021-10-23 20:25:28 -04:00
Deluan
1494be9aaa Add playCount and playDate columns to album songs list 2021-10-23 20:25:28 -04:00
Deluan
c73f64ee3a Removed unused code 2021-10-23 20:25:28 -04:00
Deluan
806b13cf42 Update stats of Smart Playlist when it is created
Also fix loadTracks
2021-10-23 20:25:28 -04:00
Deluan
2c860edeb5 Don't import invalid .nsp files 2021-10-23 20:25:28 -04:00
Deluan
6a550dab77 Use new Criteria and remove SmartPlaylist struct 2021-10-23 20:25:28 -04:00
Deluan
3972616585 New Criteria API 2021-10-23 20:25:28 -04:00
Deluan
d0ce030386 Add PlayCount and PlayDate columns to PlaylistSongs 2021-10-23 20:25:28 -04:00
Deluan
947353610c Include never played songs in the "not in the last" operator 2021-10-23 20:25:28 -04:00
Deluan
2b57b98a4b Fix smart playlist refreshing only after the tracks were loaded 2021-10-23 20:25:28 -04:00
Deluan
1a96e9fe65 Import smart playlists (extension .nsp) 2021-10-23 20:25:28 -04:00
Deluan
21da1df4ea Cache smart playlist refreshes for 5 seconds 2021-10-23 20:25:28 -04:00
Deluan
d21932bd1b First version of SmartPlaylists being generated on demand 2021-10-23 20:25:28 -04:00
Deluan
c72add516a Add methods to Playlist model
Also, don't load genres for Playlists tracks (not necessary for now)
2021-10-23 20:25:28 -04:00
Deluan
d200933b68 Reduce number of queries for some playlists operations.
Also allow admins to update/delete playlists from other users in the Subsonic API. Closes #1366
2021-10-23 20:25:28 -04:00
Deluan
943082ef4e Fix time-based tests (again) 2021-10-23 20:25:28 -04:00
Deluan
c3fb4e1282 Fix rules serialization 2021-10-23 20:25:28 -04:00
Deluan
9c8f779f42 Fix time-based tests 2021-10-23 20:25:28 -04:00
Deluan
815623715e Load SmartPlaylists rules from DB 2021-10-23 20:25:28 -04:00
Deluan
7221b49b98 More tests 2021-10-23 20:25:28 -04:00
Deluan
cf8d08ec26 Initial drafts for Smart Playlists 2021-10-23 20:25:28 -04:00
Deluan
2a756eab88 Show external links on all resolutions but mobile 2021-10-21 10:30:53 -04:00
Deluan
104679ca6e Guard against record being undefined. Fix error Cannot read properties of undefined (reading 'id') 2021-10-19 20:22:56 -04:00
Dheeraj Lalwani
5621551dd0
Adds Lyrics Support to Subsonic API (#1379)
* Add function 'isSynced' that identifies if lyrics are synced or not and add tests for the same

* implement 'getLyrics' which returns lyrics if they exist

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* remove timestamps frorom the the lyrics if they are synced, fix filters & clean up code

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* add snapshot tests for the 'Lyrics' response & add some clean up

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* add tests for 'GetLyrics' function

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>

* update the snapshot test & the test for 'GetLyrics' function

Signed-off-by: Dheeraj Lalwani <lalwanidheeraj1234@gmail.com>
2021-10-19 16:33:06 -04:00
Deluan
3214783ce9 Remove double-retching playlist's tracks 2021-10-19 12:54:21 -04:00
Chirag Lulla
34b01c2cbf
Display lyrics on UI if synced lyrics present in metadata (#1406)
Signed-off-by: Chirag Lulla <lullachirag239@gmail.com>
2021-10-19 10:21:20 -04:00
Deluan
0d2a8f5338 Enable new Artist Page by default 2021-10-17 11:07:59 -04:00
Deluan
b7fedddfd8 Guard against record being undefined. Fix error Cannot read properties of undefined (reading 'albumId') 2021-10-16 20:29:31 -04:00
Dnouv
1d742cf8c7
Artist page improvements (#1391)
* Seperate mobile desktop components

* Fix err

* Rename classes and fix some styles

* Add lastFM button and remove console log

* Add Mbiz Icon

* render bio as dangerouslySetInnerHTML and remove unused css classes

* Add Fav and Stars

* Remove unstandardised class selector

* Remove ext link from m view

* Fix naming and simplify rounded styling

* Refactor ArtistShow:

- Extracted DesktopArtistDetails to its own file
- Removed album count as it was incorrect, it is not considering compilations
- Show bio and image from Native API, if it is available, before calling `getArtistInfo`

Co-authored-by: Deluan <deluan@navidrome.org>
2021-10-15 21:02:11 -04:00
Deluan
7505b5c554 Bump GoLang to 1.17.2 2021-10-13 09:53:44 -04:00
Deluan
174ad9e9da Fix ffmpeg bitrate parsing for flac files 2021-10-12 22:02:24 -04:00
certuna
ba0ee6aba4
Rename manifest.json to manifest.webmanifest (#1399)
* Rename manifest.json to manifest.webmanifest

browser consoles keep complaining that the manifest doesn't have the `.webmanifest` extension.

* FIx manifest.webmanifest references

Co-authored-by: Deluan <deluan@navidrome.org>
2021-10-12 20:06:09 -04:00
Deluan Quintão
6b38acad49
Update README.md 2021-10-08 10:51:09 -04:00
Deluan
ee8943f338 Fix semantic classes for currently playing song
Fix #1364
2021-10-07 19:49:27 -04:00
Serguey Parkhomovsky
86a87b4bb1
Fix default volume (#1395)
With the update in #1378, the default volume is now erroneously set to 25% instead of 50%. Remove the Math.pow and set it to 50% instead.
2021-10-07 17:21:08 -04:00
Deluan
8bbb878bb3 Add Finnish translation 2021-10-06 18:11:02 -04:00
Deluan Quintão
8591a9acdf
Update translations (#1383)
* Add Persian translation

* Update cs.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update ru.json (POEditor.com)

* Update sl.json (POEditor.com)

* Fix "Shared Playlists" pt translation

* Update de.json (POEditor.com)

* Update it.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update th.json (POEditor.com)
2021-10-06 18:08:29 -04:00
Deluan
b6e30cd01f Return playlists sorted in getPlaylists Subsonic endpoint 2021-10-05 14:47:57 -04:00
Deluan Quintão
058e7e4374
Add logo to README 2021-10-05 12:15:44 -04:00
Deluan
152836a01c Bump @testing-library/react from 12.1.1 to 12.1.2 in /ui 2021-10-04 17:30:01 -04:00
Deluan
6139338e80 Bump react-icons from 4.2.0 to 4.3.1 in /ui 2021-10-04 17:29:27 -04:00
Deluan
f0c11916ca Revert: Small optimization in genre mapping 2021-10-04 17:28:45 -04:00
Dnouv
a6311259fd
Fix layout error in ArtistShow (#1387) 2021-10-04 17:14:38 -04:00
Deluan
dbde0ffa0c Bump github.com/djherbis/atime to v1.1.0 2021-10-03 22:50:25 -04:00
Deluan
fba733708c Sort songs by artist/album/disc/track_number before adding to playlist 2021-10-02 21:55:45 -04:00
Deluan
e673360087 Limit number of playlists displayed in the sidebar, to avoid UI freezes 2021-10-02 21:39:33 -04:00
Deluan
2b105ca77b Enable DevSidebarPlaylists by default.
Closes #771
2021-10-02 13:56:42 -04:00
Deluan
9c29ee3651 Check permissions before adding songs to playlists 2021-10-02 13:23:17 -04:00
Deluan
6c3e45de41 Add songs to playlists with drag and drop 2021-10-02 13:14:33 -04:00
dependabot[bot]
2ab4647420
Bump golang.org/x/tools from 0.1.6 to 0.1.7 (#1382)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.6 to 0.1.7.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.6...v0.1.7)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-01 16:38:04 -04:00
Deluan Quintão
91e36a2c18
Check goimports in the pipeline (#1381)
* Check goimports in the pipeline

* Check goimports in the pipeline

* Check goimports in the pipeline

* go mod tidy

* wip

* wip

* Fix goimports and go:build tags

* Run golangci-lint before goimports
2021-10-01 15:32:24 -04:00
dependabot[bot]
0cbba80284
Bump react-router-dom from 5.2.0 to 5.3.0 in /ui (#1330)
Bumps [react-router-dom](https://github.com/ReactTraining/react-router) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/ReactTraining/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ReactTraining/react-router/compare/v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-01 10:34:37 -04:00
Deluan
f9d910473f Bump react-admin to 3.18.3 2021-10-01 09:45:28 -04:00
Igor Rzegocki
be3a6dc7a3
Use local copy of workbox service worker scripts (#1358)
* Use local copy of workbox service worker scripts

* Refactor workbox integration:

- Only add prod js, without maps. Reduces the size from 170k to 24k
- Removed it from build. As it is small now, we can add it to source, and have a script to just update it whenever it is required
- Fixed relative paths in navidrome-service-worker.js, should now work with BaseUrl != ''

Co-authored-by: Deluan <deluan@navidrome.org>
2021-10-01 09:14:15 -04:00
Deluan
b1e7760996 Preload next song 2021-10-01 08:43:59 -04:00
Deluan
ad45ab4a04 Fix genre update chunking 2021-10-01 08:43:59 -04:00
Serguey Parkhomovsky
24fef584ad
Bump react-jinke-music-player from 4.24.0 to 4.24.2 (#1378)
This should fix #1367.
2021-10-01 08:42:02 -04:00
Deluan
e17d436902 Do not attach Genres to the "Various Artists" artist 2021-09-27 21:55:33 -04:00
Deluan
73659e5669 Change "Build" link to point to the latest build artifacts from master 2021-09-27 18:17:53 -04:00
Deluan
71b1e7f870 Bump github.com/lestrrat-go/jwx from 1.2.6 to 1.2.7 2021-09-27 13:29:31 -04:00
Deluan
694056010c Bump @testing-library/react from 12.1.0 to 12.1.1 in /ui 2021-09-27 13:27:59 -04:00
Deluan
4fda895a64 Bump blueimp-md5 from 2.18.0 to 2.19.0 in /ui 2021-09-27 13:26:31 -04:00
Deluan
f664af5559 Bump react-admin from 3.18.1 to 3.18.2 in /ui 2021-09-27 13:26:31 -04:00
Deluan
c6868ff8a0 Don't show Artist Page for "Various Artists" 2021-09-27 11:52:23 -04:00
Deluan
0b65a4e34e Fix comment word wrapping 2021-09-27 09:48:31 -04:00
Deluan
24872e6c2a Fix biography word wrapping and requests for undefined resource 2021-09-27 09:47:16 -04:00
Deluan
b4e5c662dc Fix JS console warning 2021-09-26 17:36:30 -04:00
Deluan
6752e0a17d Fix harmless error message in logs when ScanSchedule set was "0"
Message:
`ERRO[0000] Error scheduling periodic scan                error="expected exactly 5 fields, found 1: [0]"`
2021-09-26 15:57:27 -04:00
Deluan
5680e53949 Update genres in chunks. Should fix #1368 2021-09-26 15:55:52 -04:00
Dnouv
482c2dec0c
Artist Detail Page (first cut) (#1287)
* Configure fetching from API and route

* pretty

* Remove errors

* Remove errors

* Remove errors

* Complete page for Desktop view

* Fix error

* Add xs Artist page

* Remove unused import

* Add styles for theme

* Change route path

* Remove artId useEffect array

* Remove array

* Fix cover load err

* Add redirect on err

* Remove route

* What's in a name? consistency :)

* Fix err

* Fix UI changes

* Fetch album from resource

* Renaming done

* Review changes

* Some touch-up

* Small refactor, to make naming and structure more consistent with AlbumShow

* Make artist's album list similar to original implementation

* Reuse AlbumGridView, to avoid duplication

* Add feature flag to enable new Artist Page, default false

* Better biography styling. Small refactorings,

* Don't encode quotes and other symbols

* Moved AlbumShow to correct folder

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-26 15:32:40 -04:00
caiocotts
210dc6b12e
Add x-total-count to Subsonic API getAlbumList (#1360)
* Add x-total-count to Subsonic API getAlbumList

* Rename variable

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-21 20:40:39 -04:00
Deluan
73a2271cdd Small optimization in genre mapping 2021-09-21 13:37:44 -04:00
Samarjeet
0c0bd2967d
Replace expanded with a dialog (#1258)
* Replace expanded with a dialog

* Change `info` label to "Get Info"

* Rename things for consistency

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-20 20:30:43 -04:00
Deluan
15ae3d47cf Only apply audioStreamRx once 2021-09-20 19:33:50 -04:00
Deluan
1365adbb39 Support 7.1 (8) channels 2021-09-20 19:33:50 -04:00
Miguel A. Arroyo
e12a14a87d feat: Adds Audio Channel Metadata - #1036 2021-09-20 19:33:50 -04:00
Deluan
0079a9b938 Close Sidebar when going to Playlists list 2021-09-20 19:00:37 -04:00
Deluan
892c2bfd58 Revert "Disable mini-player (bubble) dragging. Should fix #1217"
This reverts commit abf6318a8b.
2021-09-20 18:24:18 -04:00
dependabot[bot]
5fb7328965 Bump golang.org/x/tools from 0.1.5 to 0.1.6
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.5 to 0.1.6.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.5...v0.1.6)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 18:18:45 -04:00
Deluan
86479a6d06 More info when recovering from panic 2021-09-20 18:16:22 -04:00
Deluan
76bd20e8ff Recover from any possible taglib panics. Fixes #1343 2021-09-20 18:09:39 -04:00
dependabot[bot]
7a15ed0740 Bump prettier from 2.4.0 to 2.4.1 in /ui
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.4.0...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 17:45:50 -04:00
dependabot[bot]
d574df5fd7 Bump github.com/go-chi/jwtauth/v5 from 5.0.1 to 5.0.2
Bumps [github.com/go-chi/jwtauth/v5](https://github.com/go-chi/jwtauth) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/go-chi/jwtauth/releases)
- [Commits](https://github.com/go-chi/jwtauth/compare/v5.0.1...v5.0.2)

---
updated-dependencies:
- dependency-name: github.com/go-chi/jwtauth/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 17:45:25 -04:00
dependabot[bot]
a7ace48efb Bump github.com/ReneKroon/ttlcache/v2 from 2.8.0 to 2.8.1
Bumps [github.com/ReneKroon/ttlcache/v2](https://github.com/ReneKroon/ttlcache) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/ReneKroon/ttlcache/releases)
- [Changelog](https://github.com/ReneKroon/ttlcache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ReneKroon/ttlcache/compare/v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: github.com/ReneKroon/ttlcache/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 17:44:52 -04:00
dependabot[bot]
84d98010d3 Bump github.com/spf13/viper from 1.8.1 to 1.9.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 17:44:02 -04:00
Deluan
e63804fbdd Use newer versions of node in the pipeline 2021-09-18 22:38:55 -04:00
Deluan
a5101fa9b4 Use npm dependencies cache from setup-node@v2 2021-09-18 22:38:55 -04:00
dependabot[bot]
f2ed3f2d86
Bump prettier from 2.3.2 to 2.4.0 in /ui (#1341)
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-13 16:12:29 -04:00
dependabot[bot]
b23ab1ccec
Bump @testing-library/react from 12.0.0 to 12.1.0 in /ui (#1342)
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 12.0.0 to 12.1.0.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v12.0.0...v12.1.0)

---
updated-dependencies:
- dependency-name: "@testing-library/react"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-13 16:10:07 -04:00
Deluan
abf6318a8b Disable mini-player (bubble) dragging. Should fix #1217 2021-09-13 11:17:06 -04:00
Deluan
b55f3a6946 Add paddingBottom to the whole sidebar menu, to avoid playlists to be covered by the player 2021-09-12 21:24:07 -04:00
Deluan
ab2912b4fa Only import playlists from configured paths in option PlaylistsPath. Closes #1181
Syntax is Ant-style Globs, with support for '**' (any subfolder). Default: '.:**' (or '.;**' in Windows`, meaning all folders and subfolders under `MusicFolder`
2021-09-12 21:07:51 -04:00
Deluan
9f00aad216 Upgrade to GoLang 1.17.1 2021-09-12 14:14:33 -04:00
Deluan Quintão
79363d6c07
Move Playlists to the sidebar menu (#1339)
* Show playlists in sidebar menu

* Fix menu

* Refresh playlist submenu when adding new playlist

* Group shared playlists below user's playlists

* Fix text overflow in menu options

* Add button in playlist menu to go to Playlists list

* Add config option `DevSidebarPlaylists` to enable this feature (default false)
2021-09-11 13:11:15 -04:00
Deluan
a7017e4bb0 Fix JS console warning 2021-09-10 18:04:38 -04:00
Deluan
dc0ec32dbf Fix menu items highlight 2021-09-10 16:17:08 -04:00
Salman Inayat
06b1a1a25c
Album size overflow fixed (#1071)
* Added back button

* Added back button

* Added back button

* Fixed Album size overflow

* Fixed Album size overflow

* Fixed album size overflowing

* Fixed album size overflowing

* Fixed album size overflowing

* Fixed album size overflow on small screen

* Changes reverted in PlayerEdit.js

* prettier formatting issue resolved

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-09 11:56:48 -04:00
Deluan
6ac2fefaf3 Make AppBar stick on scroll 2021-09-09 11:21:16 -04:00
Samarjeet
2e921cd793
Fix sidebar scroll height (#1338)
* Fix sidebar scroll height

* Prettier

Co-authored-by: Deluan <deluan@navidrome.org>
2021-09-09 09:33:38 -04:00
Deluan Quintão
c2251e6ddc
Update GoLang to 1.17 (#1295)
* Update GoLang to 1.17

* Rename pipeline jobs
2021-09-09 00:26:56 -04:00
Deluan
25aab8bcb5 go mod tidy 2021-09-09 00:17:43 -04:00
Deluan
94083f85d2 Bump @testing-library/react-hooks version 2021-09-09 00:16:44 -04:00
Deluan
f0ef5187b2 Bump react-redux version 2021-09-09 00:16:13 -04:00
Deluan
79e79b6366 Bump github.com/go-chi/chi 2021-09-09 00:15:16 -04:00
Deluan
a961ffe2e1 Bump github.com/golangci/golangci-lint 2021-09-09 00:14:18 -04:00
Deluan
402aaaaf45 Bump github.com/lestrrat-go/jwx version 2021-09-09 00:13:39 -04:00
Deluan
5c7784f842 Bump github.com/cespare/reflex version 2021-09-09 00:13:06 -04:00
Deluan
a4e96d25a8 Pin Node to 16.8 as a workaround to https://github.com/nodejs/node/issues/40030 2021-09-08 23:28:28 -04:00
Deluan
8444c28bed Upgrade react-admin to 3.18.1
This makes the sidebar fixed when users scroll vertically. This supersedes #1024, even though it also hides the hamburger menu...
2021-09-08 22:50:03 -04:00
Tucker Kern
fb11080545
Improve performance of placeholder images (#1325)
* Don't include updatedAt field when fetching album art placeholder. This will allow browers to cache the place holder

* Apply resizing to placeholder image

* Fix issues discovered by CI linter and prettier

* Updates from PR review
2021-09-06 22:34:37 -04:00
whorfin
173b30cd59
Extract version from directory name if .git dir is missing (#1327)
* Extract version from directory name if .git dir is missing

* Avoid using shell

* Remove .gitinfo build from pipeline
2021-09-06 21:26:04 -04:00
Deluan
af7c87dd7b Give a warning on commands that do not build the frontend.
This is to avoid confusions like this:
https://github.com/navidrome/navidrome/issues/1297#issuecomment-913007331
2021-09-05 21:39:19 -04:00
Artyom
8df056b797
ru.json update (#1320) 2021-09-05 10:56:54 -04:00
caiocotts
54f98497c2
Use wchar_t for TagLib filenames on Windows (#1310)
* Use wchar_t for tagLib filenames on Windows

* Make TagLib default extractor for all platforms.

* Organize imports

Co-authored-by: Deluan <deluan@navidrome.org>
2021-08-28 19:35:54 -04:00
dependabot[bot]
c55e65902b
Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1300)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 20:50:46 -04:00
dependabot[bot]
d37231f319
Bump github.com/ReneKroon/ttlcache/v2 from 2.7.0 to 2.8.0 (#1298)
Bumps [github.com/ReneKroon/ttlcache/v2](https://github.com/ReneKroon/ttlcache) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/ReneKroon/ttlcache/releases)
- [Changelog](https://github.com/ReneKroon/ttlcache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ReneKroon/ttlcache/compare/v2.7.0...v2.8.0)

---
updated-dependencies:
- dependency-name: github.com/ReneKroon/ttlcache/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 20:47:36 -04:00
dependabot[bot]
47fa32ec93
Bump github.com/golangci/golangci-lint from 1.41.1 to 1.42.0 (#1299)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.41.1 to 1.42.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.41.1...v1.42.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 17:41:55 -04:00
Deluan
cf042ed83d Fix random volume changes 2021-08-22 12:18:26 -04:00
Deluan
d481864035 Some small refactorings 2021-08-22 12:16:49 -04:00
Deluan
c2927e105b Fix loadSimilar method, was causing "internal error". Fix #1293 2021-08-21 19:37:00 -04:00
Deluan
6983390ca3 Setup git hooks when running make setup 2021-08-21 13:45:34 -04:00
Deluan
143f5ba9d5 Import song duration with hundredths when using TagLib
This is how ffmpeg extractor currently works, and it makes album durations more precise.
2021-08-20 21:42:01 -04:00
Deluan
05e27095b2 Fix getTopSongs endpoint 2021-08-19 08:17:22 -04:00
Tucker Kern
aa72d3d41b
Add missing song information to players and apply EnableCoverAnimation to mobile player. (#1268)
* Disable mobile player cover animation when EnableCoverAnimation is set to false. Also increase cover art size and remove rounded borders.

* Display song album and year in mobile player view

* Remove default singer element from mobile player and reduce vertical white space

* Only add song year if it exists

* Add song year to desktop player when present

* Increase non-animated cover size to 85% and set a limit on the width of 600px.

* Explain what what the styles impact

* Remove unused style for songArtist

* Apply prettier

* Adjust player styles to handle nonsquare album art better. Should probably push this upstream too

* Also fix desktop player's handling of non square cover art.
2021-08-17 13:57:48 -04:00
ToadCast
a20bd5fe05
Correct some french translations (#1278) 2021-08-13 20:27:37 -04:00
Deluan Quintão
99aeaabf7d
Update translations (#1285)
* Update es.json (POEditor.com)

* Update zh-Hans.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update de.json (POEditor.com)

* Update it.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update pl.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update th.json (POEditor.com)

* Update uk.json (POEditor.com)
2021-08-13 20:27:18 -04:00
dependabot[bot]
0a5f966047 Bump redux from 4.1.0 to 4.1.1 in /ui
Bumps [redux](https://github.com/reduxjs/redux) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/reduxjs/redux/releases)
- [Changelog](https://github.com/reduxjs/redux/blob/master/CHANGELOG.md)
- [Commits](https://github.com/reduxjs/redux/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: redux
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-13 20:11:05 -04:00
dependabot[bot]
5338567346 Bump github.com/onsi/gomega from 1.14.0 to 1.15.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-13 19:57:12 -04:00
dependabot[bot]
50526024b2 Bump github.com/lestrrat-go/jwx from 1.2.4 to 1.2.5
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.4 to 1.2.5.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/main/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.4...v1.2.5)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-13 19:56:57 -04:00
Deluan
db4165f27c Bum react-admin to 3.17.2. Fix SearchInput border 2021-08-13 19:45:18 -04:00
Deluan
a8cf887e87 Adjust icon size 2021-08-03 22:01:57 -04:00
Deluan Quintão
63000ab5ae Update en.json (POEditor.com) 2021-08-03 21:41:32 -04:00
Deluan
b44ef81c6f Allow 0 value to disable ScanSchedule.
Seems that Viper does not recognize empty environment vars as valid values

Closes #1274
2021-08-03 19:37:36 -04:00
caio
e9d0abe0bc Support local paths as urls in playlists. 2021-08-02 23:53:47 -04:00
Deluan
bcafe88ef9 Don't autoplay when reloading play queue from Redux store 2021-08-01 19:49:17 -04:00
dependabot[bot]
1710730b45
Bump github.com/kr/pretty from 0.2.1 to 0.3.0 (#1267)
Bumps [github.com/kr/pretty](https://github.com/kr/pretty) from 0.2.1 to 0.3.0.
- [Release notes](https://github.com/kr/pretty/releases)
- [Commits](https://github.com/kr/pretty/compare/v0.2.1...v0.3.0)

---
updated-dependencies:
- dependency-name: github.com/kr/pretty
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-01 12:56:55 -04:00
Deluan
aa1571e074 Remove unused AnnotatedModel interface 2021-08-01 12:04:45 -04:00
Deluan
c831dc4cdf Use structs lib to map models to DB. Fix #1266 2021-08-01 12:04:45 -04:00
Deluan
344d7a4392 Inject DB into DataStore, instead of hardcode the dependency 2021-07-31 20:15:20 -04:00
Deluan
c0fc36da63 Make album genres clickable 2021-07-27 13:22:35 -04:00
Deluan
e68b22ea5d Don't send invalid scrobbles when clearing the player's queue 2021-07-26 16:50:50 -04:00
Sitansh Rajput
fb4eefced5
"Add to Playlist" on AlbumList actions (#1257)
* added a dependency npm was complaining about

added playlist to album actions

* removed chokidar dependency

Co-authored-by: Skrtansh Rajput <srajput@alienvault.com>
2021-07-26 15:00:38 -04:00
Deluan
615cac2ec4 Extract ExternalLinks into its own component 2021-07-26 13:25:31 -04:00
dependabot[bot]
72f9e3e80a Bump @testing-library/user-event from 13.2.0 to 13.2.1 in /ui
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.2.0 to 13.2.1.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.2.0...v13.2.1)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 13:25:19 -04:00
Deluan
763bcafdac Use Tooltip in links to external sites 2021-07-24 19:52:15 -04:00
Deluan
5b81f7a73a Fix get song by id 2021-07-24 18:54:22 -04:00
Deluan
7bd506accc Retrieve all options for Genre filters 2021-07-24 16:00:27 -04:00
Deluan
b66c39451f Fix build 2021-07-24 11:45:46 -04:00
Deluan
4ed01bad86 Use ffmpeg extractor by default on Windows
This is to avoid issue with unicode chars in filenames. See #810
2021-07-24 11:35:49 -04:00
Deluan
d3975d206a Reorganize metadata extractors code 2021-07-24 11:10:19 -04:00
Deluan Quintão
6175629bb4
Build and release Docker image for Linux 32 bits platform (#1260) 2021-07-24 07:51:12 -04:00
Deluan
6c550819fd Use TagLib to detect whether a media file has embedded cover or not 2021-07-24 01:59:53 -04:00
Deluan
91325071a6 Change fallback extractor to taglib, the default option 2021-07-22 23:08:47 -04:00
Deluan
876dda83f2 Reduce number of calls to lstat.
Should make the scanner a bit faster, specially in networked filesystems
2021-07-21 22:17:37 -04:00
Deluan
86c0b422f6 Small refactorings 2021-07-21 12:46:30 -04:00
Deluan
1cef44a543 Show in the logs which mbid will be used if multiple mbids are found for album/artist 2021-07-21 11:12:03 -04:00
Deluan
4fcb238295 Fix "too many SQL variables" error in GetStarred endpoint 2021-07-21 10:45:52 -04:00
Deluan
4f9d546da4 Abort startup if config file is invalid 2021-07-20 22:35:22 -04:00
Deluan
eeb14f0243 Removed unused function 2021-07-20 20:50:59 -04:00
Deluan
a89bdfbb8d Fix build 2021-07-20 20:22:15 -04:00
Deluan
8afa2cd833 Remove dependency of deprecated ioutil package 2021-07-20 20:12:28 -04:00
Deluan
774ad65155 Use fs.FS in MergeFS implementation 2021-07-20 19:54:44 -04:00
Deluan
7540881695 Small refactorings 2021-07-20 19:18:29 -04:00
Deluan
08840f6170 Simplify cover detection in roll-up code by left-joining synthesized table 2021-07-20 17:45:08 -04:00
Deluan
cddd1b3f6b Simplify genre roll-up code by left-joining synthesized tables 2021-07-20 17:45:08 -04:00
Deluan
bc6b175414 Make getGenre Subsonic endpoint returns genres sorted by counts 2021-07-20 17:45:08 -04:00
Deluan
b6e9ec4db4 Optimize GetAll genres query 2021-07-20 17:45:08 -04:00
Deluan
1471e1240d Show songs' genres as text instead of Chips 2021-07-20 17:45:08 -04:00
Deluan
95181d748d Fix rollup of track genres to albums and artists.
See: https://github.com/navidrome/navidrome/pull/1251#issuecomment-882343022
2021-07-20 17:45:08 -04:00
Deluan
254e5673e1 Fix log message about artist with Various Artists' mbid 2021-07-20 17:45:08 -04:00
Deluan
00e418cb2a Fix log message about multiple MBIDs 2021-07-20 17:45:08 -04:00
Deluan
2742977c63 Fix multiple id3v2.4 genres appearing as one big concatenated genre 2021-07-20 17:45:08 -04:00
Deluan
69f71be98a Add more tests 2021-07-20 17:45:08 -04:00
Deluan
58ee4c60ca Add Links to external sites 2021-07-20 17:45:08 -04:00
Deluan
21cd50d81c Fix aggregated values (count, size, duration) in roll-up queries 2021-07-20 17:45:08 -04:00
Deluan
054b5eafdb Add Genres as "Chips" in Album details and Song details 2021-07-20 17:45:08 -04:00
Deluan
e2233779f1 Force full rescan when adding multi-genres 2021-07-20 17:45:08 -04:00
Deluan
3a356499ae Fix lint error 2021-07-20 17:45:08 -04:00
Deluan
a0cd585401 Fix Count methods 2021-07-20 17:45:08 -04:00
Deluan
20b7e5c49b Add Genre filters to UI 2021-07-20 17:45:08 -04:00
Deluan
c56c7c865e Purge unused genres at the end of the scan 2021-07-20 17:45:08 -04:00
Deluan
b56e034ce3 Add multiple genres to Artists 2021-07-20 17:45:08 -04:00
Deluan
1d8607ef6a Remove unnecessary repositories methods 2021-07-20 17:45:08 -04:00
Deluan
5e54925520 Add multiple genres to Albums 2021-07-20 17:45:08 -04:00
Deluan
39da741a80 Add multiple genres to MediaFile 2021-07-20 17:45:08 -04:00
Deluan
7cd3a8ba67 Add genre tables, read multiple-genres from tags 2021-07-20 17:45:08 -04:00
Deluan
1f0314021e Change initial scan message log level 2021-07-19 16:53:58 -04:00
Deluan
19c2ef3803 Enable buffered scrobbles by default 2021-07-19 16:10:37 -04:00
dependabot[bot]
d886c63122
Bump react-image-lightbox from 5.1.1 to 5.1.4 in /ui (#1252)
Bumps [react-image-lightbox](https://github.com/frontend-collective/react-image-lightbox) from 5.1.1 to 5.1.4.
- [Release notes](https://github.com/frontend-collective/react-image-lightbox/releases)
- [Changelog](https://github.com/frontend-collective/react-image-lightbox/blob/master/CHANGELOG.md)
- [Commits](https://github.com/frontend-collective/react-image-lightbox/compare/v5.1.1...v5.1.4)

---
updated-dependencies:
- dependency-name: react-image-lightbox
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-19 13:20:44 -04:00
dependabot[bot]
5b828cd7ef
Bump @testing-library/user-event from 13.1.9 to 13.2.0 in /ui (#1253)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.1.9 to 13.2.0.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.1.9...v13.2.0)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-19 13:20:28 -04:00
Deluan
ef60db3a5f Bump github.com/lestrrat-go/jwx from 1.2.2 to 1.2.4 2021-07-19 13:17:55 -04:00
Deluan
882b02c747 Fix forceRescan not re-importing all tracks 2021-07-19 10:32:33 -04:00
Deluan
44e7502aef Log warning when artist has a MBID of Various Artists 2021-07-18 18:28:51 -04:00
Deluan
e61cf3217d Reapply the fix from #1054, but without getting into an infinite look in case of SMB fs errors. See #1164 2021-07-17 21:06:53 -04:00
Deluan
03ad6e972a Removed unused attributes in Last.fm responses 2021-07-16 21:06:47 -04:00
Deluan
eb8ffc6f76 Fix infinite loop when the fs fails. Closes #1164 2021-07-16 09:38:58 -04:00
Deluan
b0fc684cb6 Fix small lint errors found by gocritic 2021-07-15 13:43:03 -04:00
Deluan
8d56ec898e Use AlbumArtist tag even for compilations, when it is specified.
If the tracks' AlbumArtists are different, then use "Various Artists"
2021-07-15 11:53:08 -04:00
Deluan Quintão
5064cb2a46
Add git version info to release source (#1250) 2021-07-15 09:49:34 -04:00
Deluan
f78257235e Add option to have different loglevels per source folder/file 2021-07-14 18:44:14 -04:00
dependabot[bot]
1a6a284bc1
Bump github.com/google/uuid from 1.2.0 to 1.3.0 (#1249)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 11:09:23 -04:00
dependabot[bot]
1d948beb1f
Bump github.com/go-chi/httprate from 0.5.0 to 0.5.1 (#1248)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.5.0...v0.5.1)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 11:07:11 -04:00
dependabot[bot]
deefd7a2fd
Bump github.com/lestrrat-go/jwx from 1.2.1 to 1.2.2 (#1247)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/main/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 11:06:51 -04:00
Deluan
97f87416a4 Bump @testing-library dependencies 2021-07-14 11:02:11 -04:00
Deluan
5d8b90b168 Bump Go dependencies 2021-07-14 10:55:40 -04:00
Deluan
8396b51a9c Upgrade React-Admin to 3.17.0 2021-07-14 10:39:48 -04:00
Deluan
4a25fa0920 Make the default volume 50% (compensate for logarithmic volume).
Closes #1052
2021-07-14 09:58:50 -04:00
dependabot[bot]
8e71f308c2
Bump prettier from 2.3.1 to 2.3.2 in /ui (#1210)
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-09 21:29:51 -04:00
Deluan
53fe2e98c5 Remove eject script, hopefully it will never be used 2021-07-08 21:09:38 -04:00
Deluan
334068c8bf Refactor mime-types configuration 2021-07-08 11:38:29 -04:00
Deluan
b34d77f85a Don't show "playing/paused" icon on the first song when calling "Play Now" 2021-07-05 21:45:20 -04:00
Deluan
24d4c81b34 Change default volume to 50%
Should fix #1052
2021-07-04 21:36:41 -04:00
Deluan
189d0c0ab3 Restore volume when playing a song...
... or continuing to play a paused one
2021-07-04 21:36:41 -04:00
Deluan
1922eaaab2 Make cover rectangular in player when cover animation is disabled 2021-07-04 12:52:59 -04:00
Deluan
5d9bea5087 Fix Album grid responsiveness on small screens.
Potentially fixes #647
2021-07-04 12:09:30 -04:00
Deluan
69afb69959 Fix Disc context menu not visible in mobile 2021-07-04 11:44:41 -04:00
Deluan
27ba267b38 Fix play single song action 2021-07-03 22:29:59 -04:00
Deluan
114fdce09e Fix Last.fm's artist.getInfo 2021-07-03 21:48:53 -04:00
Deluan
fa8b4d40b4 Fix arranging songs in PlayQueue 2021-07-03 21:34:24 -04:00
Deluan
ace5c905eb Made the Player behaviour more consistent 2021-07-02 23:36:33 -04:00
Deluan
26b5e6b1b4 Better scrobble log message when buffer is disabled 2021-07-02 10:19:16 -04:00
certuna
77f6bc83ac
Update SongList.js (#1219)
Genre and Comments columns in Songs listview (hidden by default)
2021-07-02 10:18:45 -04:00
Deluan
94e36d7f60 Remove old feature flag for cache layout 2021-07-02 10:04:41 -04:00
Deluan
f49205733b Add feature flag for buffered scrobbling 2021-07-02 10:04:41 -04:00
Deluan
cfb113bd33 Disable Last.FM features based on LastFM.Enabled config option 2021-07-02 10:04:41 -04:00
Deluan
289da56f64 Implement Scrobble buffering/retrying 2021-07-02 10:04:41 -04:00
Deluan
fb183e58e9 Only encrypts NewPassword if it is not empty, when updating the user details. Fixes #1222 2021-07-01 16:09:49 -04:00
Deluan
ed286c7103 Don't rely on goroutines to send keepalive events 2021-07-01 13:31:46 -04:00
Deluan
452c8dc44b Fixed the enduring nasty "too many files open" bug!! Fix #446 2021-07-01 12:07:32 -04:00
Deluan
0c2ca2a5e4 Assign event ids in the main loop, to avoid out-of-order events 2021-07-01 10:58:41 -04:00
Deluan
5bd33455a1 Fix deadlock situation when events are sent too fast to the broker 2021-07-01 10:42:00 -04:00
Deluan
4ea0f235e1 Fix scrollbar colour for Dark/ExtraDark theme. Fixes #1216 2021-06-29 12:29:00 -04:00
Deluan Quintão
b16d473d4c Update es.json (POEditor.com) 2021-06-28 17:19:01 -04:00
Deluan
fd82b8f2dc Default for EnableCoverAnimation in dev mode is true 2021-06-28 17:18:32 -04:00
Deluan
a73f885afb Add option to disable album cover animation in the player. Closes #1185 2021-06-28 17:11:05 -04:00
Brian Schrameck
167fe46288
Addresses a bug that would prevent users from changing their own passwords, introduced as part of #1187. (#1214) 2021-06-28 16:36:14 -04:00
Deluan Quintão
cb1827ccbf
Update translations (#1134)
* Update de.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update de.json (POEditor.com)

* Update es.json (POEditor.com)

* Update uk.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update it.json (POEditor.com)

* Update it.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update de.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update it.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update zh-Hans.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update zh-Hans.json (POEditor.com)

* Update de.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update sl.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update uk.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)
2021-06-28 09:55:46 -04:00
Deluan
25f0e11562 Add 'AlbumArtist' column to SongList 2021-06-28 09:54:17 -04:00
Deluan
292cf99f49 Add 'Year' column to Album and Playlists song list 2021-06-28 09:45:30 -04:00
Deluan
d2fcab78a5 Fix ND_DEVFASTACCESSCOVERART flag not available as env var 2021-06-26 15:40:12 -04:00
Deluan
94533e585c Add tests to /scrobble endpoint 2021-06-26 13:52:29 -04:00
Deluan
6dd38376f7 Add referential integrity to remove user's props when user is deleted 2021-06-25 23:09:10 -04:00
Deluan
26bcf0b877 Enable Last.fm scrobbling by default (still requires user's authorization) 2021-06-25 23:09:09 -04:00
Deluan
92634a7408 Only show message after 2 seconds, giving time for the browser to close it first 2021-06-25 22:23:35 -04:00
Deluan
ee21f3957e Pass userId explicitly to UserPropsRepository methods 2021-06-25 22:21:37 -04:00
Deluan
a1551074bb Add a hacky way to style the react-player. 2021-06-25 18:19:57 -04:00
Deluan
823fef8e43 Fix JS console error 2021-06-25 14:11:58 -04:00
Deluan
82105c3a16 Remove React.Strict mode 2021-06-25 14:08:00 -04:00
Deluan
b684a47f80 Show DiscSubtitle even if the album has only one disc.
Closes #947
2021-06-25 11:30:24 -04:00
Deluan
da2334e10c Remove submenu "Library". Relates to #430 2021-06-25 00:01:38 -04:00
Deluan
4853760fb5 Suppress logs of successful DB migrations applied when running for the first time 2021-06-24 23:43:20 -04:00
Deluan
0cbb0acad3 Skip songs with less than 31 seconds, as per Last.fm specification
See https://www.last.fm/api/scrobbling#when-is-a-scrobble-a-scrobble
2021-06-23 21:08:01 -04:00
Deluan
5040f6fd97 Fix label 2021-06-23 18:09:05 -04:00
Deluan
abe8015745 Add option to disable external scrobbling per player 2021-06-23 17:55:58 -04:00
Deluan
5001518260 Move user properties (like session keys) to their own table 2021-06-23 17:49:32 -04:00
certuna
265f33ed9d
Remove clearServiceWorkerCache, not needed anymore. (#1205)
remove clearServiceWorkerCache, not needed anymore.
2021-06-23 12:11:35 -04:00
Deluan
99be8444d3 Disable completely external scrobblers if feature is disabled (DevEnableScrobble) 2021-06-23 11:01:58 -04:00
Deluan
f4ddd201f2 Send the time the track started playing when scrobbling 2021-06-23 11:01:58 -04:00
Deluan
056f0b944f Refactor: Consolidate scrobbling logic in play_tracker 2021-06-23 11:01:58 -04:00
Deluan
76acd7da89 Don't send scrobbles/nowPlaying updates to Last.fm if user has not authorized 2021-06-23 11:01:58 -04:00
Deluan
8af7dab23d Fix wrong warning about ignored NowPlaying 2021-06-23 11:01:58 -04:00
Deluan
a7509c9ff7 Send NowPlaying and Scrobbles to Last.fm 2021-06-23 11:01:58 -04:00
Deluan
d5461d0ae9 Refactor Agents to be singleton
Initial work for Last.fm scrobbler
2021-06-23 11:01:58 -04:00
Steve Richter
f9fa9667a3 Show user-friendly message when error occurs in Last.fm callback endpoint 2021-06-23 11:01:58 -04:00
Steve Richter
5fbfd9c81e Implement Last.fm account linking UI 2021-06-23 11:01:58 -04:00
Deluan
8b62a58b4c Remove limitation of only scrobbling tracks longer than 30 seconds 2021-06-22 09:59:00 -04:00
Deluan
743e469795 Use singleton in other places as well 2021-06-21 18:59:26 -04:00
Deluan
1f997357a9 Expose Last.fm's ApiKey to UI 2021-06-21 18:14:01 -04:00
Deluan
143cde37e5 Implement Last.FM Web authentication flow 2021-06-21 18:14:01 -04:00
Deluan
502a719e96 Implement Last.FM Desktop Auth flow endpoints 2021-06-21 18:14:01 -04:00
Steve Richter
8ee5c1f245 Initial Last.fm UI implementation 2021-06-21 18:14:01 -04:00
Deluan
0495e421fe Fix Last.fm API method signature 2021-06-21 18:14:01 -04:00
Deluan
ffa76bba6a Add flag to disable Scrobble config in the UI 2021-06-21 18:14:01 -04:00
Deluan
a4f91b74d2 Add Last.FM Authentication methods 2021-06-21 18:14:01 -04:00
Deluan
73e1a8fa06 Remove false-positive on new version detection 2021-06-21 17:46:26 -04:00
Deluan
877f01bd38 Show notification if server is updated 2021-06-21 13:48:39 -04:00
Deluan
47bcf719f2 Fix cookie warning 2021-06-20 13:27:50 -04:00
Deluan
197d430d15 Fix lint error 2021-06-20 12:07:34 -04:00
Deluan
4e1957ca71 Update Go dependencies 2021-06-20 12:06:21 -04:00
Deluan
25db2cb075 Add concurrency test for singleton 2021-06-20 11:51:32 -04:00
Deluan
80b2c2f3cf Try to register all playing music in GetNowPlaying 2021-06-20 11:25:15 -04:00
Deluan
97434c1789 Fix GetNowPlaying endpoint showing only the last play 2021-06-20 10:39:19 -04:00
Deluan
f8ee6db72a New implementation of NowPlaying 2021-06-20 10:39:16 -04:00
Deluan
0df0ac0715 Add logos to badges 2021-06-19 11:32:22 -04:00
Deluan
c09468e135 Option to allow auto-login during development. 2021-06-19 10:56:39 -04:00
Deluan
cf553ce812 Don't show "logout" when authenticated by Header 2021-06-18 19:08:25 -04:00
Deluan
31ea033880 Fix subsonic token when authenticating by Header 2021-06-18 19:00:13 -04:00
Deluan Quintão
66b74c81f1
Encrypt passwords in DB (#1187)
* Encode/Encrypt passwords in DB

* Only decrypts passwords if it is necessary

* Add tests for encryption functions
2021-06-18 18:38:38 -04:00
Deluan
d42dfafad4 Add username to request.Context 2021-06-18 18:28:51 -04:00
dependabot[bot]
84413b542e
Bump @testing-library/jest-dom from 5.13.0 to 5.14.1 in /ui (#1176)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.13.0 to 5.14.1.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.13.0...v5.14.1)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-18 09:39:23 -04:00
Deluan
b590c31e4e Fix stream url, after changes to subsonic client api 2021-06-16 16:38:50 -04:00
Deluan
c4623d7bc3 Don't show "empty" dates 2021-06-16 12:28:49 -04:00
Deluan
e0fd1c6ad8 Add "Last Played" column to SongList 2021-06-16 11:57:02 -04:00
Deluan
86271f0412 Optimize refresh events for scrobble endpoint 2021-06-16 10:23:34 -04:00
Deluan
fb7229a53e Refech using getMany, reducing the number of API calls 2021-06-16 10:01:09 -04:00
Deluan
521d1ff2bf Disable realip middleware when using the reverse proxy authentication feature
Should fix https://github.com/navidrome/navidrome/pull/1152#issuecomment-862306847
2021-06-16 10:01:09 -04:00
Deluan
d3db41ae7d Bump github.com/go-chi/httprate version 2021-06-15 19:58:29 -04:00
Deluan
8bf0089abf Bump github.com/ReneKroon/ttlcache/ and github.com/microcosm-cc/bluemonday versions 2021-06-15 19:54:18 -04:00
Deluan
b65e76293a Only send events to clients who need it
- User events (star, rating, plays) only sent to same user
- Don't send to the client (browser window) that originated the event
2021-06-15 18:59:26 -04:00
Deluan
5f6f74ff2d Always use httpClient to call APIs 2021-06-15 17:29:01 -04:00
Deluan
8383527aab Only refetch changed resources when receive a "refreshResource" event 2021-06-15 16:12:13 -04:00
Deluan
8a56584aed Removed the albumSong workaround, as React-Admin's cache seems to behave better now 2021-06-15 11:31:41 -04:00
Deluan
667701be02 Less warning messages when first running it.
They are actually `info` messages
2021-06-13 19:27:01 -04:00
Deluan
59b99d2206 No need to check for first time when authenticating. One less SQL call per request 2021-06-13 19:26:25 -04:00
Deluan
d54129ecd2 Rename app package to nativeapi 2021-06-13 19:15:41 -04:00
Deluan Quintão
03efc48137
Refactor routing, changes API URLs (#1171)
* Make authentication part of the server, so it can be reused outside the Native API

This commit has broken tests after a rebase

* Serve frontend assets from `server`, and not from Native API

* Change Native API URL

* Fix auth tests

* Refactor server authentication

* Simplify authProvider, now subsonic token+salt comes from the server

* Don't send JWT token to UI when authenticated via Request Header

* Enable ReverseProxyWhitelist to be read from environment
2021-06-13 12:46:36 -04:00
Deluan
bed2f017af Fix index of songs in downloaded playlist 2021-06-12 23:02:34 -04:00
Igor Rzegocki
6bd4c0f6bf
Reverse proxy authentication support (#1152)
* feat(auth): reverse proxy authentication support - #176

* address PR remarks

* Fix redaction of UI appConfig

Co-authored-by: Deluan <deluan@navidrome.org>
2021-06-11 23:17:21 -04:00
Deluan
b445cdd641 Use a dedicated api-key/secret pair for Last.FM 2021-06-10 15:07:06 -04:00
Deluan
e31802d2d3 Only send "refresh" event if SetRating was successful 2021-06-10 15:03:30 -04:00
Deluan
cefc939909 Trigger UI refresh on media annotation events: star, setRating and scrobble 2021-06-10 12:20:52 -04:00
Deluan
2afb2db7ef Refactor for readability 2021-06-09 22:35:20 -04:00
Deluan
7f85ecd515 Trigger a UI refresh when the scanner finds changes.
Closes #1025
2021-06-09 21:02:20 -04:00
dependabot[bot]
cb6aa49439
Bump github.com/lestrrat-go/jwx from 1.2.0 to 1.2.1 (#1167)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/main/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-09 15:33:04 -04:00
dependabot[bot]
b7f47c8833
Bump github.com/onsi/ginkgo from 1.16.3 to 1.16.4 (#1163)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.3 to 1.16.4.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.3...v1.16.4)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-09 15:18:31 -04:00
dependabot[bot]
adb09c9c69
Bump @testing-library/jest-dom from 5.12.0 to 5.13.0 in /ui (#1162)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.12.0 to 5.13.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.12.0...v5.13.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-09 15:18:17 -04:00
dependabot[bot]
0c9e0ff886
Bump prettier from 2.3.0 to 2.3.1 in /ui (#1161)
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.0...2.3.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-09 15:17:56 -04:00
Deluan
f9eec5e4dc Refactored agents calling into its own struct 2021-06-08 17:00:02 -04:00
Deluan
6c1ba8f0d0 Add tests to core.Share 2021-06-08 16:32:08 -04:00
Deluan
110e17b004 Make MockRepo names more consistent 2021-06-08 16:30:19 -04:00
Deluan
779571a086 go mod tidy 2021-06-08 15:47:34 -04:00
Yash Jipkate
af210c8903
Add Native Sharing REST API (#1150)
* Initial draft - UNTESTED

* changes to Save() and Update()

* apply col filter and limit nanoid

* remove columns to not update
2021-06-08 15:44:30 -04:00
Deluan
e80cf80d05 Move all Spotify and LastFM code into only one folder for each 2021-06-08 11:25:46 -04:00
Ye61123
182e3ec78e
Update zh-Hans.json (#1160)
Complete untranslated items
2021-06-08 10:41:01 -04:00
Steve Richter
65ccd4c99d
Parse ParamBool case-insensitively (#1151) 2021-06-04 23:37:01 -04:00
Deluan
bebfe296a5 Allow updating only specific columns 2021-06-02 18:40:29 -04:00
Deluan
9da9d73c1d Don't panic when taglib returns an error 2021-05-31 18:26:46 -04:00
Deluan
cd242695ba Foundational work to enable multi-valued tags 2021-05-31 18:08:12 -04:00
Deluan
519c89345e Omit empty fields from Native API responses 2021-05-31 12:20:21 -04:00
Deluan
336d891e58 Bump github.com/ReneKroon/ttlcache/v2 from 2.5.0 to 2.6.0 2021-05-31 10:49:42 -04:00
Deluan
9b4b28f685 Bump ginkgo/gomega versions 2021-05-31 10:32:37 -04:00
Deluan
39c560a5c2 Remove unused web-vitals package 2021-05-31 10:21:24 -04:00
Deluan
c5abdc19bc Fix recursive bug in Last.FM calls without mbid 2021-05-30 22:46:23 -04:00
Deluan
ead2095dd0 Respect EnableLogRedacting config when pretty printing configuration 2021-05-30 16:02:23 -04:00
Yash Jipkate
7b05c49215
Add devEnableShare config option (#1141)
* add devEnableShare config option

* Toggle in config.js
2021-05-30 15:36:10 -04:00
Yash Jipkate
327c259a3d
Create share table and repository. (#930)
* Add share table and repository

* Add datastore mock

* Try fixing indent

* Try fixing indent - 2

* Try fixing indent - 3

* Implement rest.Repository and rest.Persistance

* Renew date

* Better error handling

* Improve field name

* Fix json name conventionally
2021-05-30 11:50:35 -04:00
Deluan
675cbe11b3 Fix updatePlaylist not updating fields comment and public.
Fix #1140
2021-05-29 17:16:56 -04:00
Deluan
91a91f7e06 GetCoverArt returns placeholder if id is missing
This mimics Subsonic behaviour, even if it contradicts the API documentation, which states `id` is required

Fixes #1139
2021-05-29 11:37:00 -04:00
Deluan
7bbb09e546 Add tests for WeightedRandomChooser 2021-05-28 23:51:56 -04:00
Deluan
dd56a7798e Rename variable with conflicting name 2021-05-28 23:00:39 -04:00
Deluan
a38e478a47 Better SimilarSongs algorithm 2021-05-28 22:55:34 -04:00
Deluan
1940267a18 Handle functions with params in sort order.
Related to #1023
2021-05-28 17:35:32 -04:00
Deluan
01f3ce0228 Add a timeout to background task 2021-05-28 11:37:53 -04:00
Deluan
48b6fa7feb Don't use request's context when refreshing artist info in background 2021-05-28 09:34:15 -04:00
Deluan
25d62cd751 Set retention time for uploaded artifacts to 7 days 2021-05-27 23:39:20 -04:00
Deluan
ed01946ace Embed Last.FM error responses, making the tests faster 2021-05-27 21:04:03 -04:00
Deluan Quintão
89b12b34be
Retry calls to Last.FM without MBIDs when if returns artist invalid (#1138)
* Call Last.FM's getInfo again without mbid when artist is not found

* Call Last.FM's getSimilar again without mbid when artist is not found

* Call Last.FM's getTopTracks again without mbid when artist is not found
2021-05-27 20:53:24 -04:00
Deluan
4e0177ee53 Always update artist info, even if info is fresh 2021-05-27 20:32:26 -04:00
Deluan
b398053223 Include a shared Last.FM api key, providing zero conf ArtistInfo (bio/top songs/similar artists) 2021-05-27 16:14:24 -04:00
Deluan
db11b6b8f8 Remove decoration from reflex output 2021-05-26 12:24:02 -04:00
Deluan
60d50de8c9 Refactoring to make common components usage more uniform 2021-05-26 09:35:13 -04:00
Aldrin Jenson
0941fbc0cd
Fix lag on albumList toggling (#1136) 2021-05-26 08:42:39 -04:00
Deluan
4217c75c9f Upgrade to Node v16 2021-05-25 10:53:16 -04:00
Deluan
409020a502 Bump github.com/ReneKroon/ttlcache/v2 from 2.4.0 to 2.5.0 2021-05-25 10:24:40 -04:00
Deluan
b4832c36b7 Bump github.com/golangci/golangci-lint from 1.40.0 to 1.40.1 2021-05-25 10:23:08 -04:00
Deluan
1de7366ece Bump @material-ui/lab from 4.0.0-alpha.57 to 4.0.0-alpha.58 in /ui 2021-05-25 10:16:44 -04:00
Deluan
ab1bc6194a Bump @testing-library dependencies 2021-05-25 10:13:57 -04:00
dependabot[bot]
ad4db122fb
Bump hosted-git-info from 2.8.8 to 2.8.9 in /ui (#1111)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-25 10:13:40 -04:00
dependabot[bot]
200b815c67
Bump url-parse from 1.4.7 to 1.5.1 in /ui (#1107)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-25 10:12:42 -04:00
Deluan Quintão
5631493cc4
Upgrade Web UI to Create-React-App 4 and React 17 (#1105)
* Upgrade to CRA 4.0.3

* Try to fix tests. No lucky

* Fix new ESLint errors

* Fix JS tests and remove unwanted dependency. (#1106)

* Fix tests

* Fix lint

* Remove React v16 workaround (fixed in v17)

* Force eslint to break on warnings

* Lint now needs to be called explicitly in the pipeline

Co-authored-by: Yash Jipkate <34203227+YashJipkate@users.noreply.github.com>
2021-05-25 09:58:06 -04:00
Deluan
d9f268266c Rename List view mode to Table 2021-05-24 12:58:15 -04:00
Deluan
882519738f Change back mounting order, for better logs 2021-05-24 12:17:55 -04:00
Deluan
86d3a219a9 Show name of router in log 2021-05-24 11:55:39 -04:00
Deluan
1d0e75151a Update Portuguese translation 2021-05-24 11:24:28 -04:00
Deluan
107a11b445 Bump React-Admin to 3.15.2 2021-05-24 11:17:06 -04:00
Aldrin Jenson
cf8ee251ee
Option to toggle fields in songs, albums & artists (#923)
* Add toggleColumns

- Add logic for toggling columns
- Add MenuComponent + useSelectedFields hook

* Refactoring

* eslint-fixes

* Typo

* skip menu in albumGridView

* add omittedFields

* Add toggling for playlists and albumSong

* Refactoring

* defaultProps - fix

* Add toggling for PlaylistSongs

* remove accidental console log

* Refactoring for future compatibility

* Hide ToggleMenu in albumGridView

* Add TopBarComponent in ToggleFieldsMenu

* Add defaultOff for useSelectedFields

* Fix edge case

* eslint fix

* Refactoring

* Add propType for forwardRef

* Fix issues

* add translation for grid and table

* add translation for grid and table

* Ignore menuBtn for spotify-ish and Ligera themes

* hide bpm by default in playlistSongs

* Add memoization

* Default album view must be Grid

Co-authored-by: Deluan <deluan@navidrome.org>
2021-05-24 11:09:06 -04:00
Deluan Quintão
6a17717e30
Update translations (#1130)
* Update zh-Hant.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update pl.json (POEditor.com)

* Update es.json (POEditor.com)

* Update th.json (POEditor.com)

* Update sl.json (POEditor.com)
2021-05-24 10:21:59 -04:00
Deluan
b8a274e4e8 Move Swedish translation to right folder 2021-05-24 10:09:44 -04:00
Deluan
9800823015 Bump react-jinke-music-player from 4.24.0 to 4.24.1 in /ui 2021-05-24 10:04:37 -04:00
deeeeeebs
02606f43b8
Add Swedish translation (#1126)
* Swedish translation

* Updated and renamed to sv.json

Added further lines/translations from the english.json and corrected some of the previous translations

* Update sv.json

* Update sv.json

Ok now i'm done! :P
2021-05-24 10:03:06 -04:00
Deluan
e529390034 Remove md5-hex wrapper and use blueimp-md5 directly 2021-05-20 13:42:56 -04:00
Deluan
0ec7a305a2 Reorder Makefile dev targets 2021-05-20 13:42:29 -04:00
Deluan
b6cb81c3a3 Update Portuguese translations 2021-05-16 13:31:04 -04:00
Steve Richter
e60f2bfa3d
User management improvements (#1101)
* Show more descriptive success messages for User actions

* Check username uniqueness when creating/updating User

* Adjust translations

* Add tests for `validateUsernameUnique()`

Co-authored-by: Deluan <deluan@navidrome.org>
2021-05-16 13:25:38 -04:00
dependabot[bot]
666c006579
Bump lodash from 4.17.19 to 4.17.21 in /ui (#1110)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-15 14:33:29 -04:00
Deluan
6ad94548f3 Add explicit dependency for inflection 2021-05-15 11:59:56 -04:00
Deluan
fa0e6dda5b Remove C++11 warning in macOS 2021-05-14 16:03:11 -04:00
Deluan
e047008f7d Fix test 2021-05-14 15:38:28 -04:00
Deluan
3cac00ad13 Upgrade TagLib to 1.12 2021-05-14 14:31:07 -04:00
Deluan
39d68e8287 Restore pretty formatted config options in debug level 2021-05-12 14:43:09 -04:00
Deluan
751e2d6147 Make ScanInterval=0 disable the periodic scan 2021-05-12 14:08:38 -04:00
Dnouv
74300adbc8
Fix Ligera Error (#1117)
* Fix Ligera Error

* Run make setup
2021-05-12 10:21:56 -04:00
Deluan
a484adfcfb Add Slovenian translation. Thanks @jernejml 2021-05-11 22:36:22 -04:00
Deluan
25bd36dbc5 Bump react-admin to 3.15.1 2021-05-11 22:24:24 -04:00
Deluan
87298f616f Add more explicit npm dependencies 2021-05-11 22:22:32 -04:00
Deluan
4699902369 Remove dependency on lodash.get 2021-05-11 22:08:07 -04:00
Deluan
978933aa48 Add explicit npm dependencies 2021-05-11 22:07:47 -04:00
Deluan
77e736ccfd Do not use ra-core directly 2021-05-11 21:39:53 -04:00
Deluan
a77635e883 Only setup event stream when mounting the app 2021-05-11 20:27:12 -04:00
Dnouv
0c93db816c
Fix PWA notification toolbar color (#1083)
* Fix PWA notification color

* Add React hook

* Convert component into a hook

Co-authored-by: Deluan <deluan@navidrome.org>
2021-05-11 20:11:54 -04:00
Deluan
c0243580c0 Integrate goose log with our own log system 2021-05-11 19:08:06 -04:00
Deluan
22ce5b6282 Removed unnecessary code 2021-05-11 18:55:58 -04:00
Deluan
fa9083ddec Upgrade prettier to 2.3.0
Some reformatting was needed... :/
2021-05-11 18:13:03 -04:00
Deluan
da684ff44c Bump github.com/lestrrat-go/jwx from 1.1.6 to 1.2.0 2021-05-11 17:44:00 -04:00
Deluan
7d96167abc Upgrade to go-chi 5 2021-05-11 17:21:18 -04:00
Deluan
fb5840705e Bump github.com/golangci/golangci-lint from 1.39.0 to 1.40.0 2021-05-11 12:30:11 -04:00
Dnouv
089d4abab1
Replace Feature Policy with Permissions Policy (#1112)
* Add Permissions Policy

* Remove Display capture option
2021-05-11 11:29:55 -04:00
Paul TREHIOU
62ccbaad8b
Improve systemd unit security (#677)
Applied suggestions from `systemd-analyze` and also using StateDirectory to ensure /var/lib/navidrome exists and is writeable
2021-05-09 11:59:08 -04:00
Deluan
8419a2a5d1 Schedule periodic scan before starting initial scan 2021-05-08 19:19:31 -04:00
Aniket Biswas
71c2ed9922
Restart Current Song on previous (#1104)
* fixed on previous song behaviour

* rebased with master
2021-05-08 14:27:33 -04:00
Deluan
72ec808a2c Bump react-jinke-music-player from 4.21.2 to 4.24.0 in /ui 2021-05-08 13:15:39 -04:00
Deluan
702a65059f Fix redaction for query parameters. Fix #1103 2021-05-07 21:42:35 -04:00
Deluan
3e8d3e78c2 Fix Bookmarks Subsonic support (#1099)
JSON responses were incorrect
2021-05-07 09:47:13 -04:00
Deluan
47f4e0a4de Refactor to remove some nesting 2021-05-06 20:49:26 -04:00
Deluan
1f8949929d Fix(?) possible TypeError 2021-05-06 20:46:01 -04:00
Deluan
c92a24b3e2 Bump github.com/onsi/gomega from 1.11.0 to 1.12.0 2021-05-06 18:54:45 -04:00
dependabot[bot]
cbe0d9763b
Bump github.com/robfig/cron/v3 from 3.0.0 to 3.0.1 (#1098)
Bumps [github.com/robfig/cron/v3](https://github.com/robfig/cron) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/robfig/cron/releases)
- [Commits](https://github.com/robfig/cron/compare/v3.0.0...v3.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 18:46:12 -04:00
dependabot[bot]
44dd414d25
Bump github.com/microcosm-cc/bluemonday from 1.0.8 to 1.0.9 (#1056)
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.8...v1.0.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 18:45:10 -04:00
Samarjeet
d85db8ffff
Fix Spotify-ish playlist title is cut off (#1094) 2021-05-06 18:33:54 -04:00
dependabot[bot]
c7378c0fa5
Bump @testing-library/user-event from 13.1.5 to 13.1.8 in /ui (#1082)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.1.5 to 13.1.8.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.1.5...v13.1.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 18:27:02 -04:00
plr20
18696c5517
Update Czech translation (#1095)
* Update Czech translation

* Adjust translations
2021-05-06 18:22:47 -04:00
dependabot[bot]
5a5d763c19
Bump github.com/onsi/ginkgo from 1.16.1 to 1.16.2 (#1096)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.1 to 1.16.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.1...v1.16.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 18:19:40 -04:00
Deluan
f8dbc41b6d Breaking change: Add ScanSchedule, allows interval and cron based configurations.
See https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format for expression syntax.

`ScanInterval` will still work for the time being. The only situation it does not work is when you want to disable periodic scanning by setting `ScanInterval=0`. If you want to disable it, please set `ScanSchedule=""`

Closes #1085
2021-05-06 17:56:10 -04:00
Deluan
1d6aa70033 Fix possible TypeError 2021-05-06 09:49:25 -04:00
Brian Schrameck
30bb3f7b43
BPM metadata enhancement (#1087)
* BPM metadata enhancement

Related to #1036.

Adds BPM to the stored metadata about MediaFiles.

Displays BPM in the following locations:
- Listing songs in the song list (desktop, sortable)
- Listing songs in playlists (desktop, sortable)
- Listing songs in albums (desktop)
- Expanding song details

When listing, shows a blank field if no BPM is present. When showing song details, shows a question mark.

Updates test MP3 file to have BPM tag. Updated test to ensure tag is read correctly.

Updated localization files. Most languages just use "BPM" as discovered during research on Wikipedia. However, a couple use some different nomenclature. Spanish uses PPM and Japanese uses M.M.

* Enhances support for BPM metadata extraction

- Supports reading floating point BPM (still storing it as an integer) and FFmpeg as the extractor
- Replaces existing .ogg test file with one that shouldn't fail randomly
- Adds supporting tests for both FFmpeg and TagLib

* Addresses various issues with PR #1087.

- Adds index for BPM. Removes drop column as it's not supported by SQLite (duh).
- Removes localizations for BPM as those will be done in POEditor.
- Moves BPM before Comment in Song Details and removes BPM altogether if it's empty.
- Omits empty BPM in JSON responses, eliminating need for FunctionField.
- Fixes copy/paste error in ffmpeg_test.
2021-05-05 21:35:01 -04:00
Deluan
fb33aa4496 Fix possible TypeError 2021-05-05 21:14:36 -04:00
Deluan
9e559311ad Fix Album Grid flickering 2021-05-05 16:18:08 -04:00
Deluan
a5fc5f0ff6 Revert "Better way to invoke make single"
This reverts commit 73efbd90
2021-05-04 17:05:41 -04:00
Deluan
73efbd90ab Better way to invoke make single 2021-05-04 16:47:47 -04:00
Deluan
cbc4cb483d Fix QuickFilter by favourites in Album/All view 2021-05-04 16:28:19 -04:00
Deluan
986473393f Fix missing translation error in console. Closes #1038 2021-05-04 16:01:26 -04:00
Deluan
66b31644fa Upgrade React-Admin to 3.15.0 2021-05-03 22:32:30 -04:00
Deluan
b478b0af02 FIx ffmpeg output regex too rigid 2021-05-03 21:26:44 -04:00
Deluan
c3316e201e Fix cover art detection with ffmpeg 4.4 2021-05-03 20:25:31 -04:00
Deluan
874b17b8f6 Require user to provide current password to be able to change it
Admins can change other users' password without providing the current one, but not when changing their own
2021-05-03 15:03:34 -04:00
Deluan
5808b9fb71 Fix Transcodings menu 2021-05-03 13:54:08 -04:00
Deluan
c33ebabde8 Fix warning about promise being ignored 2021-05-03 13:38:34 -04:00
Deluan
7feda4bea4 Add EnableUserEditing, to control whether a regular user can change their own details (default true) 2021-05-02 17:11:12 -04:00
Deluan
2ff1c79b64 Fix EnableLogRedacting case 2021-05-02 16:49:20 -04:00
Deluan
cfbc39fb7f Add log redacting, controlled by the new EnableLogRedacting config option (default true)
Imported redacting code from https://github.com/whuang8/redactrus (thanks William Huang)
Didn't use it as a dependency as it was too small and we want to keep dependencies at a minimum
2021-05-02 16:45:16 -04:00
Deluan
2372f1d12b Change visibility of helper function 2021-05-02 15:23:51 -04:00
Deluan
490a7fcf52 Add test to Login function 2021-05-02 15:19:21 -04:00
Deluan
ad153f5f63 Fix User delete button not showing 2021-05-02 15:03:15 -04:00
Deluan
b8138ebad6 Fix create first login 2021-05-02 14:13:17 -04:00
Deluan
e3fe8399c8 Fix DevAutoCreateAdminPassword 2021-05-01 18:40:02 -04:00
Deluan
88105d5c30 Clean-up Makefile, add help 2021-05-01 11:14:24 -04:00
Deluan
b180386d23 Simplify build targets 2021-05-01 09:16:45 -04:00
Deluan
70e7bf6b5b Clean up some make targets 2021-05-01 08:51:29 -04:00
Samarjeet
d41137ad8e
[Spotify-ish] Login consistent with other themes (#1073) 2021-05-01 08:48:12 -04:00
Deluan
88f2fc35cd Fix regular users not able to edit their info before logging in again 2021-04-30 17:53:17 -04:00
Deluan
bc62efb059 More auth tests 2021-04-30 10:00:03 -04:00
Deluan
eaf40efdf4 Never send passwords to the UI 2021-04-29 20:04:01 -04:00
Deluan
71dc0dddaf Show Person icon for non admin users 2021-04-29 18:26:53 -04:00
Deluan
bcda53f115 Less waiting for cache to be ready 2021-04-29 13:58:01 -04:00
Deluan
8a07bac2a2 Fix SIGUSR1 work when ScanInterval=0 2021-04-29 13:10:10 -04:00
Deluan
a35de2bfd1 Allow regular users to change their info, including password.
Should fix #199
2021-04-28 22:35:25 -04:00
Deluan
22582392a0 Fix "Failed prop type: Invalid prop variant" in console 2021-04-28 22:07:16 -04:00
Deluan
932c108e82 Fix "SharedArrayBuffer will require cross-origin isolation"
This is a workaround for React v16 while we don't upgrade to v17

See https://github.com/facebook/create-react-app/issues/10474
2021-04-28 21:42:17 -04:00
whorfin
20d2726faa
Improve scanner (#1054)
* Handle subdirectories without rx permission correctly
Allow ogg files w/o metadata, having taglib behave more like ffmpeg

* Fix test for walk_dir_tree, fix full reading of files in permission-
constrained directories, allow directories with leading ellipses

* Sorted directory traversal is preferred, and cleanup tests

* Small refactoring to clean-up `loadDir` function and to remove some "warnings" from IntelliJ

Co-authored-by: Deluan <deluan@navidrome.org>
2021-04-28 19:51:02 -04:00
Samarjeet
771c91d2dd
[Spotify-ish] Indicate active page number (#1068) 2021-04-28 08:57:08 -04:00
Deluan Quintão
b8173124f4 Update ja.json (POEditor.com) 2021-04-27 18:39:45 -04:00
Deluan
d1605dcfbe Replace godirwalk with standard Go 1.16 filepath.WalkDir
Should fix https://github.com/navidrome/navidrome/issues/1048
2021-04-27 11:28:47 -04:00
Deluan
10cfaad95c Bump react-redux version to 7.2.4 2021-04-26 23:22:53 -04:00
Deluan
07f6a7cc9f Bump @testing-library dependencies 2021-04-26 23:19:30 -04:00
Deluan
6e73c23704 Keepalive must return an ID to be used with dataProvider.getOne 2021-04-26 23:19:30 -04:00
Deluan
862c6d3c73 Upgrade React-Admin to 3.14.5 2021-04-26 23:19:28 -04:00
Deluan
692663680b Uses GoLang 1.16.3
Also add a target to build snapshots for a single platform
2021-04-26 17:21:59 -04:00
Deluan
0d409e37e2 Fix aspect ratio of login icon 2021-04-26 12:35:49 -04:00
dependabot[bot]
f1bd736b20 Bump jest-environment-jsdom-sixteen from 1.0.3 to 2.0.0 in /ui
Bumps [jest-environment-jsdom-sixteen](https://github.com/SimenB/jest-environment-jsdom-sixteen) from 1.0.3 to 2.0.0.
- [Release notes](https://github.com/SimenB/jest-environment-jsdom-sixteen/releases)
- [Commits](https://github.com/SimenB/jest-environment-jsdom-sixteen/compare/v1.0.3...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 09:11:34 -04:00
Deluan
cde6626016 Fix logo aspect ratio in Safari 2021-04-25 21:16:45 -04:00
Deluan
1c7d4c5630 Improve Logo resolution in login dialog 2021-04-25 21:16:24 -04:00
Dnouv
c75314c605
Enhanced Mobile Login Screen (#953)
* Enhanced Mobile Login Screen

* Removed duplicate line of code

* Add support for desktop

* Remove conflict

* Reset button style

* Change Login
2021-04-25 21:09:23 -04:00
Deluan
b10f491de8 Fix Song details row height 2021-04-24 23:06:14 -04:00
caiocotts
b671d0ff7b
Better handling of album comments (#1013)
* Change album comment behaviour

* Don't check first item

* Fix previously imported album comments.

* Remove song comments if album comment is present
2021-04-24 21:40:55 -04:00
Deluan
4b5a5abe1b Fix Web Scroller compatibility
This fixes https://github.com/web-scrobbler/web-scrobbler/issues/2828
2021-04-24 21:13:14 -04:00
Deluan
3cede28161 Reorganize AudioTitle classes.
Should fix https://github.com/web-scrobbler/web-scrobbler/issues/2828
2021-04-24 18:06:24 -04:00
Deluan
79bbff0e98 Make Playlist grid more responsive 2021-04-24 11:29:12 -04:00
Deluan
0142352280 Fix build tag 2021-04-23 21:42:22 -04:00
Deluan
d5c7a81888 Disable SIGUSR1 handler for Windows (not available) 2021-04-23 21:22:04 -04:00
Deluan
1e539f4e54 Add trigger scan when receiving SIGUSR1 signal 2021-04-23 20:40:28 -04:00
Dnouv
e83a0b23a3
Hide volume bar in lower resolutions (#889)
This gives more space for the song and artist names in the player

* fix min-width of AlbumDetails

* Fix song play time display

* Song duration display fix#2

* Removed important

* Resolve conflicts

* Update Player.js

* Change breakdown and hide volume

Co-authored-by: Deluan <deluan@navidrome.org>
2021-04-23 19:04:37 -04:00
dependabot[bot]
9f39f062d8
Bump @testing-library/user-event from 13.1.2 to 13.1.5 in /ui (#1051)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.1.2 to 13.1.5.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.1.2...v13.1.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-23 18:44:32 -04:00
Yash Jipkate
df57cd6bb5
Allow adding songs to multiple playlists at once. (#995)
* Add support for multiple playlists

* Fix lint

* Remove console log comment

* Disable 'check' when loading

* Fix lint

* reset playlists on closeAddToPlaylist

* new playlist: accomodate string type on enter

* Fix lint

* multiple new playlists are added correctly

* use makestyle()

* Add tests

* Fix lint
2021-04-23 18:37:08 -04:00
Arbaz Ahmed
d829a63686
fix: refactored some styles in jinkie player and removed br tag - #865 (#1047)
* refactored some styles in jinkieplayer

* fix: refactored some styles in jinkie player and removed br tag - #865

* fix: refactored some styles in jinkie player and removed br tag - #865

Signed-off-by: armedev <epiratesdev@gmail.com>
2021-04-23 18:06:39 -04:00
Deluan Quintão
4b061427ad
Update translations (#1002)
* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update fr.json (POEditor.com)

* Update ja.json (POEditor.com)

* Update pt.json (POEditor.com)

* Update es.json (POEditor.com)

* Update uk.json (POEditor.com)

* Update zh-Hans.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update eo.json (POEditor.com)

* Update de.json (POEditor.com)

* Update zh-Hant.json (POEditor.com)

* Update cs.json (POEditor.com)

* Update cs.json (POEditor.com)
2021-04-22 23:12:02 -04:00
Deluan
aa9cf8ef17 Add a cleanup to tests 2021-04-22 14:04:48 -04:00
Deluan
240de70026 Add tests for SpreadFS 2021-04-22 14:02:42 -04:00
Shishir A S
6da9dee7d3
Fade in QualityInfo while hovering on Song title (#1041)
* feat(Player/QualityInfo) : Animate Quality Info + Increased audio player dimensions

Signed-off-by: Shishir <shishir.srik@gmail.com>

* fix(Player.js) : Converted JS hover functionality to pure CSS

Signed-off-by: Shishir <shishir.srik@gmail.com>

* Removed unused useState

* fix(Player) : Reverted player height adjustment

Signed-off-by: Shishir <shishir.srik@gmail.com>
2021-04-22 09:53:33 -04:00
Deluan
467eb345ad Don't panic if fscache could not be initialized due to a FS error 2021-04-21 23:39:23 -04:00
Deluan
31b553e972 Add missing error log message in fscache initialization 2021-04-21 14:15:42 -04:00
Deluan
da30923a95 Replace default Login backgrounds with Navidrome's collection 2021-04-20 15:26:24 -04:00
dependabot[bot]
e7be2f6f9c
Bump ssri from 6.0.1 to 6.0.2 in /ui (#1045)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-20 15:06:46 -04:00
Deluan
9a509c749a Workaround for https://github.com/lijinke666/react-music-player/issues/351 2021-04-20 11:01:31 -04:00
Deluan
abaecf2b88 Add Nginx header to not buffer SSE connection
This should allow the Activity Panel, that uses a Server-Side Events/ Event Source connection, to work with default Nginx reverse proxy configuration.
2021-04-20 10:16:20 -04:00
Deluan
f63a912341 Add config option to set default theme 2021-04-18 13:51:00 -04:00
Deluan
b6f525bda5 Fix exception when running in Firefox over insecure http. Fix #1039 2021-04-18 02:21:58 -04:00
Deluan
0063720cc2 Change size and position of QualityInfo in the Player 2021-04-17 22:49:36 -04:00
Ruchi Kushwaha
b441260186
Change icon on active menu item (#903)
* add icons

* add logic to change the icon

* make the active menu bold

* Encapsulate the dynamic icon behaviour into a self-contained component

Co-authored-by: Deluan <deluan@navidrome.org>
2021-04-17 00:40:07 -04:00
Deluan
16a5ac323b Fix migration error caused by #868 2021-04-15 21:25:02 -04:00
Praveen Kumar
749f5d45c6
Fix welcome message styles (#1015)
* style(login): welcome-message-wrapping - #1014

Signed-off-by: Praveen Kumar <pkspyder007@gmail.com>

* style(login): welcome-message-wrapping - #1014

Signed-off-by: Praveen Kumar <pkspyder007@gmail.com>

* chore(makefile): Removed-lint-timeout

Signed-off-by: Praveen Kumar <pkspyder007@gmail.com>
2021-04-15 20:18:35 -04:00
Deluan
a81ef0923b Fix cover art not showing in notification when using a BaseURL 2021-04-14 13:30:14 -04:00
Samarjeet
c86d2a93b1
Fix transparent background in Spotify-ish (#1030) 2021-04-13 21:05:25 -04:00
Deluan
b55d582882 go mod tidy 2021-04-13 16:55:26 -04:00
Deluan
6635149f3c Fix pre-commit hook 2021-04-13 16:54:31 -04:00
Deluan
01b34f4f14 Bumps @testing-library/user-event from 13.1.1 to 13.1.2 2021-04-13 16:52:11 -04:00
Deluan
cb9cabe0ec Bumps github.com/ReneKroon/ttlcache/v2 from 2.3.0 to 2.4.0 2021-04-13 16:48:41 -04:00
Deluan
29aff05f70 Bump github.com/onsi/ginkgo from 1.16.0 to 1.16.1 2021-04-13 16:48:05 -04:00
Deluan
f48bfb6ad1 Bump github.com/microcosm-cc/bluemonday version 2021-04-13 16:47:31 -04:00
Deluan
ef9a16ac9f Change order of themes 2021-04-10 19:52:01 -04:00
Dnouv
ca9d42714f
New Ligera (light) Theme (#990)
* Enhanced Light Theme

* New Login Screen

* Fix Appbar for sm screen

* Reverse Gradient

* Fix test error

* Fix color

* Fix Gradient

* Theme color change

* Fix playlist autocomp popup

* Rename theme

* Fix hover icon color
2021-04-10 19:49:39 -04:00
Deluan
efe8240c0a Remove inline style in favour of MUI's styling solution 2021-04-09 17:38:08 -04:00
Ayush Naidu
f7dfabaa40
Replaced literal 302 with http constant (#1006) 2021-04-08 14:17:14 -04:00
Deluan
d8a1773d50 Increase golangci-lint timeout. Fix #1001 2021-04-08 10:19:58 -04:00
Aries
e105e2d2a2
Update Japanese translation (#997) 2021-04-07 23:18:49 -04:00
Deluan
f41bc31ba8 Fix layout when album comment is visible 2021-04-07 22:16:38 -04:00
Deluan
96a14ec484 Hide QualityInfo on small screens 2021-04-07 16:10:31 -04:00
Neil Chauhan
48ae4f7479
Add 5-star rating system(#986)
* Added Star Rating functionality for Songs

* Added Star Rating functionality for Artists

* Added Star Rating functionality for AlbumListView

* Added Star Rating functionality for AlbumDetails and improved typography for title

* Added functionality to turn on/off Star Rating functionality for Songs

* Added functionality to turn on/off Star Rating functionality for Artists

* Added functionality to turn on/off Star Rating functionality for Albums

* Added enableStarRating to server config

* Resolved the bugs and improved the ratings functionality.

* synced repo and removed duplicate key

* changed the default rating size to small, and changed the color to match the theme.

* Added translations for ratings, and Top Rated tab in side menu.

* Changed rating translation to topRated in albumLists, and added has_rating filter to topRated.

* Added empty stars icon to RatingField.

* Added sortable=false in AlbumSongs and added sortByOrder=DESC in all List components.

* Added translations for rating, for artists and albums, and removed the sortByOrder=DESC from SimpleLists.
2021-04-07 16:02:52 -04:00
Deluan
840521ffe2 Fix console errors for QualityInfo component 2021-04-07 13:08:41 -04:00
Deluan
5178f44094 Add has_rating filter to albums 2021-04-07 11:04:36 -04:00
Deluan
10dcc3fb37 Remove unnecessary export mapping (bad refactoring) 2021-04-07 10:57:14 -04:00
Aries
49b1c40fbd
Update Japanese translation (#992) 2021-04-07 10:14:45 -04:00
Deluan
156a53c2ac Add support for artist 5-star rating in Subsonic API 2021-04-06 23:06:31 -04:00
Deluan
9913b92905 Get lossless format list from server 2021-04-06 22:18:48 -04:00
Himanshu maurya
52812fa48b
Added quality info (#918)
* added quality info

* fixed formatting

* implemented various suggestions

* npm run prettier

* applied suggestions

* npm run prettier

* corrected lossless formats and other suggestions

* moved losslessformats into consts.js

* added some test

* typo while resolving conflicts

* fetch

* removed a bug causing component (as suggested)

* Update PlayerToolbar.js

* implemented suggestions

* added few more tests

* npm run prettier

* added size

* updated qualityInfo

* implemented suggestions

* added test for when no record is recieved

* Update QualityInfo.js
2021-04-06 21:30:17 -04:00
Shishir A S
c57fa7a8fc
Fixes play icon color in "Light" theme (#972)
* fix(ui/src/album): White play button on hover for all themes - #960

* fix(PlayButton) : White play button for light theme - #960

* fix(PlayButton) : White play button for light theme - #960

* bug(AlbumGridView.js) - Album play button defaults to white, can be overridden - #960

Signed-off-by: Shishir <shishir.srik@gmail.com>

* bug(AlbumGridView.js) - Album play button defaults to white, can be overridden - #960

* Reverted package.json and package-lock.json - #960

Signed-off-by: Shishir <shishir.srik@gmail.com>

* Missing lint script added - #960

Signed-off-by: Shishir <shishir.srik@gmail.com>

* Removed color, added className and made record required in PlayButton.propTypes - #960
2021-04-06 10:02:44 -04:00
Deluan
dbda8712f2 npm audit fix 2021-04-05 22:33:13 -04:00
Deluan
5f685bca30 Hide ❤️ in Playlists 2021-04-05 22:32:25 -04:00
Deluan
37f6ff02cf Do not disable eslint rule 2021-04-05 22:21:05 -04:00
dependabot[bot]
01ef4d2f21 Bump @testing-library/jest-dom from 5.11.9 to 5.11.10 in /ui
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.11.9 to 5.11.10.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.11.9...v5.11.10)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:21:14 -04:00
dependabot[bot]
32ad982b11 Bump github.com/golangci/golangci-lint from 1.38.0 to 1.39.0
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.38.0 to 1.39.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.38.0...v1.39.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:20:57 -04:00
dependabot[bot]
87b04607ad Bump @testing-library/react-hooks from 5.1.0 to 5.1.1 in /ui
Bumps [@testing-library/react-hooks](https://github.com/testing-library/react-hooks-testing-library) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/testing-library/react-hooks-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-hooks-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-hooks-testing-library/compare/v5.1.0...v5.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:17:18 -04:00
dependabot[bot]
4e41ef7542 Bump github.com/microcosm-cc/bluemonday from 1.0.4 to 1.0.6
Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.4 to 1.0.6.
- [Release notes](https://github.com/microcosm-cc/bluemonday/releases)
- [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.4...v1.0.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:14:41 -04:00
dependabot[bot]
6af45d6eea Bump @testing-library/user-event from 13.0.7 to 13.1.1 in /ui
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.0.7 to 13.1.1.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.0.7...v13.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:14:13 -04:00
dependabot[bot]
69fe771819 Bump @testing-library/react from 11.2.5 to 11.2.6 in /ui
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.2.5 to 11.2.6.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.2.5...v11.2.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:10:30 -04:00
dependabot[bot]
ce675d478a Bump github.com/onsi/ginkgo from 1.15.2 to 1.16.0
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.15.2 to 1.16.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.15.2...v1.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 21:10:18 -04:00
Balaguru Ragupathi
6988b9a086
Improved Header Readability for Songs List (#985)
* style(SongDataGrid): Table Header Definition - #943

Signed-off-by: Balaguru4580 <balaguru4580@gmail.com>

* style(SongDataGrid): Improved Header Readability - #943

Signed-off-by: Balaguru4580 <balaguru4580@gmail.com>

* Shadow Effect

* Shadow Effect Opacity Adjustment

* Fixed Songs Context Menu

* Fixed the Songs Context Menu
2021-04-05 20:32:57 -04:00
Aldrin Jenson
55c2431b17
Fix undefined variant prop in DateField (#987) 2021-04-05 20:27:40 -04:00
Ritik Pandey
69ee17402f
Add pagination to playlists (#969)
* add pagination

* prettier applied

* perPage_bug_fixed

* pagination_component_changed

* getAllSongs function added

* pagination component updated

* catch_error from data provider

* getAllSongsAndDispatch added

* remove ids from action function
2021-04-05 18:21:47 -04:00
Deluan
cdfdf78c73 Revert "style(SongDataGrid): Improved Header Readability (#954)"
This reverts commit 3d58c5ab. It broke the SongContextMenu
2021-04-04 21:46:44 -04:00
sobhanbera
ca51372d8d
Add Extra Dark theme (#955)
* added new theme - night

* removed a unused field

* fixed a typo from previous change

* night theme in login window

* changed name

changed the theme name from "Night" to "Extra Dark"

* changed the theme name

* Update index.js

* Rename night.js to extradark.js

* trying something

* formatted

the JS build was failing because I haven't formatted the index.js file with prettier. I got to know about this now.
I think now it will be resolved.
2021-04-04 21:25:54 -04:00
Éric Gaspar
a4d07734cd
Update fr.json (#975) 2021-04-04 20:53:47 -04:00
Balaguru Ragupathi
3d58c5ab54
style(SongDataGrid): Improved Header Readability (#954)
* style(SongDataGrid): Table Header Definition - #943

Signed-off-by: Balaguru4580 <balaguru4580@gmail.com>

* style(SongDataGrid): Improved Header Readability - #943

Signed-off-by: Balaguru4580 <balaguru4580@gmail.com>

* Shadow Effect

* Shadow Effect Opacity Adjustment
2021-04-02 22:15:59 -04:00
Aldrin Jenson
12223b2a83
Fix extra multiline Prop error (#966)
* Fix extra multiline Prop error

* Remove multiline prop from MultiLineTextField
2021-04-02 22:09:28 -04:00
Samarjeet
c7dc3628e2
Fix transparent bg in suggestions [Spotify-ish] (#964) 2021-04-02 13:30:27 -04:00
certuna
9871919fae
New service worker (#952)
* Add files via upload

* Update serviceWorker.js
2021-04-02 11:58:45 -04:00
Deluan
0cb7d3853f Add required prop order in random album list. Fix #957 2021-04-01 23:14:59 -04:00
rochakjain361
d0d18e8512
Album details UI fix (#922)
* Fix the Album Details UI to look similar to Song Details UI

* Remove the unused components

* Fix the gap between row and the first field in the details view

* Fix the width of the row of Album Details UI
2021-04-01 23:03:05 -04:00
Deluan
0d95c4bb9d Fix Code of Conduct link 2021-04-01 17:38:55 -04:00
Samarjeet
ea65da484b
Make spotify-ish more spotify-ish (#914)
* [Theme] Allow customising album and player parts

* [Theme] Allow customizing song lists view

* Make spotify-ish more spotify-ish

* Fix responsive issues in spotify-ish

* Spotify-ish login page

* Add back the previous "Spotify-ish" theme as "Green"

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-31 16:58:47 -04:00
harshavardhanpb
5128c049d7
Rename diodo_test.go to diode_test.go (#956)
Simple typo fix
2021-03-31 15:41:38 -04:00
Deluan
16f6d9466f Remove redundant backgroundColor from Login icon 2021-03-31 13:31:03 -04:00
Samarjeet
cf72bbfad4
Fix login page UI contrast in dark,spotify (#946) 2021-03-31 01:11:05 -04:00
Aldrin Jenson
20f5778694
Fix prop undefined bug #925 (#942)
* fix(albumListView)  prop undefined bug  #925

* Fix undefinedProp bug
2021-03-31 01:07:07 -04:00
Deluan
46d4c48d44 Login backgrounds from unsplash collection (#936) 2021-03-31 00:49:12 -04:00
Samarjeet
166410eb50
Login backgrounds from unsplash collection (#936) 2021-03-31 00:24:37 -04:00
Deluan
43cbde97ad Remove "minimize" button from Player when in Desktop resolution 2021-03-30 22:43:39 -04:00
Deluan
13e80e651c Fix issue with classes being removed from DOM. Fix #864 2021-03-30 22:42:46 -04:00
Deluan
16e495a80f Revert: Fix theme not being applied to PlayerToolbar
It was causing issues with classes being removed from DOM
2021-03-30 22:21:24 -04:00
Samarjeet
1f2b5294c3
Allow theme customizing Login Page (#940) 2021-03-29 23:25:32 -04:00
Aldrin Jenson
a36a8c2372
Fix LinkWrapping Error in the console #921 (#924) 2021-03-29 21:45:48 -04:00
Aldrin Jenson
5245b4c62b
Fix cacheUndefined bug - #901 (#915)
- add check to see if cache is defined before deleting
2021-03-29 20:43:51 -04:00
Deluan
3b0defefec Fix UI loading redirections. Should fix #906 2021-03-29 20:13:04 -04:00
Neil Chauhan
404253a881
Enable turn on/off Favorites/Loved feature. (#917)
* Added option to enable/disable favorites in Song

* Added option to enable/disable favorites in Artist

* Added option to enable/disable favorites in Albums and Favorites tab in sidebar

* Added option to enable/disable favorites in Player

* Set default value of enableFavourites as true

* Improved the functionality to enable/disable Favorites

* Add `EnableFavourites` config option

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-28 20:35:49 -04:00
Adrian Edwards
5dfcb316cf
Remove unused prop from ArtistList (#926)
* remove syncWithLocation prop from ArtistList to fix #925

* run prettier
2021-03-28 19:53:25 -04:00
Deluan
90cf118349 Fix context menu/heart column header alignment in SongList 2021-03-27 22:09:43 -04:00
Deluan
b42532dd7c Fix theme not being applied to PlayerToolbar 2021-03-27 14:24:59 -04:00
Neil Chauhan
ac37bf3631
Refactored the current ️/Star feature to ❤️/Love/Favourite feature. (#908)
* Added setRating feature to AlbumListView

* Refactored the iconography from  to ❤️

* Refactored the current component from StarButton to LoveButton

* Refactored all translations from Starred to Loved, and all props from showStar to showLove

* Refactored useToggleStar hook to useToggleLove

* rebased repository from master and removed stray commmits

* Refactored handler name from TOGGLE_STAR to TOGGLE_LOVE in PlayerToolbar.js

* Change "starred" translation to "Favorite"

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-26 23:56:19 -04:00
Deluan
db208600e4 Fix theme not being applied to Player's audioTitle 2021-03-26 22:22:36 -04:00
Arbaz Ahmed
01ba00ccdd
New component for mobile Artist List (#891)
Fixes #890
2021-03-25 22:45:21 -04:00
Yash Jipkate
e575825c33
Add / to _ mapping for paths based on tags. (#888)
Closes  #592
2021-03-25 21:48:28 -04:00
Ritik Pandey
5abc215270
Hide BulkActionsToolbar after removing songs from playlist (#898) 2021-03-25 21:40:31 -04:00
Deluan Quintão
210f34bbbe
Update CONTRIBUTING.md 2021-03-24 23:36:48 -04:00
Kushal Kumar
5e70e0702c
docs(contributing.md): Contributing guidelines added (#831)
* docs(contributing.md): Contributing guidelines added - I827

Signed-off-by: k-kumar-01 <kushalkumargupta4@gmail.com>

* docs(contributing.md): Contributing guidelines added - I827

Updated the issue number to match the existing issue
Changed channel from IRC to Discord

Signed-off-by: k-kumar-01 <kushalkumargupta4@gmail.com>

* Fix typos, remove issue template

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-24 23:33:48 -04:00
Danshil Kokil Mungur
a85b70e9db
feat(github): add issue templates (#892) 2021-03-24 23:21:48 -04:00
Josep Mª Domingo
515aa7108b
Move logger middleware to capture routing errors (ex: 405). (#877)
* Fix #836

* Remove requestLogger middleware from MountRouter
2021-03-24 23:17:36 -04:00
rohitgeddam
cdb387b22f
Properly break long comment lines. Fix #855 (#856)
Make ui responsive on smaller screen when the comment block is longer
2021-03-24 23:14:10 -04:00
Deluan
d5434d4169 Add 'lint to pre-push git hook 2021-03-24 12:21:20 -04:00
Deluan
c46aa72ede Add lint script to UI project 2021-03-24 12:05:58 -04:00
Deluan
4b68260b83 Move constant to consts.go file 2021-03-24 10:21:31 -04:00
Deluan Quintão
ba922bbfce
Update translations (#894)
* Add Ukrainian translation

* Update cs.json (POEditor.com)

* Update nl.json (POEditor.com)

* Update eo.json (POEditor.com)

* Update de.json (POEditor.com)
2021-03-23 22:28:22 -04:00
dependabot[bot]
b4a2683e65 Bump @testing-library/user-event from 12.6.2 to 13.0.7 in /ui
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 12.6.2 to 13.0.7.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v12.6.2...v13.0.7)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-23 22:26:09 -04:00
ImgBotApp
7e225c0f47 [ImgBot] Optimize images
*Total -- 8,303.62kb -> 6,130.18kb (26.17%)

/ui/src/icons/paused-light.png -- 0.81kb -> 0.29kb (63.6%)
/.github/screenshots/ss-mobile-login.png -- 1,189.03kb -> 736.30kb (38.08%)
/ui/src/icons/playing-dark.gif -- 2.29kb -> 1.58kb (31.29%)
/ui/src/icons/playing-light.gif -- 2.29kb -> 1.58kb (31.29%)
/.github/screenshots/ss-mobile-player.png -- 1,257.85kb -> 886.30kb (29.54%)
/ui/public/apple-touch-icon-152x152.png -- 9.51kb -> 6.74kb (29.21%)
/ui/public/mstile-144x144.png -- 9.63kb -> 6.88kb (28.55%)
/ui/public/mstile-70x70.png -- 6.59kb -> 4.73kb (28.22%)
/ui/public/apple-touch-icon-180x180.png -- 11.34kb -> 8.18kb (27.89%)
/ui/public/apple-touch-icon.png -- 11.34kb -> 8.18kb (27.89%)
/ui/public/apple-touch-icon-76x76.png -- 4.52kb -> 3.27kb (27.68%)
/ui/public/apple-touch-icon-120x120.png -- 7.27kb -> 5.30kb (27.2%)
/ui/public/android-chrome-192x192.png -- 13.14kb -> 9.78kb (25.59%)
/ui/public/mstile-150x150.png -- 9.57kb -> 7.20kb (24.8%)
/ui/public/apple-touch-icon-60x60.png -- 3.40kb -> 2.57kb (24.51%)
/ui/src/icons/android-icon-72x72.png -- 6.25kb -> 4.75kb (24%)
/.github/screenshots/ss-desktop-player.png -- 5,016.75kb -> 3,833.46kb (23.59%)
/resources/logo-192x192.png -- 17.10kb -> 13.21kb (22.78%)
/ui/public/android-chrome-512x512.png -- 38.32kb -> 29.78kb (22.3%)
/ui/public/mstile-310x310.png -- 21.04kb -> 16.49kb (21.61%)
/ui/public/mstile-310x150.png -- 10.35kb -> 8.12kb (21.56%)
/resources/navidrome-600x600.png -- 369.74kb -> 297.43kb (19.56%)
/ui/public/favicon-32x32.png -- 2.18kb -> 1.80kb (17.52%)
/.github/screenshots/ss-mobile-album-view.png -- 282.95kb -> 236.01kb (16.59%)
/ui/src/icons/paused-dark.png -- 0.34kb -> 0.29kb (14.25%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2021-03-23 10:29:13 -04:00
Arbaz Ahmed
4e44d841dd
New component for song display in song list (#833)
* added new component SONGSIMPLELIST for smaller displays

* added new component SONGSIMPLELIST for smaller displays

* added new component SONGSIMPLELIST for smaller displays

* Updated songsimplelist

Removed truncation

* removed garbage code

* refactored some issues of overlapping

* refactored some issues of overlapping

* changed the song ui design

* refactored some bugs in artist display

* refactored some bugs in artist display

* removed garbage dependencies

* removed div bugs

* added all the logic to the component itself
2021-03-23 00:12:19 -04:00
rochakjain361
b552eb15b3
Make the version number clickable for the SNAPSHOT version in development docker build (#843)
* Make the version number clickable for the SNAPSHOT version while using development docker build

* Update the snapshot version link in to view list of commits since the release

* Create a new component for the link to the version

* Add tests and refactored a bit

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-22 23:34:34 -04:00
Deluan
190bcd836e Bump @testing-library's dependencies 2021-03-22 15:40:06 -04:00
dependabot-preview[bot]
488a05bc5a Create Dependabot config file 2021-03-22 15:12:29 -04:00
Deluan
2daefb851a Bump golangci-lint to 1.38.0 2021-03-22 14:52:16 -04:00
Deluan
7414216094 Bump gomega and ginkgo versions 2021-03-22 14:49:57 -04:00
Deluan
300a0292ba Add timestamp indexes 2021-03-22 13:38:20 -04:00
Deluan
a4abe6ea2b Rename migration package to migrations 2021-03-22 13:38:04 -04:00
Nelyah
2671933791 Update Spanish translation
This also fixes some minor typos
2021-03-22 10:23:26 -04:00
Nelyah
da6556bb78 Update French translation 2021-03-22 10:23:26 -04:00
Deluan
c33c71ae6d Comment out flaky tests 2021-03-22 09:52:29 -04:00
certuna
1ea3d005e8
clear the ServiceWorker cache on logout (#854)
* Update authProvider.js

This fixes https://github.com/navidrome/navidrome/issues/613 : clears the ServiceWorker cache on logout. Based on this code: https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/keys . Seems to work on macOS and iOS, but please test on other platforms.

* Format code with `prettier`

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-21 14:34:10 -04:00
Ritik Pandey
9fb55d4025
Add duplicate song warning. Fix #554
* duplicate_song_warning added

* dialog_for_multiple_songs

* skip button updated

* duplicate_song_skip import removed

* duplicate_song msg updated

* handleSkip and checkDuplicateSong func modified

* Update AddToPlaylistDialog.js

* prettier applied

* go.sum file added

* duplicated songs bug fixed
2021-03-21 13:29:35 -04:00
Yash Jipkate
3e0e11c01e
Fix #260: Add Auto theme preference to set theme automatically. (#835)
* Auto theme preference added

* Fix lint

* Add and use AUTO from consts

* Add shared custom hook to get current theme

* Moved up 'Auto' choice

* AUTO -> AUTO_THEME_ID & extract useCurrentTheme to file

* Liberalise theme setting

* Add tests
2021-03-21 13:19:43 -04:00
Deluan
fa479f0a9a Show go mod download commands 2021-03-17 10:33:40 -04:00
Ketan Gupta
8b6e32588c improved makefile message to developer 2021-03-17 10:27:55 -04:00
Dnouv
b62c270b7f fix min-width of AlbumDetails 2021-03-16 23:19:11 -04:00
Ye61123
5488a829c7 Update zh-Hans.json
Improve the simplified Chinese translation accuracy and fix the parts that are not translated.
2021-03-16 23:13:40 -04:00
Daniel Morante
9d87eefd6a Create rc.d startup script for FreeBSD
Same startup script used by the port multimedia/navidrome
2021-03-16 23:11:42 -04:00
Deluan
03afb4ff0e Call go mod tidy after go mod download to undo any changes to go.sum 2021-03-16 12:49:20 -04:00
Deluan
63b9353452 Lowering the expectations caused by the name :) 2021-03-14 12:51:08 -04:00
k-kumar-01
72d6df15c6 style: New Theme Added - Spotify
Signed-off-by: k-kumar-01 <kushalkumargupta4@gmail.com>
2021-03-14 12:51:08 -04:00
Deluan
18fda0d954 Update DevContainer to GoLang 1.16 2021-03-12 18:43:03 -05:00
Deluan
34516ccf97 Bump github.com/sirupsen/logrus from 1.7.0 to 1.8.1 2021-03-12 18:19:39 -05:00
Deluan
720e2357b7 Add option to sort Recently Added by file's mtime instead of time of import. 2021-03-12 18:18:35 -05:00
Deluan
1ec105a245 Invalidate cached images when album changes 2021-03-12 15:41:11 -05:00
Deluan
0049d8d311 Bump GoLang to 1.16.2 for releases 2021-03-12 15:14:12 -05:00
Deluan Quintão
2d528bbc87
Remove dependency of go-bindata (#818)
* Use new embed functionality for serving UI assets

* Use new embed functionality for serving resources. Remove dependency on go-bindata

* Remove Go 1.15
2021-03-12 11:06:51 -05:00
rochakjain361
5a259ef3ff
Make the version number in the about dialog clickable (#817)
* Make the version number in the about dialog clickable

* Fix prettier errors

* Fix build errors
2021-03-12 10:26:41 -05:00
Nelyah
43f2d82956 Accept more recent node and Go versions when building dev or server
This will allow developers to experiment with different versions of Go.
2021-03-11 23:02:13 -05:00
Nelyah
dff18101bb Bump Go version number in go.mod to 1.16
This will allow to use 'embed' and 'fs' packages.
This also makes the check for the Go environment when running the
Makefile fail if Golang version isn't 1.16.x
2021-03-11 23:02:13 -05:00
dpirad007
6cf15748c4 SelectPlaylist Input mobile view fix 2021-03-11 22:53:55 -05:00
Deluan
54a3394559 Upgrade to GoLang 1.16.0 2021-02-19 21:00:38 -05:00
Deluan
8436e18175 Update pipeline tests to Go 1.16.0 2021-02-19 19:52:14 -05:00
Deluan
a140c222c2 Fix race condition in test 2021-02-19 19:36:55 -05:00
Deluan
64ceb5371b Revert "Bump github.com/go-chi/chi from 1.5.1 to 1.5.2"
This caused a panic and needs more investigation:

http: superfluous response.WriteHeader call from github.com/go-chi/chi/middleware.Recoverer.func1.1 (recoverer.go:33)

 panic: interface conversion: *middleware.compressResponseWriter is not io.ReaderFrom: missing method ReadFrom

 -> github.com/go-chi/chi/middleware.(*httpFancyWriter).ReadFrom
 ->   /Users/deluan/go/pkg/mod/github.com/go-chi/chi@v1.5.2/middleware/wrap_writer.go:135
2021-02-15 14:21:43 -05:00
Deluan
7eb99d0b8d Remove duplicated call to split 2021-02-15 14:18:57 -05:00
Deluan
07f815edfd go mod tidy 2021-02-15 14:08:49 -05:00
Deluan
781155ff39 Replace cursor with pointer when hovering over an expandable comment.
Fixes https://github.com/navidrome/navidrome/issues/637#issuecomment-778599670
2021-02-15 14:05:34 -05:00
dependabot-preview[bot]
0d6717ce69 Bump github.com/spf13/cobra from 1.1.1 to 1.1.3
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.1 to 1.1.3.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.1.1...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 13:21:16 -05:00
dependabot-preview[bot]
e0198f741f Bump github.com/go-chi/chi from 1.5.1 to 1.5.2
Bumps [github.com/go-chi/chi](https://github.com/go-chi/chi) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v1.5.1...v1.5.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 13:19:53 -05:00
Deluan
cfc9162729 Use a Waiter diode, to avoid constant CPU usage. Fixes #777 2021-02-13 12:08:32 -05:00
Deluan
48847ae479 Don't break if it tries to render ContextMenu without data. Fix #776 2021-02-13 12:04:02 -05:00
CgX
fbe6ecea95 Update fr.json 2021-02-11 09:13:24 -05:00
Nelyah
9d098e2302 Update French translation 2021-02-10 10:00:33 -05:00
Deluan
107803e037 Update list of Not Implemented / Gone Subsonic API endpoints 2021-02-09 21:25:14 -05:00
Gosz
1c285439ca Update spanish translation 2021-02-09 16:47:01 -05:00
Deluan
bde8692add Update Dutch translation 2021-02-09 16:46:29 -05:00
Deluan
1d681d92d3 Better explanation of NewSpreadFS 2021-02-09 15:33:34 -05:00
Deluan
157faad028 Rename ExternalInfo to ExternalMetadata 2021-02-09 15:33:33 -05:00
Deluan
5fdd8b32d7 Move utilitarian/generic packages to utils: lastfm, spotify, gravatar, cache, and pool 2021-02-09 15:33:33 -05:00
Deluan
b855fe865e Add artist ID to agent's interfaces 2021-02-09 11:19:32 -05:00
Andy Klimczak
501af14186 Upgrade pipeline to use docker/setup-buildx-action
Issue #563
2021-02-08 21:05:27 -05:00
Deluan
29465d92a7 Add Chinese Traditional translation (thanks @Leitftw) 2021-02-08 19:09:42 -05:00
Deluan
7cc026ac35 Add some info about how to create new agents 2021-02-08 17:18:43 -05:00
Deluan
fefbe0b117 Cleanup, add Placeholder agent 2021-02-08 16:54:51 -05:00
Deluan
e5cbfac483 Implement TopSongs 2021-02-08 16:54:51 -05:00
Deluan
e1cb52689e Implement SimilarSongs 2021-02-08 16:54:51 -05:00
Deluan
84a50d5dce Use MBID in calls to Last.FM, if it is available 2021-02-08 16:54:51 -05:00
Deluan
6c1fc5f836 Clean names before calling agents 2021-02-08 16:54:51 -05:00
Deluan
a76a52e99a Get MBID first, if it is not yet available 2021-02-08 16:54:51 -05:00
Deluan
52a407b84b Clean up, comments and logs 2021-02-08 16:54:51 -05:00
Deluan
365dff6435 Fix lint errors 2021-02-08 16:54:51 -05:00
Deluan
877cdf1d5c Get images 2021-02-08 16:54:51 -05:00
Deluan
28cdf1e693 Add a cached http client 2021-02-08 16:54:51 -05:00
Deluan
9d24106066 Incomplete implementation of agents 2021-02-08 16:54:51 -05:00
dependabot-preview[bot]
d8a4db36ef Bump react-icons from 4.1.0 to 4.2.0 in /ui
Bumps [react-icons](https://github.com/react-icons/react-icons) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v4.1.0...v4.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-08 11:29:27 -05:00
1194 changed files with 94872 additions and 35994 deletions

View file

@ -2,7 +2,7 @@
# [Choice] Go version: 1, 1.15, 1.14
ARG VARIANT="1"
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}
FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT}
# [Option] Install Node.js
ARG INSTALL_NODE="true"
@ -17,4 +17,4 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# RUN go get -x <your-dependency-or-tool>
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

View file

@ -4,45 +4,51 @@
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14
"VARIANT": "1.15",
"VARIANT": "1.24",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "v14"
"NODE_VERSION": "v20"
}
},
"workspaceMount": "",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
"seccomp=unconfined",
"--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z"
],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"go.useGoProxyToCheckForToolUpdates": false,
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.formatTool": "goimports",
"go.lintOnSave": "package",
"go.lintTool": "golangci-lint",
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"go.useGoProxyToCheckForToolUpdates": false,
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"go.toolsGopath": "/go/bin",
"go.formatTool": "goimports",
"go.lintOnSave": "package",
"go.lintTool": "golangci-lint",
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"esbenp.prettier-vscode",
"tamasfe.even-better-toml"
]
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"esbenp.prettier-vscode",
"tamasfe.even-better-toml"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4533,
@ -56,4 +62,4 @@
"ND_MUSICFOLDER": "./music",
"ND_DATAFOLDER": "./data"
}
}
}

View file

@ -1,12 +1,18 @@
.DS_Store
ui/node_modules
ui/build
!ui/build/.gitkeep
Dockerfile
docker-compose*.yml
data
*.db
testDB
navidrome
navidrome.db
navidrome.toml
assets/*gen.go
tmp
!tmp/taglib
dist
binaries
cache
music
!Dockerfile

103
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View file

@ -0,0 +1,103 @@
name: Bug Report
description: Before opening a new issue, please search to see if an issue already exists for the bug you encountered.
title: "[Bug]: "
labels: ["bug", "triage"]
#assignees:
# - deluan
body:
- type: markdown
attributes:
value: |
### Thanks for taking the time to fill out this bug report!
- type: checkboxes
id: requirements
attributes:
label: "I confirm that:"
options:
- label: I have searched the existing [open AND closed issues](https://github.com/navidrome/navidrome/issues?q=is%3Aissue) to see if an issue already exists for the bug I've encountered
required: true
- label: I'm using the latest version (your issue may have been fixed already)
required: false
- type: input
id: version
attributes:
label: Version
description: What version of Navidrome are you running? (please try upgrading first, as your issue may have been fixed already).
validations:
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this scenario...
2. With this config...
3. Click (or Execute) '...'
4. See error...
validations:
required: false
- type: textarea
id: env
attributes:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **Browser**: Chrome 110.0.5481.177 on Windows 11
- **Client**: DSub 5.5.1
value: |
- OS:
- Browser:
- Client:
render: markdown
- type: dropdown
id: distribution
attributes:
label: How Navidrome is installed?
multiple: false
options:
- Docker
- Binary (from downloads page)
- Package
- Built from sources
validations:
required: true
- type: textarea
id: config
attributes:
label: Configuration
description: Please copy and paste your `navidrome.toml` (and/or `docker-compose.yml`) configuration. This will be automatically formatted into code, so no need for backticks.
render: toml
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output (change your `LogLevel` (`ND_LOGLEVEL`) to debug). This will be automatically formatted into code, so no need for backticks. ([Where I can find the logs?](https://www.navidrome.org/docs/faq/#where-are-the-logs))
render: shell
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach screenshots by clicking this area to highlight it and then dragging files in.
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/navidrome/navidrome/blob/master/CODE_OF_CONDUCT.md).
options:
- label: I agree to follow Navidrome's Code of Conduct
required: true

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Ideas for new features
url: https://github.com/navidrome/navidrome/discussions/categories/ideas
about: This is the place to share and discuss new ideas and potentially new features.
- name: Support requests
url: https://github.com/navidrome/navidrome/discussions/categories/q-a
about: This is the place to ask questions.

View file

@ -0,0 +1,23 @@
name: 'Download TagLib'
description: 'Downloads and extracts the TagLib library, adding it to PKG_CONFIG_PATH'
inputs:
version:
description: 'Version of TagLib to download'
required: true
platform:
description: 'Platform to download TagLib for'
default: 'linux-amd64'
runs:
using: 'composite'
steps:
- name: Download TagLib
shell: bash
run: |
mkdir -p /tmp/taglib
cd /tmp
FILE=taglib-${{ inputs.platform }}.tar.gz
wget https://github.com/navidrome/cross-taglib/releases/download/v${{ inputs.version }}/${FILE}
tar -xzf ${FILE} -C taglib
PKG_CONFIG_PREFIX=/tmp/taglib
echo "PKG_CONFIG_PREFIX=${PKG_CONFIG_PREFIX}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${PKG_CONFIG_PREFIX}/lib/pkgconfig" >> $GITHUB_ENV

View file

@ -0,0 +1,84 @@
name: 'Prepare Docker Buildx environment'
description: 'Downloads and extracts the TagLib library, adding it to PKG_CONFIG_PATH'
inputs:
github_token:
description: 'GitHub token'
required: true
default: ''
hub_repository:
description: 'Docker Hub repository to push images to'
required: false
default: ''
hub_username:
description: 'Docker Hub username'
required: false
default: ''
hub_password:
description: 'Docker Hub password'
required: false
default: ''
outputs:
tags:
description: 'Docker image tags'
value: ${{ steps.meta.outputs.tags }}
labels:
description: 'Docker image labels'
value: ${{ steps.meta.outputs.labels }}
annotations:
description: 'Docker image annotations'
value: ${{ steps.meta.outputs.annotations }}
version:
description: 'Docker image version'
value: ${{ steps.meta.outputs.version }}
hub_repository:
description: 'Docker Hub repository'
value: ${{ env.DOCKER_HUB_REPO }}
hub_enabled:
description: 'Is Docker Hub enabled'
value: ${{ env.DOCKER_HUB_ENABLED }}
runs:
using: 'composite'
steps:
- name: Check Docker Hub configuration
shell: bash
run: |
if [ -z "${{inputs.hub_repository}}" ]; then
echo "DOCKER_HUB_REPO=none" >> $GITHUB_ENV
echo "DOCKER_HUB_ENABLED=false" >> $GITHUB_ENV
else
echo "DOCKER_HUB_REPO=${{inputs.hub_repository}}" >> $GITHUB_ENV
echo "DOCKER_HUB_ENABLED=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
if: inputs.hub_username != '' && inputs.hub_password != ''
uses: docker/login-action@v3
with:
username: ${{ inputs.hub_username }}
password: ${{ inputs.hub_password }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github_token }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata for Docker image
id: meta
uses: docker/metadata-action@v5
with:
labels: |
maintainer=deluan@navidrome.org
images: |
name=${{env.DOCKER_HUB_REPO}},enable=${{env.DOCKER_HUB_ENABLED}}
name=ghcr.io/${{ github.repository }}
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=raw,value=develop,enable={{is_default_branch}}

22
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/ui"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/.github/workflows"
schedule:
interval: weekly
open-pull-requests-limit: 10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 735 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 885 KiB

Before After
Before After

View file

@ -1,22 +0,0 @@
#!/bin/bash
GIT_TAG="${GITHUB_REF##refs/tags/}"
GIT_BRANCH="${GITHUB_REF##refs/heads/}"
GIT_SHA=$(git rev-parse --short HEAD)
PR_NUM=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
DOCKER_IMAGE_TAG="--tag ${DOCKER_IMAGE}:sha-${GIT_SHA}"
if [[ $PR_NUM != "null" ]]; then
DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:pr-${PR_NUM}"
fi
if [[ $GITHUB_REF != "$GIT_TAG" ]]; then
DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:${GIT_TAG#v} --tag ${DOCKER_IMAGE}:latest"
elif [[ $GITHUB_REF == "refs/heads/master" ]]; then
DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:develop"
elif [[ $GIT_BRANCH = feature/* ]]; then
DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:$(echo $GIT_BRANCH | tr / -)"
fi
echo ${DOCKER_IMAGE_TAG}

View file

@ -0,0 +1,54 @@
name: Add download link to PR
on:
workflow_run:
workflows: ['Pipeline: Test, Lint, Build']
types: [completed]
jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
# This snippet is public-domain, taken from
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
script: |
const {owner, repo} = context.repo;
const run_id = ${{github.event.workflow_run.id}};
const pull_head_sha = '${{github.event.workflow_run.head_sha}}';
const pull_user_id = ${{github.event.sender.id}};
const issue_number = await (async () => {
const pulls = await github.pulls.list({owner, repo});
for await (const {data} of github.paginate.iterator(pulls)) {
for (const pull of data) {
if (pull.head.sha === pull_head_sha && pull.user.id === pull_user_id) {
return pull.number;
}
}
}
})();
if (issue_number) {
core.info(`Using pull request ${issue_number}`);
} else {
return core.error(`No matching pull request found`);
}
const {data: {artifacts}} = await github.actions.listWorkflowRunArtifacts({owner, repo, run_id});
if (!artifacts.length) {
return core.error(`No artifacts found`);
}
let body = `Download the artifacts for this pull request:\n`;
for (const art of artifacts) {
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
}
const {data: comments} = await github.issues.listComments({repo, owner, issue_number});
const existing_comment = comments.find((c) => c.user.login === 'github-actions[bot]');
if (existing_comment) {
core.info(`Updating comment ${existing_comment.id}`);
await github.issues.updateComment({repo, owner, comment_id: existing_comment.id, body});
} else {
core.info(`Creating a comment`);
await github.issues.createComment({repo, owner, issue_number, body});
}

View file

@ -1,37 +0,0 @@
#####################################################
### Copy platform specific binary
FROM bash as copy-binary
ARG TARGETPLATFORM
RUN echo "Target Platform = ${TARGETPLATFORM}"
COPY dist .
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then cp navidrome_linux_amd64_linux_amd64/navidrome /navidrome; fi
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then cp navidrome_linux_arm64_linux_arm64/navidrome /navidrome; fi
RUN if [ "$TARGETPLATFORM" = "linux/arm/v6" ]; then cp navidrome_linux_arm_linux_arm_6/navidrome /navidrome; fi
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then cp navidrome_linux_arm_linux_arm_7/navidrome /navidrome; fi
RUN chmod +x /navidrome
#####################################################
### Build Final Image
FROM alpine as release
LABEL maintainer="deluan@navidrome.org"
# Install ffmpeg and output build config
RUN apk add --no-cache ffmpeg
RUN ffmpeg -buildconf
COPY --from=copy-binary /navidrome /app/
VOLUME ["/data", "/music"]
ENV ND_MUSICFOLDER /music
ENV ND_DATAFOLDER /data
ENV ND_PORT 4533
ENV GODEBUG "asyncpreemptoff=1"
EXPOSE ${ND_PORT}
HEALTHCHECK CMD wget -O- http://localhost:${ND_PORT}/ping || exit 1
WORKDIR /app
ENTRYPOINT ["/app/navidrome"]

View file

@ -1,4 +1,4 @@
name: Pipeline
name: "Pipeline: Test, Lint, Build"
on:
push:
branches:
@ -8,87 +8,128 @@ on:
pull_request:
branches:
- master
concurrency:
group: ${{ startsWith(github.ref, 'refs/tags/v') && 'tag' || 'branch' }}-${{ github.ref }}
cancel-in-progress: true
env:
CROSS_TAGLIB_VERSION: "2.0.2-1"
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}
jobs:
golangci-lint:
name: Lint Server
git-version:
name: Get version info
runs-on: ubuntu-latest
outputs:
git_tag: ${{ steps.git-version.outputs.GIT_TAG }}
git_sha: ${{ steps.git-version.outputs.GIT_SHA }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Show git version info
run: |
echo "git describe (dirty): $(git describe --dirty --always --tags)"
echo "git describe --tags: $(git describe --tags `git rev-list --tags --max-count=1`)"
echo "git tag: $(git tag --sort=-committerdate | head -n 1)"
echo "github_ref: $GITHUB_REF"
echo "github_head_sha: ${{ github.event.pull_request.head.sha }}"
git tag -l
- name: Determine git current SHA and latest tag
id: git-version
run: |
GIT_TAG=$(git tag --sort=-committerdate | head -n 1)
if [ -n "$GIT_TAG" ]; then
if [[ "$GITHUB_REF" != refs/tags/* ]]; then
GIT_TAG=${GIT_TAG}-SNAPSHOT
fi
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_OUTPUT
fi
GIT_SHA=$(git rev-parse --short HEAD)
PR_NUM=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
if [[ $PR_NUM != "null" ]]; then
GIT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-8)
GIT_SHA="pr-${PR_NUM}/${GIT_SHA}"
fi
echo "GIT_SHA=$GIT_SHA" >> $GITHUB_OUTPUT
echo "GIT_TAG=$GIT_TAG"
echo "GIT_SHA=$GIT_SHA"
go-lint:
name: Lint Go code
runs-on: ubuntu-latest
steps:
- name: Install taglib
run: sudo apt-get install libtag1-dev
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Download TagLib
uses: ./.github/actions/download-taglib
with:
version: ${{ env.CROSS_TAGLIB_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v6
with:
version: v1.36
github-token: ${{ secrets.GITHUB_TOKEN }}
version: latest
problem-matchers: true
args: --timeout 2m
- name: Run go goimports
run: go run golang.org/x/tools/cmd/goimports@latest -w `find . -name '*.go' | grep -v '_gen.go$'`
- run: go mod tidy
- name: Verify no changes from goimports and go mod tidy
run: |
git status --porcelain
if [ -n "$(git status --porcelain)" ]; then
echo 'To fix this check, run "make format" and commit the changes'
exit 1
fi
go:
name: Test Server with Go ${{ matrix.go_version }}
name: Test Go code
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.15.x, 1.16.0-rc1]
steps:
- name: Install taglib
run: sudo apt-get install libtag1-dev
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v2
with:
stable: '!contains(${{ matrix.go_version }}, "beta") && !contains(${{ matrix.go_version }}, "rc")'
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4
- uses: actions/cache@v2
id: cache-go
- name: Download TagLib
uses: ./.github/actions/download-taglib
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go_version }}-
version: ${{ env.CROSS_TAGLIB_VERSION }}
- name: Download dependencies
if: steps.cache-go.outputs.cache-hit != 'true'
continue-on-error: ${{contains(matrix.go_version, 'beta') || contains(matrix.go_version, 'rc')}}
run: go mod download
- name: Test
continue-on-error: ${{contains(matrix.go_version, 'beta') || contains(matrix.go_version, 'rc')}}
run: go test -cover ./... -v
run: |
pkg-config --define-prefix --cflags --libs taglib # for debugging
go test -shuffle=on -tags netgo -race -cover ./... -v
js:
name: Build JS bundle
name: Test JS code
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
- uses: actions/cache@v2
id: cache-npm
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-version: 20
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: npm install dependencies
run: |
cd ui
npm ci
- name: npm check-formatting
- name: npm lint
run: |
cd ui
npm run check-formatting
npm run check-formatting && npm run lint
- name: npm test
run: |
@ -100,85 +141,289 @@ jobs:
cd ui
npm run build
- uses: actions/upload-artifact@v2
with:
name: js-bundle
path: ui/build
binaries:
name: Binaries
needs: [js, go, golangci-lint]
i18n-lint:
name: Lint i18n files
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v4
- run: |
set -e
for file in resources/i18n/*.json; do
echo "Validating $file"
if ! jq empty "$file" 2>error.log; then
error_message=$(cat error.log)
line_number=$(echo "$error_message" | grep -oP 'line \K[0-9]+')
echo "::error file=$file,line=$line_number::$error_message"
exit 1
fi
done
- uses: actions/download-artifact@v2
with:
name: js-bundle
path: ui/build
check-push-enabled:
name: Check Docker configuration
runs-on: ubuntu-latest
outputs:
is_enabled: ${{ steps.check.outputs.is_enabled }}
steps:
- name: Check if Docker push is configured
id: check
run: echo "is_enabled=${{ secrets.DOCKER_HUB_USERNAME != '' }}" >> $GITHUB_OUTPUT
- name: Show Tags
run: git tag
- name: Show Version
run: git describe --tags
- name: Run GoReleaser - SNAPSHOT
if: startsWith(github.ref, 'refs/tags/') != true
uses: docker://deluan/ci-goreleaser:1.15.5-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: goreleaser release --rm-dist --skip-publish --snapshot
- name: Run GoReleaser - RELEASE
if: startsWith(github.ref, 'refs/tags/')
uses: docker://deluan/ci-goreleaser:1.15.5-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: goreleaser release --rm-dist
- uses: actions/upload-artifact@v2
with:
name: binaries
path: |
dist
!dist/*.tar.gz
!dist/*.zip
docker:
name: Docker images
needs: [binaries]
build:
name: Build
needs: [js, go, go-lint, i18n-lint, git-version, check-push-enabled]
strategy:
matrix:
platform: [ linux/amd64, linux/arm64, linux/arm/v5, linux/arm/v6, linux/arm/v7, linux/386, darwin/amd64, darwin/arm64, windows/amd64, windows/386 ]
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: ${{secrets.DOCKER_IMAGE}}
IS_LINUX: ${{ startsWith(matrix.platform, 'linux/') && 'true' || 'false' }}
IS_ARMV5: ${{ matrix.platform == 'linux/arm/v5' && 'true' || 'false' }}
IS_DOCKER_PUSH_CONFIGURED: ${{ needs.check-push-enabled.outputs.is_enabled == 'true' }}
DOCKER_BUILD_SUMMARY: false
GIT_SHA: ${{ needs.git-version.outputs.git_sha }}
GIT_TAG: ${{ needs.git-version.outputs.git_tag }}
steps:
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
if: env.DOCKER_IMAGE != ''
with:
buildx-version: latest
qemu-version: latest
- uses: actions/checkout@v2
if: env.DOCKER_IMAGE != ''
- uses: actions/download-artifact@v2
if: env.DOCKER_IMAGE != ''
with:
name: binaries
path: dist
- name: Build the Docker image and push
if: env.DOCKER_IMAGE != ''
env:
DOCKER_IMAGE: ${{secrets.DOCKER_IMAGE}}
DOCKER_PLATFORM: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
- name: Sanitize platform name
id: set-platform
run: |
echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin
docker buildx build --platform ${DOCKER_PLATFORM} `.github/workflows/docker-tags.sh` -f .github/workflows/pipeline.dockerfile --push .
PLATFORM=$(echo ${{ matrix.platform }} | tr '/' '_')
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Prepare Docker Buildx
uses: ./.github/actions/prepare-docker
id: docker
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
hub_repository: ${{ vars.DOCKER_HUB_REPO }}
hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build Binaries
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
outputs: |
type=local,dest=./output/${{ env.PLATFORM }}
target: binary
build-args: |
GIT_SHA=${{ env.GIT_SHA }}
GIT_TAG=${{ env.GIT_TAG }}
CROSS_TAGLIB_VERSION=${{ env.CROSS_TAGLIB_VERSION }}
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: navidrome-${{ env.PLATFORM }}
path: ./output
retention-days: 7
- name: Build and push image by digest
id: push-image
if: env.IS_LINUX == 'true' && env.IS_DOCKER_PUSH_CONFIGURED == 'true' && env.IS_ARMV5 == 'false'
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.docker.outputs.labels }}
build-args: |
GIT_SHA=${{ env.GIT_SHA }}
GIT_TAG=${{ env.GIT_TAG }}
CROSS_TAGLIB_VERSION=${{ env.CROSS_TAGLIB_VERSION }}
outputs: |
type=image,name=${{ steps.docker.outputs.hub_repository }},push-by-digest=true,name-canonical=true,push=${{ steps.docker.outputs.hub_enabled }}
type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
if: env.IS_LINUX == 'true' && env.IS_DOCKER_PUSH_CONFIGURED == 'true' && env.IS_ARMV5 == 'false'
run: |
mkdir -p /tmp/digests
digest="${{ steps.push-image.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
if: env.IS_LINUX == 'true' && env.IS_DOCKER_PUSH_CONFIGURED == 'true' && env.IS_ARMV5 == 'false'
with:
name: digests-${{ env.PLATFORM }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
push-manifest:
name: Push Docker manifest
runs-on: ubuntu-latest
needs: [build, check-push-enabled]
if: needs.check-push-enabled.outputs.is_enabled == 'true'
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
steps:
- uses: actions/checkout@v4
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Prepare Docker Buildx
uses: ./.github/actions/prepare-docker
id: docker
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
hub_repository: ${{ vars.DOCKER_HUB_REPO }}
hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Create manifest list and push to ghcr.io
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Create manifest list and push to Docker Hub
working-directory: /tmp/digests
if: vars.DOCKER_HUB_REPO != ''
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ vars.DOCKER_HUB_REPO }}@sha256:%s ' *)
- name: Inspect image in ghcr.io
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.docker.outputs.version }}
- name: Inspect image in Docker Hub
if: vars.DOCKER_HUB_REPO != ''
run: |
docker buildx imagetools inspect ${{ vars.DOCKER_HUB_REPO }}:${{ steps.docker.outputs.version }}
- name: Delete unnecessary digest artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
for artifact in $(gh api repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts[] | select(.name | startswith("digests-")) | .id'); do
gh api --method DELETE repos/${{ github.repository }}/actions/artifacts/$artifact
done
msi:
name: Build Windows installers
needs: [build, git-version]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ./binaries
pattern: navidrome-windows*
merge-multiple: true
- name: Install Wix
run: sudo apt-get install -y wixl jq
- name: Build MSI
env:
GIT_TAG: ${{ needs.git-version.outputs.git_tag }}
run: |
rm -rf binaries/msi
sudo GIT_TAG=$GIT_TAG release/wix/build_msi.sh ${GITHUB_WORKSPACE} 386
sudo GIT_TAG=$GIT_TAG release/wix/build_msi.sh ${GITHUB_WORKSPACE} amd64
du -h binaries/msi/*.msi
- name: Upload MSI files
uses: actions/upload-artifact@v4
with:
name: navidrome-windows-installers
path: binaries/msi/*.msi
retention-days: 7
release:
name: Package/Release
needs: [build, msi]
runs-on: ubuntu-latest
outputs:
package_list: ${{ steps.set-package-list.outputs.package_list }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/download-artifact@v4
with:
path: ./binaries
pattern: navidrome-*
merge-multiple: true
- run: ls -lR ./binaries
- name: Set RELEASE_FLAGS for snapshot releases
if: env.IS_RELEASE == 'false'
run: echo 'RELEASE_FLAGS=--skip=publish --snapshot' >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: "release --clean -f release/goreleaser.yml ${{ env.RELEASE_FLAGS }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove build artifacts
run: |
ls -l ./dist
rm ./dist/*.tar.gz ./dist/*.zip
- name: Upload all-packages artifact
uses: actions/upload-artifact@v4
with:
name: packages
path: dist/navidrome_0*
- id: set-package-list
name: Export list of generated packages
run: |
cd dist
set +x
ITEMS=$(ls navidrome_0* | sed 's/^navidrome_0[^_]*_linux_//' | jq -R -s -c 'split("\n")[:-1]')
echo $ITEMS
echo "package_list=${ITEMS}" >> $GITHUB_OUTPUT
upload-packages:
name: Upload Linux PKG
runs-on: ubuntu-latest
needs: [release]
strategy:
matrix:
item: ${{ fromJson(needs.release.outputs.package_list) }}
steps:
- name: Download all-packages artifact
uses: actions/download-artifact@v4
with:
name: packages
path: ./dist
- name: Upload all-packages artifact
uses: actions/upload-artifact@v4
with:
name: navidrome_linux_${{ matrix.item }}
path: dist/navidrome_0*_linux_${{ matrix.item }}
# delete-artifacts:
# name: Delete unused artifacts
# runs-on: ubuntu-latest
# needs: [upload-packages]
# steps:
# - name: Delete all-packages artifact
# env:
# GH_TOKEN: ${{ github.token }}
# run: |
# for artifact in $(gh api repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts[] | select(.name | startswith("packages")) | .id'); do
# gh api --method DELETE repos/${{ github.repository }}/actions/artifacts/$artifact
# done

View file

@ -1,18 +0,0 @@
name: Remove old artifacts
on:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '7 days'
skip-tags: false

56
.github/workflows/stale.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: 'Close stale issues and PRs'
on:
workflow_dispatch:
schedule:
- cron: '30 1 * * *'
permissions:
contents: read
jobs:
stale:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
process-only: 'issues, prs'
issue-inactive-days: 120
pr-inactive-days: 120
log-output: true
add-issue-labels: 'frozen-due-to-age'
add-pr-labels: 'frozen-due-to-age'
issue-comment: >
This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
pr-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
- uses: actions/stale@v9
with:
operations-per-run: 999
days-before-issue-stale: 180
days-before-pr-stale: 180
days-before-issue-close: 30
days-before-pr-close: 30
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. The resources of the Navidrome team are limited, and so we are asking for your help.
If this is a **bug** and you can still reproduce this error on the <code>master</code> branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a **feature request**, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
stale-pr-message: This PR has been automatically marked as stale because it has not had
recent activity. The resources of the Navidrome team are limited, and so we are asking for your help.
Please check https://github.com/navidrome/navidrome/blob/master/CONTRIBUTING.md#pull-requests and verify that this code contribution fits with the description. If yes, tell it in a comment.
This PR will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
stale-issue-label: 'stale'
exempt-issue-labels: 'keep,security'
stale-pr-label: 'stale'
exempt-pr-labels: 'keep,security'

93
.github/workflows/update-translations.sh vendored Executable file
View file

@ -0,0 +1,93 @@
#!/bin/sh
set -e
I18N_DIR=resources/i18n
# Function to process JSON: remove empty attributes and sort
process_json() {
jq 'walk(if type == "object" then with_entries(select(.value != null and .value != "" and .value != [] and .value != {})) | to_entries | sort_by(.key) | from_entries else . end)' "$1"
}
# Function to check differences between local and remote translations
check_lang_diff() {
filename=${I18N_DIR}/"$1".json
url=$(curl -s -X POST https://poeditor.com/api/ \
-d api_token="${POEDITOR_APIKEY}" \
-d action="export" \
-d id="${POEDITOR_PROJECTID}" \
-d language="$1" \
-d type="key_value_json" | jq -r .item)
if [ -z "$url" ]; then
echo "Failed to export $1"
return 1
fi
curl -sSL "$url" > poeditor.json
process_json "$filename" > "$filename".tmp
process_json poeditor.json > poeditor.tmp
diff=$(diff -u "$filename".tmp poeditor.tmp) || true
if [ -n "$diff" ]; then
echo "$diff"
mv poeditor.json "$filename"
fi
rm -f poeditor.json poeditor.tmp "$filename".tmp
}
# Function to get the list of languages
get_language_list() {
response=$(curl -s -X POST https://api.poeditor.com/v2/languages/list \
-d api_token="${POEDITOR_APIKEY}" \
-d id="${POEDITOR_PROJECTID}")
echo $response
}
# Function to get the language name from the language code
get_language_name() {
lang_code="$1"
lang_list="$2"
lang_name=$(echo "$lang_list" | jq -r ".result.languages[] | select(.code == \"$lang_code\") | .name")
if [ -z "$lang_name" ]; then
echo "Error: Language code '$lang_code' not found" >&2
return 1
fi
echo "$lang_name"
}
# Function to get the language code from the file path
get_lang_code() {
filepath="$1"
# Extract just the filename
filename=$(basename "$filepath")
# Remove the extension
lang_code="${filename%.*}"
echo "$lang_code"
}
lang_list=$(get_language_list)
# Check differences for each language
for file in ${I18N_DIR}/*.json; do
code=$(get_lang_code "$file")
lang=$(jq -r .languageName < "$file")
lang_name=$(get_language_name "$code" "$lang_list")
echo "Downloading $lang_name - $lang ($code)"
check_lang_diff "$code"
done
# List changed languages to stderr
languages=""
for file in $(git diff --name-only --exit-code | grep json); do
lang_code=$(get_lang_code "$file")
lang_name=$(get_language_name "$lang_code" "$lang_list")
languages="${languages}$(echo "$lang_name" | tr -d '\n'), "
done
echo "${languages%??}" 1>&2

View file

@ -0,0 +1,33 @@
name: POEditor import
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *'
jobs:
update-translations:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'navidrome' }}
steps:
- uses: actions/checkout@v4
- name: Get updated translations
id: poeditor
env:
POEDITOR_PROJECTID: ${{ secrets.POEDITOR_PROJECTID }}
POEDITOR_APIKEY: ${{ secrets.POEDITOR_APIKEY }}
run: |
.github/workflows/update-translations.sh 2> title.tmp
title=$(cat title.tmp)
echo "::set-output name=title::$title"
rm title.tmp
- name: Show changes, if any
run: |
git status --porcelain
git diff
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PAT }}
author: "navidrome-bot <navidrome-bot@navidrome.org>"
commit-message: "fix(ui): update ${{ steps.poeditor.outputs.title }} translations from POEditor"
title: "fix(ui): update ${{ steps.poeditor.outputs.title }} translations from POEditor"
branch: update-translations

14
.gitignore vendored
View file

@ -11,15 +11,17 @@ wiki
TODO.md
var
navidrome.toml
!release/linux/navidrome.toml
master.zip
testDB
navidrome.db
cache/*
*.swp
embedded_gen.go
dist
music
*.db*
.gitinfo
docker-compose.yml
navidrome.db-shm
navidrome.db-wal
tags
!contrib/docker-compose.yml
binaries
navidrome-master
*.exe

View file

@ -1,29 +1,52 @@
run:
build-tags:
- netgo
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- deadcode
- copyloopvar
- dogsled
- durationcheck
- errcheck
- errorlint
- gocyclo
- goimports
- gocritic
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- nilerr
- rowserrcheck
- staticcheck
- structcheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
issues:
exclude-rules:
- linters:
- gosec
text: "(G501|G401|G505):"
- path: scanner2
linters:
- unused
linters-settings:
gocritic:
disable-all: true
enabled-checks:
- deprecatedComment
govet:
enable:
- nilness
gosec:
excludes:
- G501
- G401
- G505
- G115 # Can't check context, where the warning is clearly a false positive. See discussion in https://github.com/securego/gosec/pull/1149

View file

@ -1,141 +0,0 @@
# GoReleaser config
project_name: navidrome
before:
hooks:
- go-bindata -fs -prefix resources -tags embed -ignore="\\\*.go" -pkg resources -o resources/embedded_gen.go resources/...
- go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
builds:
- id: navidrome_linux_amd64
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static -lz'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_linux_386
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- 386
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_linux_arm
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabi-gcc
- CXX=arm-linux-gnueabi-g++
goos:
- linux
goarch:
- arm
goarm:
- 5
- 6
- 7
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_linux_arm64
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
goos:
- linux
goarch:
- arm64
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_windows_i686
env:
- CGO_ENABLED=1
- CC=i686-w64-mingw32-gcc
- CXX=i686-w64-mingw32-g++
- PKG_CONFIG_PATH=/mingw32/lib/pkgconfig
goos:
- windows
goarch:
- 386
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_windows_x64
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
- PKG_CONFIG_PATH=/mingw64/lib/pkgconfig
goos:
- windows
goarch:
- amd64
flags:
- -tags=embed,netgo
ldflags:
- "-extldflags '-static'"
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
- id: navidrome_darwin
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- PKG_CONFIG_PATH=/darwin/lib/pkgconfig
goos:
- darwin
goarch:
- amd64
flags:
- -tags=embed,netgo
ldflags:
- -s -w -X github.com/navidrome/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/navidrome/navidrome/consts.gitTag={{.Version}}
archives:
- format_overrides:
- goos: windows
format: zip
replacements:
darwin: macOS
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
snapshot:
name_template: "{{ .Tag }}-SNAPSHOT"
release:
draft: true
changelog:
# sort: asc
filters:
exclude:
- "^docs:"

2
.nvmrc
View file

@ -1 +1 @@
v14
v20

93
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,93 @@
# Navidrome Contribution Guide
Navidrome is a streaming service which allows you to enjoy your music collection from anywhere. We'd welcome you to contribute to our open source project and make Navidrome even better. There are some basic guidelines which you need to follow if you like to contribute to Navidrome.
- [Asking Support Questions](#asking-support-questions)
- [Code of Conduct](#code-of-conduct)
- [Issues](#issues)
- [Pull Requests](#pull-requests)
## Asking Support Questions
We have an active [discussion forum](https://github.com/navidrome/navidrome/discussions) where users and developers can ask questions. Please don't use the GitHub issue tracker to ask questions.
## Code of Conduct
Please read the following [Code of Conduct](https://github.com/navidrome/navidrome/blob/master/CODE_OF_CONDUCT.md).
## Issues
Found any issue or bug in our codebase? Have a great idea you want to propose or discuss with
the developers? You can help by submitting an [issue](https://github.com/navidrome/navidrome/issues/new/choose)
to the GitHub repository.
**Before opening a new issue, please check if the issue has not been already made by searching
the [issues](https://github.com/navidrome/navidrome/issues)**
## Pull requests
Before submitting a pull request, ensure that you go through the following:
- Open a corresponding issue for the Pull Request, if not existing. The issue can be opened following [these guidelines](#issues)
- Ensure that there is no open or closed Pull Request corresponding to your submission to avoid duplication of effort.
- Setup the [development environment](https://www.navidrome.org/docs/developers/dev-environment/)
- Create a new branch on your forked repo and make the changes in it. Naming conventions for branch are: `<Issue Title>/<Issue Number>`. Example:
```
git checkout -b adding-docs/834 master
```
- The commits should follow a [specific convention](#commit-conventions)
- Ensure that a DCO sign-off for commits is provided via `--signoff` option of git commit
- Provide a link to the issue that will be closed via your Pull request.
### Commit Conventions
Each commit message must adhere to the following format:
```
<type>(scope): <description> - <issue number>
[optional body]
```
This improves the readability of the messages
#### Type
It can be one of the following:
1. **feat**: Addition of a new feature
2. **fix**: Bug fix
3. **sec**: Fixing security issues
4. **docs**: Documentation Changes
5. **style**: Changes to styling
6. **refactor**: Refactoring of code
7. **perf**: Code that affects performance
8. **test**: Updating or improving the current tests
9. **build**: Changes to Build process
10. **revert**: Reverting to a previous commit
11. **chore** : updating grunt tasks etc
If there is a breaking change in your Pull Request, please add `BREAKING CHANGE` in the optional body section
#### Scope
The file or folder where the changes are made. If there are more than one, you can mention any
#### Description
A short description of the issue
#### Issue number
The issue fixed by this Pull Request.
The body is optional. It may contain short description of changes made.
Following all the guidelines an ideal commit will look like:
```
git commit --signoff -m "feat(themes): New-theme - #834"
```
After committing, push your commits to your forked branch and create a Pull Request from there.
The Pull Request Title can be the same as `<type>(scope): <description> - <issue number>`
A demo layout of how the Pull request body can look:
```
Closes <Issue number along with link>
Description (What does the pull request do)
Changes (What changes were made )
Screenshots or Videos
Related Issues and Pull Requests(if any)
```

145
Dockerfile Normal file
View file

@ -0,0 +1,145 @@
FROM --platform=$BUILDPLATFORM ghcr.io/crazy-max/osxcross:14.5-debian AS osxcross
########################################################################################################################
### Build xx (orignal image: tonistiigi/xx)
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/alpine:3.21 AS xx-build
# v1.5.0
ENV XX_VERSION=b4e4c451c778822e6742bfc9d9a91d7c7d885c8a
RUN apk add -U --no-cache git
RUN git clone https://github.com/tonistiigi/xx && \
cd xx && \
git checkout ${XX_VERSION} && \
mkdir -p /out && \
cp src/xx-* /out/
RUN cd /out && \
ln -s xx-cc /out/xx-clang && \
ln -s xx-cc /out/xx-clang++ && \
ln -s xx-cc /out/xx-c++ && \
ln -s xx-apt /out/xx-apt-get
# xx mimics the original tonistiigi/xx image
FROM scratch AS xx
COPY --from=xx-build /out/ /usr/bin/
########################################################################################################################
### Get TagLib
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/alpine:3.21 AS taglib-build
ARG TARGETPLATFORM
ARG CROSS_TAGLIB_VERSION=2.0.2-1
ENV CROSS_TAGLIB_RELEASES_URL=https://github.com/navidrome/cross-taglib/releases/download/v${CROSS_TAGLIB_VERSION}/
RUN <<EOT
PLATFORM=$(echo ${TARGETPLATFORM} | tr '/' '-')
FILE=taglib-${PLATFORM}.tar.gz
DOWNLOAD_URL=${CROSS_TAGLIB_RELEASES_URL}${FILE}
wget ${DOWNLOAD_URL}
mkdir /taglib
tar -xzf ${FILE} -C /taglib
EOT
########################################################################################################################
### Build Navidrome UI
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/node:lts-alpine AS ui
WORKDIR /app
# Install node dependencies
COPY ui/package.json ui/package-lock.json ./
COPY ui/bin/ ./bin/
RUN npm ci
# Build bundle
COPY ui/ ./
RUN npm run build -- --outDir=/build
FROM scratch AS ui-bundle
COPY --from=ui /build /build
########################################################################################################################
### Build Navidrome binary
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.24-bookworm AS base
RUN apt-get update && apt-get install -y clang lld
COPY --from=xx / /
WORKDIR /workspace
FROM --platform=$BUILDPLATFORM base AS build
# Install build dependencies for the target platform
ARG TARGETPLATFORM
RUN xx-apt install -y binutils gcc g++ libc6-dev zlib1g-dev
RUN xx-verify --setup
RUN --mount=type=bind,source=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
go mod download
ARG GIT_SHA
ARG GIT_TAG
RUN --mount=type=bind,source=. \
--mount=from=ui,source=/build,target=./ui/build,ro \
--mount=from=osxcross,src=/osxcross/SDK,target=/xx-sdk,ro \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
--mount=from=taglib-build,target=/taglib,src=/taglib,ro <<EOT
# Setup CGO cross-compilation environment
xx-go --wrap
export CGO_ENABLED=1
export PKG_CONFIG_PATH=/taglib/lib/pkgconfig
cat $(go env GOENV)
# Only Darwin (macOS) requires clang (default), Windows requires gcc, everything else can use any compiler.
# So let's use gcc for everything except Darwin.
if [ "$(xx-info os)" != "darwin" ]; then
export CC=$(xx-info)-gcc
export CXX=$(xx-info)-g++
export LD_EXTRA="-extldflags '-static -latomic'"
fi
if [ "$(xx-info os)" = "windows" ]; then
export EXT=".exe"
fi
go build -tags=netgo -ldflags="${LD_EXTRA} -w -s \
-X github.com/navidrome/navidrome/consts.gitSha=${GIT_SHA} \
-X github.com/navidrome/navidrome/consts.gitTag=${GIT_TAG}" \
-o /out/navidrome${EXT} .
EOT
# Verify if the binary was built for the correct platform and it is statically linked
RUN xx-verify --static /out/navidrome*
FROM scratch AS binary
COPY --from=build /out /
########################################################################################################################
### Build Final Image
FROM public.ecr.aws/docker/library/alpine:3.21 AS final
LABEL maintainer="deluan@navidrome.org"
LABEL org.opencontainers.image.source="https://github.com/navidrome/navidrome"
# Install ffmpeg and mpv
RUN apk add -U --no-cache ffmpeg mpv sqlite
# Copy navidrome binary
COPY --from=build /out/navidrome /app/
VOLUME ["/data", "/music"]
ENV ND_MUSICFOLDER=/music
ENV ND_DATAFOLDER=/data
ENV ND_CONFIGFILE=/data/navidrome.toml
ENV ND_PORT=4533
ENV GODEBUG="asyncpreemptoff=1"
RUN touch /.nddockerenv
EXPOSE ${ND_PORT}
WORKDIR /app
ENTRYPOINT ["/app/navidrome"]

273
Makefile
View file

@ -1,98 +1,177 @@
GO_VERSION=$(shell grep "^go " go.mod | cut -f 2 -d ' ')
NODE_VERSION=$(shell cat .nvmrc)
ifneq ("$(wildcard .git/HEAD)","")
GIT_SHA=$(shell git rev-parse --short HEAD)
GIT_TAG=$(shell git describe --tags `git rev-list --tags --max-count=1`)
GIT_TAG=$(shell git describe --tags `git rev-list --tags --max-count=1`)-SNAPSHOT
else
GIT_SHA=source_archive
GIT_TAG=$(patsubst navidrome-%,v%,$(notdir $(PWD)))-SNAPSHOT
endif
## Default target just build the Go project.
default:
go build -ldflags="-X github.com/navidrome/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/navidrome/navidrome/consts.gitTag=master"
.PHONY: default
SUPPORTED_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v5,linux/arm/v6,linux/arm/v7,linux/386,darwin/amd64,darwin/arm64,windows/amd64,windows/386
IMAGE_PLATFORMS ?= $(shell echo $(SUPPORTED_PLATFORMS) | tr ',' '\n' | grep "linux" | grep -v "arm/v5" | tr '\n' ',' | sed 's/,$$//')
PLATFORMS ?= $(SUPPORTED_PLATFORMS)
DOCKER_TAG ?= deluan/navidrome:develop
dev: check_env
npx foreman -j Procfile.dev -p 4533 start
.PHONY: dev
# Taglib version to use in cross-compilation, from https://github.com/navidrome/cross-taglib
CROSS_TAGLIB_VERSION ?= 2.0.2-1
server: check_go_env
@go run github.com/cespare/reflex -d none -c reflex.conf
.PHONY: server
UI_SRC_FILES := $(shell find ui -type f -not -path "ui/build/*" -not -path "ui/node_modules/*")
wire: check_go_env
go run github.com/google/wire/cmd/wire ./...
.PHONY: wire
watch: check_go_env
go run github.com/onsi/ginkgo/ginkgo watch -notify ./...
.PHONY: watch
test: check_go_env
go test ./... -v
.PHONY: test
testall: check_go_env test
@(cd ./ui && npm test -- --watchAll=false)
.PHONY: testall
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v
.PHONY: lint
update-snapshots: check_go_env
UPDATE_SNAPSHOTS=true go run github.com/onsi/ginkgo/ginkgo ./server/subsonic/...
.PHONY: update-snapshots
migration:
@if [ -z "${name}" ]; then echo "Usage: make migration name=name_of_migration_file"; exit 1; fi
go run github.com/pressly/goose/cmd/goose -dir db/migration create ${name}
.PHONY: migration
setup: download-deps
@echo Installing tools from tools.go
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
setup: check_env download-deps setup-git ##@1_Run_First Install dependencies and prepare development environment
@echo Downloading Node dependencies...
@(cd ./ui && npm ci)
.PHONY: setup
download-deps:
@echo Download Go dependencies
@go mod download
@echo Download Node dependencies
@(cd ./ui && npm ci)
.PHONY: download-deps
dev: check_env ##@Development Start Navidrome in development mode, with hot-reload for both frontend and backend
ND_ENABLEINSIGHTSCOLLECTOR="false" npx foreman -j Procfile.dev -p 4533 start
.PHONY: dev
setup-dev: setup setup-git
server: check_go_env buildjs ##@Development Start the backend in development mode
@ND_ENABLEINSIGHTSCOLLECTOR="false" go tool reflex -d none -c reflex.conf
.PHONY: server
watch: ##@Development Start Go tests in watch mode (re-run when code changes)
go tool ginkgo watch -tags=netgo -notify ./...
.PHONY: watch
test: ##@Development Run Go tests
go test -tags netgo ./...
.PHONY: test
testrace: ##@Development Run Go tests with race detector
go test -tags netgo -race -shuffle=on ./...
.PHONY: test
testall: testrace ##@Development Run Go and JS tests
@(cd ./ui && npm run test:ci)
.PHONY: testall
lint: ##@Development Lint Go code
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v --timeout 5m
.PHONY: lint
lintall: lint ##@Development Lint Go and JS code
@(cd ./ui && npm run check-formatting) || (echo "\n\nPlease run 'npm run prettier' to fix formatting issues." && exit 1)
@(cd ./ui && npm run lint)
.PHONY: lintall
format: ##@Development Format code
@(cd ./ui && npm run prettier)
@go tool goimports -w `find . -name '*.go' | grep -v _gen.go$$`
@go mod tidy
.PHONY: format
wire: check_go_env ##@Development Update Dependency Injection
go tool wire gen -tags=netgo ./...
.PHONY: wire
snapshots: ##@Development Update (GoLang) Snapshot tests
UPDATE_SNAPSHOTS=true go tool ginkgo ./server/subsonic/responses/...
.PHONY: snapshots
migration-sql: ##@Development Create an empty SQL migration file
@if [ -z "${name}" ]; then echo "Usage: make migration-sql name=name_of_migration_file"; exit 1; fi
go run github.com/pressly/goose/v3/cmd/goose@latest -dir db/migrations create ${name} sql
.PHONY: migration
migration-go: ##@Development Create an empty Go migration file
@if [ -z "${name}" ]; then echo "Usage: make migration-go name=name_of_migration_file"; exit 1; fi
go run github.com/pressly/goose/v3/cmd/goose@latest -dir db/migrations create ${name}
.PHONY: migration
setup-dev: setup
.PHONY: setup-dev
setup-git:
setup-git: ##@Development Setup Git hooks (pre-commit and pre-push)
@echo Setting up git hooks
@mkdir -p .git/hooks
@(cd .git/hooks && ln -sf ../../git/* .)
.PHONY: setup-git
check_env: check_go_env check_node_env
.PHONY: check_env
check_go_env:
@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\nThis project requires version $(GO_VERSION)"; exit 1)
.PHONY: check_go_env
check_node_env:
@(hash node) || (echo "\nERROR: Node environment not setup properly!\n"; exit 1)
@node --version | grep -q $(NODE_VERSION) || (echo "\nERROR: Please check your Node version. Should be $(NODE_VERSION)\n"; exit 1)
.PHONY: check_node_env
build: check_go_env
go build -ldflags="-X github.com/navidrome/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/navidrome/navidrome/consts.gitTag=$(GIT_TAG)-SNAPSHOT"
build: check_go_env buildjs ##@Build Build the project
go build -ldflags="-X github.com/navidrome/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/navidrome/navidrome/consts.gitTag=$(GIT_TAG)" -tags=netgo
.PHONY: build
buildall: check_env
@(cd ./ui && npm run build)
go run github.com/go-bindata/go-bindata/go-bindata -fs -prefix "resources" -tags embed -ignore="\\\*.go" -pkg resources -o resources/embedded_gen.go resources/...
go run github.com/go-bindata/go-bindata/go-bindata -fs -prefix "ui/build" -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
go build -ldflags="-X github.com/navidrome/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/navidrome/navidrome/consts.gitTag=$(GIT_TAG)-SNAPSHOT" -tags=embed,netgo
buildall: deprecated build
.PHONY: buildall
pre-push: lint test
.PHONY: pre-push
debug-build: check_go_env buildjs ##@Build Build the project (with remote debug on)
go build -gcflags="all=-N -l" -ldflags="-X github.com/navidrome/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/navidrome/navidrome/consts.gitTag=$(GIT_TAG)" -tags=netgo
.PHONY: debug-build
buildjs: check_node_env ui/build/index.html ##@Build Build only frontend
.PHONY: buildjs
docker-buildjs: ##@Build Build only frontend using Docker
docker build --output "./ui" --target ui-bundle .
.PHONY: docker-buildjs
ui/build/index.html: $(UI_SRC_FILES)
@(cd ./ui && npm run build)
docker-platforms: ##@Cross_Compilation List supported platforms
@echo "Supported platforms:"
@echo "$(SUPPORTED_PLATFORMS)" | tr ',' '\n' | sort | sed 's/^/ /'
@echo "\nUsage: make PLATFORMS=\"linux/amd64\" docker-build"
@echo " make IMAGE_PLATFORMS=\"linux/amd64\" docker-image"
.PHONY: docker-platforms
docker-build: ##@Cross_Compilation Cross-compile for any supported platform (check `make docker-platforms`)
docker buildx build \
--platform $(PLATFORMS) \
--build-arg GIT_TAG=${GIT_TAG} \
--build-arg GIT_SHA=${GIT_SHA} \
--build-arg CROSS_TAGLIB_VERSION=${CROSS_TAGLIB_VERSION} \
--output "./binaries" --target binary .
.PHONY: docker-build
docker-image: ##@Cross_Compilation Build Docker image, tagged as `deluan/navidrome:develop`, override with DOCKER_TAG var. Use IMAGE_PLATFORMS to specify target platforms
@echo $(IMAGE_PLATFORMS) | grep -q "windows" && echo "ERROR: Windows is not supported for Docker builds" && exit 1 || true
@echo $(IMAGE_PLATFORMS) | grep -q "darwin" && echo "ERROR: macOS is not supported for Docker builds" && exit 1 || true
@echo $(IMAGE_PLATFORMS) | grep -q "arm/v5" && echo "ERROR: Linux ARMv5 is not supported for Docker builds" && exit 1 || true
docker buildx build \
--platform $(IMAGE_PLATFORMS) \
--build-arg GIT_TAG=${GIT_TAG} \
--build-arg GIT_SHA=${GIT_SHA} \
--build-arg CROSS_TAGLIB_VERSION=${CROSS_TAGLIB_VERSION} \
--tag $(DOCKER_TAG) .
.PHONY: docker-image
docker-msi: ##@Cross_Compilation Build MSI installer for Windows
make docker-build PLATFORMS=windows/386,windows/amd64
DOCKER_CLI_HINTS=false docker build -q -t navidrome-msi-builder -f release/wix/msitools.dockerfile .
@rm -rf binaries/msi
docker run -it --rm -v $(PWD):/workspace -v $(PWD)/binaries:/workspace/binaries -e GIT_TAG=${GIT_TAG} \
navidrome-msi-builder sh -c "release/wix/build_msi.sh /workspace 386 && release/wix/build_msi.sh /workspace amd64"
@du -h binaries/msi/*.msi
.PHONY: docker-msi
package: docker-build ##@Cross_Compilation Create binaries and packages for ALL supported platforms
@if [ -z `which goreleaser` ]; then echo "Please install goreleaser first: https://goreleaser.com/install/"; exit 1; fi
goreleaser release -f release/goreleaser.yml --clean --skip=publish --snapshot
.PHONY: package
get-music: ##@Development Download some free music from Navidrome's demo instance
mkdir -p music
( cd music; \
curl "https://demo.navidrome.org/rest/download?u=demo&p=demo&f=json&v=1.8.0&c=dev_download&id=ec2093ec4801402f1e17cc462195cdbb" > brock.zip; \
curl "https://demo.navidrome.org/rest/download?u=demo&p=demo&f=json&v=1.8.0&c=dev_download&id=b376eeb4652d2498aa2b25ba0696725e" > back_on_earth.zip; \
curl "https://demo.navidrome.org/rest/download?u=demo&p=demo&f=json&v=1.8.0&c=dev_download&id=e49c609b542fc51899ee8b53aa858cb4" > ugress.zip; \
curl "https://demo.navidrome.org/rest/download?u=demo&p=demo&f=json&v=1.8.0&c=dev_download&id=350bcab3a4c1d93869e39ce496464f03" > voodoocuts.zip; \
for file in *.zip; do unzip -n $${file}; done )
@echo "Done. Remember to set your MusicFolder to ./music"
.PHONY: get-music
##########################################
#### Miscellaneous
clean:
@rm -rf ./binaries ./dist ./ui/build/*
@touch ./ui/build/.gitkeep
.PHONY: clean
release:
@if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi
@ -103,6 +182,48 @@ release:
git push origin v${V} --no-verify
.PHONY: release
snapshot:
docker run -t -v $(PWD):/workspace -w /workspace deluan/ci-goreleaser:1.15.5-1 goreleaser release --rm-dist --skip-publish --snapshot
.PHONY: snapshot
download-deps:
@echo Downloading Go dependencies...
@go mod download
@go mod tidy # To revert any changes made by the `go mod download` command
.PHONY: download-deps
check_env: check_go_env check_node_env
.PHONY: check_env
check_go_env:
@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
@current_go_version=`go version | cut -d ' ' -f 3 | cut -c3-` && \
echo "$(GO_VERSION) $$current_go_version" | \
tr ' ' '\n' | sort -V | tail -1 | \
grep -q "^$${current_go_version}$$" || \
(echo "\nERROR: Please upgrade your GO version\nThis project requires at least the version $(GO_VERSION)"; exit 1)
.PHONY: check_go_env
check_node_env:
@(hash node) || (echo "\nERROR: Node environment not setup properly!\n"; exit 1)
@current_node_version=`node --version` && \
echo "$(NODE_VERSION) $$current_node_version" | \
tr ' ' '\n' | sort -V | tail -1 | \
grep -q "^$${current_node_version}$$" || \
(echo "\nERROR: Please check your Node version. Should be at least $(NODE_VERSION)\n"; exit 1)
.PHONY: check_node_env
pre-push: lintall testall
.PHONY: pre-push
deprecated:
@echo "WARNING: This target is deprecated and will be removed in future releases. Use 'make build' instead."
.PHONY: deprecated
.DEFAULT_GOAL := help
HELP_FUN = \
%help; while(<>){push@{$$help{$$2//'options'}},[$$1,$$3] \
if/^([\w-_]+)\s*:.*\#\#(?:@(\w+))?\s(.*)$$/}; \
print"$$_:\n", map" $$_->[0]".(" "x(20-length($$_->[0])))."$$_->[1]\n",\
@{$$help{$$_}},"\n" for sort keys %help; \
help: ##@Miscellaneous Show this help
@echo "Usage: make [target] ...\n"
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)

View file

@ -1,2 +1,2 @@
JS: sh -c "cd ./ui && npm start"
GO: go run github.com/cespare/reflex -c reflex.conf
GO: go tool reflex -d none -c reflex.conf

View file

@ -1,18 +1,26 @@
# Navidrome Music Server
<a href="https://www.navidrome.org"><img src="resources/logo-192x192.png" alt="Navidrome logo" title="navidrome" align="right" height="60px" /></a>
[![Last Release](https://img.shields.io/github/v/release/navidrome/navidrome?label=latest&style=flat-square)](https://github.com/navidrome/navidrome/releases)
[![Build](https://img.shields.io/github/workflow/status/navidrome/navidrome/Build?style=flat-square)](https://github.com/navidrome/navidrome/actions)
[![Downloads](https://img.shields.io/github/downloads/navidrome/navidrome/total?style=flat-square)](https://github.com/navidrome/navidrome/releases/latest)
[![Docker Pulls](https://img.shields.io/docker/pulls/deluan/navidrome?style=flat-square)](https://hub.docker.com/r/deluan/navidrome)
[![Dev Chat](https://img.shields.io/discord/671335427726114836?label=chat&style=flat-square)](https://discord.gg/xh7j7yF)
[![Subreddit](https://img.shields.io/reddit/subreddit-subscribers/navidrome?style=flat-square)](https://www.reddit.com/r/navidrome/)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0-ff69b4.svg?style=flat-square)](code_of_conduct.md)
# Navidrome Music Server &nbsp;[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Tired%20of%20paying%20for%20music%20subscriptions%2C%20and%20not%20finding%20what%20you%20really%20like%3F%20Roll%20your%20own%20streaming%20service%21&url=https://navidrome.org&via=navidrome)
[![Last Release](https://img.shields.io/github/v/release/navidrome/navidrome?logo=github&label=latest&style=flat-square)](https://github.com/navidrome/navidrome/releases)
[![Build](https://img.shields.io/github/actions/workflow/status/navidrome/navidrome/pipeline.yml?branch=master&logo=github&style=flat-square)](https://nightly.link/navidrome/navidrome/workflows/pipeline/master)
[![Downloads](https://img.shields.io/github/downloads/navidrome/navidrome/total?logo=github&style=flat-square)](https://github.com/navidrome/navidrome/releases/latest)
[![Docker Pulls](https://img.shields.io/docker/pulls/deluan/navidrome?logo=docker&label=pulls&style=flat-square)](https://hub.docker.com/r/deluan/navidrome)
[![Dev Chat](https://img.shields.io/discord/671335427726114836?logo=discord&label=discord&style=flat-square)](https://discord.gg/xh7j7yF)
[![Subreddit](https://img.shields.io/reddit/subreddit-subscribers/navidrome?logo=reddit&label=/r/navidrome&style=flat-square)](https://www.reddit.com/r/navidrome/)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0-ff69b4.svg?style=flat-square)](CODE_OF_CONDUCT.md)
[![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20Navidrome%20Guru-006BFF?style=flat-square)](https://gurubase.io/g/navidrome)
Navidrome is an open source web-based music collection server and streamer. It gives you freedom to listen to your
music collection from any browser or mobile device. It's like your personal Spotify!
**Note**: The `master` branch may be in an unstable or even broken state during development.
Please use [releases](https://github.com/navidrome/navidrome/releases) instead of
the `master` branch in order to get a stable set of binaries.
## [Check out our Live Demo!](https://www.navidrome.org/demo/)
Navidrome is an open source web-based music collection server and streamer. It gives you freedom to listen to your
music collection from any browser or mobile device. It's like your personal Spotify!
__Any feedback is welcome!__ If you need/want a new feature, find a bug or think of any way to improve Navidrome,
please file a [GitHub issue](https://github.com/navidrome/navidrome/issues) or join the discussion in our
[Subreddit](https://www.reddit.com/r/navidrome/). If you want to contribute to the project in any other way
@ -23,7 +31,15 @@ please file a [GitHub issue](https://github.com/navidrome/navidrome/issues) or j
## Installation
See instructions in the [project's website](https://www.navidrome.org/docs/installation/)
See instructions on the [project's website](https://www.navidrome.org/docs/installation/)
## Cloud Hosting
[PikaPods](https://www.pikapods.com) has partnered with us to offer you an
[officially supported, cloud-hosted solution](https://www.navidrome.org/docs/installation/managed/#pikapods).
A share of the revenue helps fund the development of Navidrome at no additional cost for you.
[![PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=navidrome)
## Features
@ -41,6 +57,15 @@ See instructions in the [project's website](https://www.navidrome.org/docs/insta
- **Transcoding** on the fly. Can be set per user/player. **Opus encoding is supported**
- Translated to **various languages**
## Translations
Navidrome uses [POEditor](https://poeditor.com/) for translations, and we are always looking
for [more contributors](https://www.navidrome.org/docs/developers/translations/)
<a href="https://poeditor.com/">
<img height="32" src="https://github.com/user-attachments/assets/c19b1d2b-01e1-4682-a007-12356c42147c">
</a>
## Documentation
All documentation can be found in the project's website: https://www.navidrome.org/docs.
Here are some useful direct links:

View file

@ -0,0 +1,154 @@
package taglib
import (
"io/fs"
"os"
"time"
"github.com/djherbis/times"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/metadata"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
type testFileInfo struct {
fs.FileInfo
}
func (t testFileInfo) BirthTime() time.Time {
if ts := times.Get(t.FileInfo); ts.HasBirthTime() {
return ts.BirthTime()
}
return t.FileInfo.ModTime()
}
var _ = Describe("Extractor", func() {
toP := func(name, sortName, mbid string) model.Participant {
return model.Participant{
Artist: model.Artist{Name: name, SortArtistName: sortName, MbzArtistID: mbid},
}
}
roles := []struct {
model.Role
model.ParticipantList
}{
{model.RoleComposer, model.ParticipantList{
toP("coma a", "a, coma", "bf13b584-f27c-43db-8f42-32898d33d4e2"),
toP("comb", "comb", "924039a2-09c6-4d29-9b4f-50cc54447d36"),
}},
{model.RoleLyricist, model.ParticipantList{
toP("la a", "a, la", "c84f648f-68a6-40a2-a0cb-d135b25da3c2"),
toP("lb", "lb", "0a7c582d-143a-4540-b4e9-77200835af65"),
}},
{model.RoleArranger, model.ParticipantList{
toP("aa", "", "4605a1d4-8d15-42a3-bd00-9c20e42f71e6"),
toP("ab", "", "002f0ff8-77bf-42cc-8216-61a9c43dc145"),
}},
{model.RoleConductor, model.ParticipantList{
toP("cona", "", "af86879b-2141-42af-bad2-389a4dc91489"),
toP("conb", "", "3dfa3c70-d7d3-4b97-b953-c298dd305e12"),
}},
{model.RoleDirector, model.ParticipantList{
toP("dia", "", "f943187f-73de-4794-be47-88c66f0fd0f4"),
toP("dib", "", "bceb75da-1853-4b3d-b399-b27f0cafc389"),
}},
{model.RoleEngineer, model.ParticipantList{
toP("ea", "", "f634bf6d-d66a-425d-888a-28ad39392759"),
toP("eb", "", "243d64ae-d514-44e1-901a-b918d692baee"),
}},
{model.RoleProducer, model.ParticipantList{
toP("pra", "", "d971c8d7-999c-4a5f-ac31-719721ab35d6"),
toP("prb", "", "f0a09070-9324-434f-a599-6d25ded87b69"),
}},
{model.RoleRemixer, model.ParticipantList{
toP("ra", "", "c7dc6095-9534-4c72-87cc-aea0103462cf"),
toP("rb", "", "8ebeef51-c08c-4736-992f-c37870becedd"),
}},
{model.RoleDJMixer, model.ParticipantList{
toP("dja", "", "d063f13b-7589-4efc-ab7f-c60e6db17247"),
toP("djb", "", "3636670c-385f-4212-89c8-0ff51d6bc456"),
}},
{model.RoleMixer, model.ParticipantList{
toP("ma", "", "53fb5a2d-7016-427e-a563-d91819a5f35a"),
toP("mb", "", "64c13e65-f0da-4ab9-a300-71ee53b0376a"),
}},
}
var e *extractor
BeforeEach(func() {
e = &extractor{}
})
Describe("Participants", func() {
DescribeTable("test tags consistent across formats", func(format string) {
path := "tests/fixtures/test." + format
mds, err := e.Parse(path)
Expect(err).ToNot(HaveOccurred())
info := mds[path]
fileInfo, _ := os.Stat(path)
info.FileInfo = testFileInfo{FileInfo: fileInfo}
metadata := metadata.New(path, info)
mf := metadata.ToMediaFile(1, "folderID")
for _, data := range roles {
role := data.Role
artists := data.ParticipantList
actual := mf.Participants[role]
Expect(actual).To(HaveLen(len(artists)))
for i := range artists {
actualArtist := actual[i]
expectedArtist := artists[i]
Expect(actualArtist.Name).To(Equal(expectedArtist.Name))
Expect(actualArtist.SortArtistName).To(Equal(expectedArtist.SortArtistName))
Expect(actualArtist.MbzArtistID).To(Equal(expectedArtist.MbzArtistID))
}
}
if format != "m4a" {
performers := mf.Participants[model.RolePerformer]
Expect(performers).To(HaveLen(8))
rules := map[string][]string{
"pgaa": {"2fd0b311-9fa8-4ff9-be5d-f6f3d16b835e", "Guitar"},
"pgbb": {"223d030b-bf97-4c2a-ad26-b7f7bbe25c93", "Guitar", ""},
"pvaa": {"cb195f72-448f-41c8-b962-3f3c13d09d38", "Vocals"},
"pvbb": {"60a1f832-8ca2-49f6-8660-84d57f07b520", "Vocals", "Flute"},
"pfaa": {"51fb40c-0305-4bf9-a11b-2ee615277725", "", "Flute"},
}
for name, rule := range rules {
mbid := rule[0]
for i := 1; i < len(rule); i++ {
found := false
for _, mapped := range performers {
if mapped.Name == name && mapped.MbzArtistID == mbid && mapped.SubRole == rule[i] {
found = true
break
}
}
Expect(found).To(BeTrue(), "Could not find matching artist")
}
}
}
},
Entry("FLAC format", "flac"),
Entry("M4a format", "m4a"),
Entry("OGG format", "ogg"),
Entry("WMA format", "wv"),
Entry("MP3 format", "mp3"),
Entry("WAV format", "wav"),
Entry("AIFF format", "aiff"),
)
})
})

View file

@ -0,0 +1,9 @@
//go:build !windows
package taglib
import "C"
func getFilename(s string) *C.char {
return C.CString(s)
}

View file

@ -0,0 +1,96 @@
//go:build windows
package taglib
// From https://github.com/orofarne/gowchar
/*
#include <wchar.h>
const size_t SIZEOF_WCHAR_T = sizeof(wchar_t);
void gowchar_set (wchar_t *arr, int pos, wchar_t val)
{
arr[pos] = val;
}
wchar_t gowchar_get (wchar_t *arr, int pos)
{
return arr[pos];
}
*/
import "C"
import (
"fmt"
"unicode/utf16"
"unicode/utf8"
)
var SIZEOF_WCHAR_T C.size_t = C.size_t(C.SIZEOF_WCHAR_T)
func getFilename(s string) *C.wchar_t {
wstr, _ := StringToWcharT(s)
return wstr
}
func StringToWcharT(s string) (*C.wchar_t, C.size_t) {
switch SIZEOF_WCHAR_T {
case 2:
return stringToWchar2(s) // Windows
case 4:
return stringToWchar4(s) // Unix
default:
panic(fmt.Sprintf("Invalid sizeof(wchar_t) = %v", SIZEOF_WCHAR_T))
}
panic("?!!")
}
// Windows
func stringToWchar2(s string) (*C.wchar_t, C.size_t) {
var slen int
s1 := s
for len(s1) > 0 {
r, size := utf8.DecodeRuneInString(s1)
if er, _ := utf16.EncodeRune(r); er == '\uFFFD' {
slen += 1
} else {
slen += 2
}
s1 = s1[size:]
}
slen++ // \0
res := C.malloc(C.size_t(slen) * SIZEOF_WCHAR_T)
var i int
for len(s) > 0 {
r, size := utf8.DecodeRuneInString(s)
if r1, r2 := utf16.EncodeRune(r); r1 != '\uFFFD' {
C.gowchar_set((*C.wchar_t)(res), C.int(i), C.wchar_t(r1))
i++
C.gowchar_set((*C.wchar_t)(res), C.int(i), C.wchar_t(r2))
i++
} else {
C.gowchar_set((*C.wchar_t)(res), C.int(i), C.wchar_t(r))
i++
}
s = s[size:]
}
C.gowchar_set((*C.wchar_t)(res), C.int(slen-1), C.wchar_t(0)) // \0
return (*C.wchar_t)(res), C.size_t(slen)
}
// Unix
func stringToWchar4(s string) (*C.wchar_t, C.size_t) {
slen := utf8.RuneCountInString(s)
slen++ // \0
res := C.malloc(C.size_t(slen) * SIZEOF_WCHAR_T)
var i int
for len(s) > 0 {
r, size := utf8.DecodeRuneInString(s)
C.gowchar_set((*C.wchar_t)(res), C.int(i), C.wchar_t(r))
s = s[size:]
i++
}
C.gowchar_set((*C.wchar_t)(res), C.int(slen-1), C.wchar_t(0)) // \0
return (*C.wchar_t)(res), C.size_t(slen)
}

151
adapters/taglib/taglib.go Normal file
View file

@ -0,0 +1,151 @@
package taglib
import (
"io/fs"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/navidrome/navidrome/core/storage/local"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model/metadata"
)
type extractor struct {
baseDir string
}
func (e extractor) Parse(files ...string) (map[string]metadata.Info, error) {
results := make(map[string]metadata.Info)
for _, path := range files {
props, err := e.extractMetadata(path)
if err != nil {
continue
}
results[path] = *props
}
return results, nil
}
func (e extractor) Version() string {
return Version()
}
func (e extractor) extractMetadata(filePath string) (*metadata.Info, error) {
fullPath := filepath.Join(e.baseDir, filePath)
tags, err := Read(fullPath)
if err != nil {
log.Warn("extractor: Error reading metadata from file. Skipping", "filePath", fullPath, err)
return nil, err
}
// Parse audio properties
ap := metadata.AudioProperties{}
if length, ok := tags["_lengthinmilliseconds"]; ok && len(length) > 0 {
millis, _ := strconv.Atoi(length[0])
if millis > 0 {
ap.Duration = (time.Millisecond * time.Duration(millis)).Round(time.Millisecond * 10)
}
delete(tags, "_lengthinmilliseconds")
}
parseProp := func(prop string, target *int) {
if value, ok := tags[prop]; ok && len(value) > 0 {
*target, _ = strconv.Atoi(value[0])
delete(tags, prop)
}
}
parseProp("_bitrate", &ap.BitRate)
parseProp("_channels", &ap.Channels)
parseProp("_samplerate", &ap.SampleRate)
parseProp("_bitspersample", &ap.BitDepth)
// Parse track/disc totals
parseTuple := func(prop string) {
tagName := prop + "number"
tagTotal := prop + "total"
if value, ok := tags[tagName]; ok && len(value) > 0 {
parts := strings.Split(value[0], "/")
tags[tagName] = []string{parts[0]}
if len(parts) == 2 {
tags[tagTotal] = []string{parts[1]}
}
}
}
parseTuple("track")
parseTuple("disc")
// Adjust some ID3 tags
parseLyrics(tags)
parseTIPL(tags)
delete(tags, "tmcl") // TMCL is already parsed by TagLib
return &metadata.Info{
Tags: tags,
AudioProperties: ap,
HasPicture: tags["has_picture"] != nil && len(tags["has_picture"]) > 0 && tags["has_picture"][0] == "true",
}, nil
}
// parseLyrics make sure lyrics tags have language
func parseLyrics(tags map[string][]string) {
lyrics := tags["lyrics"]
if len(lyrics) > 0 {
tags["lyrics:xxx"] = lyrics
delete(tags, "lyrics")
}
}
// These are the only roles we support, based on Picard's tag map:
// https://picard-docs.musicbrainz.org/downloads/MusicBrainz_Picard_Tag_Map.html
var tiplMapping = map[string]string{
"arranger": "arranger",
"engineer": "engineer",
"producer": "producer",
"mix": "mixer",
"DJ-mix": "djmixer",
}
// parseTIPL parses the ID3v2.4 TIPL frame string, which is received from TagLib in the format:
//
// "arranger Andrew Powell engineer Chris Blair engineer Pat Stapley producer Eric Woolfson".
//
// and breaks it down into a map of roles and names, e.g.:
//
// {"arranger": ["Andrew Powell"], "engineer": ["Chris Blair", "Pat Stapley"], "producer": ["Eric Woolfson"]}.
func parseTIPL(tags map[string][]string) {
tipl := tags["tipl"]
if len(tipl) == 0 {
return
}
addRole := func(currentRole string, currentValue []string) {
if currentRole != "" && len(currentValue) > 0 {
role := tiplMapping[currentRole]
tags[role] = append(tags[role], strings.Join(currentValue, " "))
}
}
var currentRole string
var currentValue []string
for _, part := range strings.Split(tipl[0], " ") {
if _, ok := tiplMapping[part]; ok {
addRole(currentRole, currentValue)
currentRole = part
currentValue = nil
continue
}
currentValue = append(currentValue, part)
}
addRole(currentRole, currentValue)
delete(tags, "tipl")
}
var _ local.Extractor = (*extractor)(nil)
func init() {
local.RegisterExtractor("taglib", func(_ fs.FS, baseDir string) local.Extractor {
// ignores fs, as taglib extractor only works with local files
return &extractor{baseDir}
})
}

View file

@ -0,0 +1,17 @@
package taglib
import (
"testing"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestTagLib(t *testing.T) {
tests.Init(t, true)
log.SetLevel(log.LevelFatal)
RegisterFailHandler(Fail)
RunSpecs(t, "TagLib Suite")
}

View file

@ -0,0 +1,296 @@
package taglib
import (
"io/fs"
"os"
"strings"
"github.com/navidrome/navidrome/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Extractor", func() {
var e *extractor
BeforeEach(func() {
e = &extractor{}
})
Describe("Parse", func() {
It("correctly parses metadata from all files in folder", func() {
mds, err := e.Parse(
"tests/fixtures/test.mp3",
"tests/fixtures/test.ogg",
)
Expect(err).NotTo(HaveOccurred())
Expect(mds).To(HaveLen(2))
// Test MP3
m := mds["tests/fixtures/test.mp3"]
Expect(m.Tags).To(HaveKeyWithValue("title", []string{"Song"}))
Expect(m.Tags).To(HaveKeyWithValue("album", []string{"Album"}))
Expect(m.Tags).To(HaveKeyWithValue("artist", []string{"Artist"}))
Expect(m.Tags).To(HaveKeyWithValue("albumartist", []string{"Album Artist"}))
Expect(m.HasPicture).To(BeTrue())
Expect(m.AudioProperties.Duration.String()).To(Equal("1.02s"))
Expect(m.AudioProperties.BitRate).To(Equal(192))
Expect(m.AudioProperties.Channels).To(Equal(2))
Expect(m.AudioProperties.SampleRate).To(Equal(44100))
Expect(m.Tags).To(Or(
HaveKeyWithValue("compilation", []string{"1"}),
HaveKeyWithValue("tcmp", []string{"1"})),
)
Expect(m.Tags).To(HaveKeyWithValue("genre", []string{"Rock"}))
Expect(m.Tags).To(HaveKeyWithValue("date", []string{"2014-05-21"}))
Expect(m.Tags).To(HaveKeyWithValue("originaldate", []string{"1996-11-21"}))
Expect(m.Tags).To(HaveKeyWithValue("releasedate", []string{"2020-12-31"}))
Expect(m.Tags).To(HaveKeyWithValue("discnumber", []string{"1"}))
Expect(m.Tags).To(HaveKeyWithValue("disctotal", []string{"2"}))
Expect(m.Tags).To(HaveKeyWithValue("comment", []string{"Comment1\nComment2"}))
Expect(m.Tags).To(HaveKeyWithValue("bpm", []string{"123"}))
Expect(m.Tags).To(HaveKeyWithValue("replaygain_album_gain", []string{"+3.21518 dB"}))
Expect(m.Tags).To(HaveKeyWithValue("replaygain_album_peak", []string{"0.9125"}))
Expect(m.Tags).To(HaveKeyWithValue("replaygain_track_gain", []string{"-1.48 dB"}))
Expect(m.Tags).To(HaveKeyWithValue("replaygain_track_peak", []string{"0.4512"}))
Expect(m.Tags).To(HaveKeyWithValue("tracknumber", []string{"2"}))
Expect(m.Tags).To(HaveKeyWithValue("tracktotal", []string{"10"}))
Expect(m.Tags).ToNot(HaveKey("lyrics"))
Expect(m.Tags).To(Or(HaveKeyWithValue("lyrics:eng", []string{
"[00:00.00]This is\n[00:02.50]English SYLT\n",
"[00:00.00]This is\n[00:02.50]English",
}), HaveKeyWithValue("lyrics:eng", []string{
"[00:00.00]This is\n[00:02.50]English",
"[00:00.00]This is\n[00:02.50]English SYLT\n",
})))
Expect(m.Tags).To(Or(HaveKeyWithValue("lyrics:xxx", []string{
"[00:00.00]This is\n[00:02.50]unspecified SYLT\n",
"[00:00.00]This is\n[00:02.50]unspecified",
}), HaveKeyWithValue("lyrics:xxx", []string{
"[00:00.00]This is\n[00:02.50]unspecified",
"[00:00.00]This is\n[00:02.50]unspecified SYLT\n",
})))
// Test OGG
m = mds["tests/fixtures/test.ogg"]
Expect(err).To(BeNil())
Expect(m.Tags).To(HaveKeyWithValue("fbpm", []string{"141.7"}))
// TabLib 1.12 returns 18, previous versions return 39.
// See https://github.com/taglib/taglib/commit/2f238921824741b2cfe6fbfbfc9701d9827ab06b
Expect(m.AudioProperties.BitRate).To(BeElementOf(18, 39, 40, 43, 49))
Expect(m.AudioProperties.Channels).To(BeElementOf(2))
Expect(m.AudioProperties.SampleRate).To(BeElementOf(8000))
Expect(m.AudioProperties.SampleRate).To(BeElementOf(8000))
Expect(m.HasPicture).To(BeFalse())
})
DescribeTable("Format-Specific tests",
func(file, duration string, channels, samplerate, bitdepth int, albumGain, albumPeak, trackGain, trackPeak string, id3Lyrics bool) {
file = "tests/fixtures/" + file
mds, err := e.Parse(file)
Expect(err).NotTo(HaveOccurred())
Expect(mds).To(HaveLen(1))
m := mds[file]
Expect(m.HasPicture).To(BeFalse())
Expect(m.AudioProperties.Duration.String()).To(Equal(duration))
Expect(m.AudioProperties.Channels).To(Equal(channels))
Expect(m.AudioProperties.SampleRate).To(Equal(samplerate))
Expect(m.AudioProperties.BitDepth).To(Equal(bitdepth))
Expect(m.Tags).To(Or(
HaveKeyWithValue("replaygain_album_gain", []string{albumGain}),
HaveKeyWithValue("----:com.apple.itunes:replaygain_track_gain", []string{albumGain}),
))
Expect(m.Tags).To(Or(
HaveKeyWithValue("replaygain_album_peak", []string{albumPeak}),
HaveKeyWithValue("----:com.apple.itunes:replaygain_album_peak", []string{albumPeak}),
))
Expect(m.Tags).To(Or(
HaveKeyWithValue("replaygain_track_gain", []string{trackGain}),
HaveKeyWithValue("----:com.apple.itunes:replaygain_track_gain", []string{trackGain}),
))
Expect(m.Tags).To(Or(
HaveKeyWithValue("replaygain_track_peak", []string{trackPeak}),
HaveKeyWithValue("----:com.apple.itunes:replaygain_track_peak", []string{trackPeak}),
))
Expect(m.Tags).To(HaveKeyWithValue("title", []string{"Title"}))
Expect(m.Tags).To(HaveKeyWithValue("album", []string{"Album"}))
Expect(m.Tags).To(HaveKeyWithValue("artist", []string{"Artist"}))
Expect(m.Tags).To(HaveKeyWithValue("albumartist", []string{"Album Artist"}))
Expect(m.Tags).To(HaveKeyWithValue("genre", []string{"Rock"}))
Expect(m.Tags).To(HaveKeyWithValue("date", []string{"2014"}))
Expect(m.Tags).To(HaveKeyWithValue("bpm", []string{"123"}))
Expect(m.Tags).To(Or(
HaveKeyWithValue("tracknumber", []string{"3"}),
HaveKeyWithValue("tracknumber", []string{"3/10"}),
))
if !strings.HasSuffix(file, "test.wma") {
// TODO Not sure why this is not working for WMA
Expect(m.Tags).To(HaveKeyWithValue("tracktotal", []string{"10"}))
}
Expect(m.Tags).To(Or(
HaveKeyWithValue("discnumber", []string{"1"}),
HaveKeyWithValue("discnumber", []string{"1/2"}),
))
Expect(m.Tags).To(HaveKeyWithValue("disctotal", []string{"2"}))
// WMA does not have a "compilation" tag, but "wm/iscompilation"
Expect(m.Tags).To(Or(
HaveKeyWithValue("compilation", []string{"1"}),
HaveKeyWithValue("wm/iscompilation", []string{"1"})),
)
if id3Lyrics {
Expect(m.Tags).To(HaveKeyWithValue("lyrics:eng", []string{
"[00:00.00]This is\n[00:02.50]English",
}))
Expect(m.Tags).To(HaveKeyWithValue("lyrics:xxx", []string{
"[00:00.00]This is\n[00:02.50]unspecified",
}))
} else {
Expect(m.Tags).To(HaveKeyWithValue("lyrics:xxx", []string{
"[00:00.00]This is\n[00:02.50]unspecified",
"[00:00.00]This is\n[00:02.50]English",
}))
}
Expect(m.Tags).To(HaveKeyWithValue("comment", []string{"Comment1\nComment2"}))
},
// ffmpeg -f lavfi -i "sine=frequency=1200:duration=1" test.flac
Entry("correctly parses flac tags", "test.flac", "1s", 1, 44100, 16, "+4.06 dB", "0.12496948", "+4.06 dB", "0.12496948", false),
Entry("correctly parses m4a (aac) gain tags", "01 Invisible (RED) Edit Version.m4a", "1.04s", 2, 44100, 16, "0.37", "0.48", "0.37", "0.48", false),
Entry("correctly parses m4a (aac) gain tags (uppercase)", "test.m4a", "1.04s", 2, 44100, 16, "0.37", "0.48", "0.37", "0.48", false),
Entry("correctly parses ogg (vorbis) tags", "test.ogg", "1.04s", 2, 8000, 0, "+7.64 dB", "0.11772506", "+7.64 dB", "0.11772506", false),
// ffmpeg -f lavfi -i "sine=frequency=900:duration=1" test.wma
// Weird note: for the tag parsing to work, the lyrics are actually stored in the reverse order
Entry("correctly parses wma/asf tags", "test.wma", "1.02s", 1, 44100, 16, "3.27 dB", "0.132914", "3.27 dB", "0.132914", false),
// ffmpeg -f lavfi -i "sine=frequency=800:duration=1" test.wv
Entry("correctly parses wv (wavpak) tags", "test.wv", "1s", 1, 44100, 16, "3.43 dB", "0.125061", "3.43 dB", "0.125061", false),
// ffmpeg -f lavfi -i "sine=frequency=1000:duration=1" test.wav
Entry("correctly parses wav tags", "test.wav", "1s", 1, 44100, 16, "3.06 dB", "0.125056", "3.06 dB", "0.125056", true),
// ffmpeg -f lavfi -i "sine=frequency=1400:duration=1" test.aiff
Entry("correctly parses aiff tags", "test.aiff", "1s", 1, 44100, 16, "2.00 dB", "0.124972", "2.00 dB", "0.124972", true),
)
// Skip these tests when running as root
Context("Access Forbidden", func() {
var accessForbiddenFile string
var RegularUserContext = XContext
var isRegularUser = os.Getuid() != 0
if isRegularUser {
RegularUserContext = Context
}
// Only run permission tests if we are not root
RegularUserContext("when run without root privileges", func() {
BeforeEach(func() {
accessForbiddenFile = utils.TempFileName("access_forbidden-", ".mp3")
f, err := os.OpenFile(accessForbiddenFile, os.O_WRONLY|os.O_CREATE, 0222)
Expect(err).ToNot(HaveOccurred())
DeferCleanup(func() {
Expect(f.Close()).To(Succeed())
Expect(os.Remove(accessForbiddenFile)).To(Succeed())
})
})
It("correctly handle unreadable file due to insufficient read permission", func() {
_, err := e.extractMetadata(accessForbiddenFile)
Expect(err).To(MatchError(os.ErrPermission))
})
It("skips the file if it cannot be read", func() {
files := []string{
"tests/fixtures/test.mp3",
"tests/fixtures/test.ogg",
accessForbiddenFile,
}
mds, err := e.Parse(files...)
Expect(err).NotTo(HaveOccurred())
Expect(mds).To(HaveLen(2))
Expect(mds).ToNot(HaveKey(accessForbiddenFile))
})
})
})
})
Describe("Error Checking", func() {
It("returns a generic ErrPath if file does not exist", func() {
testFilePath := "tests/fixtures/NON_EXISTENT.ogg"
_, err := e.extractMetadata(testFilePath)
Expect(err).To(MatchError(fs.ErrNotExist))
})
It("does not throw a SIGSEGV error when reading a file with an invalid frame", func() {
// File has an empty TDAT frame
md, err := e.extractMetadata("tests/fixtures/invalid-files/test-invalid-frame.mp3")
Expect(err).ToNot(HaveOccurred())
Expect(md.Tags).To(HaveKeyWithValue("albumartist", []string{"Elvis Presley"}))
})
})
Describe("parseTIPL", func() {
var tags map[string][]string
BeforeEach(func() {
tags = make(map[string][]string)
})
Context("when the TIPL string is populated", func() {
It("correctly parses roles and names", func() {
tags["tipl"] = []string{"arranger Andrew Powell DJ-mix François Kevorkian DJ-mix Jane Doe engineer Chris Blair"}
parseTIPL(tags)
Expect(tags["arranger"]).To(ConsistOf("Andrew Powell"))
Expect(tags["engineer"]).To(ConsistOf("Chris Blair"))
Expect(tags["djmixer"]).To(ConsistOf("François Kevorkian", "Jane Doe"))
})
It("handles multiple names for a single role", func() {
tags["tipl"] = []string{"engineer Pat Stapley producer Eric Woolfson engineer Chris Blair"}
parseTIPL(tags)
Expect(tags["producer"]).To(ConsistOf("Eric Woolfson"))
Expect(tags["engineer"]).To(ConsistOf("Pat Stapley", "Chris Blair"))
})
It("discards roles without names", func() {
tags["tipl"] = []string{"engineer Pat Stapley producer engineer Chris Blair"}
parseTIPL(tags)
Expect(tags).ToNot(HaveKey("producer"))
Expect(tags["engineer"]).To(ConsistOf("Pat Stapley", "Chris Blair"))
})
})
Context("when the TIPL string is empty", func() {
It("does nothing", func() {
tags["tipl"] = []string{""}
parseTIPL(tags)
Expect(tags).To(BeEmpty())
})
})
Context("when the TIPL is not present", func() {
It("does nothing", func() {
parseTIPL(tags)
Expect(tags).To(BeEmpty())
})
})
})
})

View file

@ -0,0 +1,242 @@
#include <stdlib.h>
#include <string.h>
#include <typeinfo>
#define TAGLIB_STATIC
#include <apeproperties.h>
#include <apetag.h>
#include <aifffile.h>
#include <asffile.h>
#include <dsffile.h>
#include <fileref.h>
#include <flacfile.h>
#include <id3v2tag.h>
#include <unsynchronizedlyricsframe.h>
#include <synchronizedlyricsframe.h>
#include <mp4file.h>
#include <mpegfile.h>
#include <opusfile.h>
#include <tpropertymap.h>
#include <vorbisfile.h>
#include <wavfile.h>
#include <wavfile.h>
#include <wavpackfile.h>
#include "taglib_wrapper.h"
char has_cover(const TagLib::FileRef f);
static char TAGLIB_VERSION[16];
char* taglib_version() {
snprintf((char *)TAGLIB_VERSION, 16, "%d.%d.%d", TAGLIB_MAJOR_VERSION, TAGLIB_MINOR_VERSION, TAGLIB_PATCH_VERSION);
return (char *)TAGLIB_VERSION;
}
int taglib_read(const FILENAME_CHAR_T *filename, unsigned long id) {
TagLib::FileRef f(filename, true, TagLib::AudioProperties::Fast);
if (f.isNull()) {
return TAGLIB_ERR_PARSE;
}
if (!f.audioProperties()) {
return TAGLIB_ERR_AUDIO_PROPS;
}
// Add audio properties to the tags
const TagLib::AudioProperties *props(f.audioProperties());
goPutInt(id, (char *)"_lengthinmilliseconds", props->lengthInMilliseconds());
goPutInt(id, (char *)"_bitrate", props->bitrate());
goPutInt(id, (char *)"_channels", props->channels());
goPutInt(id, (char *)"_samplerate", props->sampleRate());
if (const auto* apeProperties{ dynamic_cast<const TagLib::APE::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", apeProperties->bitsPerSample());
if (const auto* asfProperties{ dynamic_cast<const TagLib::ASF::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", asfProperties->bitsPerSample());
else if (const auto* flacProperties{ dynamic_cast<const TagLib::FLAC::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", flacProperties->bitsPerSample());
else if (const auto* mp4Properties{ dynamic_cast<const TagLib::MP4::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", mp4Properties->bitsPerSample());
else if (const auto* wavePackProperties{ dynamic_cast<const TagLib::WavPack::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", wavePackProperties->bitsPerSample());
else if (const auto* aiffProperties{ dynamic_cast<const TagLib::RIFF::AIFF::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", aiffProperties->bitsPerSample());
else if (const auto* wavProperties{ dynamic_cast<const TagLib::RIFF::WAV::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", wavProperties->bitsPerSample());
else if (const auto* dsfProperties{ dynamic_cast<const TagLib::DSF::Properties*>(props) })
goPutInt(id, (char *)"_bitspersample", dsfProperties->bitsPerSample());
// Send all properties to the Go map
TagLib::PropertyMap tags = f.file()->properties();
TagLib::ID3v2::Tag *id3Tags = NULL;
// Get some extended/non-standard ID3-only tags (ex: iTunes extended frames)
TagLib::MPEG::File *mp3File(dynamic_cast<TagLib::MPEG::File *>(f.file()));
if (mp3File != NULL) {
id3Tags = mp3File->ID3v2Tag();
}
if (id3Tags == NULL) {
TagLib::RIFF::WAV::File *wavFile(dynamic_cast<TagLib::RIFF::WAV::File *>(f.file()));
if (wavFile != NULL && wavFile->hasID3v2Tag()) {
id3Tags = wavFile->ID3v2Tag();
}
}
if (id3Tags == NULL) {
TagLib::RIFF::AIFF::File *aiffFile(dynamic_cast<TagLib::RIFF::AIFF::File *>(f.file()));
if (aiffFile && aiffFile->hasID3v2Tag()) {
id3Tags = aiffFile->tag();
}
}
// Yes, it is possible to have ID3v2 tags in FLAC. However, that can cause problems
// with many players, so they will not be parsed
if (id3Tags != NULL) {
const auto &frames = id3Tags->frameListMap();
for (const auto &kv: frames) {
if (kv.first == "USLT") {
for (const auto &tag: kv.second) {
TagLib::ID3v2::UnsynchronizedLyricsFrame *frame = dynamic_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame *>(tag);
if (frame == NULL) continue;
tags.erase("LYRICS");
const auto bv = frame->language();
char language[4] = {'x', 'x', 'x', '\0'};
if (bv.size() == 3) {
strncpy(language, bv.data(), 3);
}
char *val = (char *)frame->text().toCString(true);
goPutLyrics(id, language, val);
}
} else if (kv.first == "SYLT") {
for (const auto &tag: kv.second) {
TagLib::ID3v2::SynchronizedLyricsFrame *frame = dynamic_cast<TagLib::ID3v2::SynchronizedLyricsFrame *>(tag);
if (frame == NULL) continue;
const auto bv = frame->language();
char language[4] = {'x', 'x', 'x', '\0'};
if (bv.size() == 3) {
strncpy(language, bv.data(), 3);
}
const auto format = frame->timestampFormat();
if (format == TagLib::ID3v2::SynchronizedLyricsFrame::AbsoluteMilliseconds) {
for (const auto &line: frame->synchedText()) {
char *text = (char *)line.text.toCString(true);
goPutLyricLine(id, language, text, line.time);
}
} else if (format == TagLib::ID3v2::SynchronizedLyricsFrame::AbsoluteMpegFrames) {
const int sampleRate = props->sampleRate();
if (sampleRate != 0) {
for (const auto &line: frame->synchedText()) {
const int timeInMs = (line.time * 1000) / sampleRate;
char *text = (char *)line.text.toCString(true);
goPutLyricLine(id, language, text, timeInMs);
}
}
}
}
} else if (kv.first == "TIPL"){
if (!kv.second.isEmpty()) {
tags.insert(kv.first, kv.second.front()->toString());
}
}
}
}
// M4A may have some iTunes specific tags not captured by the PropertyMap interface
TagLib::MP4::File *m4afile(dynamic_cast<TagLib::MP4::File *>(f.file()));
if (m4afile != NULL) {
const auto itemListMap = m4afile->tag()->itemMap();
for (const auto item: itemListMap) {
char *key = (char *)item.first.toCString(true);
for (const auto value: item.second.toStringList()) {
char *val = (char *)value.toCString(true);
goPutM4AStr(id, key, val);
}
}
}
// WMA/ASF files may have additional tags not captured by the PropertyMap interface
TagLib::ASF::File *asfFile(dynamic_cast<TagLib::ASF::File *>(f.file()));
if (asfFile != NULL) {
const TagLib::ASF::Tag *asfTags{asfFile->tag()};
const auto itemListMap = asfTags->attributeListMap();
for (const auto item : itemListMap) {
tags.insert(item.first, item.second.front().toString());
}
}
// Send all collected tags to the Go map
for (TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end();
++i) {
char *key = (char *)i->first.toCString(true);
for (TagLib::StringList::ConstIterator j = i->second.begin();
j != i->second.end(); ++j) {
char *val = (char *)(*j).toCString(true);
goPutStr(id, key, val);
}
}
// Cover art has to be handled separately
if (has_cover(f)) {
goPutStr(id, (char *)"has_picture", (char *)"true");
}
return 0;
}
// Detect if the file has cover art. Returns 1 if the file has cover art, 0 otherwise.
char has_cover(const TagLib::FileRef f) {
char hasCover = 0;
// ----- MP3
if (TagLib::MPEG::File * mp3File{dynamic_cast<TagLib::MPEG::File *>(f.file())}) {
if (mp3File->ID3v2Tag()) {
const auto &frameListMap{mp3File->ID3v2Tag()->frameListMap()};
hasCover = !frameListMap["APIC"].isEmpty();
}
}
// ----- FLAC
else if (TagLib::FLAC::File * flacFile{dynamic_cast<TagLib::FLAC::File *>(f.file())}) {
hasCover = !flacFile->pictureList().isEmpty();
}
// ----- MP4
else if (TagLib::MP4::File * mp4File{dynamic_cast<TagLib::MP4::File *>(f.file())}) {
auto &coverItem{mp4File->tag()->itemMap()["covr"]};
TagLib::MP4::CoverArtList coverArtList{coverItem.toCoverArtList()};
hasCover = !coverArtList.isEmpty();
}
// ----- Ogg
else if (TagLib::Ogg::Vorbis::File * vorbisFile{dynamic_cast<TagLib::Ogg::Vorbis::File *>(f.file())}) {
hasCover = !vorbisFile->tag()->pictureList().isEmpty();
}
// ----- Opus
else if (TagLib::Ogg::Opus::File * opusFile{dynamic_cast<TagLib::Ogg::Opus::File *>(f.file())}) {
hasCover = !opusFile->tag()->pictureList().isEmpty();
}
// ----- WMA
else if (TagLib::ASF::File * asfFile{dynamic_cast<TagLib::ASF::File *>(f.file())}) {
const TagLib::ASF::Tag *tag{asfFile->tag()};
hasCover = tag && tag->attributeListMap().contains("WM/Picture");
}
// ----- WAV
else if (TagLib::RIFF::WAV::File * wavFile{ dynamic_cast<TagLib::RIFF::WAV::File*>(f.file()) }) {
if (wavFile->hasID3v2Tag()) {
const auto& frameListMap{ wavFile->ID3v2Tag()->frameListMap() };
hasCover = !frameListMap["APIC"].isEmpty();
}
}
return hasCover;
}

View file

@ -0,0 +1,157 @@
package taglib
/*
#cgo !windows pkg-config: --define-prefix taglib
#cgo windows pkg-config: taglib
#cgo illumos LDFLAGS: -lstdc++ -lsendfile
#cgo linux darwin CXXFLAGS: -std=c++11
#cgo darwin LDFLAGS: -L/opt/homebrew/opt/taglib/lib
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taglib_wrapper.h"
*/
import "C"
import (
"encoding/json"
"fmt"
"os"
"runtime/debug"
"strconv"
"strings"
"sync"
"sync/atomic"
"unsafe"
"github.com/navidrome/navidrome/log"
)
const iTunesKeyPrefix = "----:com.apple.itunes:"
func Version() string {
return C.GoString(C.taglib_version())
}
func Read(filename string) (tags map[string][]string, err error) {
// Do not crash on failures in the C code/library
debug.SetPanicOnFault(true)
defer func() {
if r := recover(); r != nil {
log.Error("extractor: recovered from panic when reading tags", "file", filename, "error", r)
err = fmt.Errorf("extractor: recovered from panic: %s", r)
}
}()
fp := getFilename(filename)
defer C.free(unsafe.Pointer(fp))
id, m, release := newMap()
defer release()
log.Trace("extractor: reading tags", "filename", filename, "map_id", id)
res := C.taglib_read(fp, C.ulong(id))
switch res {
case C.TAGLIB_ERR_PARSE:
// Check additional case whether the file is unreadable due to permission
file, fileErr := os.OpenFile(filename, os.O_RDONLY, 0600)
defer file.Close()
if os.IsPermission(fileErr) {
return nil, fmt.Errorf("navidrome does not have permission: %w", fileErr)
} else if fileErr != nil {
return nil, fmt.Errorf("cannot parse file media file: %w", fileErr)
} else {
return nil, fmt.Errorf("cannot parse file media file")
}
case C.TAGLIB_ERR_AUDIO_PROPS:
return nil, fmt.Errorf("can't get audio properties from file")
}
if log.IsGreaterOrEqualTo(log.LevelDebug) {
j, _ := json.Marshal(m)
log.Trace("extractor: read tags", "tags", string(j), "filename", filename, "id", id)
} else {
log.Trace("extractor: read tags", "tags", m, "filename", filename, "id", id)
}
return m, nil
}
type tagMap map[string][]string
var allMaps sync.Map
var mapsNextID atomic.Uint32
func newMap() (uint32, tagMap, func()) {
id := mapsNextID.Add(1)
m := tagMap{}
allMaps.Store(id, m)
return id, m, func() {
allMaps.Delete(id)
}
}
func doPutTag(id C.ulong, key string, val *C.char) {
if key == "" {
return
}
r, _ := allMaps.Load(uint32(id))
m := r.(tagMap)
k := strings.ToLower(key)
v := strings.TrimSpace(C.GoString(val))
m[k] = append(m[k], v)
}
//export goPutM4AStr
func goPutM4AStr(id C.ulong, key *C.char, val *C.char) {
k := C.GoString(key)
// Special for M4A, do not catch keys that have no actual name
k = strings.TrimPrefix(k, iTunesKeyPrefix)
doPutTag(id, k, val)
}
//export goPutStr
func goPutStr(id C.ulong, key *C.char, val *C.char) {
doPutTag(id, C.GoString(key), val)
}
//export goPutInt
func goPutInt(id C.ulong, key *C.char, val C.int) {
valStr := strconv.Itoa(int(val))
vp := C.CString(valStr)
defer C.free(unsafe.Pointer(vp))
goPutStr(id, key, vp)
}
//export goPutLyrics
func goPutLyrics(id C.ulong, lang *C.char, val *C.char) {
doPutTag(id, "lyrics:"+C.GoString(lang), val)
}
//export goPutLyricLine
func goPutLyricLine(id C.ulong, lang *C.char, text *C.char, time C.int) {
language := C.GoString(lang)
line := C.GoString(text)
timeGo := int64(time)
ms := timeGo % 1000
timeGo /= 1000
sec := timeGo % 60
timeGo /= 60
minimum := timeGo % 60
formattedLine := fmt.Sprintf("[%02d:%02d.%02d]%s\n", minimum, sec, ms/10, line)
key := "lyrics:" + language
r, _ := allMaps.Load(uint32(id))
m := r.(tagMap)
k := strings.ToLower(key)
existing, ok := m[k]
if ok {
existing[0] += formattedLine
} else {
m[k] = []string{formattedLine}
}
}

View file

@ -0,0 +1,24 @@
#define TAGLIB_ERR_PARSE -1
#define TAGLIB_ERR_AUDIO_PROPS -2
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#define FILENAME_CHAR_T wchar_t
#else
#define FILENAME_CHAR_T char
#endif
extern void goPutM4AStr(unsigned long id, char *key, char *val);
extern void goPutStr(unsigned long id, char *key, char *val);
extern void goPutInt(unsigned long id, char *key, int val);
extern void goPutLyrics(unsigned long id, char *lang, char *val);
extern void goPutLyricLine(unsigned long id, char *lang, char *text, int time);
int taglib_read(const FILENAME_CHAR_T *filename, unsigned long id);
char* taglib_version();
#ifdef __cplusplus
}
#endif

View file

@ -1,19 +0,0 @@
// +build !embed
package assets
import (
"net/http"
"sync"
"github.com/navidrome/navidrome/log"
)
var once sync.Once
func AssetFile() http.FileSystem {
once.Do(func() {
log.Warn("Using external assets from 'ui/build' folder")
})
return http.Dir("ui/build")
}

186
cmd/backup.go Normal file
View file

@ -0,0 +1,186 @@
package cmd
import (
"context"
"fmt"
"os"
"strings"
"time"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/log"
"github.com/spf13/cobra"
)
var (
backupCount int
backupDir string
force bool
restorePath string
)
func init() {
rootCmd.AddCommand(backupRoot)
backupCmd.Flags().StringVarP(&backupDir, "backup-dir", "d", "", "directory to manually make backup")
backupRoot.AddCommand(backupCmd)
pruneCmd.Flags().StringVarP(&backupDir, "backup-dir", "d", "", "directory holding Navidrome backups")
pruneCmd.Flags().IntVarP(&backupCount, "keep-count", "k", -1, "specify the number of backups to keep. 0 remove ALL backups, and negative values mean to use the default from configuration")
pruneCmd.Flags().BoolVarP(&force, "force", "f", false, "bypass warning when backup count is zero")
backupRoot.AddCommand(pruneCmd)
restoreCommand.Flags().StringVarP(&restorePath, "backup-file", "b", "", "path of backup database to restore")
restoreCommand.Flags().BoolVarP(&force, "force", "f", false, "bypass restore warning")
_ = restoreCommand.MarkFlagRequired("backup-file")
backupRoot.AddCommand(restoreCommand)
}
var (
backupRoot = &cobra.Command{
Use: "backup",
Aliases: []string{"bkp"},
Short: "Create, restore and prune database backups",
Long: "Create, restore and prune database backups",
}
backupCmd = &cobra.Command{
Use: "create",
Short: "Create a backup database",
Long: "Manually backup Navidrome database. This will ignore BackupCount",
Run: func(cmd *cobra.Command, _ []string) {
runBackup(cmd.Context())
},
}
pruneCmd = &cobra.Command{
Use: "prune",
Short: "Prune database backups",
Long: "Manually prune database backups according to backup rules",
Run: func(cmd *cobra.Command, _ []string) {
runPrune(cmd.Context())
},
}
restoreCommand = &cobra.Command{
Use: "restore",
Short: "Restore Navidrome database",
Long: "Restore Navidrome database from a backup. This must be done offline",
Run: func(cmd *cobra.Command, _ []string) {
runRestore(cmd.Context())
},
}
)
func runBackup(ctx context.Context) {
if backupDir != "" {
conf.Server.Backup.Path = backupDir
}
idx := strings.LastIndex(conf.Server.DbPath, "?")
var path string
if idx == -1 {
path = conf.Server.DbPath
} else {
path = conf.Server.DbPath[:idx]
}
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Fatal("No existing database", "path", path)
return
}
start := time.Now()
path, err := db.Backup(ctx)
if err != nil {
log.Fatal("Error backing up database", "backup path", conf.Server.BasePath, err)
}
elapsed := time.Since(start)
log.Info("Backup complete", "elapsed", elapsed, "path", path)
}
func runPrune(ctx context.Context) {
if backupDir != "" {
conf.Server.Backup.Path = backupDir
}
if backupCount != -1 {
conf.Server.Backup.Count = backupCount
}
if conf.Server.Backup.Count == 0 && !force {
fmt.Println("Warning: pruning ALL backups")
fmt.Printf("Please enter YES (all caps) to continue: ")
var input string
_, err := fmt.Scanln(&input)
if input != "YES" || err != nil {
log.Warn("Prune cancelled")
return
}
}
idx := strings.LastIndex(conf.Server.DbPath, "?")
var path string
if idx == -1 {
path = conf.Server.DbPath
} else {
path = conf.Server.DbPath[:idx]
}
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Fatal("No existing database", "path", path)
return
}
start := time.Now()
count, err := db.Prune(ctx)
if err != nil {
log.Fatal("Error pruning up database", "backup path", conf.Server.BasePath, err)
}
elapsed := time.Since(start)
log.Info("Prune complete", "elapsed", elapsed, "successfully pruned", count)
}
func runRestore(ctx context.Context) {
idx := strings.LastIndex(conf.Server.DbPath, "?")
var path string
if idx == -1 {
path = conf.Server.DbPath
} else {
path = conf.Server.DbPath[:idx]
}
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Fatal("No existing database", "path", path)
return
}
if !force {
fmt.Println("Warning: restoring the Navidrome database should only be done offline, especially if your backup is very old.")
fmt.Printf("Please enter YES (all caps) to continue: ")
var input string
_, err := fmt.Scanln(&input)
if input != "YES" || err != nil {
log.Warn("Restore cancelled")
return
}
}
start := time.Now()
err := db.Restore(ctx, restorePath)
if err != nil {
log.Fatal("Error restoring database", "backup path", conf.Server.BasePath, err)
}
elapsed := time.Since(start)
log.Info("Restore complete", "elapsed", elapsed)
}

79
cmd/inspect.go Normal file
View file

@ -0,0 +1,79 @@
package cmd
import (
"encoding/json"
"fmt"
"strings"
"github.com/navidrome/navidrome/core"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/pelletier/go-toml/v2"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
)
var (
format string
)
func init() {
inspectCmd.Flags().StringVarP(&format, "format", "f", "jsonindent", "output format (pretty, toml, yaml, json, jsonindent)")
rootCmd.AddCommand(inspectCmd)
}
var inspectCmd = &cobra.Command{
Use: "inspect [files to inspect]",
Short: "Inspect tags",
Long: "Show file tags as seen by Navidrome",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
runInspector(args)
},
}
var marshalers = map[string]func(interface{}) ([]byte, error){
"pretty": prettyMarshal,
"toml": toml.Marshal,
"yaml": yaml.Marshal,
"json": json.Marshal,
"jsonindent": func(v interface{}) ([]byte, error) {
return json.MarshalIndent(v, "", " ")
},
}
func prettyMarshal(v interface{}) ([]byte, error) {
out := v.([]core.InspectOutput)
var res strings.Builder
for i := range out {
res.WriteString(fmt.Sprintf("====================\nFile: %s\n\n", out[i].File))
t, _ := toml.Marshal(out[i].RawTags)
res.WriteString(fmt.Sprintf("Raw tags:\n%s\n\n", t))
t, _ = toml.Marshal(out[i].MappedTags)
res.WriteString(fmt.Sprintf("Mapped tags:\n%s\n\n", t))
}
return []byte(res.String()), nil
}
func runInspector(args []string) {
marshal := marshalers[format]
if marshal == nil {
log.Fatal("Invalid format", "format", format)
}
var out []core.InspectOutput
for _, filePath := range args {
if !model.IsAudioFile(filePath) {
log.Warn("Not an audio file", "file", filePath)
continue
}
output, err := core.Inspect(filePath, 1, "")
if err != nil {
log.Warn("Unable to process file", "file", filePath, "error", err)
continue
}
out = append(out, *output)
}
data, _ := marshal(out)
fmt.Println(string(data))
}

156
cmd/pls.go Normal file
View file

@ -0,0 +1,156 @@
package cmd
import (
"context"
"encoding/csv"
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"github.com/Masterminds/squirrel"
"github.com/navidrome/navidrome/core/auth"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/persistence"
"github.com/spf13/cobra"
)
var (
playlistID string
outputFile string
userID string
outputFormat string
)
type displayPlaylist struct {
Id string `json:"id"`
Name string `json:"name"`
OwnerName string `json:"ownerName"`
OwnerId string `json:"ownerId"`
Public bool `json:"public"`
}
type displayPlaylists []displayPlaylist
func init() {
plsCmd.Flags().StringVarP(&playlistID, "playlist", "p", "", "playlist name or ID")
plsCmd.Flags().StringVarP(&outputFile, "output", "o", "", "output file (default stdout)")
_ = plsCmd.MarkFlagRequired("playlist")
rootCmd.AddCommand(plsCmd)
listCommand.Flags().StringVarP(&userID, "user", "u", "", "username or ID")
listCommand.Flags().StringVarP(&outputFormat, "format", "f", "csv", "output format [supported values: csv, json]")
plsCmd.AddCommand(listCommand)
}
var (
plsCmd = &cobra.Command{
Use: "pls",
Short: "Export playlists",
Long: "Export Navidrome playlists to M3U files",
Run: func(cmd *cobra.Command, args []string) {
runExporter()
},
}
listCommand = &cobra.Command{
Use: "list",
Short: "List playlists",
Run: func(cmd *cobra.Command, args []string) {
runList()
},
}
)
func runExporter() {
sqlDB := db.Db()
ds := persistence.New(sqlDB)
ctx := auth.WithAdminUser(context.Background(), ds)
playlist, err := ds.Playlist(ctx).GetWithTracks(playlistID, true, false)
if err != nil && !errors.Is(err, model.ErrNotFound) {
log.Fatal("Error retrieving playlist", "name", playlistID, err)
}
if errors.Is(err, model.ErrNotFound) {
playlists, err := ds.Playlist(ctx).GetAll(model.QueryOptions{Filters: squirrel.Eq{"playlist.name": playlistID}})
if err != nil {
log.Fatal("Error retrieving playlist", "name", playlistID, err)
}
if len(playlists) > 0 {
playlist, err = ds.Playlist(ctx).GetWithTracks(playlists[0].ID, true, false)
if err != nil {
log.Fatal("Error retrieving playlist", "name", playlistID, err)
}
}
}
if playlist == nil {
log.Fatal("Playlist not found", "name", playlistID)
}
pls := playlist.ToM3U8()
if outputFile == "-" || outputFile == "" {
println(pls)
return
}
err = os.WriteFile(outputFile, []byte(pls), 0600)
if err != nil {
log.Fatal("Error writing to the output file", "file", outputFile, err)
}
}
func runList() {
if outputFormat != "csv" && outputFormat != "json" {
log.Fatal("Invalid output format. Must be one of csv, json", "format", outputFormat)
}
sqlDB := db.Db()
ds := persistence.New(sqlDB)
ctx := auth.WithAdminUser(context.Background(), ds)
options := model.QueryOptions{Sort: "owner_name"}
if userID != "" {
user, err := ds.User(ctx).FindByUsername(userID)
if err != nil && !errors.Is(err, model.ErrNotFound) {
log.Fatal("Error retrieving user by name", "name", userID, err)
}
if errors.Is(err, model.ErrNotFound) {
user, err = ds.User(ctx).Get(userID)
if err != nil {
log.Fatal("Error retrieving user by id", "id", userID, err)
}
}
options.Filters = squirrel.Eq{"owner_id": user.ID}
}
playlists, err := ds.Playlist(ctx).GetAll(options)
if err != nil {
log.Fatal(ctx, "Failed to retrieve playlists", err)
}
if outputFormat == "csv" {
w := csv.NewWriter(os.Stdout)
_ = w.Write([]string{"playlist id", "playlist name", "owner id", "owner name", "public"})
for _, playlist := range playlists {
_ = w.Write([]string{playlist.ID, playlist.Name, playlist.OwnerID, playlist.OwnerName, strconv.FormatBool(playlist.Public)})
}
w.Flush()
} else {
display := make(displayPlaylists, len(playlists))
for idx, playlist := range playlists {
display[idx].Id = playlist.ID
display[idx].Name = playlist.Name
display[idx].OwnerId = playlist.OwnerID
display[idx].OwnerName = playlist.OwnerName
display[idx].Public = playlist.Public
}
j, _ := json.Marshal(display)
fmt.Printf("%s\n", j)
}
}

View file

@ -2,17 +2,26 @@ package cmd
import (
"context"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/go-chi/chi/v5/middleware"
_ "github.com/navidrome/navidrome/adapters/taglib"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/log"
"github.com/oklog/run"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/resources"
"github.com/navidrome/navidrome/scanner"
"github.com/navidrome/navidrome/scheduler"
"github.com/navidrome/navidrome/server/backgrounds"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/sync/errgroup"
)
var (
@ -28,78 +37,292 @@ Complete documentation is available at https://www.navidrome.org/docs`,
preRun()
},
Run: func(cmd *cobra.Command, args []string) {
runNavidrome()
runNavidrome(cmd.Context())
},
Version: consts.Version(),
PostRun: func(cmd *cobra.Command, args []string) {
postRun()
},
Version: consts.Version,
}
)
// Execute runs the root cobra command, which will start the Navidrome server by calling the runNavidrome function.
func Execute() {
ctx, cancel := mainContext(context.Background())
defer cancel()
rootCmd.SetVersionTemplate(`{{println .Version}}`)
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
if err := rootCmd.ExecuteContext(ctx); err != nil {
log.Fatal(err)
}
}
func preRun() {
if !noBanner {
println(consts.Banner())
println(resources.Banner())
}
conf.Load()
conf.Load(noBanner)
}
func runNavidrome() {
db.EnsureLatestVersion()
func postRun() {
log.Info("Navidrome stopped, bye.")
}
var g run.Group
g.Add(startServer())
g.Add(startScanner())
// runNavidrome is the main entry point for the Navidrome server. It starts all the services and blocks.
// If any of the services returns an error, it will log it and exit. If the process receives a signal to exit,
// it will cancel the context and exit gracefully.
func runNavidrome(ctx context.Context) {
defer db.Init(ctx)()
if err := g.Run(); err != nil {
g, ctx := errgroup.WithContext(ctx)
g.Go(startServer(ctx))
g.Go(startSignaller(ctx))
g.Go(startScheduler(ctx))
g.Go(startPlaybackServer(ctx))
g.Go(schedulePeriodicBackup(ctx))
g.Go(startInsightsCollector(ctx))
g.Go(scheduleDBOptimizer(ctx))
if conf.Server.Scanner.Enabled {
g.Go(runInitialScan(ctx))
g.Go(startScanWatcher(ctx))
g.Go(schedulePeriodicScan(ctx))
} else {
log.Warn(ctx, "Automatic Scanning is DISABLED")
}
if err := g.Wait(); err != nil {
log.Error("Fatal error in Navidrome. Aborting", err)
}
}
func startServer() (func() error, func(err error)) {
return func() error {
a := CreateServer(conf.Server.MusicFolder)
a.MountRouter(consts.URLPathSubsonicAPI, CreateSubsonicAPIRouter())
a.MountRouter(consts.URLPathUI, CreateAppRouter())
return a.Run(fmt.Sprintf("%s:%d", conf.Server.Address, conf.Server.Port))
}, func(err error) {
if err != nil {
log.Error("Shutting down Server due to error", err)
} else {
log.Info("Shutting down Server")
}
}
// mainContext returns a context that is cancelled when the process receives a signal to exit.
func mainContext(ctx context.Context) (context.Context, context.CancelFunc) {
return signal.NotifyContext(ctx,
os.Interrupt,
syscall.SIGHUP,
syscall.SIGTERM,
syscall.SIGABRT,
)
}
func startScanner() (func() error, func(err error)) {
interval := conf.Server.ScanInterval
log.Info("Starting scanner", "interval", interval.String())
scanner := GetScanner()
ctx, cancel := context.WithCancel(context.Background())
// startServer starts the Navidrome web server, adding all the necessary routers.
func startServer(ctx context.Context) func() error {
return func() error {
if interval != 0 {
time.Sleep(2 * time.Second) // Wait 2 seconds before the first scan
scanner.Run(ctx, interval)
} else {
log.Warn("Periodic scan is DISABLED", "interval", interval)
<-ctx.Done()
a := CreateServer()
a.MountRouter("Native API", consts.URLPathNativeAPI, CreateNativeAPIRouter())
a.MountRouter("Subsonic API", consts.URLPathSubsonicAPI, CreateSubsonicAPIRouter(ctx))
a.MountRouter("Public Endpoints", consts.URLPathPublic, CreatePublicRouter())
if conf.Server.LastFM.Enabled {
a.MountRouter("LastFM Auth", consts.URLPathNativeAPI+"/lastfm", CreateLastFMRouter())
}
if conf.Server.ListenBrainz.Enabled {
a.MountRouter("ListenBrainz Auth", consts.URLPathNativeAPI+"/listenbrainz", CreateListenBrainzRouter())
}
if conf.Server.Prometheus.Enabled {
p := CreatePrometheus()
// blocking call because takes <100ms but useful if fails
p.WriteInitialMetrics(ctx)
a.MountRouter("Prometheus metrics", conf.Server.Prometheus.MetricsPath, p.GetHandler())
}
if conf.Server.DevEnableProfiler {
a.MountRouter("Profiling", "/debug", middleware.Profiler())
}
if strings.HasPrefix(conf.Server.UILoginBackgroundURL, "/") {
a.MountRouter("Background images", conf.Server.UILoginBackgroundURL, backgrounds.NewHandler())
}
return a.Run(ctx, conf.Server.Address, conf.Server.Port, conf.Server.TLSCert, conf.Server.TLSKey)
}
}
// schedulePeriodicScan schedules a periodic scan of the music library, if configured.
func schedulePeriodicScan(ctx context.Context) func() error {
return func() error {
schedule := conf.Server.Scanner.Schedule
if schedule == "" {
log.Info(ctx, "Periodic scan is DISABLED")
return nil
}
s := CreateScanner(ctx)
schedulerInstance := scheduler.GetInstance()
log.Info("Scheduling periodic scan", "schedule", schedule)
err := schedulerInstance.Add(schedule, func() {
_, err := s.ScanAll(ctx, false)
if err != nil {
log.Error(ctx, "Error executing periodic scan", err)
}
})
if err != nil {
log.Error(ctx, "Error scheduling periodic scan", err)
}
return nil
}
}
func pidHashChanged(ds model.DataStore) (bool, error) {
pidAlbum, err := ds.Property(context.Background()).DefaultGet(consts.PIDAlbumKey, "")
if err != nil {
return false, err
}
pidTrack, err := ds.Property(context.Background()).DefaultGet(consts.PIDTrackKey, "")
if err != nil {
return false, err
}
return !strings.EqualFold(pidAlbum, conf.Server.PID.Album) || !strings.EqualFold(pidTrack, conf.Server.PID.Track), nil
}
func runInitialScan(ctx context.Context) func() error {
return func() error {
ds := CreateDataStore()
fullScanRequired, err := ds.Property(ctx).DefaultGet(consts.FullScanAfterMigrationFlagKey, "0")
if err != nil {
return err
}
inProgress, err := ds.Library(ctx).ScanInProgress()
if err != nil {
return err
}
pidHasChanged, err := pidHashChanged(ds)
if err != nil {
return err
}
scanNeeded := conf.Server.Scanner.ScanOnStartup || inProgress || fullScanRequired == "1" || pidHasChanged
time.Sleep(2 * time.Second) // Wait 2 seconds before the initial scan
if scanNeeded {
scanner := CreateScanner(ctx)
switch {
case fullScanRequired == "1":
log.Warn(ctx, "Full scan required after migration")
_ = ds.Property(ctx).Delete(consts.FullScanAfterMigrationFlagKey)
case pidHasChanged:
log.Warn(ctx, "PID config changed, performing full scan")
fullScanRequired = "1"
case inProgress:
log.Warn(ctx, "Resuming interrupted scan")
default:
log.Info("Executing initial scan")
}
return nil
}, func(err error) {
cancel()
_, err = scanner.ScanAll(ctx, fullScanRequired == "1")
if err != nil {
log.Error("Shutting down Scanner due to error", err)
log.Error(ctx, "Scan failed", err)
} else {
log.Info("Shutting down Scanner")
log.Info(ctx, "Scan completed")
}
} else {
log.Debug(ctx, "Initial scan not needed")
}
return nil
}
}
func startScanWatcher(ctx context.Context) func() error {
return func() error {
if conf.Server.Scanner.WatcherWait == 0 {
log.Debug("Folder watcher is DISABLED")
return nil
}
w := CreateScanWatcher(ctx)
err := w.Run(ctx)
if err != nil {
log.Error("Error starting watcher", err)
}
return nil
}
}
func schedulePeriodicBackup(ctx context.Context) func() error {
return func() error {
schedule := conf.Server.Backup.Schedule
if schedule == "" {
log.Info(ctx, "Periodic backup is DISABLED")
return nil
}
schedulerInstance := scheduler.GetInstance()
log.Info("Scheduling periodic backup", "schedule", schedule)
err := schedulerInstance.Add(schedule, func() {
start := time.Now()
path, err := db.Backup(ctx)
elapsed := time.Since(start)
if err != nil {
log.Error(ctx, "Error backing up database", "elapsed", elapsed, err)
return
}
log.Info(ctx, "Backup complete", "elapsed", elapsed, "path", path)
count, err := db.Prune(ctx)
if err != nil {
log.Error(ctx, "Error pruning database", "error", err)
} else if count > 0 {
log.Info(ctx, "Successfully pruned old files", "count", count)
} else {
log.Info(ctx, "No backups pruned")
}
})
return err
}
}
func scheduleDBOptimizer(ctx context.Context) func() error {
return func() error {
log.Info(ctx, "Scheduling DB optimizer", "schedule", consts.OptimizeDBSchedule)
schedulerInstance := scheduler.GetInstance()
err := schedulerInstance.Add(consts.OptimizeDBSchedule, func() {
if scanner.IsScanning() {
log.Debug(ctx, "Skipping DB optimization because a scan is in progress")
return
}
db.Optimize(ctx)
})
return err
}
}
// startScheduler starts the Navidrome scheduler, which is used to run periodic tasks.
func startScheduler(ctx context.Context) func() error {
return func() error {
log.Info(ctx, "Starting scheduler")
schedulerInstance := scheduler.GetInstance()
schedulerInstance.Run(ctx)
return nil
}
}
// startInsightsCollector starts the Navidrome Insight Collector, if configured.
func startInsightsCollector(ctx context.Context) func() error {
return func() error {
if !conf.Server.EnableInsightsCollector {
log.Info(ctx, "Insight Collector is DISABLED")
return nil
}
log.Info(ctx, "Starting Insight Collector")
select {
case <-time.After(conf.Server.DevInsightsInitialDelay):
case <-ctx.Done():
return nil
}
ic := CreateInsights()
ic.Run(ctx)
return nil
}
}
// startPlaybackServer starts the Navidrome playback server, if configured.
// It is responsible for the Jukebox functionality
func startPlaybackServer(ctx context.Context) func() error {
return func() error {
if !conf.Server.Jukebox.Enabled {
log.Debug("Jukebox is DISABLED")
return nil
}
log.Info(ctx, "Starting Jukebox service")
playbackInstance := GetPlaybackServer()
return playbackInstance.Run(ctx)
}
}
// TODO: Implement some struct tags to map flags to viper
@ -111,30 +334,50 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&cfgFile, "configfile", "c", "", `config file (default "./navidrome.toml")`)
rootCmd.PersistentFlags().BoolVarP(&noBanner, "nobanner", "n", false, `don't show banner`)
rootCmd.PersistentFlags().String("musicfolder", viper.GetString("musicfolder"), "folder where your music is stored")
rootCmd.PersistentFlags().String("datafolder", viper.GetString("datafolder"), "folder to store application data (DB, cache...), needs write access")
rootCmd.PersistentFlags().String("datafolder", viper.GetString("datafolder"), "folder to store application data (DB), needs write access")
rootCmd.PersistentFlags().String("cachefolder", viper.GetString("cachefolder"), "folder to store cache data (transcoding, images...), needs write access")
rootCmd.PersistentFlags().StringP("loglevel", "l", viper.GetString("loglevel"), "log level, possible values: error, info, debug, trace")
rootCmd.PersistentFlags().String("logfile", viper.GetString("logfile"), "log file path, if not set logs will be printed to stderr")
_ = viper.BindPFlag("musicfolder", rootCmd.PersistentFlags().Lookup("musicfolder"))
_ = viper.BindPFlag("datafolder", rootCmd.PersistentFlags().Lookup("datafolder"))
_ = viper.BindPFlag("cachefolder", rootCmd.PersistentFlags().Lookup("cachefolder"))
_ = viper.BindPFlag("loglevel", rootCmd.PersistentFlags().Lookup("loglevel"))
_ = viper.BindPFlag("logfile", rootCmd.PersistentFlags().Lookup("logfile"))
rootCmd.Flags().StringP("address", "a", viper.GetString("address"), "IP address to bind to")
rootCmd.Flags().IntP("port", "p", viper.GetInt("port"), "HTTP port Navidrome will listen to")
rootCmd.Flags().String("baseurl", viper.GetString("baseurl"), "base URL to configure Navidrome behind a proxy (ex: /music or http://my.server.com)")
rootCmd.Flags().String("tlscert", viper.GetString("tlscert"), "optional path to a TLS cert file (enables HTTPS listening)")
rootCmd.Flags().String("unixsocketperm", viper.GetString("unixsocketperm"), "optional file permission for the unix socket")
rootCmd.Flags().String("tlskey", viper.GetString("tlskey"), "optional path to a TLS key file (enables HTTPS listening)")
rootCmd.Flags().StringP("address", "a", viper.GetString("address"), "IP address to bind")
rootCmd.Flags().IntP("port", "p", viper.GetInt("port"), "HTTP port Navidrome will use")
rootCmd.Flags().Duration("sessiontimeout", viper.GetDuration("sessiontimeout"), "how long Navidrome will wait before closing web ui idle sessions")
rootCmd.Flags().Duration("scaninterval", viper.GetDuration("scaninterval"), "how frequently to scan for changes in your music library")
rootCmd.Flags().String("baseurl", viper.GetString("baseurl"), "base URL (only the path part) to configure Navidrome behind a proxy (ex: /music)")
rootCmd.Flags().String("uiloginbackgroundurl", viper.GetString("uiloginbackgroundurl"), "URL to a backaground image used in the Login page")
rootCmd.Flags().Bool("enabletranscodingconfig", viper.GetBool("enabletranscodingconfig"), "enables transcoding configuration in the UI")
rootCmd.Flags().String("transcodingcachesize", viper.GetString("transcodingcachesize"), "size of transcoding cache")
rootCmd.Flags().String("imagecachesize", viper.GetString("imagecachesize"), "size of image (art work) cache. set to 0 to disable cache")
rootCmd.Flags().String("albumplaycountmode", viper.GetString("albumplaycountmode"), "how to compute playcount for albums. absolute (default) or normalized")
rootCmd.Flags().Bool("autoimportplaylists", viper.GetBool("autoimportplaylists"), "enable/disable .m3u playlist auto-import`")
rootCmd.Flags().Bool("prometheus.enabled", viper.GetBool("prometheus.enabled"), "enable/disable prometheus metrics endpoint`")
rootCmd.Flags().String("prometheus.metricspath", viper.GetString("prometheus.metricspath"), "http endpoint for prometheus metrics")
_ = viper.BindPFlag("address", rootCmd.Flags().Lookup("address"))
_ = viper.BindPFlag("port", rootCmd.Flags().Lookup("port"))
_ = viper.BindPFlag("tlscert", rootCmd.Flags().Lookup("tlscert"))
_ = viper.BindPFlag("unixsocketperm", rootCmd.Flags().Lookup("unixsocketperm"))
_ = viper.BindPFlag("tlskey", rootCmd.Flags().Lookup("tlskey"))
_ = viper.BindPFlag("baseurl", rootCmd.Flags().Lookup("baseurl"))
_ = viper.BindPFlag("sessiontimeout", rootCmd.Flags().Lookup("sessiontimeout"))
_ = viper.BindPFlag("scaninterval", rootCmd.Flags().Lookup("scaninterval"))
_ = viper.BindPFlag("baseurl", rootCmd.Flags().Lookup("baseurl"))
_ = viper.BindPFlag("uiloginbackgroundurl", rootCmd.Flags().Lookup("uiloginbackgroundurl"))
_ = viper.BindPFlag("prometheus.enabled", rootCmd.Flags().Lookup("prometheus.enabled"))
_ = viper.BindPFlag("prometheus.metricspath", rootCmd.Flags().Lookup("prometheus.metricspath"))
_ = viper.BindPFlag("enabletranscodingconfig", rootCmd.Flags().Lookup("enabletranscodingconfig"))
_ = viper.BindPFlag("transcodingcachesize", rootCmd.Flags().Lookup("transcodingcachesize"))
_ = viper.BindPFlag("imagecachesize", rootCmd.Flags().Lookup("imagecachesize"))

View file

@ -1,16 +1,29 @@
package cmd
import (
"github.com/navidrome/navidrome/conf"
"context"
"encoding/gob"
"os"
"github.com/navidrome/navidrome/core"
"github.com/navidrome/navidrome/core/artwork"
"github.com/navidrome/navidrome/core/metrics"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/persistence"
"github.com/navidrome/navidrome/scanner"
"github.com/navidrome/navidrome/utils/pl"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
var fullRescan bool
var (
fullScan bool
subprocess bool
)
func init() {
scanCmd.Flags().BoolVarP(&fullRescan, "full", "f", false, "check all subfolders, ignoring timestamps")
scanCmd.Flags().BoolVarP(&fullScan, "full", "f", false, "check all subfolders, ignoring timestamps")
scanCmd.Flags().BoolVarP(&subprocess, "subprocess", "", false, "run as subprocess (internal use)")
rootCmd.AddCommand(scanCmd)
}
@ -19,18 +32,53 @@ var scanCmd = &cobra.Command{
Short: "Scan music folder",
Long: "Scan music folder for updates",
Run: func(cmd *cobra.Command, args []string) {
runScanner()
runScanner(cmd.Context())
},
}
func runScanner() {
conf.Server.DevPreCacheAlbumArtwork = false
func trackScanInteractively(ctx context.Context, progress <-chan *scanner.ProgressInfo) {
for status := range pl.ReadOrDone(ctx, progress) {
if status.Warning != "" {
log.Warn(ctx, "Scan warning", "error", status.Warning)
}
if status.Error != "" {
log.Error(ctx, "Scan error", "error", status.Error)
}
// Discard the progress status, we only care about errors
}
scanner := GetScanner()
_ = scanner.RescanAll(context.Background(), fullRescan)
if fullRescan {
if fullScan {
log.Info("Finished full rescan")
} else {
log.Info("Finished rescan")
}
}
func trackScanAsSubprocess(ctx context.Context, progress <-chan *scanner.ProgressInfo) {
encoder := gob.NewEncoder(os.Stdout)
for status := range pl.ReadOrDone(ctx, progress) {
err := encoder.Encode(status)
if err != nil {
log.Error(ctx, "Failed to encode status", err)
}
}
}
func runScanner(ctx context.Context) {
sqlDB := db.Db()
defer db.Db().Close()
ds := persistence.New(sqlDB)
pls := core.NewPlaylists(ds)
progress, err := scanner.CallScan(ctx, ds, artwork.NoopCacheWarmer(), pls, metrics.NewNoopInstance(), fullScan)
if err != nil {
log.Fatal(ctx, "Failed to scan", err)
}
// Wait for the scanner to finish
if subprocess {
trackScanAsSubprocess(ctx, progress)
} else {
trackScanInteractively(ctx, progress)
}
}

14
cmd/signaller_nounix.go Normal file
View file

@ -0,0 +1,14 @@
//go:build windows || plan9
package cmd
import (
"context"
)
// Windows and Plan9 don't support SIGUSR1, so we don't need to start a signaler
func startSignaller(ctx context.Context) func() error {
return func() error {
return nil
}
}

40
cmd/signaller_unix.go Normal file
View file

@ -0,0 +1,40 @@
//go:build !windows && !plan9
package cmd
import (
"context"
"os"
"os/signal"
"syscall"
"time"
"github.com/navidrome/navidrome/log"
)
const triggerScanSignal = syscall.SIGUSR1
func startSignaller(ctx context.Context) func() error {
log.Info(ctx, "Starting signaler")
scanner := CreateScanner(ctx)
return func() error {
var sigChan = make(chan os.Signal, 1)
signal.Notify(sigChan, triggerScanSignal)
for {
select {
case sig := <-sigChan:
log.Info(ctx, "Received signal, triggering a new scan", "signal", sig)
start := time.Now()
_, err := scanner.ScanAll(ctx, false)
if err != nil {
log.Error(ctx, "Error scanning", err)
}
log.Info(ctx, "Triggered scan complete", "elapsed", time.Since(start))
case <-ctx.Done():
return nil
}
}
}
}

267
cmd/svc.go Normal file
View file

@ -0,0 +1,267 @@
package cmd
import (
"context"
"fmt"
"os"
"path/filepath"
"sync"
"time"
"github.com/kardianos/service"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/log"
"github.com/spf13/cobra"
)
var (
svcStatusLabels = map[service.Status]string{
service.StatusUnknown: "Unknown",
service.StatusStopped: "Stopped",
service.StatusRunning: "Running",
}
installUser string
workingDirectory string
)
func init() {
svcCmd.AddCommand(buildInstallCmd())
svcCmd.AddCommand(buildUninstallCmd())
svcCmd.AddCommand(buildStartCmd())
svcCmd.AddCommand(buildStopCmd())
svcCmd.AddCommand(buildStatusCmd())
svcCmd.AddCommand(buildExecuteCmd())
rootCmd.AddCommand(svcCmd)
}
var svcCmd = &cobra.Command{
Use: "service",
Aliases: []string{"svc"},
Short: "Manage Navidrome as a service",
Long: fmt.Sprintf("Manage Navidrome as a service, using the OS service manager (%s)", service.Platform()),
Run: runServiceCmd,
}
type svcControl struct {
ctx context.Context
cancel context.CancelFunc
done chan struct{}
}
func (p *svcControl) Start(service.Service) error {
p.done = make(chan struct{})
p.ctx, p.cancel = context.WithCancel(context.Background())
go func() {
runNavidrome(p.ctx)
close(p.done)
}()
return nil
}
func (p *svcControl) Stop(service.Service) error {
log.Info("Stopping service")
p.cancel()
select {
case <-p.done:
log.Info("Service stopped gracefully")
case <-time.After(10 * time.Second):
log.Error("Service did not stop in time. Killing it.")
}
return nil
}
var svcInstance = sync.OnceValue(func() service.Service {
options := make(service.KeyValue)
options["Restart"] = "on-failure"
options["SuccessExitStatus"] = "1 2 8 SIGKILL"
options["UserService"] = false
options["LogDirectory"] = conf.Server.DataFolder
options["SystemdScript"] = systemdScript
if conf.Server.LogFile != "" {
options["LogOutput"] = false
} else {
options["LogOutput"] = true
options["LogDirectory"] = conf.Server.DataFolder
}
svcConfig := &service.Config{
UserName: installUser,
Name: "navidrome",
DisplayName: "Navidrome",
Description: "Your Personal Streaming Service",
Dependencies: []string{
"After=remote-fs.target network.target",
},
WorkingDirectory: executablePath(),
Option: options,
}
arguments := []string{"service", "execute"}
if conf.Server.ConfigFile != "" {
arguments = append(arguments, "-c", conf.Server.ConfigFile)
}
svcConfig.Arguments = arguments
prg := &svcControl{}
svc, err := service.New(prg, svcConfig)
if err != nil {
log.Fatal(err)
}
return svc
})
func runServiceCmd(cmd *cobra.Command, _ []string) {
_ = cmd.Help()
}
func executablePath() string {
if workingDirectory != "" {
return workingDirectory
}
ex, err := os.Executable()
if err != nil {
log.Fatal(err)
}
return filepath.Dir(ex)
}
func buildInstallCmd() *cobra.Command {
runInstallCmd := func(_ *cobra.Command, _ []string) {
var err error
println("Installing service with:")
println(" working directory: " + executablePath())
println(" music folder: " + conf.Server.MusicFolder)
println(" data folder: " + conf.Server.DataFolder)
if conf.Server.LogFile != "" {
println(" log file: " + conf.Server.LogFile)
} else {
println(" logs folder: " + conf.Server.DataFolder)
}
if cfgFile != "" {
conf.Server.ConfigFile, err = filepath.Abs(cfgFile)
if err != nil {
log.Fatal(err)
}
println(" config file: " + conf.Server.ConfigFile)
}
err = svcInstance().Install()
if err != nil {
log.Fatal(err)
}
println("Service installed. Use 'navidrome svc start' to start it.")
}
cmd := &cobra.Command{
Use: "install",
Short: "Install Navidrome service.",
Run: runInstallCmd,
}
cmd.Flags().StringVarP(&installUser, "user", "u", "", "user to run service")
cmd.Flags().StringVarP(&workingDirectory, "working-directory", "w", "", "working directory of service")
return cmd
}
func buildUninstallCmd() *cobra.Command {
return &cobra.Command{
Use: "uninstall",
Short: "Uninstall Navidrome service. Does not delete the music or data folders",
Run: func(cmd *cobra.Command, args []string) {
err := svcInstance().Uninstall()
if err != nil {
log.Fatal(err)
}
println("Service uninstalled. Music and data folders are still intact.")
},
}
}
func buildStartCmd() *cobra.Command {
return &cobra.Command{
Use: "start",
Short: "Start Navidrome service",
Run: func(cmd *cobra.Command, args []string) {
err := svcInstance().Start()
if err != nil {
log.Fatal(err)
}
println("Service started. Use 'navidrome svc status' to check its status.")
},
}
}
func buildStopCmd() *cobra.Command {
return &cobra.Command{
Use: "stop",
Short: "Stop Navidrome service",
Run: func(cmd *cobra.Command, args []string) {
err := svcInstance().Stop()
if err != nil {
log.Fatal(err)
}
println("Service stopped. Use 'navidrome svc status' to check its status.")
},
}
}
func buildStatusCmd() *cobra.Command {
return &cobra.Command{
Use: "status",
Short: "Show Navidrome service status",
Run: func(cmd *cobra.Command, args []string) {
status, err := svcInstance().Status()
if err != nil {
log.Fatal(err)
}
fmt.Printf("Navidrome is %s.\n", svcStatusLabels[status])
},
}
}
func buildExecuteCmd() *cobra.Command {
return &cobra.Command{
Use: "execute",
Short: "Run navidrome as a service in the foreground (it is very unlikely you want to run this, you are better off running just navidrome)",
Run: func(cmd *cobra.Command, args []string) {
err := svcInstance().Run()
if err != nil {
log.Fatal(err)
}
},
}
}
const systemdScript = `[Unit]
Description={{.Description}}
ConditionFileIsExecutable={{.Path|cmdEscape}}
{{range $i, $dep := .Dependencies}}
{{$dep}} {{end}}
[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart={{.Path|cmdEscape}}{{range .Arguments}} {{.|cmd}}{{end}}
{{if .WorkingDirectory}}WorkingDirectory={{.WorkingDirectory|cmdEscape}}{{end}}
{{if .UserName}}User={{.UserName}}{{end}}
{{if .Restart}}Restart={{.Restart}}{{end}}
{{if .SuccessExitStatus}}SuccessExitStatus={{.SuccessExitStatus}}{{end}}
TimeoutStopSec=20
RestartSec=120
EnvironmentFile=-/etc/sysconfig/{{.Name}}
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
{{if .WorkingDirectory}}ReadWritePaths={{.WorkingDirectory|cmdEscape}}{{end}}
ProtectSystem=full
[Install]
WantedBy=multi-user.target
`

View file

@ -1,96 +1,173 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//+build !wireinject
//go:generate go run -mod=mod github.com/google/wire/cmd/wire gen -tags "netgo"
//go:build !wireinject
// +build !wireinject
package cmd
import (
"context"
"github.com/google/wire"
"github.com/navidrome/navidrome/core"
"github.com/navidrome/navidrome/core/transcoder"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/core/agents/lastfm"
"github.com/navidrome/navidrome/core/agents/listenbrainz"
"github.com/navidrome/navidrome/core/artwork"
"github.com/navidrome/navidrome/core/ffmpeg"
"github.com/navidrome/navidrome/core/metrics"
"github.com/navidrome/navidrome/core/playback"
"github.com/navidrome/navidrome/core/scrobbler"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/persistence"
"github.com/navidrome/navidrome/scanner"
"github.com/navidrome/navidrome/server"
"github.com/navidrome/navidrome/server/app"
"github.com/navidrome/navidrome/server/events"
"github.com/navidrome/navidrome/server/nativeapi"
"github.com/navidrome/navidrome/server/public"
"github.com/navidrome/navidrome/server/subsonic"
"sync"
)
import (
_ "github.com/navidrome/navidrome/adapters/taglib"
)
// Injectors from wire_injectors.go:
func CreateServer(musicFolder string) *server.Server {
dataStore := persistence.New()
serverServer := server.New(dataStore)
func CreateDataStore() model.DataStore {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
return dataStore
}
func CreateServer() *server.Server {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
broker := events.GetBroker()
insights := metrics.GetInstance(dataStore)
serverServer := server.New(dataStore, broker, insights)
return serverServer
}
func CreateAppRouter() *app.Router {
dataStore := persistence.New()
broker := GetBroker()
router := app.New(dataStore, broker)
func CreateNativeAPIRouter() *nativeapi.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
share := core.NewShare(dataStore)
playlists := core.NewPlaylists(dataStore)
insights := metrics.GetInstance(dataStore)
router := nativeapi.New(dataStore, share, playlists, insights)
return router
}
func CreateSubsonicAPIRouter() *subsonic.Router {
dataStore := persistence.New()
artworkCache := core.GetImageCache()
artwork := core.NewArtwork(dataStore, artworkCache)
transcoderTranscoder := transcoder.New()
func CreateSubsonicAPIRouter(ctx context.Context) *subsonic.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
fileCache := artwork.GetImageCache()
fFmpeg := ffmpeg.New()
agentsAgents := agents.GetAgents(dataStore)
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
transcodingCache := core.GetTranscodingCache()
mediaStreamer := core.NewMediaStreamer(dataStore, transcoderTranscoder, transcodingCache)
archiver := core.NewArchiver(dataStore)
mediaStreamer := core.NewMediaStreamer(dataStore, fFmpeg, transcodingCache)
share := core.NewShare(dataStore)
archiver := core.NewArchiver(mediaStreamer, dataStore, share)
players := core.NewPlayers(dataStore)
client := core.LastFMNewClient()
spotifyClient := core.SpotifyNewClient()
externalInfo := core.NewExternalInfo(dataStore, client, spotifyClient)
scanner := GetScanner()
router := subsonic.New(dataStore, artwork, mediaStreamer, archiver, players, externalInfo, scanner)
cacheWarmer := artwork.NewCacheWarmer(artworkArtwork, fileCache)
broker := events.GetBroker()
playlists := core.NewPlaylists(dataStore)
metricsMetrics := metrics.NewPrometheusInstance(dataStore)
scannerScanner := scanner.New(ctx, dataStore, cacheWarmer, broker, playlists, metricsMetrics)
playTracker := scrobbler.GetPlayTracker(dataStore, broker)
playbackServer := playback.GetInstance(dataStore)
router := subsonic.New(dataStore, artworkArtwork, mediaStreamer, archiver, players, externalMetadata, scannerScanner, broker, playlists, playTracker, share, playbackServer)
return router
}
func createScanner() scanner.Scanner {
dataStore := persistence.New()
artworkCache := core.GetImageCache()
artwork := core.NewArtwork(dataStore, artworkCache)
cacheWarmer := core.NewCacheWarmer(artwork, artworkCache)
broker := GetBroker()
scannerScanner := scanner.New(dataStore, cacheWarmer, broker)
func CreatePublicRouter() *public.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
fileCache := artwork.GetImageCache()
fFmpeg := ffmpeg.New()
agentsAgents := agents.GetAgents(dataStore)
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
transcodingCache := core.GetTranscodingCache()
mediaStreamer := core.NewMediaStreamer(dataStore, fFmpeg, transcodingCache)
share := core.NewShare(dataStore)
archiver := core.NewArchiver(mediaStreamer, dataStore, share)
router := public.New(dataStore, artworkArtwork, mediaStreamer, share, archiver)
return router
}
func CreateLastFMRouter() *lastfm.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
router := lastfm.NewRouter(dataStore)
return router
}
func CreateListenBrainzRouter() *listenbrainz.Router {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
router := listenbrainz.NewRouter(dataStore)
return router
}
func CreateInsights() metrics.Insights {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
insights := metrics.GetInstance(dataStore)
return insights
}
func CreatePrometheus() metrics.Metrics {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
metricsMetrics := metrics.NewPrometheusInstance(dataStore)
return metricsMetrics
}
func CreateScanner(ctx context.Context) scanner.Scanner {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
fileCache := artwork.GetImageCache()
fFmpeg := ffmpeg.New()
agentsAgents := agents.GetAgents(dataStore)
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
cacheWarmer := artwork.NewCacheWarmer(artworkArtwork, fileCache)
broker := events.GetBroker()
playlists := core.NewPlaylists(dataStore)
metricsMetrics := metrics.NewPrometheusInstance(dataStore)
scannerScanner := scanner.New(ctx, dataStore, cacheWarmer, broker, playlists, metricsMetrics)
return scannerScanner
}
func createBroker() events.Broker {
broker := events.NewBroker()
return broker
func CreateScanWatcher(ctx context.Context) scanner.Watcher {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
fileCache := artwork.GetImageCache()
fFmpeg := ffmpeg.New()
agentsAgents := agents.GetAgents(dataStore)
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
artworkArtwork := artwork.NewArtwork(dataStore, fileCache, fFmpeg, externalMetadata)
cacheWarmer := artwork.NewCacheWarmer(artworkArtwork, fileCache)
broker := events.GetBroker()
playlists := core.NewPlaylists(dataStore)
metricsMetrics := metrics.NewPrometheusInstance(dataStore)
scannerScanner := scanner.New(ctx, dataStore, cacheWarmer, broker, playlists, metricsMetrics)
watcher := scanner.NewWatcher(dataStore, scannerScanner)
return watcher
}
func GetPlaybackServer() playback.PlaybackServer {
sqlDB := db.Db()
dataStore := persistence.New(sqlDB)
playbackServer := playback.GetInstance(dataStore)
return playbackServer
}
// wire_injectors.go:
var allProviders = wire.NewSet(core.Set, subsonic.New, app.New, persistence.New)
// Scanner must be a Singleton
var (
onceScanner sync.Once
scannerInstance scanner.Scanner
)
func GetScanner() scanner.Scanner {
onceScanner.Do(func() {
scannerInstance = createScanner()
})
return scannerInstance
}
// Broker must be a Singleton
var (
onceBroker sync.Once
brokerInstance events.Broker
)
func GetBroker() events.Broker {
onceBroker.Do(func() {
brokerInstance = createBroker()
})
return brokerInstance
}
var allProviders = wire.NewSet(core.Set, artwork.Set, server.New, subsonic.New, nativeapi.New, public.New, persistence.New, lastfm.NewRouter, listenbrainz.NewRouter, events.GetBroker, scanner.New, scanner.NewWatcher, metrics.NewPrometheusInstance, db.Db)

View file

@ -1,84 +1,113 @@
//+build wireinject
//go:build wireinject
package cmd
import (
"sync"
"context"
"github.com/google/wire"
"github.com/navidrome/navidrome/core"
"github.com/navidrome/navidrome/core/agents/lastfm"
"github.com/navidrome/navidrome/core/agents/listenbrainz"
"github.com/navidrome/navidrome/core/artwork"
"github.com/navidrome/navidrome/core/metrics"
"github.com/navidrome/navidrome/core/playback"
"github.com/navidrome/navidrome/db"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/persistence"
"github.com/navidrome/navidrome/scanner"
"github.com/navidrome/navidrome/server"
"github.com/navidrome/navidrome/server/app"
"github.com/navidrome/navidrome/server/events"
"github.com/navidrome/navidrome/server/nativeapi"
"github.com/navidrome/navidrome/server/public"
"github.com/navidrome/navidrome/server/subsonic"
)
var allProviders = wire.NewSet(
core.Set,
artwork.Set,
server.New,
subsonic.New,
app.New,
nativeapi.New,
public.New,
persistence.New,
lastfm.NewRouter,
listenbrainz.NewRouter,
events.GetBroker,
scanner.New,
scanner.NewWatcher,
metrics.NewPrometheusInstance,
db.Db,
)
func CreateServer(musicFolder string) *server.Server {
func CreateDataStore() model.DataStore {
panic(wire.Build(
allProviders,
))
}
func CreateServer() *server.Server {
panic(wire.Build(
server.New,
allProviders,
))
}
func CreateAppRouter() *app.Router {
func CreateNativeAPIRouter() *nativeapi.Router {
panic(wire.Build(
allProviders,
GetBroker,
))
}
func CreateSubsonicAPIRouter() *subsonic.Router {
func CreateSubsonicAPIRouter(ctx context.Context) *subsonic.Router {
panic(wire.Build(
allProviders,
GetScanner,
))
}
// Scanner must be a Singleton
var (
onceScanner sync.Once
scannerInstance scanner.Scanner
)
func GetScanner() scanner.Scanner {
onceScanner.Do(func() {
scannerInstance = createScanner()
})
return scannerInstance
}
func createScanner() scanner.Scanner {
func CreatePublicRouter() *public.Router {
panic(wire.Build(
allProviders,
GetBroker,
scanner.New,
))
}
// Broker must be a Singleton
var (
onceBroker sync.Once
brokerInstance events.Broker
)
func GetBroker() events.Broker {
onceBroker.Do(func() {
brokerInstance = createBroker()
})
return brokerInstance
}
func createBroker() events.Broker {
func CreateLastFMRouter() *lastfm.Router {
panic(wire.Build(
events.NewBroker,
allProviders,
))
}
func CreateListenBrainzRouter() *listenbrainz.Router {
panic(wire.Build(
allProviders,
))
}
func CreateInsights() metrics.Insights {
panic(wire.Build(
allProviders,
))
}
func CreatePrometheus() metrics.Metrics {
panic(wire.Build(
allProviders,
))
}
func CreateScanner(ctx context.Context) scanner.Scanner {
panic(wire.Build(
allProviders,
))
}
func CreateScanWatcher(ctx context.Context) scanner.Watcher {
panic(wire.Build(
allProviders,
))
}
func GetPlaybackServer() playback.PlaybackServer {
panic(wire.Build(
allProviders,
))
}

View file

@ -0,0 +1,4 @@
package buildtags
// This file is left intentionally empty. It is used to make sure the package is not empty, in the case all
// required build tags are disabled.

11
conf/buildtags/netgo.go Normal file
View file

@ -0,0 +1,11 @@
//go:build netgo
package buildtags
// NOTICE: This file was created to force the inclusion of the `netgo` tag when compiling the project.
// If the tag is not included, the compilation will fail because this variable won't be defined, and the `main.go`
// file requires it.
// Why this tag is required? See https://github.com/navidrome/navidrome/issues/700
var NETGO = true

View file

@ -0,0 +1,10 @@
package configtest
import "github.com/navidrome/navidrome/conf"
func SetupConfig() func() {
oldValues := *conf.Server
return func() {
conf.Server = &oldValues
}
}

View file

@ -2,65 +2,156 @@ package conf
import (
"fmt"
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/bmatcuk/doublestar/v4"
"github.com/go-viper/encoding/ini"
"github.com/kr/pretty"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/utils/chain"
"github.com/robfig/cron/v3"
"github.com/spf13/viper"
)
type configOptions struct {
ConfigFile string
Address string
Port int
MusicFolder string
DataFolder string
DbPath string
LogLevel string
ScanInterval time.Duration
SessionTimeout time.Duration
BaseURL string
UILoginBackgroundURL string
EnableTranscodingConfig bool
EnableDownloads bool
TranscodingCacheSize string
ImageCacheSize string
AutoImportPlaylists bool
ConfigFile string
Address string
Port int
UnixSocketPerm string
MusicFolder string
DataFolder string
CacheFolder string
DbPath string
LogLevel string
LogFile string
SessionTimeout time.Duration
BaseURL string
BasePath string
BaseHost string
BaseScheme string
TLSCert string
TLSKey string
UILoginBackgroundURL string
UIWelcomeMessage string
MaxSidebarPlaylists int
EnableTranscodingConfig bool
EnableDownloads bool
EnableExternalServices bool
EnableInsightsCollector bool
EnableMediaFileCoverArt bool
TranscodingCacheSize string
ImageCacheSize string
AlbumPlayCountMode string
EnableArtworkPrecache bool
AutoImportPlaylists bool
DefaultPlaylistPublicVisibility bool
PlaylistsPath string
SmartPlaylistRefreshDelay time.Duration
AutoTranscodeDownload bool
DefaultDownsamplingFormat string
SearchFullString bool
RecentlyAddedByModTime bool
PreferSortTags bool
IgnoredArticles string
IndexGroups string
FFmpegPath string
MPVPath string
MPVCmdTemplate string
CoverArtPriority string
CoverJpegQuality int
ArtistArtPriority string
EnableGravatar bool
EnableFavourites bool
EnableStarRating bool
EnableUserEditing bool
EnableSharing bool
ShareURL string
DefaultDownloadableShare bool
DefaultTheme string
DefaultLanguage string
DefaultUIVolume int
EnableReplayGain bool
EnableCoverAnimation bool
GATrackingID string
EnableLogRedacting bool
AuthRequestLimit int
AuthWindowLength time.Duration
PasswordEncryptionKey string
ReverseProxyUserHeader string
ReverseProxyWhitelist string
HTTPSecurityHeaders secureOptions
Prometheus prometheusOptions
Scanner scannerOptions
Jukebox jukeboxOptions
Backup backupOptions
PID pidOptions
Inspect inspectOptions
Subsonic subsonicOptions
SearchFullString bool
IgnoredArticles string
IndexGroups string
ProbeCommand string
CoverArtPriority string
CoverJpegQuality int
UIWelcomeMessage string
EnableGravatar bool
GATrackingID string
AuthRequestLimit int
AuthWindowLength time.Duration
Scanner scannerOptions
LastFM lastfmOptions
Spotify spotifyOptions
Agents string
LastFM lastfmOptions
Spotify spotifyOptions
ListenBrainz listenBrainzOptions
Tags map[string]TagConf
// DevFlags. These are used to enable/disable debugging and incomplete features
DevLogSourceLine bool
DevAutoCreateAdminPassword string
DevPreCacheAlbumArtwork bool
DevFastAccessCoverArt bool
DevOldCacheLayout bool
DevActivityPanel bool
DevLogSourceLine bool
DevLogLevels map[string]string
DevEnableProfiler bool
DevAutoCreateAdminPassword string
DevAutoLoginUsername string
DevActivityPanel bool
DevActivityPanelUpdateRate time.Duration
DevSidebarPlaylists bool
DevEnableBufferedScrobble bool
DevShowArtistPage bool
DevOffsetOptimize int
DevArtworkMaxRequests int
DevArtworkThrottleBacklogLimit int
DevArtworkThrottleBacklogTimeout time.Duration
DevArtistInfoTimeToLive time.Duration
DevAlbumInfoTimeToLive time.Duration
DevExternalScanner bool
DevScannerThreads uint
DevInsightsInitialDelay time.Duration
DevEnablePlayerInsights bool
}
type scannerOptions struct {
Extractor string
Enabled bool
Schedule string
WatcherWait time.Duration
ScanOnStartup bool
Extractor string
ArtistJoiner string
GenreSeparators string // Deprecated: Use Tags.genre.Split instead
GroupAlbumReleases bool // Deprecated: Use PID.Album instead
}
type subsonicOptions struct {
AppendSubtitle bool
ArtistParticipations bool
DefaultReportRealPath bool
LegacyClients string
}
type TagConf struct {
Ignore bool `yaml:"ignore"`
Aliases []string `yaml:"aliases"`
Type string `yaml:"type"`
MaxLength int `yaml:"maxLength"`
Split []string `yaml:"split"`
Album bool `yaml:"album"`
}
type lastfmOptions struct {
Enabled bool
ApiKey string
Secret string
Language string
@ -71,82 +162,399 @@ type spotifyOptions struct {
Secret string
}
var Server = &configOptions{}
type listenBrainzOptions struct {
Enabled bool
BaseURL string
}
type secureOptions struct {
CustomFrameOptionsValue string
}
type prometheusOptions struct {
Enabled bool
MetricsPath string
Password string
}
type AudioDeviceDefinition []string
type jukeboxOptions struct {
Enabled bool
Devices []AudioDeviceDefinition
Default string
AdminOnly bool
}
type backupOptions struct {
Count int
Path string
Schedule string
}
type pidOptions struct {
Track string
Album string
}
type inspectOptions struct {
Enabled bool
MaxRequests int
BacklogLimit int
BacklogTimeout int
}
var (
Server = &configOptions{}
hooks []func()
)
func LoadFromFile(confFile string) {
viper.SetConfigFile(confFile)
Load()
err := viper.ReadInConfig()
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error reading config file:", err)
os.Exit(1)
}
Load(true)
}
func Load() {
func Load(noConfigDump bool) {
parseIniFileConfiguration()
err := viper.Unmarshal(&Server)
if err != nil {
fmt.Println("Error parsing config:", err)
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error parsing config:", err)
os.Exit(1)
}
err = os.MkdirAll(Server.DataFolder, os.ModePerm)
if err != nil {
fmt.Println("Error creating data path:", "path", Server.DataFolder, err)
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error creating data path:", err)
os.Exit(1)
}
if Server.CacheFolder == "" {
Server.CacheFolder = filepath.Join(Server.DataFolder, "cache")
}
err = os.MkdirAll(Server.CacheFolder, os.ModePerm)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error creating cache path:", err)
os.Exit(1)
}
Server.ConfigFile = viper.GetViper().ConfigFileUsed()
if Server.DbPath == "" {
Server.DbPath = filepath.Join(Server.DataFolder, consts.DefaultDbPath)
}
log.SetLevelString(Server.LogLevel)
log.SetLogSourceLine(Server.DevLogSourceLine)
if log.CurrentLevel() >= log.LevelDebug {
pretty.Printf("Loaded configuration from '%s': %# v\n", Server.ConfigFile, Server)
if Server.Backup.Path != "" {
err = os.MkdirAll(Server.Backup.Path, os.ModePerm)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error creating backup path:", err)
os.Exit(1)
}
}
out := os.Stderr
if Server.LogFile != "" {
out, err = os.OpenFile(Server.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "FATAL: Error opening log file %s: %s\n", Server.LogFile, err.Error())
os.Exit(1)
}
log.SetOutput(out)
}
log.SetLevelString(Server.LogLevel)
log.SetLogLevels(Server.DevLogLevels)
log.SetLogSourceLine(Server.DevLogSourceLine)
log.SetRedacting(Server.EnableLogRedacting)
err = chain.RunSequentially(
validateScanSchedule,
validateBackupSchedule,
validatePlaylistsPath,
)
if err != nil {
os.Exit(1)
}
if Server.BaseURL != "" {
u, err := url.Parse(Server.BaseURL)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Invalid BaseURL:", err)
os.Exit(1)
}
Server.BasePath = u.Path
u.Path = ""
u.RawQuery = ""
Server.BaseHost = u.Host
Server.BaseScheme = u.Scheme
}
// Print current configuration if log level is Debug
if log.IsGreaterOrEqualTo(log.LevelDebug) && !noConfigDump {
prettyConf := pretty.Sprintf("Loaded configuration from '%s': %# v", Server.ConfigFile, Server)
if Server.EnableLogRedacting {
prettyConf = log.Redact(prettyConf)
}
_, _ = fmt.Fprintln(out, prettyConf)
}
if !Server.EnableExternalServices {
disableExternalServices()
}
if Server.Scanner.Extractor != consts.DefaultScannerExtractor {
log.Warn(fmt.Sprintf("Extractor '%s' is not implemented, using 'taglib'", Server.Scanner.Extractor))
Server.Scanner.Extractor = consts.DefaultScannerExtractor
}
logDeprecatedOptions("Scanner.GenreSeparators")
logDeprecatedOptions("Scanner.GroupAlbumReleases")
// Call init hooks
for _, hook := range hooks {
hook()
}
}
func logDeprecatedOptions(options ...string) {
for _, option := range options {
envVar := "ND_" + strings.ToUpper(strings.ReplaceAll(option, ".", "_"))
if os.Getenv(envVar) != "" {
log.Warn(fmt.Sprintf("Option '%s' is deprecated and will be ignored in a future release", envVar))
}
if viper.InConfig(option) {
log.Warn(fmt.Sprintf("Option '%s' is deprecated and will be ignored in a future release", option))
}
}
}
// parseIniFileConfiguration is used to parse the config file when it is in INI format. For INI files, it
// would require a nested structure, so instead we unmarshal it to a map and then merge the nested [default]
// section into the root level.
func parseIniFileConfiguration() {
cfgFile := viper.ConfigFileUsed()
if strings.ToLower(filepath.Ext(cfgFile)) == ".ini" {
var iniConfig map[string]interface{}
err := viper.Unmarshal(&iniConfig)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error parsing config:", err)
os.Exit(1)
}
cfg, ok := iniConfig["default"].(map[string]any)
if !ok {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error parsing config: missing [default] section:", iniConfig)
os.Exit(1)
}
err = viper.MergeConfigMap(cfg)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Error parsing config:", err)
os.Exit(1)
}
}
}
func disableExternalServices() {
log.Info("All external integrations are DISABLED!")
Server.EnableInsightsCollector = false
Server.LastFM.Enabled = false
Server.Spotify.ID = ""
Server.ListenBrainz.Enabled = false
Server.Agents = ""
if Server.UILoginBackgroundURL == consts.DefaultUILoginBackgroundURL {
Server.UILoginBackgroundURL = consts.DefaultUILoginBackgroundURLOffline
}
}
func validatePlaylistsPath() error {
for _, path := range strings.Split(Server.PlaylistsPath, string(filepath.ListSeparator)) {
_, err := doublestar.Match(path, "")
if err != nil {
log.Error("Invalid PlaylistsPath", "path", path, err)
return err
}
}
return nil
}
func validateScanSchedule() error {
if Server.Scanner.Schedule == "0" || Server.Scanner.Schedule == "" {
Server.Scanner.Schedule = ""
return nil
}
var err error
Server.Scanner.Schedule, err = validateSchedule(Server.Scanner.Schedule, "Scanner.Schedule")
return err
}
func validateBackupSchedule() error {
if Server.Backup.Path == "" || Server.Backup.Schedule == "" || Server.Backup.Count == 0 {
Server.Backup.Schedule = ""
return nil
}
var err error
Server.Backup.Schedule, err = validateSchedule(Server.Backup.Schedule, "Backup.Schedule")
return err
}
func validateSchedule(schedule, field string) (string, error) {
if _, err := time.ParseDuration(schedule); err == nil {
schedule = "@every " + schedule
}
c := cron.New()
id, err := c.AddFunc(schedule, func() {})
if err != nil {
log.Error(fmt.Sprintf("Invalid %s. Please read format spec at https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format", field), "schedule", schedule, err)
} else {
c.Remove(id)
}
return schedule, err
}
// AddHook is used to register initialization code that should run as soon as the config is loaded
func AddHook(hook func()) {
hooks = append(hooks, hook)
}
func init() {
viper.SetDefault("musicfolder", filepath.Join(".", "music"))
viper.SetDefault("cachefolder", "")
viper.SetDefault("datafolder", ".")
viper.SetDefault("loglevel", "info")
viper.SetDefault("logfile", "")
viper.SetDefault("address", "0.0.0.0")
viper.SetDefault("port", 4533)
viper.SetDefault("unixsocketperm", "0660")
viper.SetDefault("sessiontimeout", consts.DefaultSessionTimeout)
viper.SetDefault("scaninterval", time.Minute)
viper.SetDefault("baseurl", "")
viper.SetDefault("uiloginbackgroundurl", "https://source.unsplash.com/random/1600x900?music")
viper.SetDefault("tlscert", "")
viper.SetDefault("tlskey", "")
viper.SetDefault("uiloginbackgroundurl", consts.DefaultUILoginBackgroundURL)
viper.SetDefault("uiwelcomemessage", "")
viper.SetDefault("maxsidebarplaylists", consts.DefaultMaxSidebarPlaylists)
viper.SetDefault("enabletranscodingconfig", false)
viper.SetDefault("transcodingcachesize", "100MB")
viper.SetDefault("imagecachesize", "100MB")
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
viper.SetDefault("enableartworkprecache", true)
viper.SetDefault("autoimportplaylists", true)
viper.SetDefault("defaultplaylistpublicvisibility", false)
viper.SetDefault("playlistspath", "")
viper.SetDefault("smartPlaylistRefreshDelay", 5*time.Second)
viper.SetDefault("enabledownloads", true)
// Config options only valid for file/env configuration
viper.SetDefault("enableexternalservices", true)
viper.SetDefault("enablemediafilecoverart", true)
viper.SetDefault("autotranscodedownload", false)
viper.SetDefault("defaultdownsamplingformat", consts.DefaultDownsamplingFormat)
viper.SetDefault("searchfullstring", false)
viper.SetDefault("recentlyaddedbymodtime", false)
viper.SetDefault("prefersorttags", false)
viper.SetDefault("ignoredarticles", "The El La Los Las Le Les Os As O A")
viper.SetDefault("indexgroups", "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ) [Unknown]([)")
viper.SetDefault("probecommand", "ffmpeg %s -f ffmetadata")
viper.SetDefault("coverartpriority", "embedded, cover.*, folder.*, front.*")
viper.SetDefault("ffmpegpath", "")
viper.SetDefault("mpvcmdtemplate", "mpv --audio-device=%d --no-audio-display --pause %f --input-ipc-server=%s")
viper.SetDefault("coverartpriority", "cover.*, folder.*, front.*, embedded, external")
viper.SetDefault("coverjpegquality", 75)
viper.SetDefault("uiwelcomemessage", "")
viper.SetDefault("artistartpriority", "artist.*, album/artist.*, external")
viper.SetDefault("enablegravatar", false)
viper.SetDefault("enablefavourites", true)
viper.SetDefault("enablestarrating", true)
viper.SetDefault("enableuserediting", true)
viper.SetDefault("defaulttheme", "Dark")
viper.SetDefault("defaultlanguage", "")
viper.SetDefault("defaultuivolume", consts.DefaultUIVolume)
viper.SetDefault("enablereplaygain", true)
viper.SetDefault("enablecoveranimation", true)
viper.SetDefault("enablesharing", false)
viper.SetDefault("shareurl", "")
viper.SetDefault("defaultdownloadableshare", false)
viper.SetDefault("gatrackingid", "")
viper.SetDefault("enableinsightscollector", true)
viper.SetDefault("enablelogredacting", true)
viper.SetDefault("authrequestlimit", 5)
viper.SetDefault("authwindowlength", 20*time.Second)
viper.SetDefault("passwordencryptionkey", "")
viper.SetDefault("scanner.extractor", "taglib")
viper.SetDefault("reverseproxyuserheader", "Remote-User")
viper.SetDefault("reverseproxywhitelist", "")
viper.SetDefault("prometheus.enabled", false)
viper.SetDefault("prometheus.metricspath", consts.PrometheusDefaultPath)
viper.SetDefault("prometheus.password", "")
viper.SetDefault("jukebox.enabled", false)
viper.SetDefault("jukebox.devices", []AudioDeviceDefinition{})
viper.SetDefault("jukebox.default", "")
viper.SetDefault("jukebox.adminonly", true)
viper.SetDefault("scanner.enabled", true)
viper.SetDefault("scanner.schedule", "0")
viper.SetDefault("scanner.extractor", consts.DefaultScannerExtractor)
viper.SetDefault("scanner.watcherwait", consts.DefaultWatcherWait)
viper.SetDefault("scanner.scanonstartup", true)
viper.SetDefault("scanner.artistjoiner", consts.ArtistJoiner)
viper.SetDefault("scanner.genreseparators", "")
viper.SetDefault("scanner.groupalbumreleases", false)
viper.SetDefault("subsonic.appendsubtitle", true)
viper.SetDefault("subsonic.artistparticipations", false)
viper.SetDefault("subsonic.defaultreportrealpath", false)
viper.SetDefault("subsonic.legacyclients", "DSub")
viper.SetDefault("agents", "lastfm,spotify")
viper.SetDefault("lastfm.enabled", true)
viper.SetDefault("lastfm.language", "en")
viper.SetDefault("lastfm.apikey", "")
viper.SetDefault("lastfm.secret", "")
viper.SetDefault("spotify.id", "")
viper.SetDefault("spotify.secret", "")
viper.SetDefault("listenbrainz.enabled", true)
viper.SetDefault("listenbrainz.baseurl", "https://api.listenbrainz.org/1/")
viper.SetDefault("httpsecurityheaders.customframeoptionsvalue", "DENY")
viper.SetDefault("backup.path", "")
viper.SetDefault("backup.schedule", "")
viper.SetDefault("backup.count", 0)
viper.SetDefault("pid.track", consts.DefaultTrackPID)
viper.SetDefault("pid.album", consts.DefaultAlbumPID)
viper.SetDefault("inspect.enabled", true)
viper.SetDefault("inspect.maxrequests", 1)
viper.SetDefault("inspect.backloglimit", consts.RequestThrottleBacklogLimit)
viper.SetDefault("inspect.backlogtimeout", consts.RequestThrottleBacklogTimeout)
// DevFlags. These are used to enable/disable debugging and incomplete features
viper.SetDefault("devlogsourceline", false)
viper.SetDefault("devenableprofiler", false)
viper.SetDefault("devautocreateadminpassword", "")
viper.SetDefault("devprecachealbumartwork", false)
viper.SetDefault("devoldcachelayout", false)
viper.SetDefault("devFastAccessCoverArt", false)
viper.SetDefault("devautologinusername", "")
viper.SetDefault("devactivitypanel", true)
viper.SetDefault("devactivitypanelupdaterate", 300*time.Millisecond)
viper.SetDefault("devenablebufferedscrobble", true)
viper.SetDefault("devsidebarplaylists", true)
viper.SetDefault("devshowartistpage", true)
viper.SetDefault("devoffsetoptimize", 50000)
viper.SetDefault("devartworkmaxrequests", max(2, runtime.NumCPU()/3))
viper.SetDefault("devartworkthrottlebackloglimit", consts.RequestThrottleBacklogLimit)
viper.SetDefault("devartworkthrottlebacklogtimeout", consts.RequestThrottleBacklogTimeout)
viper.SetDefault("devartistinfotimetolive", consts.ArtistInfoTimeToLive)
viper.SetDefault("devalbuminfotimetolive", consts.AlbumInfoTimeToLive)
viper.SetDefault("devexternalscanner", true)
viper.SetDefault("devscannerthreads", 5)
viper.SetDefault("devinsightsinitialdelay", consts.InsightsInitialDelay)
viper.SetDefault("devenableplayerinsights", true)
}
func InitConfig(cfgFile string) {
codecRegistry := viper.NewCodecRegistry()
_ = codecRegistry.RegisterCodec("ini", ini.Codec{})
viper.SetOptions(viper.WithCodecRegistry(codecRegistry))
cfgFile = getConfigFile(cfgFile)
if cfgFile != "" {
// Use config file from the flag.
@ -164,15 +572,23 @@ func InitConfig(cfgFile string) {
viper.AutomaticEnv()
err := viper.ReadInConfig()
if cfgFile != "" && err != nil {
fmt.Println("Navidrome could not open config file: ", err)
if viper.ConfigFileUsed() != "" && err != nil {
_, _ = fmt.Fprintln(os.Stderr, "FATAL: Navidrome could not open config file: ", err)
os.Exit(1)
}
}
// getConfigFile returns the path to the config file, either from the flag or from the environment variable.
// If it is defined in the environment variable, it will check if the file exists.
func getConfigFile(cfgFile string) string {
if cfgFile != "" {
return cfgFile
}
return os.Getenv("ND_CONFIGFILE")
cfgFile = os.Getenv("ND_CONFIGFILE")
if cfgFile != "" {
if _, err := os.Stat(cfgFile); err == nil {
return cfgFile
}
}
return ""
}

View file

@ -0,0 +1,50 @@
package conf_test
import (
"fmt"
"path/filepath"
"testing"
. "github.com/navidrome/navidrome/conf"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/spf13/viper"
)
func TestConfiguration(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Configuration Suite")
}
var _ = Describe("Configuration", func() {
BeforeEach(func() {
// Reset viper configuration
viper.Reset()
viper.SetDefault("datafolder", GinkgoT().TempDir())
viper.SetDefault("loglevel", "error")
ResetConf()
})
DescribeTable("should load configuration from",
func(format string) {
filename := filepath.Join("testdata", "cfg."+format)
// Initialize config with the test file
InitConfig(filename)
// Load the configuration (with noConfigDump=true)
Load(true)
// Execute the format-specific assertions
Expect(Server.MusicFolder).To(Equal(fmt.Sprintf("/%s/music", format)))
Expect(Server.UIWelcomeMessage).To(Equal("Welcome " + format))
Expect(Server.Tags["custom"].Aliases).To(Equal([]string{format, "test"}))
// The config file used should be the one we created
Expect(Server.ConfigFile).To(Equal(filename))
},
Entry("TOML format", "toml"),
Entry("YAML format", "yaml"),
Entry("INI format", "ini"),
Entry("JSON format", "json"),
)
})

5
conf/export_test.go Normal file
View file

@ -0,0 +1,5 @@
package conf
func ResetConf() {
Server = &configOptions{}
}

48
conf/mime/mime_types.go Normal file
View file

@ -0,0 +1,48 @@
package mime
import (
"mime"
"strings"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/resources"
"gopkg.in/yaml.v3"
)
type mimeConf struct {
Types map[string]string `yaml:"types"`
Lossless []string `yaml:"lossless"`
}
var LosslessFormats []string
func initMimeTypes() {
// In some circumstances, Windows sets JS mime-type to `text/plain`!
_ = mime.AddExtensionType(".js", "text/javascript")
_ = mime.AddExtensionType(".css", "text/css")
_ = mime.AddExtensionType(".webmanifest", "application/manifest+json")
f, err := resources.FS().Open("mime_types.yaml")
if err != nil {
log.Fatal("Fatal error opening mime_types.yaml", err)
}
defer f.Close()
var mimeConf mimeConf
err = yaml.NewDecoder(f).Decode(&mimeConf)
if err != nil {
log.Fatal("Fatal error parsing mime_types.yaml", err)
}
for ext, typ := range mimeConf.Types {
_ = mime.AddExtensionType(ext, typ)
}
for _, ext := range mimeConf.Lossless {
LosslessFormats = append(LosslessFormats, strings.TrimPrefix(ext, "."))
}
}
func init() {
conf.AddHook(initMimeTypes)
}

6
conf/testdata/cfg.ini vendored Normal file
View file

@ -0,0 +1,6 @@
[default]
MusicFolder = /ini/music
UIWelcomeMessage = Welcome ini
[Tags]
Custom.Aliases = ini,test

12
conf/testdata/cfg.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
"musicFolder": "/json/music",
"uiWelcomeMessage": "Welcome json",
"Tags": {
"custom": {
"aliases": [
"json",
"test"
]
}
}
}

5
conf/testdata/cfg.toml vendored Normal file
View file

@ -0,0 +1,5 @@
musicFolder = "/toml/music"
uiWelcomeMessage = "Welcome toml"
[Tags.custom]
aliases = ["toml", "test"]

7
conf/testdata/cfg.yaml vendored Normal file
View file

@ -0,0 +1,7 @@
musicFolder: "/yaml/music"
uiWelcomeMessage: "Welcome yaml"
Tags:
custom:
aliases:
- yaml
- test

View file

@ -1,20 +0,0 @@
package consts
import (
"fmt"
"strings"
"unicode"
"github.com/navidrome/navidrome/resources"
)
func getBanner() string {
data, _ := resources.Asset("banner.txt")
return strings.TrimRightFunc(string(data), unicode.IsSpace)
}
func Banner() string {
version := "Version: " + Version()
padding := strings.Repeat(" ", 52-len(version))
return fmt.Sprintf("%s\n%s%s\n", getBanner(), padding, version)
}

View file

@ -1,74 +1,167 @@
package consts
import (
"crypto/md5"
"fmt"
"os"
"strings"
"time"
"github.com/navidrome/navidrome/model/id"
)
const (
AppName = "navidrome"
DefaultDbPath = "navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on"
InitialSetupFlagKey = "InitialSetup"
DefaultDbPath = "navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on&synchronous=normal"
InitialSetupFlagKey = "InitialSetup"
FullScanAfterMigrationFlagKey = "FullScanAfterMigration"
UIAuthorizationHeader = "X-ND-Authorization"
JWTSecretKey = "JWTSecret"
JWTIssuer = "ND"
DefaultSessionTimeout = 24 * time.Hour
UIAuthorizationHeader = "X-ND-Authorization"
UIClientUniqueIDHeader = "X-ND-Client-Unique-Id"
JWTSecretKey = "JWTSecret"
JWTIssuer = "ND"
DefaultSessionTimeout = 48 * time.Hour
CookieExpiry = 365 * 24 * 3600 // One year
OptimizeDBSchedule = "@every 24h"
// DefaultEncryptionKey This is the encryption key used if none is specified in the `PasswordEncryptionKey` option
// Never ever change this! Or it will break all Navidrome installations that don't set the config option
DefaultEncryptionKey = "just for obfuscation"
PasswordsEncryptedKey = "PasswordsEncryptedKey"
PasswordAutogenPrefix = "__NAVIDROME_AUTOGEN__" //nolint:gosec
DevInitialUserName = "admin"
DevInitialName = "Dev Admin"
URLPathUI = "/app"
URLPathSubsonicAPI = "/rest"
URLPathUI = "/app"
URLPathNativeAPI = "/api"
URLPathSubsonicAPI = "/rest"
URLPathPublic = "/share"
URLPathPublicImages = URLPathPublic + "/img"
// DefaultUILoginBackgroundURL uses Navidrome curated background images collection,
// available at https://unsplash.com/collections/20072696/navidrome
DefaultUILoginBackgroundURL = "/backgrounds"
// DefaultUILoginBackgroundOffline Background image used in case external integrations are disabled
DefaultUILoginBackgroundOffline = "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAABGdBTUEAALGPC/xhBQAAAiJJREFUeF7t0IEAAAAAw6D5Ux/khVBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDDwMDDVlwABBWcSrQAAAABJRU5ErkJggg=="
DefaultUILoginBackgroundURLOffline = "data:image/png;base64," + DefaultUILoginBackgroundOffline
DefaultMaxSidebarPlaylists = 100
RequestThrottleBacklogLimit = 100
RequestThrottleBacklogTimeout = time.Minute
ArtistInfoTimeToLive = 1 * time.Hour
ServerReadHeaderTimeout = 3 * time.Second
I18nFolder = "i18n"
SkipScanFile = ".ndignore"
ArtistInfoTimeToLive = 24 * time.Hour
AlbumInfoTimeToLive = 7 * 24 * time.Hour
UpdateLastAccessFrequency = time.Minute
UpdatePlayerFrequency = time.Minute
PlaceholderAlbumArt = "navidrome-600x600.png"
PlaceholderAvatar = "logo-192x192.png"
I18nFolder = "i18n"
ScanIgnoreFile = ".ndignore"
PlaceholderArtistArt = "artist-placeholder.webp"
PlaceholderAlbumArt = "album-placeholder.webp"
PlaceholderAvatar = "logo-192x192.png"
UICoverArtSize = 300
DefaultUIVolume = 100
DefaultHttpClientTimeOut = 10 * time.Second
DefaultScannerExtractor = "taglib"
DefaultWatcherWait = 5 * time.Second
Zwsp = string('\u200b')
)
// Prometheus options
const (
PrometheusDefaultPath = "/metrics"
PrometheusAuthUser = "navidrome"
)
// Cache options
const (
TranscodingCacheDir = "cache/transcoding"
TranscodingCacheDir = "transcoding"
DefaultTranscodingCacheMaxItems = 0 // Unlimited
ImageCacheDir = "cache/images"
ImageCacheDir = "images"
DefaultImageCacheMaxItems = 0 // Unlimited
DefaultCacheSize = 100 * 1024 * 1024 // 100MB
DefaultCacheCleanUpInterval = 10 * time.Minute
)
const (
AlbumPlayCountModeAbsolute = "absolute"
AlbumPlayCountModeNormalized = "normalized"
)
const (
//DefaultAlbumPID = "album_legacy"
DefaultAlbumPID = "musicbrainz_albumid|albumartistid,album,albumversion,releasedate"
DefaultTrackPID = "musicbrainz_trackid|albumid,discnumber,tracknumber,title"
PIDAlbumKey = "PIDAlbum"
PIDTrackKey = "PIDTrack"
)
const (
InsightsIDKey = "InsightsID"
InsightsEndpoint = "https://insights.navidrome.org/collect"
InsightsUpdateInterval = 24 * time.Hour
InsightsInitialDelay = 30 * time.Minute
)
var (
DefaultTranscodings = []map[string]interface{}{
DefaultDownsamplingFormat = "opus"
DefaultTranscodings = []struct {
Name string
TargetFormat string
DefaultBitRate int
Command string
}{
{
"name": "mp3 audio",
"targetFormat": "mp3",
"defaultBitRate": 192,
"command": "ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -",
Name: "mp3 audio",
TargetFormat: "mp3",
DefaultBitRate: 192,
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -f mp3 -",
},
{
"name": "opus audio",
"targetFormat": "opus",
"defaultBitRate": 128,
"command": "ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -c:a libopus -f opus -",
Name: "opus audio",
TargetFormat: "opus",
DefaultBitRate: 128,
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a libopus -f opus -",
},
{
Name: "aac audio",
TargetFormat: "aac",
DefaultBitRate: 256,
Command: "ffmpeg -i %s -ss %t -map 0:a:0 -b:a %bk -v 0 -c:a aac -f adts -",
},
}
)
var (
VariousArtists = "Various Artists"
VariousArtistsID = fmt.Sprintf("%x", md5.Sum([]byte(strings.ToLower(VariousArtists))))
VariousArtists = "Various Artists"
// TODO This will be dynamic when using disambiguation
VariousArtistsID = "63sqASlAfjbGMuLP4JhnZU"
UnknownAlbum = "[Unknown Album]"
UnknownArtist = "[Unknown Artist]"
// TODO This will be dynamic when using disambiguation
UnknownArtistID = id.NewHash(strings.ToLower(UnknownArtist))
VariousArtistsMbzId = "89ad4ac3-39f7-470e-963a-56509c546377"
ServerStart = time.Now()
ArtistJoiner = " • "
)
var (
ServerStart = time.Now()
InContainer = func() bool {
// Check if the /.nddockerenv file exists
if _, err := os.Stat("/.nddockerenv"); err == nil {
return true
}
return false
}()
)

View file

@ -1,38 +0,0 @@
package consts
import "mime"
func init() {
mt := map[string]string{
".mp3": "audio/mpeg",
".ogg": "audio/ogg",
".oga": "audio/ogg",
".opus": "audio/ogg",
".aac": "audio/mp4",
".m4a": "audio/mp4",
".m4b": "audio/mp4",
".flac": "audio/flac",
".wav": "audio/x-wav",
".wma": "audio/x-ms-wma",
".ape": "audio/x-monkeys-audio",
".mpc": "audio/x-musepack",
".shn": "audio/x-shn",
".aif": "audio/x-aiff",
".aiff": "audio/x-aiff",
".m3u": "audio/x-mpegurl",
".pls": "audio/x-scpls",
".dsf": "audio/dsd",
".wv": "audio/x-wavpack",
".wvp": "audio/x-wavpack",
".gif": "image/gif",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".webp": "image/webp",
".png": "image/png",
".bmp": "image/bmp",
}
for ext, typ := range mt {
_ = mime.AddExtensionType(ext, typ)
}
}

View file

@ -11,15 +11,16 @@ var (
gitSha string
)
// Formats:
// Version holds the version string, with tag and git sha info.
// Examples:
// dev
// v0.2.0 (5b84188)
// v0.3.2-SNAPSHOT (715f552)
// master (9ed35cb)
func Version() string {
var Version = func() string {
if gitSha == "" {
return "dev"
}
gitTag = strings.TrimPrefix(gitTag, "v")
return fmt.Sprintf("%s (%s)", gitTag, gitSha)
}
}()

View file

@ -0,0 +1,7 @@
https://your.website {
reverse_proxy * navidrome:4533 {
header_up Host {http.reverse_proxy.upstream.hostport}
header_up X-Forwarded-For {http.request.remote}
header_up X-Real-IP {http.reverse_proxy.upstream.port}
}
}

View file

@ -0,0 +1,31 @@
version: '3.6'
volumes:
caddy_data:
navidrome_data:
services:
caddy:
container_name: "caddy"
image: caddy:2.6-alpine
restart: unless-stopped
read_only: true
volumes:
- "caddy_data:/data:rw"
- "./Caddyfile:/etc/caddy/Caddyfile:ro"
ports:
- "80:80"
- "443:443"
navidrome:
container_name: "navidrome"
image: deluan/navidrome:latest
restart: unless-stopped
read_only: true
# user: 1000:1000
ports:
- "4533:4533"
volumes:
- "navidrome_data:/data"
#- "/mnt/music:/music:ro"

View file

@ -0,0 +1,51 @@
version: "3.6"
volumes:
traefik_data:
navidrome_data:
services:
traefik:
container_name: "traefik"
image: traefik:2.9
restart: unless-stopped
read_only: true
command:
- "--log.level=ERROR"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.tc.acme.tlschallenge=true"
#- "--certificatesresolvers.tc.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.tc.acme.email=foo@foo.com"
- "--certificatesresolvers.tc.acme.storage=/letsencrypt/acme.json"
ports:
- "443:443"
volumes:
- "traefik_data:/letsencrypt"
#- "/var/run/docker.sock:/var/run/docker.sock:ro"
navidrome:
container_name: "navidrome"
image: deluan/navidrome:latest
restart: unless-stopped
read_only: true
# user: 1000:1000
ports:
- "4533:4533"
environment:
ND_SCANINTERVAL: 6h
ND_LOGLEVEL: info
ND_SESSIONTIMEOUT: 168h
ND_BASEURL: ""
volumes:
- "navidrome_data:/data"
#- "/mnt/music:/music:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.navidrome.rule=Host(`foo.com`)"
- "traefik.http.routers.navidrome.entrypoints=websecure"
- "traefik.http.routers.navidrome.tls=true"
- "traefik.http.routers.navidrome.tls.certresolver=tc"
- "traefik.http.services.navidrome.loadbalancer.server.port=4533"

View file

@ -0,0 +1,18 @@
version: '3.6'
volumes:
navidrome_data:
services:
navidrome:
container_name: "navidrome"
image: deluan/navidrome:latest
restart: unless-stopped
read_only: true
# user: 1000:1000
ports:
- "4533:4533"
volumes:
- "navidrome_data:/data"
#- "/mnt/music:/music:ro"

52
contrib/freebsd_rc Normal file
View file

@ -0,0 +1,52 @@
#!/bin/sh
#
# $FreeBSD: $
#
# PROVIDE: navidrome
# REQUIRE: NETWORKING
# KEYWORD:
#
# Add the following lines to /etc/rc.conf to enable navidrome:
# navidrome_enable="YES"
#
# navidrome_enable (bool): Set to YES to enable navidrome
# Default: NO
# navidrome_config (str): navidrome configuration file
# Default: /usr/local/etc/navidrome/config.toml
# navidrome_datafolder (str): navidrome Folder to store application data
# Default: www
# navidrome_user (str): navidrome daemon user
# Default: www
# navidrome_group (str): navidrome daemon group
# Default: www
. /etc/rc.subr
name="navidrome"
rcvar="navidrome_enable"
load_rc_config $name
: ${navidrome_user:="www"}
: ${navidrome_group:="www"}
: ${navidrome_enable:="NO"}
: ${navidrome_config:="/usr/local/etc/navidrome/config.toml"}
: ${navidrome_flags=""}
: ${navidrome_facility:="daemon"}
: ${navidrome_priority:="debug"}
: ${navidrome_datafolder:="/var/db/${name}"}
required_dirs=${navidrome_datafolder}
required_files=${navidrome_config}
procname="/usr/local/bin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="${name}_precmd"
command=/usr/sbin/daemon
command_args="-S -l ${navidrome_facility} -s ${navidrome_priority} -T ${name} -t ${name} -p ${pidfile} \
${procname} --configfile ${navidrome_config} --datafolder ${navidrome_datafolder} ${navidrome_flags}"
navidrome_precmd()
{
install -o ${navidrome_user} /dev/null ${pidfile}
}
run_rc_command "$1"

11
contrib/k8s/README.md Normal file
View file

@ -0,0 +1,11 @@
# Kubernetes
A couple things to keep in mind with this manifest:
1. This creates a namespace called `navidrome`. Adjust this as needed.
1. This manifest was created on [K3s](https://github.com/k3s-io/k3s), which uses its own storage provisioner called [local-path-provisioner](https://github.com/rancher/local-path-provisioner). Be sure to change the `storageClassName` of the `PersistentVolumeClaim` as needed.
1. The `PersistentVolumeClaim` sets up a 2Gi volume for Navidrome's database. Adjust this as needed.
1. Be sure to change the `image` tag from `ghcr.io/navidrome/navidrome:0.49.3` to whatever the newest version is.
1. This assumes your music is mounted on the host using `hostPath` at `/path/to/your/music/on/the/host`. Adjust this as needed.
1. The `Ingress` is already configured for `cert-manager` to obtain a Let's Encrypt TLS certificate and uses Traefik for routing. Adjust this as needed.
1. The `Ingress` presents the service at `navidrome.${SECRET_INTERNAL_DOMAIN_NAME}`, which needs to already be setup in DNS.

111
contrib/k8s/manifest.yml Normal file
View file

@ -0,0 +1,111 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: navidrome
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: navidrome-data-pvc
namespace: navidrome
annotations:
volumeType: local
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: local-path
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: navidrome-deployment
namespace: navidrome
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: navidrome
template:
metadata:
labels:
app: navidrome
spec:
containers:
- name: navidrome
image: ghcr.io/navidrome/navidrome:0.49.3
ports:
- containerPort: 4533
env:
- name: ND_SCANSCHEDULE
value: "12h"
- name: ND_SESSIONTIMEOUT
value: "24h"
- name: ND_LOGLEVEL
value: "info"
- name: ND_ENABLETRANSCODINGCONFIG
value: "false"
- name: ND_TRANSCODINGCACHESIZE
value: "512MB"
- name: ND_ENABLESTARRATING
value: "false"
- name: ND_ENABLEFAVOURITES
value: "false"
volumeMounts:
- name: data
mountPath: /data
- name: music
mountPath: /music
readOnly: true
volumes:
- name: data
persistentVolumeClaim:
claimName: navidrome-data-pvc
- name: music
hostPath:
path: /path/to/your/music/on/the/host
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: navidrome-service
namespace: navidrome
spec:
type: ClusterIP
ports:
- name: http
targetPort: 4533
port: 4533
protocol: TCP
selector:
app: navidrome
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: navidrome-ingress
namespace: navidrome
annotations:
cert-manager.io/cluster-issuer: letsencrypt-production
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: navidrome.${SECRET_INTERNAL_DOMAIN_NAME}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: navidrome-service
port:
number: 4533
tls:
- hosts:
- navidrome.${SECRET_INTERNAL_DOMAIN_NAME}
secretName: navidrome-tls

View file

@ -3,7 +3,6 @@
[Unit]
Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome
[Install]
WantedBy=multi-user.target
@ -12,27 +11,34 @@ WantedBy=multi-user.target
User=navidrome
Group=navidrome
Type=simple
ExecStart=/usr/bin/navidrome
ExecStart=/usr/bin/navidrome --configfile "/etc/navidrome/navidrome.toml"
StateDirectory=navidrome
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure
EnvironmentFile=-/etc/sysconfig/navidrome
# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
CapabilityBoundingSet=
DevicePolicy=closed
NoNewPrivileges=yes
LockPersonality=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectClock=yes
ProtectHostname=yes
ProtectKernelLogs=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallFilter=setrlimit
SystemCallArchitectures=native
UMask=0066
# You can uncomment the following line if you're not using the jukebox This
# will prevent navidrome from accessing any real (physical) devices

12
core/agents/README.md Normal file
View file

@ -0,0 +1,12 @@
This folder abstracts metadata lookup into "agents". Each agent can be implemented to get as
much info as the external source provides, by using a granular set of interfaces
(see [interfaces](interfaces.go)).
A new agent must comply with these simple implementation rules:
1) Implement the `AgentName()` method. It just returns the name of the agent for logging purposes.
2) Implement one or more of the `*Retriever()` interfaces. That's where the agent's logic resides.
3) Register itself (in its `init()` function).
For an agent to be used it needs to be listed in the `Agents` config option (default is `"lastfm,spotify"`). The order dictates the priority of the agents
For a simple Agent example, look at the [local_agent](local_agent.go) agent source code.

243
core/agents/agents.go Normal file
View file

@ -0,0 +1,243 @@
package agents
import (
"context"
"strings"
"time"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/utils"
"github.com/navidrome/navidrome/utils/singleton"
)
type Agents struct {
ds model.DataStore
agents []Interface
}
func GetAgents(ds model.DataStore) *Agents {
return singleton.GetInstance(func() *Agents {
return createAgents(ds)
})
}
func createAgents(ds model.DataStore) *Agents {
var order []string
if conf.Server.Agents != "" {
order = strings.Split(conf.Server.Agents, ",")
}
order = append(order, LocalAgentName)
var res []Interface
var enabled []string
for _, name := range order {
init, ok := Map[name]
if !ok {
log.Error("Invalid agent. Check `Agents` configuration", "name", name, "conf", conf.Server.Agents)
continue
}
agent := init(ds)
if agent == nil {
log.Debug("Agent not available. Missing configuration?", "name", name)
continue
}
enabled = append(enabled, name)
res = append(res, init(ds))
}
log.Debug("List of agents enabled", "names", enabled)
return &Agents{ds: ds, agents: res}
}
func (a *Agents) AgentName() string {
return "agents"
}
func (a *Agents) GetArtistMBID(ctx context.Context, id string, name string) (string, error) {
switch id {
case consts.UnknownArtistID:
return "", ErrNotFound
case consts.VariousArtistsID:
return "", nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistMBIDRetriever)
if !ok {
continue
}
mbid, err := agent.GetArtistMBID(ctx, id, name)
if mbid != "" && err == nil {
log.Debug(ctx, "Got MBID", "agent", ag.AgentName(), "artist", name, "mbid", mbid, "elapsed", time.Since(start))
return mbid, nil
}
}
return "", ErrNotFound
}
func (a *Agents) GetArtistURL(ctx context.Context, id, name, mbid string) (string, error) {
switch id {
case consts.UnknownArtistID:
return "", ErrNotFound
case consts.VariousArtistsID:
return "", nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistURLRetriever)
if !ok {
continue
}
url, err := agent.GetArtistURL(ctx, id, name, mbid)
if url != "" && err == nil {
log.Debug(ctx, "Got External Url", "agent", ag.AgentName(), "artist", name, "url", url, "elapsed", time.Since(start))
return url, nil
}
}
return "", ErrNotFound
}
func (a *Agents) GetArtistBiography(ctx context.Context, id, name, mbid string) (string, error) {
switch id {
case consts.UnknownArtistID:
return "", ErrNotFound
case consts.VariousArtistsID:
return "", nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistBiographyRetriever)
if !ok {
continue
}
bio, err := agent.GetArtistBiography(ctx, id, name, mbid)
if err == nil {
log.Debug(ctx, "Got Biography", "agent", ag.AgentName(), "artist", name, "len", len(bio), "elapsed", time.Since(start))
return bio, nil
}
}
return "", ErrNotFound
}
func (a *Agents) GetSimilarArtists(ctx context.Context, id, name, mbid string, limit int) ([]Artist, error) {
switch id {
case consts.UnknownArtistID:
return nil, ErrNotFound
case consts.VariousArtistsID:
return nil, nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistSimilarRetriever)
if !ok {
continue
}
similar, err := agent.GetSimilarArtists(ctx, id, name, mbid, limit)
if len(similar) > 0 && err == nil {
if log.IsGreaterOrEqualTo(log.LevelTrace) {
log.Debug(ctx, "Got Similar Artists", "agent", ag.AgentName(), "artist", name, "similar", similar, "elapsed", time.Since(start))
} else {
log.Debug(ctx, "Got Similar Artists", "agent", ag.AgentName(), "artist", name, "similarReceived", len(similar), "elapsed", time.Since(start))
}
return similar, err
}
}
return nil, ErrNotFound
}
func (a *Agents) GetArtistImages(ctx context.Context, id, name, mbid string) ([]ExternalImage, error) {
switch id {
case consts.UnknownArtistID:
return nil, ErrNotFound
case consts.VariousArtistsID:
return nil, nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistImageRetriever)
if !ok {
continue
}
images, err := agent.GetArtistImages(ctx, id, name, mbid)
if len(images) > 0 && err == nil {
log.Debug(ctx, "Got Images", "agent", ag.AgentName(), "artist", name, "images", images, "elapsed", time.Since(start))
return images, nil
}
}
return nil, ErrNotFound
}
func (a *Agents) GetArtistTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]Song, error) {
switch id {
case consts.UnknownArtistID:
return nil, ErrNotFound
case consts.VariousArtistsID:
return nil, nil
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(ArtistTopSongsRetriever)
if !ok {
continue
}
songs, err := agent.GetArtistTopSongs(ctx, id, artistName, mbid, count)
if len(songs) > 0 && err == nil {
log.Debug(ctx, "Got Top Songs", "agent", ag.AgentName(), "artist", artistName, "songs", songs, "elapsed", time.Since(start))
return songs, nil
}
}
return nil, ErrNotFound
}
func (a *Agents) GetAlbumInfo(ctx context.Context, name, artist, mbid string) (*AlbumInfo, error) {
if name == consts.UnknownAlbum {
return nil, ErrNotFound
}
start := time.Now()
for _, ag := range a.agents {
if utils.IsCtxDone(ctx) {
break
}
agent, ok := ag.(AlbumInfoRetriever)
if !ok {
continue
}
album, err := agent.GetAlbumInfo(ctx, name, artist, mbid)
if err == nil {
log.Debug(ctx, "Got Album Info", "agent", ag.AgentName(), "album", name, "artist", artist,
"mbid", mbid, "elapsed", time.Since(start))
return album, nil
}
}
return nil, ErrNotFound
}
var _ Interface = (*Agents)(nil)
var _ ArtistMBIDRetriever = (*Agents)(nil)
var _ ArtistURLRetriever = (*Agents)(nil)
var _ ArtistBiographyRetriever = (*Agents)(nil)
var _ ArtistSimilarRetriever = (*Agents)(nil)
var _ ArtistImageRetriever = (*Agents)(nil)
var _ ArtistTopSongsRetriever = (*Agents)(nil)
var _ AlbumInfoRetriever = (*Agents)(nil)

View file

@ -0,0 +1,17 @@
package agents
import (
"testing"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestAgents(t *testing.T) {
tests.Init(t, false)
log.SetLevel(log.LevelFatal)
RegisterFailHandler(Fail)
RunSpecs(t, "Agents Test Suite")
}

357
core/agents/agents_test.go Normal file
View file

@ -0,0 +1,357 @@
package agents
import (
"context"
"errors"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/tests"
"github.com/navidrome/navidrome/utils/slice"
"github.com/navidrome/navidrome/conf"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Agents", func() {
var ctx context.Context
var cancel context.CancelFunc
var ds model.DataStore
var mfRepo *tests.MockMediaFileRepo
BeforeEach(func() {
ctx, cancel = context.WithCancel(context.Background())
mfRepo = tests.CreateMockMediaFileRepo()
ds = &tests.MockDataStore{MockedMediaFile: mfRepo}
})
Describe("Local", func() {
var ag *Agents
BeforeEach(func() {
conf.Server.Agents = ""
ag = createAgents(ds)
})
It("calls the placeholder GetArtistImages", func() {
mfRepo.SetData(model.MediaFiles{{ID: "1", Title: "One", MbzReleaseTrackID: "111"}, {ID: "2", Title: "Two", MbzReleaseTrackID: "222"}})
songs, err := ag.GetArtistTopSongs(ctx, "123", "John Doe", "mb123", 2)
Expect(err).ToNot(HaveOccurred())
Expect(songs).To(ConsistOf([]Song{{Name: "One", MBID: "111"}, {Name: "Two", MBID: "222"}}))
})
})
Describe("Agents", func() {
var ag *Agents
var mock *mockAgent
BeforeEach(func() {
mock = &mockAgent{}
Register("fake", func(model.DataStore) Interface { return mock })
Register("disabled", func(model.DataStore) Interface { return nil })
Register("empty", func(model.DataStore) Interface { return &emptyAgent{} })
conf.Server.Agents = "empty,fake,disabled"
ag = createAgents(ds)
Expect(ag.AgentName()).To(Equal("agents"))
})
It("does not register disabled agents", func() {
ags := slice.Map(ag.agents, func(a Interface) string { return a.AgentName() })
// local agent is always appended to the end of the agents list
Expect(ags).To(HaveExactElements("empty", "fake", "local"))
Expect(ags).ToNot(ContainElement("disabled"))
})
Describe("GetArtistMBID", func() {
It("returns on first match", func() {
Expect(ag.GetArtistMBID(ctx, "123", "test")).To(Equal("mbid"))
Expect(mock.Args).To(HaveExactElements("123", "test"))
})
It("returns empty if artist is Various Artists", func() {
mbid, err := ag.GetArtistMBID(ctx, consts.VariousArtistsID, consts.VariousArtists)
Expect(err).ToNot(HaveOccurred())
Expect(mbid).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("returns not found if artist is Unknown Artist", func() {
mbid, err := ag.GetArtistMBID(ctx, consts.VariousArtistsID, consts.VariousArtists)
Expect(err).ToNot(HaveOccurred())
Expect(mbid).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetArtistMBID(ctx, "123", "test")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("123", "test"))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetArtistMBID(ctx, "123", "test")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetArtistURL", func() {
It("returns on first match", func() {
Expect(ag.GetArtistURL(ctx, "123", "test", "mb123")).To(Equal("url"))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("returns empty if artist is Various Artists", func() {
url, err := ag.GetArtistURL(ctx, consts.VariousArtistsID, consts.VariousArtists, "")
Expect(err).ToNot(HaveOccurred())
Expect(url).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("returns not found if artist is Unknown Artist", func() {
url, err := ag.GetArtistURL(ctx, consts.VariousArtistsID, consts.VariousArtists, "")
Expect(err).ToNot(HaveOccurred())
Expect(url).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetArtistURL(ctx, "123", "test", "mb123")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetArtistURL(ctx, "123", "test", "mb123")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetArtistBiography", func() {
It("returns on first match", func() {
Expect(ag.GetArtistBiography(ctx, "123", "test", "mb123")).To(Equal("bio"))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("returns empty if artist is Various Artists", func() {
bio, err := ag.GetArtistBiography(ctx, consts.VariousArtistsID, consts.VariousArtists, "")
Expect(err).ToNot(HaveOccurred())
Expect(bio).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("returns not found if artist is Unknown Artist", func() {
bio, err := ag.GetArtistBiography(ctx, consts.VariousArtistsID, consts.VariousArtists, "")
Expect(err).ToNot(HaveOccurred())
Expect(bio).To(BeEmpty())
Expect(mock.Args).To(BeEmpty())
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetArtistBiography(ctx, "123", "test", "mb123")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetArtistBiography(ctx, "123", "test", "mb123")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetArtistImages", func() {
It("returns on first match", func() {
Expect(ag.GetArtistImages(ctx, "123", "test", "mb123")).To(Equal([]ExternalImage{{
URL: "imageUrl",
Size: 100,
}}))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetArtistImages(ctx, "123", "test", "mb123")
Expect(err).To(MatchError("not found"))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123"))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetArtistImages(ctx, "123", "test", "mb123")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetSimilarArtists", func() {
It("returns on first match", func() {
Expect(ag.GetSimilarArtists(ctx, "123", "test", "mb123", 1)).To(Equal([]Artist{{
Name: "Joe Dohn",
MBID: "mbid321",
}}))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123", 1))
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetSimilarArtists(ctx, "123", "test", "mb123", 1)
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123", 1))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetSimilarArtists(ctx, "123", "test", "mb123", 1)
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetArtistTopSongs", func() {
It("returns on first match", func() {
Expect(ag.GetArtistTopSongs(ctx, "123", "test", "mb123", 2)).To(Equal([]Song{{
Name: "A Song",
MBID: "mbid444",
}}))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123", 2))
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetArtistTopSongs(ctx, "123", "test", "mb123", 2)
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("123", "test", "mb123", 2))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetArtistTopSongs(ctx, "123", "test", "mb123", 2)
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
Describe("GetAlbumInfo", func() {
It("returns meaningful data", func() {
Expect(ag.GetAlbumInfo(ctx, "album", "artist", "mbid")).To(Equal(&AlbumInfo{
Name: "A Song",
MBID: "mbid444",
Description: "A Description",
URL: "External URL",
Images: []ExternalImage{
{
Size: 174,
URL: "https://lastfm.freetls.fastly.net/i/u/174s/00000000000000000000000000000000.png",
}, {
Size: 64,
URL: "https://lastfm.freetls.fastly.net/i/u/64s/00000000000000000000000000000000.png",
}, {
Size: 34,
URL: "https://lastfm.freetls.fastly.net/i/u/34s/00000000000000000000000000000000.png",
},
},
}))
Expect(mock.Args).To(HaveExactElements("album", "artist", "mbid"))
})
It("skips the agent if it returns an error", func() {
mock.Err = errors.New("error")
_, err := ag.GetAlbumInfo(ctx, "album", "artist", "mbid")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(HaveExactElements("album", "artist", "mbid"))
})
It("interrupts if the context is canceled", func() {
cancel()
_, err := ag.GetAlbumInfo(ctx, "album", "artist", "mbid")
Expect(err).To(MatchError(ErrNotFound))
Expect(mock.Args).To(BeEmpty())
})
})
})
})
type mockAgent struct {
Args []interface{}
Err error
}
func (a *mockAgent) AgentName() string {
return "fake"
}
func (a *mockAgent) GetArtistMBID(_ context.Context, id string, name string) (string, error) {
a.Args = []interface{}{id, name}
if a.Err != nil {
return "", a.Err
}
return "mbid", nil
}
func (a *mockAgent) GetArtistURL(_ context.Context, id, name, mbid string) (string, error) {
a.Args = []interface{}{id, name, mbid}
if a.Err != nil {
return "", a.Err
}
return "url", nil
}
func (a *mockAgent) GetArtistBiography(_ context.Context, id, name, mbid string) (string, error) {
a.Args = []interface{}{id, name, mbid}
if a.Err != nil {
return "", a.Err
}
return "bio", nil
}
func (a *mockAgent) GetArtistImages(_ context.Context, id, name, mbid string) ([]ExternalImage, error) {
a.Args = []interface{}{id, name, mbid}
if a.Err != nil {
return nil, a.Err
}
return []ExternalImage{{
URL: "imageUrl",
Size: 100,
}}, nil
}
func (a *mockAgent) GetSimilarArtists(_ context.Context, id, name, mbid string, limit int) ([]Artist, error) {
a.Args = []interface{}{id, name, mbid, limit}
if a.Err != nil {
return nil, a.Err
}
return []Artist{{
Name: "Joe Dohn",
MBID: "mbid321",
}}, nil
}
func (a *mockAgent) GetArtistTopSongs(_ context.Context, id, artistName, mbid string, count int) ([]Song, error) {
a.Args = []interface{}{id, artistName, mbid, count}
if a.Err != nil {
return nil, a.Err
}
return []Song{{
Name: "A Song",
MBID: "mbid444",
}}, nil
}
func (a *mockAgent) GetAlbumInfo(ctx context.Context, name, artist, mbid string) (*AlbumInfo, error) {
a.Args = []interface{}{name, artist, mbid}
if a.Err != nil {
return nil, a.Err
}
return &AlbumInfo{
Name: "A Song",
MBID: "mbid444",
Description: "A Description",
URL: "External URL",
Images: []ExternalImage{
{
Size: 174,
URL: "https://lastfm.freetls.fastly.net/i/u/174s/00000000000000000000000000000000.png",
}, {
Size: 64,
URL: "https://lastfm.freetls.fastly.net/i/u/64s/00000000000000000000000000000000.png",
}, {
Size: 34,
URL: "https://lastfm.freetls.fastly.net/i/u/34s/00000000000000000000000000000000.png",
},
},
}, nil
}
type emptyAgent struct {
Interface
}
func (e *emptyAgent) AgentName() string {
return "empty"
}

79
core/agents/interfaces.go Normal file
View file

@ -0,0 +1,79 @@
package agents
import (
"context"
"errors"
"github.com/navidrome/navidrome/model"
)
type Constructor func(ds model.DataStore) Interface
type Interface interface {
AgentName() string
}
type AlbumInfo struct {
Name string
MBID string
Description string
URL string
Images []ExternalImage
}
type Artist struct {
Name string
MBID string
}
type ExternalImage struct {
URL string
Size int
}
type Song struct {
Name string
MBID string
}
var (
ErrNotFound = errors.New("not found")
)
// TODO Break up this interface in more specific methods, like artists
type AlbumInfoRetriever interface {
GetAlbumInfo(ctx context.Context, name, artist, mbid string) (*AlbumInfo, error)
}
type ArtistMBIDRetriever interface {
GetArtistMBID(ctx context.Context, id string, name string) (string, error)
}
type ArtistURLRetriever interface {
GetArtistURL(ctx context.Context, id, name, mbid string) (string, error)
}
type ArtistBiographyRetriever interface {
GetArtistBiography(ctx context.Context, id, name, mbid string) (string, error)
}
type ArtistSimilarRetriever interface {
GetSimilarArtists(ctx context.Context, id, name, mbid string, limit int) ([]Artist, error)
}
type ArtistImageRetriever interface {
GetArtistImages(ctx context.Context, id, name, mbid string) ([]ExternalImage, error)
}
type ArtistTopSongsRetriever interface {
GetArtistTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]Song, error)
}
var Map map[string]Constructor
func Register(name string, init Constructor) {
if Map == nil {
Map = make(map[string]Constructor)
}
Map[name] = init
}

361
core/agents/lastfm/agent.go Normal file
View file

@ -0,0 +1,361 @@
package lastfm
import (
"context"
"errors"
"fmt"
"net/http"
"regexp"
"strconv"
"strings"
"sync"
"github.com/andybalholm/cascadia"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/core/scrobbler"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/utils/cache"
"golang.org/x/net/html"
)
const (
lastFMAgentName = "lastfm"
sessionKeyProperty = "LastFMSessionKey"
)
var ignoredBiographies = []string{
// Unknown Artist
`<a href="https://www.last.fm/music/`,
}
type lastfmAgent struct {
ds model.DataStore
sessionKeys *agents.SessionKeys
apiKey string
secret string
lang string
client *client
getInfoMutex sync.Mutex
}
func lastFMConstructor(ds model.DataStore) *lastfmAgent {
if !conf.Server.LastFM.Enabled || conf.Server.LastFM.ApiKey == "" || conf.Server.LastFM.Secret == "" {
return nil
}
l := &lastfmAgent{
ds: ds,
lang: conf.Server.LastFM.Language,
apiKey: conf.Server.LastFM.ApiKey,
secret: conf.Server.LastFM.Secret,
sessionKeys: &agents.SessionKeys{DataStore: ds, KeyName: sessionKeyProperty},
}
hc := &http.Client{
Timeout: consts.DefaultHttpClientTimeOut,
}
chc := cache.NewHTTPClient(hc, consts.DefaultHttpClientTimeOut)
l.client = newClient(l.apiKey, l.secret, l.lang, chc)
return l
}
func (l *lastfmAgent) AgentName() string {
return lastFMAgentName
}
var imageRegex = regexp.MustCompile(`u\/(\d+)`)
func (l *lastfmAgent) GetAlbumInfo(ctx context.Context, name, artist, mbid string) (*agents.AlbumInfo, error) {
a, err := l.callAlbumGetInfo(ctx, name, artist, mbid)
if err != nil {
return nil, err
}
response := agents.AlbumInfo{
Name: a.Name,
MBID: a.MBID,
Description: a.Description.Summary,
URL: a.URL,
Images: make([]agents.ExternalImage, 0),
}
// Last.fm can return duplicate sizes.
seenSizes := map[int]bool{}
// This assumes that Last.fm returns images with size small, medium, and large.
// This is true as of December 29, 2022
for _, img := range a.Image {
size := imageRegex.FindStringSubmatch(img.URL)
// Last.fm can return images without URL
if len(size) == 0 || len(size[0]) < 4 {
log.Trace(ctx, "LastFM/albuminfo image URL does not match expected regex or is empty", "url", img.URL, "size", img.Size)
continue
}
numericSize, err := strconv.Atoi(size[0][2:])
if err != nil {
log.Error(ctx, "LastFM/albuminfo image URL does not match expected regex", "url", img.URL, "size", img.Size, err)
return nil, err
} else {
if _, exists := seenSizes[numericSize]; !exists {
response.Images = append(response.Images, agents.ExternalImage{
Size: numericSize,
URL: img.URL,
})
seenSizes[numericSize] = true
}
}
}
return &response, nil
}
func (l *lastfmAgent) GetArtistMBID(ctx context.Context, id string, name string) (string, error) {
a, err := l.callArtistGetInfo(ctx, name)
if err != nil {
return "", err
}
if a.MBID == "" {
return "", agents.ErrNotFound
}
return a.MBID, nil
}
func (l *lastfmAgent) GetArtistURL(ctx context.Context, id, name, mbid string) (string, error) {
a, err := l.callArtistGetInfo(ctx, name)
if err != nil {
return "", err
}
if a.URL == "" {
return "", agents.ErrNotFound
}
return a.URL, nil
}
func (l *lastfmAgent) GetArtistBiography(ctx context.Context, id, name, mbid string) (string, error) {
a, err := l.callArtistGetInfo(ctx, name)
if err != nil {
return "", err
}
a.Bio.Summary = strings.TrimSpace(a.Bio.Summary)
if a.Bio.Summary == "" {
return "", agents.ErrNotFound
}
for _, ign := range ignoredBiographies {
if strings.HasPrefix(a.Bio.Summary, ign) {
return "", nil
}
}
return a.Bio.Summary, nil
}
func (l *lastfmAgent) GetSimilarArtists(ctx context.Context, id, name, mbid string, limit int) ([]agents.Artist, error) {
resp, err := l.callArtistGetSimilar(ctx, name, limit)
if err != nil {
return nil, err
}
if len(resp) == 0 {
return nil, agents.ErrNotFound
}
var res []agents.Artist
for _, a := range resp {
res = append(res, agents.Artist{
Name: a.Name,
MBID: a.MBID,
})
}
return res, nil
}
func (l *lastfmAgent) GetArtistTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]agents.Song, error) {
resp, err := l.callArtistGetTopTracks(ctx, artistName, count)
if err != nil {
return nil, err
}
if len(resp) == 0 {
return nil, agents.ErrNotFound
}
var res []agents.Song
for _, t := range resp {
res = append(res, agents.Song{
Name: t.Name,
MBID: t.MBID,
})
}
return res, nil
}
var artistOpenGraphQuery = cascadia.MustCompile(`html > head > meta[property="og:image"]`)
func (l *lastfmAgent) GetArtistImages(ctx context.Context, _, name, mbid string) ([]agents.ExternalImage, error) {
log.Debug(ctx, "Getting artist images from Last.fm", "name", name)
hc := http.Client{
Timeout: consts.DefaultHttpClientTimeOut,
}
a, err := l.callArtistGetInfo(ctx, name)
if err != nil {
return nil, fmt.Errorf("get artist info: %w", err)
}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, a.URL, nil)
if err != nil {
return nil, fmt.Errorf("create artist image request: %w", err)
}
resp, err := hc.Do(req)
if err != nil {
return nil, fmt.Errorf("get artist url: %w", err)
}
defer resp.Body.Close()
node, err := html.Parse(resp.Body)
if err != nil {
return nil, fmt.Errorf("parse html: %w", err)
}
var res []agents.ExternalImage
n := cascadia.Query(node, artistOpenGraphQuery)
if n == nil {
return res, nil
}
for _, attr := range n.Attr {
if attr.Key == "content" {
res = []agents.ExternalImage{
{URL: attr.Val},
}
break
}
}
return res, nil
}
func (l *lastfmAgent) callAlbumGetInfo(ctx context.Context, name, artist, mbid string) (*Album, error) {
a, err := l.client.albumGetInfo(ctx, name, artist, mbid)
var lfErr *lastFMError
isLastFMError := errors.As(err, &lfErr)
if mbid != "" && (isLastFMError && lfErr.Code == 6) {
log.Debug(ctx, "LastFM/album.getInfo could not find album by mbid, trying again", "album", name, "mbid", mbid)
return l.callAlbumGetInfo(ctx, name, artist, "")
}
if err != nil {
if isLastFMError && lfErr.Code == 6 {
log.Debug(ctx, "Album not found", "album", name, "mbid", mbid, err)
} else {
log.Error(ctx, "Error calling LastFM/album.getInfo", "album", name, "mbid", mbid, err)
}
return nil, err
}
return a, nil
}
func (l *lastfmAgent) callArtistGetInfo(ctx context.Context, name string) (*Artist, error) {
l.getInfoMutex.Lock()
defer l.getInfoMutex.Unlock()
a, err := l.client.artistGetInfo(ctx, name)
if err != nil {
log.Error(ctx, "Error calling LastFM/artist.getInfo", "artist", name, err)
return nil, err
}
return a, nil
}
func (l *lastfmAgent) callArtistGetSimilar(ctx context.Context, name string, limit int) ([]Artist, error) {
s, err := l.client.artistGetSimilar(ctx, name, limit)
if err != nil {
log.Error(ctx, "Error calling LastFM/artist.getSimilar", "artist", name, err)
return nil, err
}
return s.Artists, nil
}
func (l *lastfmAgent) callArtistGetTopTracks(ctx context.Context, artistName string, count int) ([]Track, error) {
t, err := l.client.artistGetTopTracks(ctx, artistName, count)
if err != nil {
log.Error(ctx, "Error calling LastFM/artist.getTopTracks", "artist", artistName, err)
return nil, err
}
return t.Track, nil
}
func (l *lastfmAgent) NowPlaying(ctx context.Context, userId string, track *model.MediaFile) error {
sk, err := l.sessionKeys.Get(ctx, userId)
if err != nil || sk == "" {
return scrobbler.ErrNotAuthorized
}
err = l.client.updateNowPlaying(ctx, sk, ScrobbleInfo{
artist: track.Artist,
track: track.Title,
album: track.Album,
trackNumber: track.TrackNumber,
mbid: track.MbzRecordingID,
duration: int(track.Duration),
albumArtist: track.AlbumArtist,
})
if err != nil {
log.Warn(ctx, "Last.fm client.updateNowPlaying returned error", "track", track.Title, err)
return errors.Join(err, scrobbler.ErrUnrecoverable)
}
return nil
}
func (l *lastfmAgent) Scrobble(ctx context.Context, userId string, s scrobbler.Scrobble) error {
sk, err := l.sessionKeys.Get(ctx, userId)
if err != nil || sk == "" {
return errors.Join(err, scrobbler.ErrNotAuthorized)
}
if s.Duration <= 30 {
log.Debug(ctx, "Skipping Last.fm scrobble for short song", "track", s.Title, "duration", s.Duration)
return nil
}
err = l.client.scrobble(ctx, sk, ScrobbleInfo{
artist: s.Artist,
track: s.Title,
album: s.Album,
trackNumber: s.TrackNumber,
mbid: s.MbzRecordingID,
duration: int(s.Duration),
albumArtist: s.AlbumArtist,
timestamp: s.TimeStamp,
})
if err == nil {
return nil
}
var lfErr *lastFMError
isLastFMError := errors.As(err, &lfErr)
if !isLastFMError {
log.Warn(ctx, "Last.fm client.scrobble returned error", "track", s.Title, err)
return errors.Join(err, scrobbler.ErrRetryLater)
}
if lfErr.Code == 11 || lfErr.Code == 16 {
return errors.Join(err, scrobbler.ErrRetryLater)
}
return errors.Join(err, scrobbler.ErrUnrecoverable)
}
func (l *lastfmAgent) IsAuthorized(ctx context.Context, userId string) bool {
sk, err := l.sessionKeys.Get(ctx, userId)
return err == nil && sk != ""
}
func init() {
conf.AddHook(func() {
agents.Register(lastFMAgentName, func(ds model.DataStore) agents.Interface {
a := lastFMConstructor(ds)
if a != nil {
return a
}
return nil
})
scrobbler.Register(lastFMAgentName, func(ds model.DataStore) scrobbler.Scrobbler {
a := lastFMConstructor(ds)
if a != nil {
return a
}
return nil
})
})
}

View file

@ -0,0 +1,392 @@
package lastfm
import (
"bytes"
"context"
"errors"
"io"
"net/http"
"os"
"strconv"
"time"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/conf/configtest"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/core/scrobbler"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
const (
lastfmError3 = `{"error":3,"message":"Invalid Method - No method with that name in this package","links":[]}`
lastfmError6 = `{"error":6,"message":"The artist you supplied could not be found","links":[]}`
)
var _ = Describe("lastfmAgent", func() {
var ds model.DataStore
var ctx context.Context
BeforeEach(func() {
ds = &tests.MockDataStore{}
ctx = context.Background()
DeferCleanup(configtest.SetupConfig())
conf.Server.LastFM.Enabled = true
conf.Server.LastFM.ApiKey = "123"
conf.Server.LastFM.Secret = "secret"
})
Describe("lastFMConstructor", func() {
When("Agent is properly configured", func() {
It("uses configured api key and language", func() {
conf.Server.LastFM.Language = "pt"
agent := lastFMConstructor(ds)
Expect(agent.apiKey).To(Equal("123"))
Expect(agent.secret).To(Equal("secret"))
Expect(agent.lang).To(Equal("pt"))
})
})
When("Agent is disabled", func() {
It("returns nil", func() {
conf.Server.LastFM.Enabled = false
Expect(lastFMConstructor(ds)).To(BeNil())
})
})
When("ApiKey is empty", func() {
It("returns nil", func() {
conf.Server.LastFM.ApiKey = ""
Expect(lastFMConstructor(ds)).To(BeNil())
})
})
When("Secret is empty", func() {
It("returns nil", func() {
conf.Server.LastFM.Secret = ""
Expect(lastFMConstructor(ds)).To(BeNil())
})
})
})
Describe("GetArtistBiography", func() {
var agent *lastfmAgent
var httpClient *tests.FakeHttpClient
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client := newClient("API_KEY", "SECRET", "pt", httpClient)
agent = lastFMConstructor(ds)
agent.client = client
})
It("returns the biography", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.getinfo.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
Expect(agent.GetArtistBiography(ctx, "123", "U2", "")).To(Equal("U2 é uma das mais importantes bandas de rock de todos os tempos. Formada em 1976 em Dublin, composta por Bono (vocalista e guitarrista), The Edge (guitarrista, pianista e backing vocal), Adam Clayton (baixista), Larry Mullen, Jr. (baterista e percussionista).\n\nDesde a década de 80, U2 é uma das bandas mais populares no mundo. Seus shows são únicos e um verdadeiro festival de efeitos especiais, além de serem um dos que mais arrecadam anualmente. <a href=\"https://www.last.fm/music/U2\">Read more on Last.fm</a>"))
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call fails", func() {
httpClient.Err = errors.New("error")
_, err := agent.GetArtistBiography(ctx, "123", "U2", "")
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call returns an error", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError3)), StatusCode: 200}
_, err := agent.GetArtistBiography(ctx, "123", "U2", "")
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
})
Describe("GetSimilarArtists", func() {
var agent *lastfmAgent
var httpClient *tests.FakeHttpClient
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client := newClient("API_KEY", "SECRET", "pt", httpClient)
agent = lastFMConstructor(ds)
agent.client = client
})
It("returns similar artists", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.getsimilar.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
Expect(agent.GetSimilarArtists(ctx, "123", "U2", "", 2)).To(Equal([]agents.Artist{
{Name: "Passengers", MBID: "e110c11f-1c94-4471-a350-c38f46b29389"},
{Name: "INXS", MBID: "481bf5f9-2e7c-4c44-b08a-05b32bc7c00d"},
}))
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call fails", func() {
httpClient.Err = errors.New("error")
_, err := agent.GetSimilarArtists(ctx, "123", "U2", "", 2)
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call returns an error", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError3)), StatusCode: 200}
_, err := agent.GetSimilarArtists(ctx, "123", "U2", "", 2)
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
})
Describe("GetArtistTopSongs", func() {
var agent *lastfmAgent
var httpClient *tests.FakeHttpClient
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client := newClient("API_KEY", "SECRET", "pt", httpClient)
agent = lastFMConstructor(ds)
agent.client = client
})
It("returns top songs", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.gettoptracks.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
Expect(agent.GetArtistTopSongs(ctx, "123", "U2", "", 2)).To(Equal([]agents.Song{
{Name: "Beautiful Day", MBID: "f7f264d0-a89b-4682-9cd7-a4e7c37637af"},
{Name: "With or Without You", MBID: "6b9a509f-6907-4a6e-9345-2f12da09ba4b"},
}))
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call fails", func() {
httpClient.Err = errors.New("error")
_, err := agent.GetArtistTopSongs(ctx, "123", "U2", "", 2)
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
It("returns an error if Last.fm call returns an error", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError3)), StatusCode: 200}
_, err := agent.GetArtistTopSongs(ctx, "123", "U2", "", 2)
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("artist")).To(Equal("U2"))
})
})
Describe("Scrobbling", func() {
var agent *lastfmAgent
var httpClient *tests.FakeHttpClient
var track *model.MediaFile
BeforeEach(func() {
_ = ds.UserProps(ctx).Put("user-1", sessionKeyProperty, "SK-1")
httpClient = &tests.FakeHttpClient{}
client := newClient("API_KEY", "SECRET", "en", httpClient)
agent = lastFMConstructor(ds)
agent.client = client
track = &model.MediaFile{
ID: "123",
Title: "Track Title",
Album: "Track Album",
Artist: "Track Artist",
AlbumArtist: "Track AlbumArtist",
TrackNumber: 1,
Duration: 180,
MbzRecordingID: "mbz-123",
}
})
Describe("NowPlaying", func() {
It("calls Last.fm with correct params", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString("{}")), StatusCode: 200}
err := agent.NowPlaying(ctx, "user-1", track)
Expect(err).ToNot(HaveOccurred())
Expect(httpClient.SavedRequest.Method).To(Equal(http.MethodPost))
sentParams := httpClient.SavedRequest.URL.Query()
Expect(sentParams.Get("method")).To(Equal("track.updateNowPlaying"))
Expect(sentParams.Get("sk")).To(Equal("SK-1"))
Expect(sentParams.Get("track")).To(Equal(track.Title))
Expect(sentParams.Get("album")).To(Equal(track.Album))
Expect(sentParams.Get("artist")).To(Equal(track.Artist))
Expect(sentParams.Get("albumArtist")).To(Equal(track.AlbumArtist))
Expect(sentParams.Get("trackNumber")).To(Equal(strconv.Itoa(track.TrackNumber)))
Expect(sentParams.Get("duration")).To(Equal(strconv.FormatFloat(float64(track.Duration), 'G', -1, 32)))
Expect(sentParams.Get("mbid")).To(Equal(track.MbzRecordingID))
})
It("returns ErrNotAuthorized if user is not linked", func() {
err := agent.NowPlaying(ctx, "user-2", track)
Expect(err).To(MatchError(scrobbler.ErrNotAuthorized))
})
})
Describe("scrobble", func() {
It("calls Last.fm with correct params", func() {
ts := time.Now()
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString("{}")), StatusCode: 200}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: ts})
Expect(err).ToNot(HaveOccurred())
Expect(httpClient.SavedRequest.Method).To(Equal(http.MethodPost))
sentParams := httpClient.SavedRequest.URL.Query()
Expect(sentParams.Get("method")).To(Equal("track.scrobble"))
Expect(sentParams.Get("sk")).To(Equal("SK-1"))
Expect(sentParams.Get("track")).To(Equal(track.Title))
Expect(sentParams.Get("album")).To(Equal(track.Album))
Expect(sentParams.Get("artist")).To(Equal(track.Artist))
Expect(sentParams.Get("albumArtist")).To(Equal(track.AlbumArtist))
Expect(sentParams.Get("trackNumber")).To(Equal(strconv.Itoa(track.TrackNumber)))
Expect(sentParams.Get("duration")).To(Equal(strconv.FormatFloat(float64(track.Duration), 'G', -1, 32)))
Expect(sentParams.Get("mbid")).To(Equal(track.MbzRecordingID))
Expect(sentParams.Get("timestamp")).To(Equal(strconv.FormatInt(ts.Unix(), 10)))
})
It("skips songs with less than 31 seconds", func() {
track.Duration = 29
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString("{}")), StatusCode: 200}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).ToNot(HaveOccurred())
Expect(httpClient.SavedRequest).To(BeNil())
})
It("returns ErrNotAuthorized if user is not linked", func() {
err := agent.Scrobble(ctx, "user-2", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).To(MatchError(scrobbler.ErrNotAuthorized))
})
It("returns ErrRetryLater on error 11", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"error":11,"message":"Service Offline - This service is temporarily offline. Try again later."}`)),
StatusCode: 400,
}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrRetryLater on error 16", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"error":16,"message":"There was a temporary error processing your request. Please try again"}`)),
StatusCode: 400,
}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrRetryLater on http errors", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`internal server error`)),
StatusCode: 500,
}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrUnrecoverable on other errors", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"error":8,"message":"Operation failed - Something else went wrong"}`)),
StatusCode: 400,
}
err := agent.Scrobble(ctx, "user-1", scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()})
Expect(err).To(MatchError(scrobbler.ErrUnrecoverable))
})
})
})
Describe("GetAlbumInfo", func() {
var agent *lastfmAgent
var httpClient *tests.FakeHttpClient
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client := newClient("API_KEY", "SECRET", "pt", httpClient)
agent = lastFMConstructor(ds)
agent.client = client
})
It("returns the biography", func() {
f, _ := os.Open("tests/fixtures/lastfm.album.getinfo.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
Expect(agent.GetAlbumInfo(ctx, "Believe", "Cher", "03c91c40-49a6-44a7-90e7-a700edf97a62")).To(Equal(&agents.AlbumInfo{
Name: "Believe",
MBID: "03c91c40-49a6-44a7-90e7-a700edf97a62",
Description: "Believe is the twenty-third studio album by American singer-actress Cher, released on November 10, 1998 by Warner Bros. Records. The RIAA certified it Quadruple Platinum on December 23, 1999, recognizing four million shipments in the United States; Worldwide, the album has sold more than 20 million copies, making it the biggest-selling album of her career. In 1999 the album received three Grammy Awards nominations including \"Record of the Year\", \"Best Pop Album\" and winning \"Best Dance Recording\" for the single \"Believe\". It was released by Warner Bros. Records at the end of 1998. The album was executive produced by Rob <a href=\"https://www.last.fm/music/Cher/Believe\">Read more on Last.fm</a>.",
URL: "https://www.last.fm/music/Cher/Believe",
Images: []agents.ExternalImage{
{
URL: "https://lastfm.freetls.fastly.net/i/u/34s/3b54885952161aaea4ce2965b2db1638.png",
Size: 34,
},
{
URL: "https://lastfm.freetls.fastly.net/i/u/64s/3b54885952161aaea4ce2965b2db1638.png",
Size: 64,
},
{
URL: "https://lastfm.freetls.fastly.net/i/u/174s/3b54885952161aaea4ce2965b2db1638.png",
Size: 174,
},
{
URL: "https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png",
Size: 300,
},
},
}))
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("mbid")).To(Equal("03c91c40-49a6-44a7-90e7-a700edf97a62"))
})
It("returns empty images if no images are available", func() {
f, _ := os.Open("tests/fixtures/lastfm.album.getinfo.empty_urls.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
Expect(agent.GetAlbumInfo(ctx, "The Definitive Less Damage And More Joy", "The Jesus and Mary Chain", "")).To(Equal(&agents.AlbumInfo{
Name: "The Definitive Less Damage And More Joy",
URL: "https://www.last.fm/music/The+Jesus+and+Mary+Chain/The+Definitive+Less+Damage+And+More+Joy",
Images: []agents.ExternalImage{},
}))
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("album")).To(Equal("The Definitive Less Damage And More Joy"))
})
It("returns an error if Last.fm call fails", func() {
httpClient.Err = errors.New("error")
_, err := agent.GetAlbumInfo(ctx, "123", "U2", "mbid-1234")
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("mbid")).To(Equal("mbid-1234"))
})
It("returns an error if Last.fm call returns an error", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError3)), StatusCode: 200}
_, err := agent.GetAlbumInfo(ctx, "123", "U2", "mbid-1234")
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
Expect(httpClient.SavedRequest.URL.Query().Get("mbid")).To(Equal("mbid-1234"))
})
It("returns an error if Last.fm call returns an error 6 and mbid is empty", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError6)), StatusCode: 200}
_, err := agent.GetAlbumInfo(ctx, "123", "U2", "")
Expect(err).To(HaveOccurred())
Expect(httpClient.RequestCount).To(Equal(1))
})
Context("MBID non existent in Last.fm", func() {
It("calls again when last.fm returns an error 6", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(lastfmError6)), StatusCode: 200}
_, _ = agent.GetAlbumInfo(ctx, "123", "U2", "mbid-1234")
Expect(httpClient.RequestCount).To(Equal(2))
Expect(httpClient.SavedRequest.URL.Query().Get("mbid")).To(BeEmpty())
})
})
})
})

View file

@ -0,0 +1,132 @@
package lastfm
import (
"bytes"
"context"
_ "embed"
"errors"
"net/http"
"time"
"github.com/deluan/rest"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/request"
"github.com/navidrome/navidrome/server"
"github.com/navidrome/navidrome/utils/req"
)
//go:embed token_received.html
var tokenReceivedPage []byte
type Router struct {
http.Handler
ds model.DataStore
sessionKeys *agents.SessionKeys
client *client
apiKey string
secret string
}
func NewRouter(ds model.DataStore) *Router {
r := &Router{
ds: ds,
apiKey: conf.Server.LastFM.ApiKey,
secret: conf.Server.LastFM.Secret,
sessionKeys: &agents.SessionKeys{DataStore: ds, KeyName: sessionKeyProperty},
}
r.Handler = r.routes()
hc := &http.Client{
Timeout: consts.DefaultHttpClientTimeOut,
}
r.client = newClient(r.apiKey, r.secret, "en", hc)
return r
}
func (s *Router) routes() http.Handler {
r := chi.NewRouter()
r.Group(func(r chi.Router) {
r.Use(server.Authenticator(s.ds))
r.Use(server.JWTRefresher)
r.Get("/link", s.getLinkStatus)
r.Delete("/link", s.unlink)
})
r.Get("/link/callback", s.callback)
return r
}
func (s *Router) getLinkStatus(w http.ResponseWriter, r *http.Request) {
resp := map[string]interface{}{
"apiKey": s.apiKey,
}
u, _ := request.UserFrom(r.Context())
key, err := s.sessionKeys.Get(r.Context(), u.ID)
if err != nil && !errors.Is(err, model.ErrNotFound) {
resp["error"] = err
resp["status"] = false
_ = rest.RespondWithJSON(w, http.StatusInternalServerError, resp)
return
}
resp["status"] = key != ""
_ = rest.RespondWithJSON(w, http.StatusOK, resp)
}
func (s *Router) unlink(w http.ResponseWriter, r *http.Request) {
u, _ := request.UserFrom(r.Context())
err := s.sessionKeys.Delete(r.Context(), u.ID)
if err != nil {
_ = rest.RespondWithError(w, http.StatusInternalServerError, err.Error())
} else {
_ = rest.RespondWithJSON(w, http.StatusOK, map[string]string{})
}
}
func (s *Router) callback(w http.ResponseWriter, r *http.Request) {
p := req.Params(r)
token, err := p.String("token")
if err != nil {
_ = rest.RespondWithError(w, http.StatusBadRequest, "token not received")
return
}
uid, err := p.String("uid")
if err != nil {
_ = rest.RespondWithError(w, http.StatusBadRequest, "uid not received")
return
}
// Need to add user to context, as this is a non-authenticated endpoint, so it does not
// automatically contain any user info
ctx := request.WithUser(r.Context(), model.User{ID: uid})
err = s.fetchSessionKey(ctx, uid, token)
if err != nil {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte("An error occurred while authorizing with Last.fm. \n\nRequest ID: " + middleware.GetReqID(ctx)))
return
}
http.ServeContent(w, r, "response", time.Now(), bytes.NewReader(tokenReceivedPage))
}
func (s *Router) fetchSessionKey(ctx context.Context, uid, token string) error {
sessionKey, err := s.client.getSession(ctx, token)
if err != nil {
log.Error(ctx, "Could not fetch LastFM session key", "userId", uid, "token", token,
"requestId", middleware.GetReqID(ctx), err)
return err
}
err = s.sessionKeys.Put(ctx, uid, sessionKey)
if err != nil {
log.Error("Could not save LastFM session key", "userId", uid, "requestId", middleware.GetReqID(ctx), err)
}
return err
}

View file

@ -0,0 +1,233 @@
package lastfm
import (
"context"
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"net/http"
"net/url"
"slices"
"sort"
"strconv"
"strings"
"time"
"github.com/navidrome/navidrome/log"
)
const (
apiBaseUrl = "https://ws.audioscrobbler.com/2.0/"
)
type lastFMError struct {
Code int
Message string
}
func (e *lastFMError) Error() string {
return fmt.Sprintf("last.fm error(%d): %s", e.Code, e.Message)
}
type httpDoer interface {
Do(req *http.Request) (*http.Response, error)
}
func newClient(apiKey string, secret string, lang string, hc httpDoer) *client {
return &client{apiKey, secret, lang, hc}
}
type client struct {
apiKey string
secret string
lang string
hc httpDoer
}
func (c *client) albumGetInfo(ctx context.Context, name string, artist string, mbid string) (*Album, error) {
params := url.Values{}
params.Add("method", "album.getInfo")
params.Add("album", name)
params.Add("artist", artist)
params.Add("mbid", mbid)
params.Add("lang", c.lang)
response, err := c.makeRequest(ctx, http.MethodGet, params, false)
if err != nil {
return nil, err
}
return &response.Album, nil
}
func (c *client) artistGetInfo(ctx context.Context, name string) (*Artist, error) {
params := url.Values{}
params.Add("method", "artist.getInfo")
params.Add("artist", name)
params.Add("lang", c.lang)
response, err := c.makeRequest(ctx, http.MethodGet, params, false)
if err != nil {
return nil, err
}
return &response.Artist, nil
}
func (c *client) artistGetSimilar(ctx context.Context, name string, limit int) (*SimilarArtists, error) {
params := url.Values{}
params.Add("method", "artist.getSimilar")
params.Add("artist", name)
params.Add("limit", strconv.Itoa(limit))
response, err := c.makeRequest(ctx, http.MethodGet, params, false)
if err != nil {
return nil, err
}
return &response.SimilarArtists, nil
}
func (c *client) artistGetTopTracks(ctx context.Context, name string, limit int) (*TopTracks, error) {
params := url.Values{}
params.Add("method", "artist.getTopTracks")
params.Add("artist", name)
params.Add("limit", strconv.Itoa(limit))
response, err := c.makeRequest(ctx, http.MethodGet, params, false)
if err != nil {
return nil, err
}
return &response.TopTracks, nil
}
func (c *client) GetToken(ctx context.Context) (string, error) {
params := url.Values{}
params.Add("method", "auth.getToken")
c.sign(params)
response, err := c.makeRequest(ctx, http.MethodGet, params, true)
if err != nil {
return "", err
}
return response.Token, nil
}
func (c *client) getSession(ctx context.Context, token string) (string, error) {
params := url.Values{}
params.Add("method", "auth.getSession")
params.Add("token", token)
response, err := c.makeRequest(ctx, http.MethodGet, params, true)
if err != nil {
return "", err
}
return response.Session.Key, nil
}
type ScrobbleInfo struct {
artist string
track string
album string
trackNumber int
mbid string
duration int
albumArtist string
timestamp time.Time
}
func (c *client) updateNowPlaying(ctx context.Context, sessionKey string, info ScrobbleInfo) error {
params := url.Values{}
params.Add("method", "track.updateNowPlaying")
params.Add("artist", info.artist)
params.Add("track", info.track)
params.Add("album", info.album)
params.Add("trackNumber", strconv.Itoa(info.trackNumber))
params.Add("mbid", info.mbid)
params.Add("duration", strconv.Itoa(info.duration))
params.Add("albumArtist", info.albumArtist)
params.Add("sk", sessionKey)
resp, err := c.makeRequest(ctx, http.MethodPost, params, true)
if err != nil {
return err
}
if resp.NowPlaying.IgnoredMessage.Code != "0" {
log.Warn(ctx, "LastFM: NowPlaying was ignored", "code", resp.NowPlaying.IgnoredMessage.Code,
"text", resp.NowPlaying.IgnoredMessage.Text)
}
return nil
}
func (c *client) scrobble(ctx context.Context, sessionKey string, info ScrobbleInfo) error {
params := url.Values{}
params.Add("method", "track.scrobble")
params.Add("timestamp", strconv.FormatInt(info.timestamp.Unix(), 10))
params.Add("artist", info.artist)
params.Add("track", info.track)
params.Add("album", info.album)
params.Add("trackNumber", strconv.Itoa(info.trackNumber))
params.Add("mbid", info.mbid)
params.Add("duration", strconv.Itoa(info.duration))
params.Add("albumArtist", info.albumArtist)
params.Add("sk", sessionKey)
resp, err := c.makeRequest(ctx, http.MethodPost, params, true)
if err != nil {
return err
}
if resp.Scrobbles.Scrobble.IgnoredMessage.Code != "0" {
log.Warn(ctx, "LastFM: scrobble was ignored", "code", resp.Scrobbles.Scrobble.IgnoredMessage.Code,
"text", resp.Scrobbles.Scrobble.IgnoredMessage.Text, "info", info)
}
if resp.Scrobbles.Attr.Accepted != 1 {
log.Warn(ctx, "LastFM: scrobble was not accepted", "code", resp.Scrobbles.Scrobble.IgnoredMessage.Code,
"text", resp.Scrobbles.Scrobble.IgnoredMessage.Text, "info", info)
}
return nil
}
func (c *client) makeRequest(ctx context.Context, method string, params url.Values, signed bool) (*Response, error) {
params.Add("format", "json")
params.Add("api_key", c.apiKey)
if signed {
c.sign(params)
}
req, _ := http.NewRequestWithContext(ctx, method, apiBaseUrl, nil)
req.URL.RawQuery = params.Encode()
log.Trace(ctx, fmt.Sprintf("Sending Last.fm %s request", req.Method), "url", req.URL)
resp, err := c.hc.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
decoder := json.NewDecoder(resp.Body)
var response Response
jsonErr := decoder.Decode(&response)
if resp.StatusCode != 200 && jsonErr != nil {
return nil, fmt.Errorf("last.fm http status: (%d)", resp.StatusCode)
}
if jsonErr != nil {
return nil, jsonErr
}
if response.Error != 0 {
return &response, &lastFMError{Code: response.Error, Message: response.Message}
}
return &response, nil
}
func (c *client) sign(params url.Values) {
// the parameters must be in order before hashing
keys := make([]string, 0, len(params))
for k := range params {
if slices.Contains([]string{"format", "callback"}, k) {
continue
}
keys = append(keys, k)
}
sort.Strings(keys)
msg := strings.Builder{}
for _, k := range keys {
msg.WriteString(k)
msg.WriteString(params[k][0])
}
msg.WriteString(c.secret)
hash := md5.Sum([]byte(msg.String()))
params.Add("api_sig", hex.EncodeToString(hash[:]))
}

View file

@ -0,0 +1,173 @@
package lastfm
import (
"bytes"
"context"
"crypto/md5"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("client", func() {
var httpClient *tests.FakeHttpClient
var client *client
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client = newClient("API_KEY", "SECRET", "pt", httpClient)
})
Describe("albumGetInfo", func() {
It("returns an album on successful response", func() {
f, _ := os.Open("tests/fixtures/lastfm.album.getinfo.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
album, err := client.albumGetInfo(context.Background(), "Believe", "U2", "mbid-1234")
Expect(err).To(BeNil())
Expect(album.Name).To(Equal("Believe"))
Expect(httpClient.SavedRequest.URL.String()).To(Equal(apiBaseUrl + "?album=Believe&api_key=API_KEY&artist=U2&format=json&lang=pt&mbid=mbid-1234&method=album.getInfo"))
})
})
Describe("artistGetInfo", func() {
It("returns an artist for a successful response", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.getinfo.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
artist, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(BeNil())
Expect(artist.Name).To(Equal("U2"))
Expect(httpClient.SavedRequest.URL.String()).To(Equal(apiBaseUrl + "?api_key=API_KEY&artist=U2&format=json&lang=pt&method=artist.getInfo"))
})
It("fails if Last.fm returns an http status != 200", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`Internal Server Error`)),
StatusCode: 500,
}
_, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(MatchError("last.fm http status: (500)"))
})
It("fails if Last.fm returns an http status != 200", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"error":3,"message":"Invalid Method - No method with that name in this package"}`)),
StatusCode: 400,
}
_, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(MatchError(&lastFMError{Code: 3, Message: "Invalid Method - No method with that name in this package"}))
})
It("fails if Last.fm returns an error", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"error":6,"message":"The artist you supplied could not be found"}`)),
StatusCode: 200,
}
_, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(MatchError(&lastFMError{Code: 6, Message: "The artist you supplied could not be found"}))
})
It("fails if HttpClient.Do() returns error", func() {
httpClient.Err = errors.New("generic error")
_, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(MatchError("generic error"))
})
It("fails if returned body is not a valid JSON", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`<xml>NOT_VALID_JSON</xml>`)),
StatusCode: 200,
}
_, err := client.artistGetInfo(context.Background(), "U2")
Expect(err).To(MatchError("invalid character '<' looking for beginning of value"))
})
})
Describe("artistGetSimilar", func() {
It("returns an artist for a successful response", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.getsimilar.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
similar, err := client.artistGetSimilar(context.Background(), "U2", 2)
Expect(err).To(BeNil())
Expect(len(similar.Artists)).To(Equal(2))
Expect(httpClient.SavedRequest.URL.String()).To(Equal(apiBaseUrl + "?api_key=API_KEY&artist=U2&format=json&limit=2&method=artist.getSimilar"))
})
})
Describe("artistGetTopTracks", func() {
It("returns top tracks for a successful response", func() {
f, _ := os.Open("tests/fixtures/lastfm.artist.gettoptracks.json")
httpClient.Res = http.Response{Body: f, StatusCode: 200}
top, err := client.artistGetTopTracks(context.Background(), "U2", 2)
Expect(err).To(BeNil())
Expect(len(top.Track)).To(Equal(2))
Expect(httpClient.SavedRequest.URL.String()).To(Equal(apiBaseUrl + "?api_key=API_KEY&artist=U2&format=json&limit=2&method=artist.getTopTracks"))
})
})
Describe("GetToken", func() {
It("returns a token when the request is successful", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"token":"TOKEN"}`)),
StatusCode: 200,
}
Expect(client.GetToken(context.Background())).To(Equal("TOKEN"))
queryParams := httpClient.SavedRequest.URL.Query()
Expect(queryParams.Get("method")).To(Equal("auth.getToken"))
Expect(queryParams.Get("format")).To(Equal("json"))
Expect(queryParams.Get("api_key")).To(Equal("API_KEY"))
Expect(queryParams.Get("api_sig")).ToNot(BeEmpty())
})
})
Describe("getSession", func() {
It("returns a session key when the request is successful", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"session":{"name":"Navidrome","key":"SESSION_KEY","subscriber":0}}`)),
StatusCode: 200,
}
Expect(client.getSession(context.Background(), "TOKEN")).To(Equal("SESSION_KEY"))
queryParams := httpClient.SavedRequest.URL.Query()
Expect(queryParams.Get("method")).To(Equal("auth.getSession"))
Expect(queryParams.Get("format")).To(Equal("json"))
Expect(queryParams.Get("token")).To(Equal("TOKEN"))
Expect(queryParams.Get("api_key")).To(Equal("API_KEY"))
Expect(queryParams.Get("api_sig")).ToNot(BeEmpty())
})
})
Describe("sign", func() {
It("adds an api_sig param with the signature", func() {
params := url.Values{}
params.Add("d", "444")
params.Add("callback", "https://myserver.com")
params.Add("a", "111")
params.Add("format", "json")
params.Add("c", "333")
params.Add("b", "222")
client.sign(params)
Expect(params).To(HaveKey("api_sig"))
sig := params.Get("api_sig")
expected := fmt.Sprintf("%x", md5.Sum([]byte("a111b222c333d444SECRET")))
Expect(sig).To(Equal(expected))
})
})
})

View file

@ -5,13 +5,13 @@ import (
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestLastFM(t *testing.T) {
tests.Init(t, false)
log.SetLevel(log.LevelCritical)
log.SetLevel(log.LevelFatal)
RegisterFailHandler(Fail)
RunSpecs(t, "LastFM Test Suite")
}

View file

@ -0,0 +1,119 @@
package lastfm
type Response struct {
Artist Artist `json:"artist"`
SimilarArtists SimilarArtists `json:"similarartists"`
TopTracks TopTracks `json:"toptracks"`
Album Album `json:"album"`
Error int `json:"error"`
Message string `json:"message"`
Token string `json:"token"`
Session Session `json:"session"`
NowPlaying NowPlaying `json:"nowplaying"`
Scrobbles Scrobbles `json:"scrobbles"`
}
type Album struct {
Name string `json:"name"`
MBID string `json:"mbid"`
URL string `json:"url"`
Image []ExternalImage `json:"image"`
Description Description `json:"wiki"`
}
type Artist struct {
Name string `json:"name"`
MBID string `json:"mbid"`
URL string `json:"url"`
Image []ExternalImage `json:"image"`
Bio Description `json:"bio"`
}
type SimilarArtists struct {
Artists []Artist `json:"artist"`
Attr Attr `json:"@attr"`
}
type Attr struct {
Artist string `json:"artist"`
}
type ExternalImage struct {
URL string `json:"#text"`
Size string `json:"size"`
}
type Description struct {
Published string `json:"published"`
Summary string `json:"summary"`
Content string `json:"content"`
}
type Track struct {
Name string `json:"name"`
MBID string `json:"mbid"`
}
type TopTracks struct {
Track []Track `json:"track"`
Attr Attr `json:"@attr"`
}
type Session struct {
Name string `json:"name"`
Key string `json:"key"`
Subscriber int `json:"subscriber"`
}
type NowPlaying struct {
Artist struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"artist"`
IgnoredMessage struct {
Code string `json:"code"`
Text string `json:"#text"`
} `json:"ignoredMessage"`
Album struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"album"`
AlbumArtist struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"albumArtist"`
Track struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"track"`
}
type Scrobbles struct {
Attr struct {
Accepted int `json:"accepted"`
Ignored int `json:"ignored"`
} `json:"@attr"`
Scrobble struct {
Artist struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"artist"`
IgnoredMessage struct {
Code string `json:"code"`
Text string `json:"#text"`
} `json:"ignoredMessage"`
AlbumArtist struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"albumArtist"`
Timestamp string `json:"timestamp"`
Album struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"album"`
Track struct {
Corrected string `json:"corrected"`
Text string `json:"#text"`
} `json:"track"`
} `json:"scrobble"`
}

View file

@ -2,9 +2,9 @@ package lastfm
import (
"encoding/json"
"io/ioutil"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@ -12,7 +12,7 @@ var _ = Describe("LastFM responses", func() {
Describe("Artist", func() {
It("parses the response correctly", func() {
var resp Response
body, _ := ioutil.ReadFile("tests/fixtures/lastfm.artist.getinfo.json")
body, _ := os.ReadFile("tests/fixtures/lastfm.artist.getinfo.json")
err := json.Unmarshal(body, &resp)
Expect(err).To(BeNil())
@ -20,18 +20,13 @@ var _ = Describe("LastFM responses", func() {
Expect(resp.Artist.MBID).To(Equal("a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432"))
Expect(resp.Artist.URL).To(Equal("https://www.last.fm/music/U2"))
Expect(resp.Artist.Bio.Summary).To(ContainSubstring("U2 é uma das mais importantes bandas de rock de todos os tempos"))
similarArtists := []string{"Passengers", "INXS", "R.E.M.", "Simple Minds", "Bono"}
for i, similar := range similarArtists {
Expect(resp.Artist.Similar.Artists[i].Name).To(Equal(similar))
}
})
})
Describe("SimilarArtists", func() {
It("parses the response correctly", func() {
var resp Response
body, _ := ioutil.ReadFile("tests/fixtures/lastfm.artist.getsimilar.json")
body, _ := os.ReadFile("tests/fixtures/lastfm.artist.getsimilar.json")
err := json.Unmarshal(body, &resp)
Expect(err).To(BeNil())
@ -44,7 +39,7 @@ var _ = Describe("LastFM responses", func() {
Describe("TopTracks", func() {
It("parses the response correctly", func() {
var resp Response
body, _ := ioutil.ReadFile("tests/fixtures/lastfm.artist.gettoptracks.json")
body, _ := os.ReadFile("tests/fixtures/lastfm.artist.gettoptracks.json")
err := json.Unmarshal(body, &resp)
Expect(err).To(BeNil())
@ -58,12 +53,12 @@ var _ = Describe("LastFM responses", func() {
Describe("Error", func() {
It("parses the error response correctly", func() {
var error Error
var error Response
body := []byte(`{"error":3,"message":"Invalid Method - No method with that name in this package"}`)
err := json.Unmarshal(body, &error)
Expect(err).To(BeNil())
Expect(error.Code).To(Equal(3))
Expect(error.Error).To(Equal(3))
Expect(error.Message).To(Equal("Invalid Method - No method with that name in this package"))
})
})

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Account Linking Success</title>
</head>
<body>
<h2 id="msg"></h2>
<script>
setTimeout("document.getElementById('msg').innerHTML = 'Success! Your account is linked to Last.fm. You can close this tab now.';",2000)
document.addEventListener("DOMContentLoaded", () => {
window.close();
});
</script>
</body>
</html>

View file

@ -0,0 +1,129 @@
package listenbrainz
import (
"context"
"errors"
"net/http"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/core/scrobbler"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/utils/cache"
"github.com/navidrome/navidrome/utils/slice"
)
const (
listenBrainzAgentName = "listenbrainz"
sessionKeyProperty = "ListenBrainzSessionKey"
)
type listenBrainzAgent struct {
ds model.DataStore
sessionKeys *agents.SessionKeys
baseURL string
client *client
}
func listenBrainzConstructor(ds model.DataStore) *listenBrainzAgent {
l := &listenBrainzAgent{
ds: ds,
sessionKeys: &agents.SessionKeys{DataStore: ds, KeyName: sessionKeyProperty},
baseURL: conf.Server.ListenBrainz.BaseURL,
}
hc := &http.Client{
Timeout: consts.DefaultHttpClientTimeOut,
}
chc := cache.NewHTTPClient(hc, consts.DefaultHttpClientTimeOut)
l.client = newClient(l.baseURL, chc)
return l
}
func (l *listenBrainzAgent) AgentName() string {
return listenBrainzAgentName
}
func (l *listenBrainzAgent) formatListen(track *model.MediaFile) listenInfo {
artistMBIDs := slice.Map(track.Participants[model.RoleArtist], func(p model.Participant) string {
return p.MbzArtistID
})
artistNames := slice.Map(track.Participants[model.RoleArtist], func(p model.Participant) string {
return p.Name
})
li := listenInfo{
TrackMetadata: trackMetadata{
ArtistName: track.Artist,
TrackName: track.Title,
ReleaseName: track.Album,
AdditionalInfo: additionalInfo{
SubmissionClient: consts.AppName,
SubmissionClientVersion: consts.Version,
TrackNumber: track.TrackNumber,
ArtistNames: artistNames,
ArtistMBIDs: artistMBIDs,
RecordingMBID: track.MbzRecordingID,
ReleaseMBID: track.MbzAlbumID,
ReleaseGroupMBID: track.MbzReleaseGroupID,
DurationMs: int(track.Duration * 1000),
},
},
}
return li
}
func (l *listenBrainzAgent) NowPlaying(ctx context.Context, userId string, track *model.MediaFile) error {
sk, err := l.sessionKeys.Get(ctx, userId)
if err != nil || sk == "" {
return errors.Join(err, scrobbler.ErrNotAuthorized)
}
li := l.formatListen(track)
err = l.client.updateNowPlaying(ctx, sk, li)
if err != nil {
log.Warn(ctx, "ListenBrainz updateNowPlaying returned error", "track", track.Title, err)
return errors.Join(err, scrobbler.ErrUnrecoverable)
}
return nil
}
func (l *listenBrainzAgent) Scrobble(ctx context.Context, userId string, s scrobbler.Scrobble) error {
sk, err := l.sessionKeys.Get(ctx, userId)
if err != nil || sk == "" {
return errors.Join(err, scrobbler.ErrNotAuthorized)
}
li := l.formatListen(&s.MediaFile)
li.ListenedAt = int(s.TimeStamp.Unix())
err = l.client.scrobble(ctx, sk, li)
if err == nil {
return nil
}
var lbErr *listenBrainzError
isListenBrainzError := errors.As(err, &lbErr)
if !isListenBrainzError {
log.Warn(ctx, "ListenBrainz Scrobble returned HTTP error", "track", s.Title, err)
return errors.Join(err, scrobbler.ErrRetryLater)
}
if lbErr.Code == 500 || lbErr.Code == 503 {
return errors.Join(err, scrobbler.ErrRetryLater)
}
return errors.Join(err, scrobbler.ErrUnrecoverable)
}
func (l *listenBrainzAgent) IsAuthorized(ctx context.Context, userId string) bool {
sk, err := l.sessionKeys.Get(ctx, userId)
return err == nil && sk != ""
}
func init() {
conf.AddHook(func() {
if conf.Server.ListenBrainz.Enabled {
scrobbler.Register(listenBrainzAgentName, func(ds model.DataStore) scrobbler.Scrobbler {
return listenBrainzConstructor(ds)
})
}
})
}

View file

@ -0,0 +1,165 @@
package listenbrainz
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
"time"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/scrobbler"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
)
var _ = Describe("listenBrainzAgent", func() {
var ds model.DataStore
var ctx context.Context
var agent *listenBrainzAgent
var httpClient *tests.FakeHttpClient
var track *model.MediaFile
BeforeEach(func() {
ds = &tests.MockDataStore{}
ctx = context.Background()
_ = ds.UserProps(ctx).Put("user-1", sessionKeyProperty, "SK-1")
httpClient = &tests.FakeHttpClient{}
agent = listenBrainzConstructor(ds)
agent.client = newClient("http://localhost:8080", httpClient)
track = &model.MediaFile{
ID: "123",
Title: "Track Title",
Album: "Track Album",
Artist: "Track Artist",
TrackNumber: 1,
MbzRecordingID: "mbz-123",
MbzAlbumID: "mbz-456",
MbzReleaseGroupID: "mbz-789",
Duration: 142.2,
Participants: map[model.Role]model.ParticipantList{
model.RoleArtist: []model.Participant{
{Artist: model.Artist{ID: "ar-1", Name: "Artist 1", MbzArtistID: "mbz-111"}},
{Artist: model.Artist{ID: "ar-2", Name: "Artist 2", MbzArtistID: "mbz-222"}},
},
},
}
})
Describe("formatListen", func() {
It("constructs the listenInfo properly", func() {
lr := agent.formatListen(track)
Expect(lr).To(MatchAllFields(Fields{
"ListenedAt": Equal(0),
"TrackMetadata": MatchAllFields(Fields{
"ArtistName": Equal(track.Artist),
"TrackName": Equal(track.Title),
"ReleaseName": Equal(track.Album),
"AdditionalInfo": MatchAllFields(Fields{
"SubmissionClient": Equal(consts.AppName),
"SubmissionClientVersion": Equal(consts.Version),
"TrackNumber": Equal(track.TrackNumber),
"RecordingMBID": Equal(track.MbzRecordingID),
"ReleaseMBID": Equal(track.MbzAlbumID),
"ReleaseGroupMBID": Equal(track.MbzReleaseGroupID),
"ArtistNames": ConsistOf("Artist 1", "Artist 2"),
"ArtistMBIDs": ConsistOf("mbz-111", "mbz-222"),
"DurationMs": Equal(142200),
}),
}),
}))
})
})
Describe("NowPlaying", func() {
It("updates NowPlaying successfully", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(`{"status": "ok"}`)), StatusCode: 200}
err := agent.NowPlaying(ctx, "user-1", track)
Expect(err).ToNot(HaveOccurred())
})
It("returns ErrNotAuthorized if user is not linked", func() {
err := agent.NowPlaying(ctx, "user-2", track)
Expect(err).To(MatchError(scrobbler.ErrNotAuthorized))
})
})
Describe("Scrobble", func() {
var sc scrobbler.Scrobble
BeforeEach(func() {
sc = scrobbler.Scrobble{MediaFile: *track, TimeStamp: time.Now()}
})
It("sends a Scrobble successfully", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(`{"status": "ok"}`)), StatusCode: 200}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).ToNot(HaveOccurred())
})
It("sets the Timestamp properly", func() {
httpClient.Res = http.Response{Body: io.NopCloser(bytes.NewBufferString(`{"status": "ok"}`)), StatusCode: 200}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).ToNot(HaveOccurred())
decoder := json.NewDecoder(httpClient.SavedRequest.Body)
var lr listenBrainzRequestBody
err = decoder.Decode(&lr)
Expect(err).ToNot(HaveOccurred())
Expect(lr.Payload[0].ListenedAt).To(Equal(int(sc.TimeStamp.Unix())))
})
It("returns ErrNotAuthorized if user is not linked", func() {
err := agent.Scrobble(ctx, "user-2", sc)
Expect(err).To(MatchError(scrobbler.ErrNotAuthorized))
})
It("returns ErrRetryLater on error 503", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 503, "error": "Cannot submit listens to queue, please try again later."}`)),
StatusCode: 503,
}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrRetryLater on error 500", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 500, "error": "Something went wrong. Please try again."}`)),
StatusCode: 500,
}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrRetryLater on http errors", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`Bad Gateway`)),
StatusCode: 500,
}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).To(MatchError(scrobbler.ErrRetryLater))
})
It("returns ErrUnrecoverable on other errors", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 400, "error": "BadRequest: Invalid JSON document submitted."}`)),
StatusCode: 400,
}
err := agent.Scrobble(ctx, "user-1", sc)
Expect(err).To(MatchError(scrobbler.ErrUnrecoverable))
})
})
})

View file

@ -0,0 +1,121 @@
package listenbrainz
import (
"context"
"encoding/json"
"errors"
"net/http"
"github.com/deluan/rest"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/core/agents"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/request"
"github.com/navidrome/navidrome/server"
)
type sessionKeysRepo interface {
Put(ctx context.Context, userId, sessionKey string) error
Get(ctx context.Context, userId string) (string, error)
Delete(ctx context.Context, userId string) error
}
type Router struct {
http.Handler
ds model.DataStore
sessionKeys sessionKeysRepo
client *client
}
func NewRouter(ds model.DataStore) *Router {
r := &Router{
ds: ds,
sessionKeys: &agents.SessionKeys{DataStore: ds, KeyName: sessionKeyProperty},
}
r.Handler = r.routes()
hc := &http.Client{
Timeout: consts.DefaultHttpClientTimeOut,
}
r.client = newClient(conf.Server.ListenBrainz.BaseURL, hc)
return r
}
func (s *Router) routes() http.Handler {
r := chi.NewRouter()
r.Group(func(r chi.Router) {
r.Use(server.Authenticator(s.ds))
r.Use(server.JWTRefresher)
r.Get("/link", s.getLinkStatus)
r.Put("/link", s.link)
r.Delete("/link", s.unlink)
})
return r
}
func (s *Router) getLinkStatus(w http.ResponseWriter, r *http.Request) {
resp := map[string]interface{}{}
u, _ := request.UserFrom(r.Context())
key, err := s.sessionKeys.Get(r.Context(), u.ID)
if err != nil && !errors.Is(err, model.ErrNotFound) {
resp["error"] = err
resp["status"] = false
_ = rest.RespondWithJSON(w, http.StatusInternalServerError, resp)
return
}
resp["status"] = key != ""
_ = rest.RespondWithJSON(w, http.StatusOK, resp)
}
func (s *Router) link(w http.ResponseWriter, r *http.Request) {
type tokenPayload struct {
Token string `json:"token"`
}
var payload tokenPayload
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
if payload.Token == "" {
_ = rest.RespondWithError(w, http.StatusBadRequest, "Token is required")
return
}
u, _ := request.UserFrom(r.Context())
resp, err := s.client.validateToken(r.Context(), payload.Token)
if err != nil {
log.Error(r.Context(), "Could not validate ListenBrainz token", "userId", u.ID, "requestId", middleware.GetReqID(r.Context()), err)
_ = rest.RespondWithError(w, http.StatusInternalServerError, err.Error())
return
}
if !resp.Valid {
_ = rest.RespondWithError(w, http.StatusBadRequest, "Invalid token")
return
}
err = s.sessionKeys.Put(r.Context(), u.ID, payload.Token)
if err != nil {
log.Error("Could not save ListenBrainz token", "userId", u.ID, "requestId", middleware.GetReqID(r.Context()), err)
_ = rest.RespondWithError(w, http.StatusInternalServerError, err.Error())
return
}
_ = rest.RespondWithJSON(w, http.StatusOK, map[string]interface{}{"status": resp.Valid, "user": resp.UserName})
}
func (s *Router) unlink(w http.ResponseWriter, r *http.Request) {
u, _ := request.UserFrom(r.Context())
err := s.sessionKeys.Delete(r.Context(), u.ID)
if err != nil {
_ = rest.RespondWithError(w, http.StatusInternalServerError, err.Error())
} else {
_ = rest.RespondWithJSON(w, http.StatusOK, map[string]string{})
}
}

View file

@ -0,0 +1,130 @@
package listenbrainz
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"strings"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("ListenBrainz Auth Router", func() {
var sk *fakeSessionKeys
var httpClient *tests.FakeHttpClient
var r Router
var req *http.Request
var resp *httptest.ResponseRecorder
BeforeEach(func() {
sk = &fakeSessionKeys{KeyName: sessionKeyProperty}
httpClient = &tests.FakeHttpClient{}
cl := newClient("http://localhost/", httpClient)
r = Router{
sessionKeys: sk,
client: cl,
}
resp = httptest.NewRecorder()
})
Describe("getLinkStatus", func() {
It("returns false when there is no stored session key", func() {
req = httptest.NewRequest("GET", "/listenbrainz/link", nil)
r.getLinkStatus(resp, req)
Expect(resp.Code).To(Equal(http.StatusOK))
var parsed map[string]interface{}
Expect(json.Unmarshal(resp.Body.Bytes(), &parsed)).To(BeNil())
Expect(parsed["status"]).To(Equal(false))
})
It("returns true when there is a stored session key", func() {
sk.KeyValue = "sk-1"
req = httptest.NewRequest("GET", "/listenbrainz/link", nil)
r.getLinkStatus(resp, req)
Expect(resp.Code).To(Equal(http.StatusOK))
var parsed map[string]interface{}
Expect(json.Unmarshal(resp.Body.Bytes(), &parsed)).To(BeNil())
Expect(parsed["status"]).To(Equal(true))
})
})
Describe("link", func() {
It("returns bad request when no token is sent", func() {
req = httptest.NewRequest("PUT", "/listenbrainz/link", strings.NewReader(`{}`))
r.link(resp, req)
Expect(resp.Code).To(Equal(http.StatusBadRequest))
})
It("returns bad request when the token is invalid", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 200, "message": "Token invalid.", "valid": false}`)),
StatusCode: 200,
}
req = httptest.NewRequest("PUT", "/listenbrainz/link", strings.NewReader(`{"token": "invalid-tok-1"}`))
r.link(resp, req)
Expect(resp.Code).To(Equal(http.StatusBadRequest))
})
It("returns true and the username when the token is valid", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 200, "message": "Token valid.", "user_name": "ListenBrainzUser", "valid": true}`)),
StatusCode: 200,
}
req = httptest.NewRequest("PUT", "/listenbrainz/link", strings.NewReader(`{"token": "tok-1"}`))
r.link(resp, req)
Expect(resp.Code).To(Equal(http.StatusOK))
var parsed map[string]interface{}
Expect(json.Unmarshal(resp.Body.Bytes(), &parsed)).To(BeNil())
Expect(parsed["status"]).To(Equal(true))
Expect(parsed["user"]).To(Equal("ListenBrainzUser"))
})
It("saves the session key when the token is valid", func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 200, "message": "Token valid.", "user_name": "ListenBrainzUser", "valid": true}`)),
StatusCode: 200,
}
req = httptest.NewRequest("PUT", "/listenbrainz/link", strings.NewReader(`{"token": "tok-1"}`))
r.link(resp, req)
Expect(resp.Code).To(Equal(http.StatusOK))
Expect(sk.KeyValue).To(Equal("tok-1"))
})
})
Describe("unlink", func() {
It("removes the session key when unlinking", func() {
sk.KeyValue = "tok-1"
req = httptest.NewRequest("DELETE", "/listenbrainz/link", nil)
r.unlink(resp, req)
Expect(resp.Code).To(Equal(http.StatusOK))
Expect(sk.KeyValue).To(Equal(""))
})
})
})
type fakeSessionKeys struct {
KeyName string
KeyValue string
}
func (sk *fakeSessionKeys) Put(ctx context.Context, userId, sessionKey string) error {
sk.KeyValue = sessionKey
return nil
}
func (sk *fakeSessionKeys) Get(ctx context.Context, userId string) (string, error) {
return sk.KeyValue, nil
}
func (sk *fakeSessionKeys) Delete(ctx context.Context, userId string) error {
sk.KeyValue = ""
return nil
}

View file

@ -0,0 +1,179 @@
package listenbrainz
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"path"
"github.com/navidrome/navidrome/log"
)
type listenBrainzError struct {
Code int
Message string
}
func (e *listenBrainzError) Error() string {
return fmt.Sprintf("ListenBrainz error(%d): %s", e.Code, e.Message)
}
type httpDoer interface {
Do(req *http.Request) (*http.Response, error)
}
func newClient(baseURL string, hc httpDoer) *client {
return &client{baseURL, hc}
}
type client struct {
baseURL string
hc httpDoer
}
type listenBrainzResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Error string `json:"error"`
Status string `json:"status"`
Valid bool `json:"valid"`
UserName string `json:"user_name"`
}
type listenBrainzRequest struct {
ApiKey string
Body listenBrainzRequestBody
}
type listenBrainzRequestBody struct {
ListenType listenType `json:"listen_type,omitempty"`
Payload []listenInfo `json:"payload,omitempty"`
}
type listenType string
const (
Single listenType = "single"
PlayingNow listenType = "playing_now"
)
type listenInfo struct {
ListenedAt int `json:"listened_at,omitempty"`
TrackMetadata trackMetadata `json:"track_metadata,omitempty"`
}
type trackMetadata struct {
ArtistName string `json:"artist_name,omitempty"`
TrackName string `json:"track_name,omitempty"`
ReleaseName string `json:"release_name,omitempty"`
AdditionalInfo additionalInfo `json:"additional_info,omitempty"`
}
type additionalInfo struct {
SubmissionClient string `json:"submission_client,omitempty"`
SubmissionClientVersion string `json:"submission_client_version,omitempty"`
TrackNumber int `json:"tracknumber,omitempty"`
ArtistNames []string `json:"artist_names,omitempty"`
ArtistMBIDs []string `json:"artist_mbids,omitempty"`
RecordingMBID string `json:"recording_mbid,omitempty"`
ReleaseMBID string `json:"release_mbid,omitempty"`
ReleaseGroupMBID string `json:"release_group_mbid,omitempty"`
DurationMs int `json:"duration_ms,omitempty"`
}
func (c *client) validateToken(ctx context.Context, apiKey string) (*listenBrainzResponse, error) {
r := &listenBrainzRequest{
ApiKey: apiKey,
}
response, err := c.makeRequest(ctx, http.MethodGet, "validate-token", r)
if err != nil {
return nil, err
}
return response, nil
}
func (c *client) updateNowPlaying(ctx context.Context, apiKey string, li listenInfo) error {
r := &listenBrainzRequest{
ApiKey: apiKey,
Body: listenBrainzRequestBody{
ListenType: PlayingNow,
Payload: []listenInfo{li},
},
}
resp, err := c.makeRequest(ctx, http.MethodPost, "submit-listens", r)
if err != nil {
return err
}
if resp.Status != "ok" {
log.Warn(ctx, "ListenBrainz: NowPlaying was not accepted", "status", resp.Status)
}
return nil
}
func (c *client) scrobble(ctx context.Context, apiKey string, li listenInfo) error {
r := &listenBrainzRequest{
ApiKey: apiKey,
Body: listenBrainzRequestBody{
ListenType: Single,
Payload: []listenInfo{li},
},
}
resp, err := c.makeRequest(ctx, http.MethodPost, "submit-listens", r)
if err != nil {
return err
}
if resp.Status != "ok" {
log.Warn(ctx, "ListenBrainz: Scrobble was not accepted", "status", resp.Status)
}
return nil
}
func (c *client) path(endpoint string) (string, error) {
u, err := url.Parse(c.baseURL)
if err != nil {
return "", err
}
u.Path = path.Join(u.Path, endpoint)
return u.String(), nil
}
func (c *client) makeRequest(ctx context.Context, method string, endpoint string, r *listenBrainzRequest) (*listenBrainzResponse, error) {
b, _ := json.Marshal(r.Body)
uri, err := c.path(endpoint)
if err != nil {
return nil, err
}
req, _ := http.NewRequestWithContext(ctx, method, uri, bytes.NewBuffer(b))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
if r.ApiKey != "" {
req.Header.Add("Authorization", fmt.Sprintf("Token %s", r.ApiKey))
}
log.Trace(ctx, fmt.Sprintf("Sending ListenBrainz %s request", req.Method), "url", req.URL)
resp, err := c.hc.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
decoder := json.NewDecoder(resp.Body)
var response listenBrainzResponse
jsonErr := decoder.Decode(&response)
if resp.StatusCode != 200 && jsonErr != nil {
return nil, fmt.Errorf("ListenBrainz: HTTP Error, Status: (%d)", resp.StatusCode)
}
if jsonErr != nil {
return nil, jsonErr
}
if response.Code != 0 && response.Code != 200 {
return &response, &listenBrainzError{Code: response.Code, Message: response.Error}
}
return &response, nil
}

View file

@ -0,0 +1,120 @@
package listenbrainz
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
"os"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("client", func() {
var httpClient *tests.FakeHttpClient
var client *client
BeforeEach(func() {
httpClient = &tests.FakeHttpClient{}
client = newClient("BASE_URL/", httpClient)
})
Describe("listenBrainzResponse", func() {
It("parses a response properly", func() {
var response listenBrainzResponse
err := json.Unmarshal([]byte(`{"code": 200, "message": "Message", "user_name": "UserName", "valid": true, "status": "ok", "error": "Error"}`), &response)
Expect(err).ToNot(HaveOccurred())
Expect(response.Code).To(Equal(200))
Expect(response.Message).To(Equal("Message"))
Expect(response.UserName).To(Equal("UserName"))
Expect(response.Valid).To(BeTrue())
Expect(response.Status).To(Equal("ok"))
Expect(response.Error).To(Equal("Error"))
})
})
Describe("validateToken", func() {
BeforeEach(func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"code": 200, "message": "Token valid.", "user_name": "ListenBrainzUser", "valid": true}`)),
StatusCode: 200,
}
})
It("formats the request properly", func() {
_, err := client.validateToken(context.Background(), "LB-TOKEN")
Expect(err).ToNot(HaveOccurred())
Expect(httpClient.SavedRequest.Method).To(Equal(http.MethodGet))
Expect(httpClient.SavedRequest.URL.String()).To(Equal("BASE_URL/validate-token"))
Expect(httpClient.SavedRequest.Header.Get("Authorization")).To(Equal("Token LB-TOKEN"))
Expect(httpClient.SavedRequest.Header.Get("Content-Type")).To(Equal("application/json; charset=UTF-8"))
})
It("parses and returns the response", func() {
res, err := client.validateToken(context.Background(), "LB-TOKEN")
Expect(err).ToNot(HaveOccurred())
Expect(res.Valid).To(Equal(true))
Expect(res.UserName).To(Equal("ListenBrainzUser"))
})
})
Context("with listenInfo", func() {
var li listenInfo
BeforeEach(func() {
httpClient.Res = http.Response{
Body: io.NopCloser(bytes.NewBufferString(`{"status": "ok"}`)),
StatusCode: 200,
}
li = listenInfo{
TrackMetadata: trackMetadata{
ArtistName: "Track Artist",
TrackName: "Track Title",
ReleaseName: "Track Album",
AdditionalInfo: additionalInfo{
TrackNumber: 1,
ArtistNames: []string{"Artist 1", "Artist 2"},
ArtistMBIDs: []string{"mbz-789", "mbz-012"},
RecordingMBID: "mbz-123",
ReleaseMBID: "mbz-456",
DurationMs: 142200,
},
},
}
})
Describe("updateNowPlaying", func() {
It("formats the request properly", func() {
Expect(client.updateNowPlaying(context.Background(), "LB-TOKEN", li)).To(Succeed())
Expect(httpClient.SavedRequest.Method).To(Equal(http.MethodPost))
Expect(httpClient.SavedRequest.URL.String()).To(Equal("BASE_URL/submit-listens"))
Expect(httpClient.SavedRequest.Header.Get("Authorization")).To(Equal("Token LB-TOKEN"))
Expect(httpClient.SavedRequest.Header.Get("Content-Type")).To(Equal("application/json; charset=UTF-8"))
body, _ := io.ReadAll(httpClient.SavedRequest.Body)
f, _ := os.ReadFile("tests/fixtures/listenbrainz.nowplaying.request.json")
Expect(body).To(MatchJSON(f))
})
})
Describe("scrobble", func() {
BeforeEach(func() {
li.ListenedAt = 1635000000
})
It("formats the request properly", func() {
Expect(client.scrobble(context.Background(), "LB-TOKEN", li)).To(Succeed())
Expect(httpClient.SavedRequest.Method).To(Equal(http.MethodPost))
Expect(httpClient.SavedRequest.URL.String()).To(Equal("BASE_URL/submit-listens"))
Expect(httpClient.SavedRequest.Header.Get("Authorization")).To(Equal("Token LB-TOKEN"))
Expect(httpClient.SavedRequest.Header.Get("Content-Type")).To(Equal("application/json; charset=UTF-8"))
body, _ := io.ReadAll(httpClient.SavedRequest.Body)
f, _ := os.ReadFile("tests/fixtures/listenbrainz.scrobble.request.json")
Expect(body).To(MatchJSON(f))
})
})
})
})

View file

@ -0,0 +1,17 @@
package listenbrainz
import (
"testing"
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestListenBrainz(t *testing.T) {
tests.Init(t, false)
log.SetLevel(log.LevelFatal)
RegisterFailHandler(Fail)
RunSpecs(t, "ListenBrainz Test Suite")
}

View file

@ -0,0 +1,52 @@
package agents
import (
"context"
"github.com/Masterminds/squirrel"
"github.com/navidrome/navidrome/model"
)
const LocalAgentName = "local"
type localAgent struct {
ds model.DataStore
}
func localsConstructor(ds model.DataStore) Interface {
return &localAgent{ds}
}
func (p *localAgent) AgentName() string {
return LocalAgentName
}
func (p *localAgent) GetArtistTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]Song, error) {
top, err := p.ds.MediaFile(ctx).GetAll(model.QueryOptions{
Sort: "playCount",
Order: "desc",
Max: count,
Filters: squirrel.And{
squirrel.Eq{"artist_id": id},
squirrel.Or{
squirrel.Eq{"starred": true},
squirrel.Eq{"rating": 5},
},
},
})
if err != nil {
return nil, err
}
var result []Song
for _, s := range top {
result = append(result, Song{
Name: s.Title,
MBID: s.MbzReleaseTrackID,
})
}
return result, nil
}
func init() {
Register(LocalAgentName, localsConstructor)
}

View file

@ -0,0 +1,25 @@
package agents
import (
"context"
"github.com/navidrome/navidrome/model"
)
// SessionKeys is a simple wrapper around the UserPropsRepository
type SessionKeys struct {
model.DataStore
KeyName string
}
func (sk *SessionKeys) Put(ctx context.Context, userId, sessionKey string) error {
return sk.DataStore.UserProps(ctx).Put(userId, sk.KeyName, sessionKey)
}
func (sk *SessionKeys) Get(ctx context.Context, userId string) (string, error) {
return sk.DataStore.UserProps(ctx).Get(userId, sk.KeyName)
}
func (sk *SessionKeys) Delete(ctx context.Context, userId string) error {
return sk.DataStore.UserProps(ctx).Delete(userId, sk.KeyName)
}

View file

@ -0,0 +1,37 @@
package agents
import (
"context"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/tests"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("SessionKeys", func() {
ctx := context.Background()
user := model.User{ID: "u-1"}
ds := &tests.MockDataStore{MockedUserProps: &tests.MockedUserPropsRepo{}}
sk := SessionKeys{DataStore: ds, KeyName: "fakeSessionKey"}
It("uses the assigned key name", func() {
Expect(sk.KeyName).To(Equal("fakeSessionKey"))
})
It("stores a value in the DB", func() {
Expect(sk.Put(ctx, user.ID, "test-stored-value")).To(BeNil())
})
It("fetches the stored value", func() {
value, err := sk.Get(ctx, user.ID)
Expect(err).ToNot(HaveOccurred())
Expect(value).To(Equal("test-stored-value"))
})
It("deletes the stored value", func() {
Expect(sk.Delete(ctx, user.ID)).To(BeNil())
})
It("handles a not found value", func() {
_, err := sk.Get(ctx, "u-2")
Expect(err).To(MatchError(model.ErrNotFound))
})
})

View file

@ -6,7 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strconv"
@ -21,21 +21,21 @@ var (
ErrNotFound = errors.New("spotify: not found")
)
type HttpClient interface {
type httpDoer interface {
Do(req *http.Request) (*http.Response, error)
}
func NewClient(id, secret string, hc HttpClient) *Client {
return &Client{id, secret, hc}
func newClient(id, secret string, hc httpDoer) *client {
return &client{id, secret, hc}
}
type Client struct {
type client struct {
id string
secret string
hc HttpClient
hc httpDoer
}
func (c *Client) SearchArtists(ctx context.Context, name string, limit int) ([]Artist, error) {
func (c *client) searchArtists(ctx context.Context, name string, limit int) ([]Artist, error) {
token, err := c.authorize(ctx)
if err != nil {
return nil, err
@ -46,7 +46,7 @@ func (c *Client) SearchArtists(ctx context.Context, name string, limit int) ([]A
params.Add("q", name)
params.Add("offset", "0")
params.Add("limit", strconv.Itoa(limit))
req, _ := http.NewRequest("GET", apiBaseUrl+"search", nil)
req, _ := http.NewRequestWithContext(ctx, "GET", apiBaseUrl+"search", nil)
req.URL.RawQuery = params.Encode()
req.Header.Add("Authorization", "Bearer "+token)
@ -62,13 +62,14 @@ func (c *Client) SearchArtists(ctx context.Context, name string, limit int) ([]A
return results.Artists.Items, err
}
func (c *Client) authorize(ctx context.Context) (string, error) {
func (c *client) authorize(ctx context.Context) (string, error) {
payload := url.Values{}
payload.Add("grant_type", "client_credentials")
req, _ := http.NewRequest("POST", "https://accounts.spotify.com/api/token", strings.NewReader(payload.Encode()))
encodePayload := payload.Encode()
req, _ := http.NewRequestWithContext(ctx, "POST", "https://accounts.spotify.com/api/token", strings.NewReader(encodePayload))
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Content-Length", strconv.Itoa(len(payload.Encode())))
req.Header.Add("Content-Length", strconv.Itoa(len(encodePayload)))
auth := c.id + ":" + c.secret
req.Header.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(auth)))
@ -85,14 +86,15 @@ func (c *Client) authorize(ctx context.Context) (string, error) {
return "", errors.New("invalid response")
}
func (c *Client) makeRequest(req *http.Request, response interface{}) error {
func (c *client) makeRequest(req *http.Request, response interface{}) error {
log.Trace(req.Context(), fmt.Sprintf("Sending Spotify %s request", req.Method), "url", req.URL)
resp, err := c.hc.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
@ -104,7 +106,7 @@ func (c *Client) makeRequest(req *http.Request, response interface{}) error {
return json.Unmarshal(data, response)
}
func (c *Client) parseError(data []byte) error {
func (c *client) parseError(data []byte) error {
var e Error
err := json.Unmarshal(data, &e)
if err != nil {

View file

@ -3,21 +3,21 @@ package spotify
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Client", func() {
var _ = Describe("client", func() {
var httpClient *fakeHttpClient
var client *Client
var client *client
BeforeEach(func() {
httpClient = &fakeHttpClient{}
client = NewClient("SPOTIFY_ID", "SPOTIFY_SECRET", httpClient)
client = newClient("SPOTIFY_ID", "SPOTIFY_SECRET", httpClient)
})
Describe("ArtistImages", func() {
@ -26,10 +26,10 @@ var _ = Describe("Client", func() {
httpClient.mock("https://api.spotify.com/v1/search", http.Response{Body: f, StatusCode: 200})
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
})
artists, err := client.SearchArtists(context.TODO(), "U2", 10)
artists, err := client.searchArtists(context.TODO(), "U2", 10)
Expect(err).To(BeNil())
Expect(artists).To(HaveLen(20))
Expect(artists[0].Popularity).To(Equal(82))
@ -44,7 +44,7 @@ var _ = Describe("Client", func() {
It("fails if artist was not found", func() {
httpClient.mock("https://api.spotify.com/v1/search", http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{
Body: io.NopCloser(bytes.NewBufferString(`{
"artists" : {
"href" : "https://api.spotify.com/v1/search?query=dasdasdas%2Cdna&type=artist&offset=0&limit=20",
"items" : [ ], "limit" : 20, "next" : null, "offset" : 0, "previous" : null, "total" : 0
@ -52,10 +52,10 @@ var _ = Describe("Client", func() {
})
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
})
_, err := client.SearchArtists(context.TODO(), "U2", 10)
_, err := client.searchArtists(context.TODO(), "U2", 10)
Expect(err).To(MatchError(ErrNotFound))
})
@ -64,10 +64,10 @@ var _ = Describe("Client", func() {
httpClient.mock("https://api.spotify.com/v1/search", http.Response{Body: f, StatusCode: 200})
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 400,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
})
_, err := client.SearchArtists(context.TODO(), "U2", 10)
_, err := client.searchArtists(context.TODO(), "U2", 10)
Expect(err).To(MatchError("spotify error(invalid_client): Invalid client"))
})
})
@ -76,7 +76,7 @@ var _ = Describe("Client", func() {
It("returns an access_token on successful authorization", func() {
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"access_token": "NEW_ACCESS_TOKEN","token_type": "Bearer","expires_in": 3600}`)),
})
token, err := client.authorize(context.TODO())
@ -89,7 +89,7 @@ var _ = Describe("Client", func() {
It("fails on unsuccessful authorization", func() {
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 400,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"error":"invalid_client","error_description":"Invalid client"}`)),
})
_, err := client.authorize(context.TODO())
@ -99,7 +99,7 @@ var _ = Describe("Client", func() {
It("fails on invalid JSON response", func() {
httpClient.mock("https://accounts.spotify.com/api/token", http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{NOT_VALID}`)),
Body: io.NopCloser(bytes.NewBufferString(`{NOT_VALID}`)),
})
_, err := client.authorize(context.TODO())

View file

@ -2,9 +2,9 @@ package spotify
import (
"encoding/json"
"io/ioutil"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@ -12,7 +12,7 @@ var _ = Describe("Responses", func() {
Describe("Search type=artist", func() {
It("parses the artist search result correctly ", func() {
var resp SearchResults
body, _ := ioutil.ReadFile("tests/fixtures/spotify.search.artist.json")
body, _ := os.ReadFile("tests/fixtures/spotify.search.artist.json")
err := json.Unmarshal(body, &resp)
Expect(err).To(BeNil())

Some files were not shown because too many files have changed in this diff Show more