Skip to content

Instantly share code, notes, and snippets.

@kopiro
Last active October 11, 2015 21:18
Show Gist options
  • Select an option

  • Save kopiro/3920647 to your computer and use it in GitHub Desktop.

Select an option

Save kopiro/3920647 to your computer and use it in GitHub Desktop.
Rename in bash title of a TV serie from Wikipedia tables
var commands = [];
var serie = 1;
var serietitle = prompt("Serie Title");
$('table tbody tr').each(function(k)
{
var title = $(this).find('td').eq(2).text();
if (!title) return;
var episode = k<10 ? "0"+k : k;
var finder = "*"+serie+"x"+episode+"*";
commands.push( "mv \"$(find . -name "+finder+")\" \""+serietitle+" - "+serie+"x"+episode+" - "+title+".avi\"" );
});
prompt('Execute this in the shell:', commands.join(';\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment