ultimate-renamer
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

ultimate-renamer

Example

import { Renamer, TVDB } from "ultimate-renamer"

const main = async () => {
  //example
  const r = new Renamer();
  r.load(`/path/to/files`);
  r.parse(async file => {
    const pattern = /_(?<songNumber>[0-9]{2})_-_(?<title>[a-zA-Z\_]+)/g;
    const match = pattern.exec(file.name);
    if (match) {
      const songNumber: number = parseInt(match.groups['songNumber']);
      const title: string = match.groups['title'].replace('_', ' ');

      const tvdb = new TVDB();
      await tvdb.login('API_KEY', 'USER_KEY', 'USERNAME');
      const response = await tvdb.searchEpisodeList({
        name: "lucifer"
      });
      if (response) {
        //full list of episodes
      
        //update file name
        file.newName = `${songNumber} ${title}`;
      }
    }
    return file;
  });
  r.changeLog();
  await r.save();

  process.exit(0);
}

main();

Readme

Keywords

none

Package Sidebar

Install

npm i ultimate-renamer

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

44.2 kB

Total Files

24

Last publish

Collaborators

  • zeeshan595