]> git.rmz.io Git - dotfiles.git/blob - bin/ninja2avi
6cd4c9ed64efc31f949e70ffe470cb5ca3ab4985
[dotfiles.git] / bin / ninja2avi
1 #! /usr/bin/perl
2
3 ##
4 # This script changes the name of a video downloaded from Ninjavideo to a readable format
5 # and changes the extension to avi.
6 # It will change all files with a divx extension.
7 ##
8
9 while(<*.divx>){
10 $old=$_;
11
12 # remove the Series name at beginning
13 s/.*(\dx\d{2}.*)/\1/;
14
15 # remove (HD xxxp/i) on HD Series
16 s/\+%28HD\+\d+[pi]%29//;
17
18 # remove the + if at beginning of line else replace with space
19 s/^\+//;
20 s/\+{1,2}/ /g;
21
22 # Change URL encodings
23 s/%26/&/gi;
24 s/%2C/,/gi;
25 s/%3F/?/gi;
26 s/%3A/ -/gi;
27 s/%27/\'/gi;
28 s/%28/\(/gi;
29 s/%29/\)/gi;
30 s/%3D/=/gi;
31 s/%21/!/gi;
32
33 # change to avi
34 s/divx$/avi/;
35
36 rename $old ,"$_";
37 }
38