]> git.rmz.io Git - dotfiles.git/blobdiff - bin/ninja2avi
add tardis bin
[dotfiles.git] / bin / ninja2avi
diff --git a/bin/ninja2avi b/bin/ninja2avi
new file mode 100755 (executable)
index 0000000..6cd4c9e
--- /dev/null
@@ -0,0 +1,38 @@
+#! /usr/bin/perl
+
+##
+# This script changes the name of a video downloaded from Ninjavideo to a readable format
+# and changes the extension to avi.
+# It will change all files with a divx extension.
+##
+
+while(<*.divx>){    
+    $old=$_;
+
+    # remove the Series name at beginning
+    s/.*(\dx\d{2}.*)/\1/;
+    
+    # remove (HD xxxp/i) on HD Series
+    s/\+%28HD\+\d+[pi]%29//;
+    
+    # remove the + if at beginning of line else replace with space 
+    s/^\+//;
+    s/\+{1,2}/ /g;
+    
+    # Change URL encodings
+    s/%26/&/gi;
+    s/%2C/,/gi;
+    s/%3F/?/gi;
+    s/%3A/ -/gi;
+    s/%27/\'/gi;
+    s/%28/\(/gi;
+    s/%29/\)/gi;
+    s/%3D/=/gi;
+    s/%21/!/gi;
+       
+    # change to avi
+    s/divx$/avi/;
+    
+    rename $old ,"$_";
+}
+