-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Replace AtomicParsley with @orsetto/meta-writer #582
base: master
Are you sure you want to change the base?
Conversation
Hi @orsett0, thanks for taking the time to look into this.. I tried to look at and audit the code for |
PS: $ npm ci
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing. |
I also removed an unused key/pair from the object passed to meta_writer(). That was just a leftover from the parameters passed to AtomicParsley.
Right, sorry. I forgot to make the repo public. Here it is now: meta-writer.
I'm not very familiar with I also removed some functions that were needed for AtomicParsley and which were reported by codefactor as unused. CodeFactors also reports a lot of |
Run eslint. |
I don't know how to resolve the errors reported by |
I'll take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests for consistency
$ git checkout master
$ mkdir atomicparsley meta-writer
$ freyr https://open.spotify.com/track/5w9upngVRHNjdZcRC7Xxr2 -d atomicparsley
$ git checkout orsett0/replace-atomicparsley
$ freyr https://open.spotify.com/track/5w9upngVRHNjdZcRC7Xxr2 -d meta-writer
On my machine, they both run in 15s, the AtomicParsley
version is 10118732
bytes (10.12MB), and the meta-writer
version is 10141969
bytes (10.14MB).
Tag dumping:
$ AtomicParsley "atomicparsley/Fred again/Actual Life 3 (January 1 - September 9 2022)/03 Delilah (pull me out of this).m4a" -t | sort > atomicparsley/tags
$ AtomicParsley "meta-writer/Fred again/Actual Life 3 (January 1 - September 9 2022)/03 Delilah (pull me out of this).m4a" -t | sort > meta-writer/tags
$ diff atomicparsley/tags meta-writer/tags
# see below
Dump Diffs
> Atom "©gen" contains:
> Atom "©wrt" contains: null
14a17
> Atom "cpil" contains: false
17,18c20,21
< Atom "purd" contains: 2023-10-18T11:04:53Z
< Atom "rtng" contains: Clean Content
---
> Atom "purd" contains: timestamp
> Atom "rtng" contains: clean
Some notes: the logic in the now-removed parseMeta
method removed entries with null-ish values and doesn't pass them to AtomicParsley
, meta_writer
(btw, this should be metaWriter
following JS convention) doesn't do this..
Spotify doesn't provide Genre and Composer data - See https://github.com/miraclx/freyr-js?tab=readme-ov-file#metadata-availability
This is why we have ©wrt
as null
and ©gen
empty.
Now, AtomicParsley
had special input values that it mapped to certain output values.
Like in the case of rtng
, us passing clean
or explicit
map to Clean Content
and Explicit Content
respectively.
See AtomicParsley --help
--advisory (string*) Content advisory (*values: 'clean', 'explicit')
And in the case of purd
, AtomicParsley
accepts timestamp
as a valid input for the current timestamp.
See AtomicParsley --longhelp
--purchaseDate , -D (UTC) Set Universal Coordinated Time of purchase on a "purd" atom
(use "timestamp" to set UTC to now; can be akin to id3v2 TDTG tag)
We should be able to do without these special features and use the actual values from freyr.
Also, AtomicParsley
only sets the cpil
tag when it is true
. Not sure what effects including it as false
would cause. Should be harmless.
See AtomicParsley --longhelp
--compilation , -C (bool) Sets the "cpil" atom (true or false to delete the atom)
Sorry for the late reply, I was out of town and I'll be moving shortly, so I don't have much time.
I'll re-implement parseMeta to remove null values, i honestly didn't notice it.
Regarding The value of $ atomicparsley sample.m4a --purchaseDate timestamp -W
Started writing to temp file.
Progress: =======================================================>100% |
Finished writing to temp file.
$ xxd sample.m4a | grep -A3 'purd'
00000c40: 2054 696d 6529 0000 002c 7075 7264 0000 Time)...,purd..
00000c50: 0024 6461 7461 0000 0001 0000 0000 3230 .$data........20
00000c60: 3233 2d31 302d 3239 5431 383a 3139 3a35 23-10-29T18:19:5
00000c70: 365a 0000 0019 7067 6170 0000 0011 6461 6Z....pgap....da so I decided to allow any string to be passed to
I agree with you that it shouldn't be a problem. I didn't find it on the linked Apple specs, but ExifTool documentation says that it can hold both 1 and 0 as values.
Noted ;), I'll change it with the next release. |
I did all the changes. It should be okay. One note: I encountered what seems to be a bug in the WebAssembly Systemm Interface. This bug causes a segfault in the function In the meantime, I've found a workaround for this (I'm direcly calling the exported method in One other thing: I haven't been able to reproduce this bug outside of |
Not at all, please proceed. |
Hi, sorry for the (very) late reply. It's been a rough couple of months. I recently started to work again on this, and the good news is that I've been able to identify the error. Here's the issue, nodejs/node#51303, if you want to follow any development. |
Quite interesting that we're observing a substantial chunk (if not all) of the file being buffered in memory, m4a supports streamed mutation so this is weird. Worth investigating for sure. |
@orsetto/meta-writer uses the library lofty-rs to write metadata to audio files.
It's currently only tested with mp4 and mp3, but it can easily be extended to the other formats supported by
lofty-rs
.Fix #334