Author SHA1 Message Date
yaemiku c2e2e037a2 Merge branch 'master' into default_music_folder 2026-04-26 03:57:41 +02:00
yaemiku 0f469d7eac Merge branch 'master' into default_music_folder 2026-04-26 03:02:02 +02:00
Eric Munson f79af9c6a8 feat(podcast): ensure that any error path out of doPodcastDownload sets status (#672)
Release / Lint and test (push) Successful in 2m44s
Release / Run Release Please (push) Failing after 15s
Release / Notify IRC (push) Has been skipped
Release / Build binaries (386, linux) (push) Has been skipped
Release / Build binaries (386, windows) (push) Has been skipped
Release / Build binaries (amd64, darwin) (push) Has been skipped
Release / Build binaries (amd64, linux) (push) Has been skipped
Release / Build binaries (amd64, windows) (push) Has been skipped
Release / Build binaries (arm64, darwin) (push) Has been skipped
Release / Build binaries (arm64, linux) (push) Has been skipped
Release / Build, tag, and publish Docker image (push) Has been skipped
Some error paths out of this function are not setting the podcast status
to 'error'. Move the deferred error checking earlier to ensure the
status is set.

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-04-26 03:00:56 +02:00
Florian Sorko 8df5f95a3d fix(podcast): fix crash if itunes extensions are missing (#668)
I came across this issue when I started to use a custom RSS
generator that works fine for e.g. the Apple Podcasts app
but results in a crash in gonic.

I found these nil pointer dereferences by looking at the stacktraces
only.
No time was spent looking for additional locations were this might need to
be fixed.

The custom generator if that helps
https://gist.github.com/diepfote/59aaf5eb8ea3e2d7bcdd97b8efd2a472
2026-04-26 03:00:55 +02:00
Eric Munson 3c46097df3 feat(subsonic): make error codes match Open Subsonic spec (#671)
There were a number of error codes being returned that did not match the
the code given by the spec. Primarily this was the use of error code 10
(missing input parameter) when 70 (data not found) was the more
appropriate return. Though several uses of 10 are actually 0 (internal
server or unspecified error).

Signed-off-by: Eric B Munson <eric@munsonfam.org>
2026-04-26 03:00:54 +02:00
sentriz 13098660d2 feat(playlist): use relative paths in m3u playlists
write playlist item paths relative to the playlist file directory, an resolve relative paths back to absolute on read

closes #537
closes #529
2026-04-26 03:00:53 +02:00
sentriz fb3fb745f8 fix(scanner): reset batch timer on fsnotify Remove events
fixes #637
2026-04-26 03:00:52 +02:00
sentriz ee43c4db00 fix(subsonic): update homepage URL casing
closes #664
2026-04-26 03:00:51 +02:00
sentriz da5f2ca01c update readme
closes #667
2026-04-26 03:00:50 +02:00
Kynn | CherryblueandSenan Kelly e4a07750e4 feat: support track level year tags (#661)
* [ PR Year @ Track-level ] This resolves issue #549

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* [ PR #661 ] Fixes proposed by Sentriz (file indentation, simpler call to functions)

* [ PR #661 ] Fix File indentation for construct_by_folder

* [ PR #661 ] Set known tracks year field to their parent (album) year value ; until next deep scan.

* [ PR #661 ] Fix database field names in sql query

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

* Update db/migrations.go

Co-authored-by: Senan Kelly <senan@senan.xyz>

---------

Co-authored-by: Senan Kelly <senan@senan.xyz>
2026-04-26 03:00:49 +02:00
sentriz d42ce531c6 fix(listenbrainz): disable post-quantum TLS to avoid connection reset errors
listenbrainz's server can't handle the larger TLS ClientHello from
Go's post-quantum key exchange (Kyber). Explicitly set classic curve
preferences to avoid "connection reset by peer" errors.

https://github.com/golang/go/issues/70139
2026-04-26 03:00:48 +02:00
yaemiku 002a38f7a6 Merge branch 'master' into default_music_folder 2026-03-11 22:15:20 +01:00
yaemiku a7929ecb38 Merge branch 'master' into default_music_folder 2026-02-19 03:26:10 +01:00
yaemiku a63df166b0 Add default music path flag 2026-02-19 02:51:10 +01:00
sentriz 25a061f44e fix(listenbrainz): disable keep-alive to avoid connection reset errors 2026-02-17 15:36:20 +00:00
6 changed files with 57 additions and 52 deletions

No files matched your search

+1
View File
@@ -52,6 +52,7 @@ password can then be changed from the web interface
| env var | command line arg | description | | env var | command line arg | description |
| ----------------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) | | `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) |
| `GONIC_DEFAULT_MUSIC_PATH` | `-default-music-path` | default music path for when no folder is selected in client (useful for when client does not support choosing a folder) |
| `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory | | `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory |
| `GONIC_PLAYLISTS_PATH` | `-playlists-path` | path to new or existing directory with m3u files for subsonic playlists. items in the directory should be in the format `<userid>/<name>.m3u`. for example the admin user could have `1/my-playlist.m3u`. gonic create and make changes to these playlists over the subsonic api. | | `GONIC_PLAYLISTS_PATH` | `-playlists-path` | path to new or existing directory with m3u files for subsonic playlists. items in the directory should be in the format `<userid>/<name>.m3u`. for example the admin user could have `1/my-playlist.m3u`. gonic create and make changes to these playlists over the subsonic api. |
| `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc | | `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc |
+2 -1
View File
@@ -62,6 +62,7 @@ func main() {
var confMusicPaths pathAliases var confMusicPaths pathAliases
flag.Var(&confMusicPaths, "music-path", "path to music") flag.Var(&confMusicPaths, "music-path", "path to music")
defaultMusicPath := flag.String("default-music-path", "", "interval (in minutes) to automatically scan music (optional)")
confPlaylistsPath := flag.String("playlists-path", "", "path to your list of new or existing m3u playlists that gonic can manage") confPlaylistsPath := flag.String("playlists-path", "", "path to your list of new or existing m3u playlists that gonic can manage")
@@ -256,7 +257,7 @@ func main() {
if err != nil { if err != nil {
log.Panicf("error creating admin controller: %v\n", err) log.Panicf("error creating admin controller: %v\n", err)
} }
ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath) ctrlSubsonic, err := ctrlsubsonic.New(dbc, scannr, musicPaths, *defaultMusicPath, *confPodcastPath, cacheDirAudio, cacheDirCovers, jukebx, playlistStore, scrobblers, podcast, transcoder, lastfmClient, artistInfoCache, albumInfoCache, tagReader, resolveProxyPath)
if err != nil { if err != nil {
log.Panicf("error creating subsonic controller: %v\n", err) log.Panicf("error creating subsonic controller: %v\n", err)
} }
+3 -1
View File
@@ -56,6 +56,7 @@ type Controller struct {
dbc *db.DB dbc *db.DB
scanner *scanner.Scanner scanner *scanner.Scanner
musicPaths []MusicPath musicPaths []MusicPath
defaultMusicPath string
podcastsPath string podcastsPath string
cacheAudioPath string cacheAudioPath string
cacheCoverPath string cacheCoverPath string
@@ -72,13 +73,14 @@ type Controller struct {
resolveProxyPath ProxyPathResolver resolveProxyPath ProxyPathResolver
} }
func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, tagReader tags.Reader, resolveProxyPath ProxyPathResolver) (*Controller, error) { func New(dbc *db.DB, scannr *scanner.Scanner, musicPaths []MusicPath, defaultMusicPath string, podcastsPath string, cacheAudioPath string, cacheCoverPath string, jukebox *jukebox.Jukebox, playlistStore *playlist.Store, scrobblers []scrobble.Scrobbler, podcasts *podcast.Podcasts, transcoder transcode.Transcoder, lastFMClient *lastfm.Client, artistInfoCache *artistinfocache.ArtistInfoCache, albumInfoCache *albuminfocache.AlbumInfoCache, tagReader tags.Reader, resolveProxyPath ProxyPathResolver) (*Controller, error) {
c := Controller{ c := Controller{
ServeMux: http.NewServeMux(), ServeMux: http.NewServeMux(),
dbc: dbc, dbc: dbc,
scanner: scannr, scanner: scannr,
musicPaths: musicPaths, musicPaths: musicPaths,
defaultMusicPath: defaultMusicPath,
podcastsPath: podcastsPath, podcastsPath: podcastsPath,
cacheAudioPath: cacheAudioPath, cacheAudioPath: cacheAudioPath,
cacheCoverPath: cacheCoverPath, cacheCoverPath: cacheCoverPath,
+8 -8
View File
@@ -25,7 +25,7 @@ func (c *Controller) ServeGetIndexes(r *http.Request) *spec.Response {
Select("id"). Select("id").
Model(&db.Album{}). Model(&db.Album{}).
Where("parent_id IS NULL") Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ. rootQ = rootQ.
Where("root_dir=?", m) Where("root_dir=?", m)
} }
@@ -170,7 +170,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
return spec.NewError(10, "unknown value %q for parameter 'type'", v) return spec.NewError(10, "unknown value %q for parameter 'type'", v)
} }
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m) q = q.Where("root_dir=?", m)
} }
var folders []*db.Album var folders []*db.Album
@@ -220,7 +220,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Select("id"). Select("id").
Model(&db.Album{}). Model(&db.Album{}).
Where("parent_id IS NULL") Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ.Where("root_dir=?", m) rootQ = rootQ.Where("root_dir=?", m)
} }
@@ -261,7 +261,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Preload("AlbumRating", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID).
Offset(params.GetOrInt("albumOffset", 0)). Offset(params.GetOrInt("albumOffset", 0)).
Limit(params.GetOrInt("albumCount", 20)) Limit(params.GetOrInt("albumCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m) q = q.Where("root_dir=?", m)
} }
if err := q.Find(&albums).Error; err != nil { if err := q.Find(&albums).Error; err != nil {
@@ -287,7 +287,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
Preload("TrackRating", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID).
Offset(params.GetOrInt("songOffset", 0)). Offset(params.GetOrInt("songOffset", 0)).
Limit(params.GetOrInt("songCount", 20)) Limit(params.GetOrInt("songCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q. q = q.
Joins("JOIN albums ON albums.id=tracks.album_id"). Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m) Where("albums.root_dir=?", m)
@@ -324,7 +324,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Select("id"). Select("id").
Model(&db.Album{}). Model(&db.Album{}).
Where("parent_id IS NULL") Where("parent_id IS NULL")
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
rootQ = rootQ.Where("root_dir=?", m) rootQ = rootQ.Where("root_dir=?", m)
} }
@@ -350,7 +350,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Where("album_stars.user_id=?", user.ID). Where("album_stars.user_id=?", user.ID).
Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID) Preload("AlbumRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m) q = q.Where("root_dir=?", m)
} }
if err := q.Find(&albums).Error; err != nil { if err := q.Find(&albums).Error; err != nil {
@@ -369,7 +369,7 @@ func (c *Controller) ServeGetStarred(r *http.Request) *spec.Response {
Preload("Artists"). Preload("Artists").
Preload("TrackStar", "user_id=?", user.ID). Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID) Preload("TrackRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q. q = q.
Joins("JOIN albums ON albums.id=tracks.album_id"). Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m) Where("albums.root_dir=?", m)
+9 -9
View File
@@ -33,7 +33,7 @@ func (c *Controller) ServeGetArtists(r *http.Request) *spec.Response {
Preload("Info"). Preload("Info").
Group("artists.id"). Group("artists.id").
Order("artists.name COLLATE NOCASE") Order("artists.name COLLATE NOCASE")
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q. q = q.
Joins("JOIN albums ON albums.id=album_artists.album_id"). Joins("JOIN albums ON albums.id=album_artists.album_id").
Where("albums.root_dir=?", m) Where("albums.root_dir=?", m)
@@ -187,7 +187,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
default: default:
return spec.NewError(10, "unknown value %q for parameter 'type'", listType) return spec.NewError(10, "unknown value %q for parameter 'type'", listType)
} }
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m) q = q.Where("root_dir=?", m)
} }
var albums []*db.Album var albums []*db.Album
@@ -255,7 +255,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
Preload("Info"). Preload("Info").
Offset(params.GetOrInt("artistOffset", 0)). Offset(params.GetOrInt("artistOffset", 0)).
Limit(params.GetOrInt("artistCount", 20)) Limit(params.GetOrInt("artistCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m) q = q.Where("albums.root_dir=?", m)
} }
if err := q.Find(&artists).Error; err != nil { if err := q.Find(&artists).Error; err != nil {
@@ -284,7 +284,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
q = q. q = q.
Offset(params.GetOrInt("albumOffset", 0)). Offset(params.GetOrInt("albumOffset", 0)).
Limit(params.GetOrInt("albumCount", 20)) Limit(params.GetOrInt("albumCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("root_dir=?", m) q = q.Where("root_dir=?", m)
} }
if err := q.Find(&albums).Error; err != nil { if err := q.Find(&albums).Error; err != nil {
@@ -313,7 +313,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
} }
q = q.Offset(params.GetOrInt("songOffset", 0)). q = q.Offset(params.GetOrInt("songOffset", 0)).
Limit(params.GetOrInt("songCount", 20)) Limit(params.GetOrInt("songCount", 20))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q. q = q.
Joins("JOIN albums ON albums.id=tracks.album_id"). Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m) Where("albums.root_dir=?", m)
@@ -486,7 +486,7 @@ func (c *Controller) ServeGetSongsByGenre(r *http.Request) *spec.Response {
Preload("TrackRating", "user_id=?", user.ID). Preload("TrackRating", "user_id=?", user.ID).
Offset(params.GetOrInt("offset", 0)). Offset(params.GetOrInt("offset", 0)).
Limit(params.GetOrInt("count", 10)) Limit(params.GetOrInt("count", 10))
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m) q = q.Where("albums.root_dir=?", m)
} }
q = q.Group("tracks.id") q = q.Group("tracks.id")
@@ -527,7 +527,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("ArtistRating", "user_id=?", user.ID). Preload("ArtistRating", "user_id=?", user.ID).
Preload("Info"). Preload("Info").
Group("artists.id") Group("artists.id")
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m) q = q.Where("albums.root_dir=?", m)
} }
if err := q.Find(&artists).Error; err != nil { if err := q.Find(&artists).Error; err != nil {
@@ -548,7 +548,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumStar", "user_id=?", user.ID).
Preload("AlbumRating", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID).
Preload("Play", "user_id=?", user.ID) Preload("Play", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m) q = q.Where("albums.root_dir=?", m)
} }
if err := q.Find(&albums).Error; err != nil { if err := q.Find(&albums).Error; err != nil {
@@ -570,7 +570,7 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response {
Preload("Contributors.Artist"). Preload("Contributors.Artist").
Preload("TrackStar", "user_id=?", user.ID). Preload("TrackStar", "user_id=?", user.ID).
Preload("TrackRating", "user_id=?", user.ID) Preload("TrackRating", "user_id=?", user.ID)
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q. q = q.
Joins("JOIN albums ON albums.id=tracks.album_id"). Joins("JOIN albums ON albums.id=tracks.album_id").
Where("albums.root_dir=?", m) Where("albums.root_dir=?", m)
+4 -3
View File
@@ -336,7 +336,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
q = q.Joins("JOIN track_genres ON track_genres.track_id=tracks.id") q = q.Joins("JOIN track_genres ON track_genres.track_id=tracks.id")
q = q.Joins("JOIN genres ON genres.id=track_genres.genre_id AND genres.name=?", genre) q = q.Joins("JOIN genres ON genres.id=track_genres.genre_id AND genres.name=?", genre)
} }
if m := getMusicFolder(c.musicPaths, params); m != "" { if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m) q = q.Where("albums.root_dir=?", m)
} }
if err := q.Find(&tracks).Error; err != nil { if err := q.Find(&tracks).Error; err != nil {
@@ -779,10 +779,11 @@ func scrobbleStatsUpdatePodcastEpisode(dbc *db.DB, peID int) error {
return nil return nil
} }
func getMusicFolder(musicPaths []MusicPath, p params.Params) string { func getMusicFolder(c *Controller, p params.Params) string {
musicPaths := c.musicPaths
idx, err := p.GetInt("musicFolderId") idx, err := p.GetInt("musicFolderId")
if err != nil { if err != nil {
return "" return c.defaultMusicPath
} }
if idx < 0 || idx >= len(musicPaths) { if idx < 0 || idx >= len(musicPaths) {
return os.DevNull return os.DevNull