navidrome/db/migration/20230117155559_add_replaygain_metadata.go
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

34 lines
636 B
Go

package migrations
import (
"database/sql"
"github.com/pressly/goose"
)
func init() {
goose.AddMigration(upAddReplaygainMetadata, downAddReplaygainMetadata)
}
func upAddReplaygainMetadata(tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file add
rg_album_gain real;
alter table media_file add
rg_album_peak real;
alter table media_file add
rg_track_gain real;
alter table media_file add
rg_track_peak real;
`)
if err != nil {
return err
}
notice(tx, "A full rescan needs to be performed to import more tags")
return forceFullRescan(tx)
}
func downAddReplaygainMetadata(tx *sql.Tx) error {
return nil
}