mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
feat: add log hooks
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
soundcloudprovider "streamrip-go/internal/provider/soundcloud"
|
||||
tidalprovider "streamrip-go/internal/provider/tidal"
|
||||
"streamrip-go/internal/store"
|
||||
"streamrip-go/internal/verbose"
|
||||
)
|
||||
|
||||
type Main struct {
|
||||
@@ -110,7 +111,7 @@ func New(cfg *config.Config) (*Main, error) {
|
||||
"soundcloud": soundcloudprovider.New(cfg),
|
||||
}
|
||||
|
||||
return &Main{
|
||||
m := &Main{
|
||||
Config: cfg,
|
||||
Providers: providers,
|
||||
Store: db,
|
||||
@@ -118,7 +119,9 @@ func New(cfg *config.Config) (*Main, error) {
|
||||
Tagger: tag.New(),
|
||||
Pending: []media.Pending{},
|
||||
Media: []media.Media{},
|
||||
}, nil
|
||||
}
|
||||
verbose.SetSink(func(msg string) { m.DL.Logf("%s", msg) })
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// downloaderMaxConnsPerHost picks the per-host idle connection cap for the
|
||||
@@ -133,6 +136,7 @@ func downloaderMaxConnsPerHost(maxConnections int) int {
|
||||
}
|
||||
|
||||
func (m *Main) Close() error {
|
||||
verbose.SetSink(nil)
|
||||
m.DL.Close()
|
||||
artwork.CleanupTempDirs()
|
||||
for _, p := range m.Providers {
|
||||
|
||||
Reference in New Issue
Block a user