feat(gonic): add scan-embedded-cover-enabled flag
This commit is contained in:
No files matched your search
@@ -50,7 +50,7 @@ password can then be changed from the web interface
|
|||||||
## configuration options
|
## configuration options
|
||||||
|
|
||||||
| 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_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. |
|
||||||
@@ -64,6 +64,7 @@ password can then be changed from the web interface
|
|||||||
| `GONIC_SCAN_INTERVAL` | `-scan-interval` | **optional** interval (in minutes) to check for new music (automatic scanning disabled if omitted) |
|
| `GONIC_SCAN_INTERVAL` | `-scan-interval` | **optional** interval (in minutes) to check for new music (automatic scanning disabled if omitted) |
|
||||||
| `GONIC_SCAN_AT_START_ENABLED` | `-scan-at-start-enabled` | **optional** whether to perform an initial scan at startup |
|
| `GONIC_SCAN_AT_START_ENABLED` | `-scan-at-start-enabled` | **optional** whether to perform an initial scan at startup |
|
||||||
| `GONIC_SCAN_WATCHER_ENABLED` | `-scan-watcher-enabled` | **optional** whether to watch file system for new music and rescan |
|
| `GONIC_SCAN_WATCHER_ENABLED` | `-scan-watcher-enabled` | **optional** whether to watch file system for new music and rescan |
|
||||||
|
| `GONIC_SCAN_EMBEDDED_COVER_ENABLED` | `-scan-embedded-cover-enabled` | **optional** whether to scan for embedded covers in audio files (_default_ `true`) |
|
||||||
| `GONIC_JUKEBOX_ENABLED` | `-jukebox-enabled` | **optional** whether the subsonic [jukebox api](https://airsonic.github.io/docs/jukebox/) should be enabled |
|
| `GONIC_JUKEBOX_ENABLED` | `-jukebox-enabled` | **optional** whether the subsonic [jukebox api](https://airsonic.github.io/docs/jukebox/) should be enabled |
|
||||||
| `GONIC_JUKEBOX_MPV_EXTRA_ARGS` | `-jukebox-mpv-extra-args` | **optional** extra command line arguments to pass to the jukebox mpv daemon |
|
| `GONIC_JUKEBOX_MPV_EXTRA_ARGS` | `-jukebox-mpv-extra-args` | **optional** extra command line arguments to pass to the jukebox mpv daemon |
|
||||||
| `GONIC_PODCAST_PURGE_AGE` | `-podcast-purge-age` | **optional** age (in days) to purge podcast episodes if not accessed |
|
| `GONIC_PODCAST_PURGE_AGE` | `-podcast-purge-age` | **optional** age (in days) to purge podcast episodes if not accessed |
|
||||||
|
|||||||
+3
-1
@@ -68,6 +68,7 @@ func main() {
|
|||||||
confScanIntervalMins := flag.Uint("scan-interval", 0, "interval (in minutes) to automatically scan music (optional)")
|
confScanIntervalMins := flag.Uint("scan-interval", 0, "interval (in minutes) to automatically scan music (optional)")
|
||||||
confScanAtStart := flag.Bool("scan-at-start-enabled", false, "whether to perform an initial scan at startup (optional)")
|
confScanAtStart := flag.Bool("scan-at-start-enabled", false, "whether to perform an initial scan at startup (optional)")
|
||||||
confScanWatcher := flag.Bool("scan-watcher-enabled", false, "whether to watch file system for new music and rescan (optional)")
|
confScanWatcher := flag.Bool("scan-watcher-enabled", false, "whether to watch file system for new music and rescan (optional)")
|
||||||
|
confScanEmbeddedCover := flag.Bool("scan-embedded-cover-enabled", true, "whether to scan for embedded covers in audio files (optional)")
|
||||||
|
|
||||||
confJukeboxEnabled := flag.Bool("jukebox-enabled", false, "whether the subsonic jukebox api should be enabled (optional)")
|
confJukeboxEnabled := flag.Bool("jukebox-enabled", false, "whether the subsonic jukebox api should be enabled (optional)")
|
||||||
confJukeboxMPVExtraArgs := flag.String("jukebox-mpv-extra-args", "", "extra command line arguments to pass to the jukebox mpv daemon (optional)")
|
confJukeboxMPVExtraArgs := flag.String("jukebox-mpv-extra-args", "", "extra command line arguments to pass to the jukebox mpv daemon (optional)")
|
||||||
@@ -177,7 +178,7 @@ func main() {
|
|||||||
log.Printf("provided config\n")
|
log.Printf("provided config\n")
|
||||||
flag.VisitAll(func(f *flag.Flag) {
|
flag.VisitAll(func(f *flag.Flag) {
|
||||||
value := strings.ReplaceAll(f.Value.String(), "\n", "")
|
value := strings.ReplaceAll(f.Value.String(), "\n", "")
|
||||||
log.Printf(" %-25s %s\n", f.Name, value)
|
log.Printf(" %-30s %s\n", f.Name, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
scannr := scanner.New(
|
scannr := scanner.New(
|
||||||
@@ -190,6 +191,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
tagReader,
|
tagReader,
|
||||||
*confExcludePattern,
|
*confExcludePattern,
|
||||||
|
*confScanEmbeddedCover,
|
||||||
)
|
)
|
||||||
podcast := podcast.New(dbc, *confPodcastPath, tagReader)
|
podcast := podcast.New(dbc, *confPodcastPath, tagReader)
|
||||||
transcoder := transcode.NewCachingTranscoder(
|
transcoder := transcode.NewCachingTranscoder(
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ func newMockFS(tb testing.TB, dirs []string, excludePattern string) *MockFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagReader := &tagReader{paths: map[string]*TagInfo{}}
|
tagReader := &tagReader{paths: map[string]*TagInfo{}}
|
||||||
scanner := scanner.New(absDirs, dbc, multiValueSettings, tagReader, excludePattern)
|
scanner := scanner.New(absDirs, dbc, multiValueSettings, tagReader, excludePattern, true)
|
||||||
|
|
||||||
return &MockFS{
|
return &MockFS{
|
||||||
t: tb,
|
t: tb,
|
||||||
|
|||||||
+4
-2
@@ -41,10 +41,11 @@ type Scanner struct {
|
|||||||
multiValueSettings map[Tag]MultiValueSetting
|
multiValueSettings map[Tag]MultiValueSetting
|
||||||
tagReader tags.Reader
|
tagReader tags.Reader
|
||||||
excludePattern *regexp.Regexp
|
excludePattern *regexp.Regexp
|
||||||
|
scanEmbeddedCover bool
|
||||||
scanning *int32
|
scanning *int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(musicDirs []string, db *db.DB, multiValueSettings map[Tag]MultiValueSetting, tagReader tags.Reader, excludePattern string) *Scanner {
|
func New(musicDirs []string, db *db.DB, multiValueSettings map[Tag]MultiValueSetting, tagReader tags.Reader, excludePattern string, scanEmbeddedCover bool) *Scanner {
|
||||||
var excludePatternRegExp *regexp.Regexp
|
var excludePatternRegExp *regexp.Regexp
|
||||||
if excludePattern != "" {
|
if excludePattern != "" {
|
||||||
excludePatternRegExp = regexp.MustCompile(excludePattern)
|
excludePatternRegExp = regexp.MustCompile(excludePattern)
|
||||||
@@ -56,6 +57,7 @@ func New(musicDirs []string, db *db.DB, multiValueSettings map[Tag]MultiValueSet
|
|||||||
multiValueSettings: multiValueSettings,
|
multiValueSettings: multiValueSettings,
|
||||||
tagReader: tagReader,
|
tagReader: tagReader,
|
||||||
excludePattern: excludePatternRegExp,
|
excludePattern: excludePatternRegExp,
|
||||||
|
scanEmbeddedCover: scanEmbeddedCover,
|
||||||
scanning: new(int32),
|
scanning: new(int32),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,7 +454,7 @@ func (s *Scanner) populateTrackAndArtists(tx *db.DB, st *State, i int, album *db
|
|||||||
}
|
}
|
||||||
|
|
||||||
// embedded covers come only from the first track
|
// embedded covers come only from the first track
|
||||||
if i == 0 && album.Cover == "" && track.ID > 0 {
|
if i == 0 && s.scanEmbeddedCover && album.Cover == "" && track.ID > 0 {
|
||||||
if err := populateEmbeddedCover(tx, s.tagReader, album, track, absPath); err != nil {
|
if err := populateEmbeddedCover(tx, s.tagReader, album, track, absPath); err != nil {
|
||||||
return fmt.Errorf("populate embedded cover: %w", err)
|
return fmt.Errorf("populate embedded cover: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user