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

Can't see tags after adding #49

Closed
vk22 opened this issue Jan 14, 2022 · 8 comments
Closed

Can't see tags after adding #49

vk22 opened this issue Jan 14, 2022 · 8 comments

Comments

@vk22
Copy link

vk22 commented Jan 14, 2022

Hey mate! Sorry, but i'm back))
I have some strange with saving file after adding tags.

My code:

const myFile = File.createFromPath(path);                   
const pic = {
        data: ByteVector.fromPath(pathToPic),
        mimeType: 'image/png',
        type: PictureType.FrontCover,
        filename: 'Cover.png', 
        description: 'Cover.png'
    }
    myFile.tag.pictures = [pic];    
    myFile.tag.title = tagsData.trackTitle;
    myFile.tag.album = tagsData.releaseAlbum;
    myFile.tag.performers = [tagsData.artists];
    myFile.tag.albumArtists = [tagsData.albumArtists];
    myFile.tag.genres = tagsData.styleAsString;
    if (tagsData.year) {
      myFile.tag.year = tagsData.year;
    }
    myFile.tag.track = tagsData.indexTrack;
    myFile.tag.trackCount = tagsData.trackCount;
    myFile.save();
    myFile.dispose(); 

After saving i don't see cover and tags in finder or preview. - http://prntscr.com/26bi92t

They are present, I can see they in players (itunes) or tag editors (kid3, meta) - http://prntscr.com/26bi9er
And then if I open this file in kid3 and save it - tags and cover will be visible in finder and preview - http://prntscr.com/26bia32

OS: Mac OS
Files type: aiff

Can you help me?
Regards!

Originally posted by @vk22 in #34 (comment)

@benrr101
Copy link
Owner

Hi, @vk22, apologies for the delay in getting back to you. This project has taken a bit of a back seat as work has given me plenty of stuff to work on (and my mom passed away a couple weeks ago which has taken up most of my time lately).

After some experimentation, I was able to reproduce your issue with a hex editor, kid3, foobar2000, and VLC on Windows. It looks like the issue is caused by the node-taglib-sharp library not properly updating AIFF length property in the header of the file. This property tells any decoders how long the file is. Not updating this value is not an issue when reading tags with the node-taglib-sharp library (and apparently in VLC, kid3, and itunes) because the library scans the file for the ID3 chunk header, regardless of how many bytes the property says the file is. Other libraries appear to only scan the file for as many bytes as the property says, which means it'll skip reading the tags node-taglib-sharp creates.

I'm working on a hotfix and will let you know when it is ready.

@vk22
Copy link
Author

vk22 commented Jan 16, 2022

@benrr101 thanks a lot for your answer. In no case I didn't want to rush you with this, I understand that this is not your main job. And I am very sorry for your loss. Be strong.

benrr101 added a commit that referenced this issue Jan 17, 2022
benrr101 added a commit that referenced this issue Jan 17, 2022
@benrr101
Copy link
Owner

Good news, the fix is out v4.0.2 https://www.npmjs.com/package/node-taglib-sharp/v/4.0.2

It was a pretty easy fix, and to be honest I'm happy to have someone interested enough in the project to point out something not working right. Also thanks for the condolences 🙏

One quick thing I'll add - I completely forgot there's a much easier way to create an IPicture:

import {Picture} from "node-taglib-sharp";

const pic = Picture.fromPath("path/to/picture.jpg");
// pic.type defaults to FrontCover if you give it a picture, but you can always manually change for other types.

Let me know if you have any other issues 👍

@vk22
Copy link
Author

vk22 commented Jan 17, 2022

Thank you very much! I will try it today and return with result.
Have a nice week!

@vk22
Copy link
Author

vk22 commented Jan 17, 2022

Works like a charm! Thank you very much!

@vk22
Copy link
Author

vk22 commented Jan 19, 2022

Hey mate! Sorry, i have a question: which the best way to convert aif to flac with keeping all meta tags using node.js?
Thank you for answer.
Regards!

@benrr101
Copy link
Owner

Glad to hear it worked!
As for converting AIFF to FLAC using node.js... I'm not sure. The node-taglib-sharp library is just for doing tagging and reading properties of the files. If I were doing it, I'd probably try to use ffmpeg since it's very versatile for transcoding files. I've used it from the command line quite a bit to verify tags while I'm testing node-taglib-sharp stuff, so at the very least it's aware of tagging. There's at least one node.js binding for it you can check out https://www.npmjs.com/package/ffmpeg

@vk22
Copy link
Author

vk22 commented Jan 20, 2022

Thank you for answer! I use ffmpeg now.
Regards!

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

No branches or pull requests

2 participants