Skip to content

Type mismatch when adding an AttachedPictureFrame #128

Description

@goulvench

Hi!
When running code straight from the readme, I get the following error:

# `add_frame': Expected argument 1 of type TagLib::ID3v2::Frame *, 
#  but got TagLib::ID3v2::AttachedPictureFrame #<TagLib::ID3v2::AttachedPictu... (ObjectPreviouslyDeleted)
#    in SWIG method 'addFrame'

# Here's the code I'm using:
apic = TagLib::ID3v2::AttachedPictureFrame.new
apic.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover
apic.picture = File.open(image_path, "rb") { |f| f.read }
apic.mime_type = "image/jpeg"
apic.description = "Cover"

TagLib::MPEG::File.open("file.mp3") do |file|
  tag = file.id3v2_tag
  tag.artist = metadata[:artist]
  tag.title = metadata[:album]
  tag.year = metadata[:year].to_i
  tag.track = index
  tag.add_frame(apic)
  file.save
end

Any idea why this happens, or what I should change in my code for it to work?

Versions

  • ruby 3.1.4 on an Intel Mac (same error with 3.2.0).
  • gem version 1.1.3.
  • brew info taglib gives taglib: stable 1.13.1 (bottled), HEAD

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions