mirror of
https://github.com/gabehf/music-importer.git
synced 2026-03-07 21:48:16 -08:00
embed & move covers, remove m4a support
This commit is contained in:
parent
9de7dc83d8
commit
6480f93bb5
6 changed files with 193 additions and 3 deletions
18
main.go
18
main.go
|
|
@ -12,6 +12,8 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
"text/template"
|
||||
|
||||
"github.com/gabehf/music-import/media"
|
||||
)
|
||||
|
||||
type MusicMetadata struct {
|
||||
|
|
@ -191,6 +193,13 @@ func RunImporter() {
|
|||
continue
|
||||
}
|
||||
|
||||
// embed cover img if available
|
||||
fmt.Println("→ Applying ReplayGain to album:", albumPath)
|
||||
if err := media.EmbedAlbumArtIntoFolder(albumPath); err != nil {
|
||||
fmt.Println("Cover embed failed, skipping album:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Move files to library
|
||||
for _, track := range tracks {
|
||||
if err := moveToLibrary(libraryDir, md, track); err != nil {
|
||||
|
|
@ -198,6 +207,13 @@ func RunImporter() {
|
|||
}
|
||||
}
|
||||
|
||||
// Move album cover image
|
||||
if coverImg, err := media.FindCoverImage(albumPath); err == nil {
|
||||
if err := moveToLibrary(libraryDir, md, coverImg); err != nil {
|
||||
fmt.Println("Failed to cover image:", coverImg, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove empty album directory after moving files
|
||||
os.Remove(albumPath)
|
||||
}
|
||||
|
|
@ -217,7 +233,7 @@ func getAudioFiles(dir string) ([]string, error) {
|
|||
continue
|
||||
}
|
||||
ext := strings.ToLower(filepath.Ext(e.Name()))
|
||||
if ext == ".flac" || ext == ".mp3" || ext == ".m4a" {
|
||||
if ext == ".flac" || ext == ".mp3" {
|
||||
tracks = append(tracks, filepath.Join(dir, e.Name()))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue