Naughty Pterodactyl Maid
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


1.0.5 • Public • Published


A small script to sync your play counts from back to iTunes. Supports both Windows and Mac OS X without any native dependencies.

Useful if you scrobble to from iTunes on multiple computers / devices and want to keep your local play counts consistent.


npm install -g itunesfm
itunesfm < username>

Potential changes will be displayed in the console, and you will be prompted before anything is actually saved.

Play counts will only be updated if the play count is higher than your local play count.


Songs are matched using a fairly naive method:

  • First, we look for exact name + artist matches.
  • If none exist, we consider exact name matches only.
  • If still none exist, consider names with >= 80% similarity (via Levenshtein distance)

It should be pretty easy to improve :)

In the case of ambiguities, you will be prompted for verification: this is then recorded in a matching.json file (in /usr/local/lib/node_modules/itunesfm) for future script runs.

In the case where songs cannot be matched, you can try modifying matching.json manually. You'll notice that the script prints the following:

warning: could not match ( (id = <identifier string>)

matching.json maps the id strings to track URLs. Example of a valid mapping (id format varies by platform):


You can find the URL for a song on by checking your scrobble history and going to the track page. The format should match the example exactly (<ARTIST>/_/<SONG_NAME>).

Making changes

The source files in src/ are written in ES6/Flow and transpiled with Babel. Make sure you have the development dependencies installed with npm install and then run npm run build to re-transpile the changes into bin/.

Most of the code is type-checked with Flow.


npm i itunesfm

Downloadsweekly downloads









last publish


  • avatar