How to use node-id3 - 8 common examples

To help you get started, we’ve selected a few node-id3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lepisma / blackbird / app / js / extras.js View on Github external
], {}, function(err, output) {
        if (err) {
            ui.flash("error");
            console.log(err);
        }
        console.log(output.join("\n"));

        // Write tags
        var tags = {
            title: metadata.title,
            artist: metadata.artist
        };
        if (id3.write(tags, filename + ".mp3") == false) {
            ui.flash("error");
        }
        else {
            ui.flash("ok");
        }
    });
};
github trazyn / ieaseMusic / submodules / downloader / index.js View on Github external
doneTask(task);
                } else {
                    updateTask(task);
                }
            },
            song.id
        );
        await writeFile(song.album.cover.replace(/\?.*/, ''), imagefile);

        let tags = {
            title: song.name,
            artist: song.artists.map(e => e.name).join(),
            album: song.album.name,
            image: imagefile,
        };
        let success = nodeID3.write(tags, trackfile);

        queue.done(task);

        if (!success) {
            throw Error('Failed to write ID3 tags: \'%s\'', trackfile);
        }
    } catch (ex) {
        error(ex);

        if (ex.message === '_aborted') {
            // Download task has been canceled
            return;
        }

        queue.done(task);
        failTask(task, ex);
github lyswhut / lx-music-desktop / src / main / utils / mp3Meta.js View on Github external
module.exports = (filePath, meta) => {
  if (!meta.APIC) return NodeID3.write(meta, filePath)
  if (!/^http/.test(meta.APIC)) {
    delete meta.APIC
    return NodeID3.write(meta, filePath)
  }
  let picPath = filePath.replace(/\.mp3$/, '') + path.extname(meta.APIC).replace(extReg, '$1')
  request(meta.APIC)
    .on('response', respones => {
      if (respones.statusCode !== 200 && respones.statusCode != 206) {
        delete meta.APIC
        NodeID3.write(meta, filePath)
        return
      }
      respones
        .pipe(fs.createWriteStream(picPath))
        .on('finish', () => {
          if (respones.complete) {
github Kefir100 / radio-ch1ller / src / sound / methods / sound.ts View on Github external
const getMeta = ({ fullPath, name }: TrackStats): ShallowTrackMeta => {
  try {
    const { artist, title, ...rest } = id3.read(fullPath);
    if (!artist || !title) {
      throw new Error('id3 tags dont have enough data');
    }
    return { artist, title, ...rest, origin: 'id3' };
  }
  catch (e) {
    const [artist, title] = name.split(' - ');
    return { artist, title, origin: 'fs' };
  }
};
github cadejscroggins / catz / src / app / Song.jsx View on Github external
tagMp3() {
    const tags = {
      title: this.props.title,
      artist: this.props.artist,
      album: this.props.album,
      image: this.verifyImage(this.tmpArt) ? this.tmpArt : false,
      trackNumber: `${this.props.trackNum}/${this.props.totalTracks}`,
    };

    nodeID3.removeTags(this.tmpSong);
    nodeID3.write(tags, this.tmpSong);
  }
github compactd / compactd / server / src / features / store / SoundCloudStore.ts View on Github external
return new Promise((resolve, reject) => {
      NodeID3.write(tags, target, function(err: any, buffer: Buffer) { 
        if (err) return reject(err);
        resolve(buffer);
      });
    });
  }
github LoliLin / CloudMan / modules / metadata.js View on Github external
writeMetadata (trackInfo, trackPath = '', coverPath = '') {
    if (trackPath.endsWith('mp3')) {
      const tags = {
        title: trackInfo.title,
        album: trackInfo.album,
        artist: trackInfo.artist,
        year: trackInfo.year,
        date: trackInfo.year,
        TRCK: trackInfo.albumNo,
        MCDI: trackInfo.discNo
      }
      if (trackInfo.albumImg) tags.APIC = path.resolve(coverPath)

      logger.debug('MP3 meatadata', tags)
      const result = nodeID3.write(tags, trackPath)
      if (result) {
        logger.debug('Metadata writed.')
      } else {
        logger.warn('Write metadata failed.')
      }
    } else {
      const flac = new Metaflac(trackPath)

      flac.setTag('TITLE=' + trackInfo.title)
      flac.setTag('ALBUM=' + trackInfo.album)
      flac.setTag('ARTIST=' + trackInfo.artist)
      flac.setTag('DATE=' + trackInfo.year)
      flac.setTag('YEAR=' + trackInfo.year)
      flac.setTag('TRACKNUMBER=' + trackInfo.albumNo)
      flac.setTag('DISCNUMBER=' + trackInfo.discNo)
github cadejscroggins / catz / src / app / Song.jsx View on Github external
tagMp3() {
    const tags = {
      title: this.props.title,
      artist: this.props.artist,
      album: this.props.album,
      image: this.verifyImage(this.tmpArt) ? this.tmpArt : false,
      trackNumber: `${this.props.trackNum}/${this.props.totalTracks}`,
    };

    nodeID3.removeTags(this.tmpSong);
    nodeID3.write(tags, this.tmpSong);
  }

node-id3

Pure JavaScript ID3v2 Tag writer and reader

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis