Coder Social home page Coder Social logo

Comments (4)

benrr101 avatar benrr101 commented on June 25, 2024

Hmmm... I played around with it for a bit this evening and so far haven't been able to directly reproduce your issue. I do however notice neither windows nor Foobar2000 seem to recognize ID3v2 tags placed at the end of the file with node-taglib-sharp. It's worth noting as well that Foobar2000 seems to cache tags when a file is added to a playlist. I wasn't able to get the scenario you had where Windows doesn't show the picture but Foobar2000 does, but this might be because Foobar2000 needed to reload the tags.

node-taglib-sharp by default creates new ID3v2 tags at the beginning of the file, but if a file already has ID3v2 tag at the end of the file, it will write any changes (via dest.tag) to that tag. As a workaround, you could try removing and re-adding the tag so that it is added at the end of the file.

const file = taglib.File.createFromPath("pathtofile");
const cover = taglib.Picture.fromPath("pathtopicture");

const oldId3v2 = file.getTag(taglib.TagTypes.Id3v2, false);
file.removeTags(0xFFFFFFFF);

const newId3v2 = file.getTag(taglib.TagTypes.Id3v2, true);
oldId3v2.copyTo(newId3v2, true);

// make changes via file.tag

file.save();
file.dispose();

Inspecting the file I tested with, I see the image is being added to the tag and node-taglib-sharp can see it. However, the fact neither foobar2000, vlc, nor windows can see the tag means something is wrong.

from node-taglib-sharp.

RogerChen2005 avatar RogerChen2005 commented on June 25, 2024

Thanks for your help, I accidentally got two samples today, one cover displays properly and the other doesn't.
2
Compared the content of two files, I notice that the tag type of two samples are different, and 'id3v2.3' can display properly,
1
Thus, I suppose that explorer.exe can't read newer tag type.
Thanks again for your help, have a nice day.

from node-taglib-sharp.

RogerChen2005 avatar RogerChen2005 commented on June 25, 2024
taglib.Id3v2Settings.forceDefaultVersion=true;
taglib.Id3v2Settings.defaultVersion=3;

After forcing the version of id3v2, The problem has been solved.
{C12CC650-7036-4023-9A4F-25549B81B8AA}

from node-taglib-sharp.

benrr101 avatar benrr101 commented on June 25, 2024

Hi @RogerChen2005 yes, ID3v2.4 still isn't supported in nearly as many places as ID3v2.3 is. Glad you found a workaround. The investigation for your issue also uncovered a related issue with ID3v2 tags at the end of a file. I'll track that in a separate issue, but thanks for helping bring it to my attention.

from node-taglib-sharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.