Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support embedded album art covers #556

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

turtletowerz
Copy link

@turtletowerz turtletowerz commented Jan 4, 2025

This adds complete support for embedded album art for any format that TagLib supports.

I'm marking this as a draft because there are a few code considerations I would like to get input on before continuing:

  1. The relevant audiotags package changes need to be made to sentriz/audiotags instead of linking to my personal repo. I did this for testing reasons but it will be removed before this is actually committed
  2. All of the embedded logic is shoved into tagcommon; not sure if this is appropriate or not

closes #11

@Pikone
Copy link

Pikone commented Jan 11, 2025

Good day. Very interested in your pull request. Album art support is very lacking in gonic.

I built the project from the source code. Everything started successfully. However, I found the following error: when updating the list with the scan button in web interface, the program terminates with an error:

2025/01/11 19:59:20 finished scan in 54.37ms, +1/1 tracks (0 err)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x543177]

goroutine 52 [running]:
bytes.(*Reader).Read(0x7fc5cc8caa88?, {0xc000498000?, 0x59?, 0xc00055d318?})
	/usr/lib/go-1.23/src/bytes/reader.go:40 +0x17
bufio.(*Reader).fill(0xc0002cfc20)
	/usr/lib/go-1.23/src/bufio/bufio.go:110 +0x103
bufio.(*Reader).Peek(0xc0002cfc20, 0xa)
	/usr/lib/go-1.23/src/bufio/bufio.go:148 +0x53
image.sniff({0xe6b910, 0xc0002cfc20})
	/usr/lib/go-1.23/src/image/format.go:75 +0x110
image.Decode({0xe67820, 0x0})
	/usr/lib/go-1.23/src/image/format.go:89 +0x18f
github.com/disintegration/imaging.Decode({0xe67820, 0x0}, {0x0, 0x0, 0xc00055d4f0?})
	/root/go/pkg/mod/github.com/disintegration/imaging@v1.6.2/io.go:61 +0x2a5
go.senan.xyz/gonic/tags/tagcommon.CoverScaleAndSave({0xe67820?, 0x0?}, {0xc0003f1aa0, 0x1a}, 0x258)
	/root/gonic-master/tags/tagcommon/tagcommmon.go:57 +0x4e
go.senan.xyz/gonic/scanner.(*Scanner).scanDir(0xc0002e8360, 0xc00055d9d8, 0xc000444f00, {0xc00048d8b0, 0xd})
	/root/gonic-master/scanner/scanner.go:321 +0xb8b
go.senan.xyz/gonic/scanner.(*Scanner).scanCallback.func2(0xc0002a0c30?)
	/root/gonic-master/scanner/scanner.go:252 +0x45
go.senan.xyz/gonic/scanner.(*Scanner).scanCallback.(*DB).Transaction.func5(0xc00055da18?)
	/root/gonic-master/db/db.go:129 +0x22
github.com/jinzhu/gorm.(*DB).Transaction(0xc0002a0d00, 0xc00055db18)
	/root/go/pkg/mod/github.com/jinzhu/gorm@v1.9.17-0.20211120011537-5c235b72a414/main.go:551 +0xd2
go.senan.xyz/gonic/db.(*DB).Transaction(...)
	/root/gonic-master/db/db.go:128
go.senan.xyz/gonic/scanner.(*Scanner).scanCallback(0xc0002e8360, 0xc000444f00, {0xc00048d8b0, 0xd}, {0xe6e478?, 0xc00031b440?}, {0x0?, 0x0?})
	/root/gonic-master/scanner/scanner.go:251 +0x3a6
go.senan.xyz/gonic/scanner.(*Scanner).ScanAndClean.func2({0xc00048d8b0?, 0xc00048d8b0?}, {0xe6e478?, 0xc00031b440?}, {0x0?, 0x0?})
	/root/gonic-master/scanner/scanner.go:92 +0x4c
path/filepath.walkDir({0xc00048d8b0, 0xd}, {0xe6e478, 0xc00031b440}, 0xc00055df08)
	/usr/lib/go-1.23/src/path/filepath/path.go:310 +0x50
path/filepath.walkDir({0xc00003a029, 0x6}, {0xe6e4e8, 0xc00047dd30}, 0xc00055df08)
	/usr/lib/go-1.23/src/path/filepath/path.go:332 +0x285
path/filepath.WalkDir({0xc00003a029, 0x6}, 0xc0003baf08)
	/usr/lib/go-1.23/src/path/filepath/path.go:400 +0x75
go.senan.xyz/gonic/scanner.(*Scanner).ScanAndClean(0xc0000def98?, {0x52?})
	/root/gonic-master/scanner/scanner.go:91 +0x337
go.senan.xyz/gonic/server/ctrladmin.doScan.func1()
	/root/gonic-master/server/ctrladmin/handlers.go:619 +0x1f
created by go.senan.xyz/gonic/server/ctrladmin.doScan in goroutine 50
	/root/gonic-master/server/ctrladmin/handlers.go:618 +0x5e

I am not a developer, so I have not been able to find in what causes this error.

Additionally, I have tried running the scan in the following configurations:

  • No audio files
  • Audio files without cover
  • Audio files with embedded covers in ogg/opus format

Covers in jpeg format. In all of these configurations, the error described above occurs

@turtletowerz
Copy link
Author

Hi @Pikone, thanks for the report!

Additionally, I have tried running the scan in the following configurations:

  • No audio files
  • Audio files without cover
  • Audio files with embedded covers in ogg/opus format

This should definitely not be happening with No audio files, and ogg/opus use the same Vorbis comments that flac uses so there should be no difference in functionality.

Audio files with no embedded cover had an issue where TagLib was reading an embedded cover tag but no image was set. I was able to reproduce this on my system, and I just pushed a commit that should fix this issue. Please download the updated source and see if this issue has been solved for you.

@Pikone
Copy link

Pikone commented Jan 12, 2025

Please download the updated source and see if this issue has been solved for you.

Just built with the last commit - the error no longer occurs. All songs in my library are successfully scanned and the covers are displayed. The last change solved my problem. Thank you for your pull-request. Hopefully it will be accepted into the main repository branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is there support for album art embedded in the mp3 files?
2 participants