npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tagtoname

v6.0.0

Published

Renames audio files using the metadata tags

Downloads

8

Readme

tagtoname

Renames audio files using the metadata tags

Installing

npm install tagtoname

CLI

Usage: tagtoname [-i] [-k] [-n] [-s separator] [-t tag]... file...

Renames audio files using the metadata tags.

Options:

  -i, --ignore               Ignore a glob pattern
  -k, --keep-case            Keep the original case of the tags when renaming
  -n, --noop                 Dry run, show new paths without renaming the files
  -s, --separator=SEPARATOR  Split tags with SEPARATOR;
                             defaults to -s-
  -t, --tag=TAG              Append TAG(s) to the new name;
                             defaults to -t artist -t title
  --help                     Show help
  --version                  Output the version number

For example, by default a file with the "mp3" ext, the artist tag "Beethoven",
and the title tag "Ode to Joy" is renamed to "beethoven-ode-to-joy.mp3".

See the list of supported tags (the -t option accepts any value from the "Common tag" column).

Examples

# Rename a file.
# For example, if the file has the "artist" tag "Beethoven", and the "title" tag
# "Ode to Joy", by default it will be renamed to "beethoven-ode-to-joy.mp3".
tagtoname file.mp3

# Rename all files in a directory.
tagtoname directory/*

# Rename all files in the current directory and its subdirectories
tagtoname **/*
# Rename a file and keep the original case of the tags instead of lowercasing.
# For example, if the file has the "artist" tag "Philip Glass", and the "title"
# tag "Opening", it will be renamed to "Philip-Glass-Opening.mp3".
tagtoname -k file.mp3

# Dry run, output what would happen if we were to rename all files in a directory.
tagtoname -n directory/*

# Rename a file using a custom separator.
# For example, if the file has the "artist" tag "Debussy" and the "title" tag
# "Reverie", the file will be renamed to "debussy/reverie.mp3" (since the
# separator is "/", the directory "debussy" is created if needed).
tagtoname -s / file.mp3

# Rename a file using specific tags.
# For example, if the file has the "title" tag "A Clockwork Orange", and the
# "year" tag "1971", it will be renamed to "a-clockwork-orange-1971.mp4".
tagtoname -t title -t year file.mp4

API

tagtoname(paths, options)

Renames an audio file using its metadata tags. Resolves with the new path.

The first argument is the path of the file to be renamed.

The second argument is an options object with the following properties:

  • keepCase: Keep the original case of the tags when renaming, defaults to false
  • noop: Perform a dry run without renaming the file, defaults to false
  • separator: The separator used to split the tags in the new name, defaults to "-"
  • tags: An array of the tags used in the new name, defaults to ["artist", "title"]

Examples

import tagtoname from "tagtoname";

// Rename "/file.mp3"
// assuming the artist tag is "Queen" and the title tag is "Bohemian Rhapsody"
tagtoname("/file.mp3").then(console.log);
// => /queen-bohemian-rhapsody.mp3

// Rename "/file.mp3" keeping the original case
// assuming the artist tag is "Queen" and the title tag is "Bohemian Rhapsody"
tagtoname("/file.mp3", { keepCase: true }).then(console.log);
// => /Queen-Bohemian-Rhapsody.mp3

// Rename "/file.mp3" using "/" as a separator
// assuming the artist tag is "Queen" and the title tag is "Bohemian Rhapsody"
// (since the separator is "/", the directory "queen" is created if needed).
tagtoname("/file.mp3", { separator: "/" }).then(console.log);
// => /queen/bohemian-rhapsody.mp3

// Rename "/file.mp3" using the "year" and "title" tags
// assuming the year tag is "1975" and the title tag is "Bohemian Rhapsody"
tagtoname("/file.mp3", { tags: ["year", "title"] }).then(console.log);
// => /1975-bohemian-rhapsody.mp3