Comments (4)
Hi thanks for reaching out!
I tried out your code (fudging in some values for your result object) and noticed a couple things:
- Your
pic
variable doesn't specify all the fields for theIPicture
interface (it's missing type [required], description and filename [not required]) - The
data
property of anIPicture
must be aByteVector
object, you can easily create one that reads the file usingByteVector.fromPath(myFilePath)
Otherwise, it looks pretty good. I patched up your code a bit and ended up with (in typescript):
import * as fs from "fs";
import {ByteVector, File, PictureType} from "node-taglib-sharp";
const myFile = File.createFromPath("path_to_aif");
const pic = {
data: ByteVector.fromPath("path_to_img"),
mimeType: 'image/png',
type: PictureType.FrontCover,
filename: undefined, // not required
description: undefined // not required
}
myFile.tag.title = "title";
myFile.tag.album = "album";
myFile.tag.performers = ["foo", "bar", "baz"];
myFile.tag.pictures = [pic];
myFile.tag.genres = ["reggae"];
myFile.tag.year = 2021;
myFile.save();
myFile.dispose();
Alternatively, you can let the library construct an IPicture
object by doing Picture.fromPath("path_to_img");
This library mostly follows the paradigms from the original .NET implementation, including the (somewhat confusing) ByteVector class. If you have any suggestions for how I can better document or implement it to work better for node developers, please let me know!
from node-taglib-sharp.
Looks like that resolves your issue. Let me know if you have anymore issues, and thanks again for trying out node-taglib-sharp!
from node-taglib-sharp.
Hi! I'm sorry I didn't answer right away. Was away. Your answer helped me. Thank you very much!
But I have a couple more questions, I'll write a little later today! Have a nice day!
from node-taglib-sharp.
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!
from node-taglib-sharp.
Related Issues (20)
- Version 5.2.3 breaks reading of mp3 picture.data for some files HOT 4
- bitrate will be 0 on some files HOT 2
- "Granular position is too large to be handled with this version of node-taglib-sharp" when parsing ogg file HOT 7
- Remove Ogg granule position safe integer check and make granule position a number HOT 1
- Support for M4A HOT 7
- use in browser HOT 5
- Matroska tag docs didn't get generated HOT 1
- Question - error setting title HOT 2
- Question - Setting the text information frames in a id3v2TextInformationFrame HOT 2
- Id3v2FrameIdentifier doc and possible bug ? HOT 4
- Named export not found HOT 4
- Pictures cannot display in windows file browser. HOT 4
- ID3v2 tags at end of file not showing up in players
- Throwing error: `Argument null: ${name} was not provided` HOT 10
- 'Cannot set property ByteVector' error on load of module HOT 3
- id3v2 frameId RGAD causes failure to read tags HOT 4
- Add Legacy ReplayGain Frame Support
- Why Tag class has no accessor for 'artist' ? HOT 1
- poor performance when saving picture HOT 3
- wrong duration of `.mp3` and `.wav` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-taglib-sharp.