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

On Fedora never reads tags destroys tags when writing. #44

Closed
amsterdamharu opened this issue Aug 26, 2018 · 2 comments
Closed

On Fedora never reads tags destroys tags when writing. #44

amsterdamharu opened this issue Aug 26, 2018 · 2 comments
Labels

Comments

@amsterdamharu
Copy link

amsterdamharu commented Aug 26, 2018

With the following file (generated with audacity version 2.1.3):
01.zip

Using the following code I can't read any tags from the file, updating the tags (commented out code) will destroy the tags in the file in both Nautilus file browser properties and Rythmbox.

// "dependencies": {
//   "glob": "^7.1.2",
//   "node-id3": "^0.1.5"
// }
//node version: v10.8.0
const NodeID3 = require('node-id3');
const glob = require("glob");

const getGlob = ()=>{
  if(!process.argv[2]){
    console.log("need to provide path to files");
    process.exit(1);
  }
  const ret = `${process.argv[2]}/*.mp3`;
  console.log("Using glob:",ret);
  return ret;
};

readTags = file =>
  new Promise(
    (resolve,reject)=>
      NodeID3.read(
        file,
        (err, tags) =>
          err?reject(err):resolve(tags)
      )
  )
;

const createTag = tags =>
  new Promise(
    (resolve,reject)=>
      NodeID3.create(
        tags,
        frame=>resolve(frame)
      )
  )
;

const updateTag = (tags,file)=>
  new Promise(
    (resolve,reject)=>
      NodeID3.update(
        tags,
        file,
        (err, buffer)=>err?reject(err):resolve(buffer)
      )
  )
;

const globPromise = (path,options)=>
  new Promise(
    (resolve,reject)=>
      glob(
        path,
        options,
        (err,files)=>
          err
            ?reject(err)
            :resolve(files))
  )
;

globPromise(getGlob(), {})
.then(
  files=>
    // updateTag(NodeID3.create(tags[0]),files[0])
    // updateTag(tags[0],files[0])
    Promise.resolve()
    .then(
        ()=>readTags(files[0])
    )
).then(
  result=>console.log("ok",result)//this logs: ok { raw: {} }
).catch(
  error=>console.log("oops:",error)
);

const tags = [
  [{
    TIT2:"some title"
  }]
]
@Zazama Zazama added the bug label Aug 28, 2018
@Zazama
Copy link
Owner

Zazama commented Aug 28, 2018

The file uses extended header which isn't implemented by node-id3, which is why it doesn't find any tags.

@Zazama
Copy link
Owner

Zazama commented Oct 26, 2020

Fixed by 8c42c6c in v0.2.0

@Zazama Zazama closed this as completed Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants