Skip to content

zeeshan595/ultimate-renamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published