changeset 102:7a287a518718

Merge.
author Edho Prima Arief <edho@myconan.net>
date Thu, 18 Aug 2011 15:20:54 +0700
parents 29bd7f6ef58a (current diff) a1c6b40a535f (diff)
children 0e8018fb4203
files bash bin/cek.rb
diffstat 14 files changed, 256 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/bash	Thu Aug 18 15:15:06 2011 +0700
+++ b/bash	Thu Aug 18 15:20:54 2011 +0700
@@ -1,28 +1,33 @@
 #!/usr/bin/env bash
 
-[ -f .ecos_bash.before ] && . .ecos_bash.before
+[ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
 
-PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
+_org_path="${PATH}"
+export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
 PS1='[\u@\h \W]\$ '
 
 export PAGER="less -Rins"
 export EDITOR=vi
 export LANG="en_US.UTF-8"
+unset LS_COLORS
 
 alias less="less -Rins"
 #assuming POSIX grep
 alias fgrep="grep -F"
 alias egrep="grep -E"
+alias ls="ls -F"
+alias rm="rm -i"
+alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
 
 _has_rm_I=
 _has_gnu_ls=
 _has_gnu_grep=
-_has_bsd_ls=
 case "$(uname -s)" in
   Linux)
     _has_rm_I=y
     _has_gnu_ls=y
+    _has_gnu_grep=y
   ;;
   SunOS)
     [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
@@ -32,6 +37,7 @@
     [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
     [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
     [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
+    export PATH
     alias ping="ping -s"
     alias ping6="ping -A inet6"
   ;;
@@ -39,29 +45,25 @@
     _has_rm_I=y
     CLICOLOR=
   ;;
+  OpenBSD)
+    if command -v colorls > /dev/null 2>&1; then
+      export CLICOLOR=
+      alias ls='colorls -F'
+    fi
+  ;;
+  CYGWIN*)
+    export PATH="${PATH}:${_org_path}"
+  ;;
 esac
-if [ "${_has_rm_I}" = y ]; then
-  alias rm="rm -I"
-else
-  alias rm="rm -i"
-fi
 
-if [ "${_has_gnu_ls}" = y ]; then
-  alias ls="ls -F --color=auto"
-else
-  alias ls="ls -F"
-fi
-
-if [ "${_has_gnu_grep}" = y ]; then
-  alias grep="grep --color=auto"
-fi
+[ "${_has_rm_I}" = y ] && alias rm="rm -I"
+[ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
+[ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
 
 unset _has_rm_I
 unset _has_gnu_ls
 unset _has_gnu_grep
-unset _has_bsd_ls
 
-export PATH
 
 case "${TERM}" in
   xterm*|screen*|dtterm)
@@ -69,5 +71,8 @@
   ;;
 esac
 
-command -v vim > /dev/null 2>&1 && alias vi=vim
-[ -f .ecos_bash.after ] && . .ecos_bash.after
+if command -v vim > /dev/null 2>&1; then
+  alias vi=vim
+  export EDITOR=vim
+fi
+[ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"
--- a/bin/cek	Thu Aug 18 15:15:06 2011 +0700
+++ b/bin/cek	Thu Aug 18 15:20:54 2011 +0700
@@ -2,7 +2,7 @@
 
 bn() { basename "/$*"; }
 #cs() { cksfv -- "$@"; }
-cs() { cek.rb "$@"; }
+cs() { cek.py "$@"; }
 if [ "$#" -lt 1 ]; then
 	cat <<EOF
 Usage: $(bn "$0") file1 file2 ... fileN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/cek.py	Thu Aug 18 15:20:54 2011 +0700
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import zlib, os, sys
+
+def get_file_crc32(filename):
+  block_size = 1*2**20
+  return_code = 0
+  file_crc32 = 0
+  file_digest = 0
+  file_handle = open(filename, "rb")
+  if return_code == 0:
+    file_block = file_handle.read(block_size)
+    while file_block:
+      file_digest = zlib.crc32(file_block, file_digest)
+      file_block = file_handle.read(block_size)
+    file_handle.close()
+    file_digest = file_digest & 0xffffffff
+  return "%08X" % file_digest
+
+if __name__ == "__main__":
+  for file in sys.argv[1:]:
+    print "%s %s" % (file, get_file_crc32(file))
--- a/bin/cek.rb	Thu Aug 18 15:15:06 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/usr/bin/env ruby
-require 'zlib'
-
-block = 1048576
-ARGV.each do |filename|
-	crc = 0
-	file = File.open(filename, 'rb')
-	currentbyte = 0
-	while (line = file.read(block)) do
-		crc = Zlib.crc32(line,crc)
-	end
-	file.close
-	printf("%s %08X\n", filename, crc.to_s)
-end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/dumpshot	Thu Aug 18 15:20:54 2011 +0700
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import sys, os, re
+
+def is_shotfile(inpath):
+  finpath = os.path.basename(inpath)
+  return (finpath[-4:] == ".png") and (finpath[:4] == "shot")
+
+def main(source_files, targetdir):
+  max_shot=0
+  try:
+    current_files=os.listdir(targetdir)
+    for current_file in current_files:
+      if is_shotfile(current_file):
+        file_shot = int(re.findall("\d+", current_file)[0])
+        if file_shot > max_shot:
+          max_shot = file_shot
+    for source_file in source_files:
+      if is_shotfile(source_file):
+        max_shot += 1
+        target_file = os.path.join(targetdir, "shot%04d.png" % max_shot)
+        print "Moving: %s => %s" % (source_file, target_file)
+        os.rename(source_file, target_file)
+  except:
+    print "(%s: %s)" % (sys.exc_type, sys.exc_value)
+
+if __name__ == "__main__":
+  main(sys.argv[2:], sys.argv[1])
--- a/bin/putcrc	Thu Aug 18 15:15:06 2011 +0700
+++ b/bin/putcrc	Thu Aug 18 15:20:54 2011 +0700
@@ -24,7 +24,7 @@
 		dirname="$(dirname "$(safe_path "${file}")")"
 		myfile="$(printf "%s\n" "${filename%.*}" | sed -e 's/\([^]]\)$/\1 /')"
 		myext="${filename##*.}"; if [ "${myext}" = "${filename}" ]; then myext=""; else myext=".${myext}"; fi
-		crc=$(cek.rb "$(safe_path "${file}")" | tail -1 | sed -e 's/.*\([A-F0-9]\{8\}\)$/\1/')
+		crc=$(cek.py "$(safe_path "${file}")" | tail -1 | sed -e 's/.*\([A-F0-9]\{8\}\)$/\1/')
 		mv -- "${file}" "${dirname}/${myfile}[${crc}]${myext}" && printf "%s => %s\n" "${file}" "${myfile}[${crc}]${myext}"
 	else
 		printf "%s\n" "${file} is not a file or unreadable"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/recompress	Thu Aug 18 15:20:54 2011 +0700
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import sys, os
+from PIL import Image
+
+
+# Raises a generic exception (exception.Exception) if input is not a PNG file.
+def repng(filename):
+  im = Image.open(filename)
+  if im.format == "PNG":
+    im.save(filename, "PNG", optimize=1)
+  else:
+    raise Exception("Not a PNG image file")
+
+def hbytes(inbyte):
+  units = ["B", "kB", "MB", "GB", "TB", "PB"] 
+  outbyte = float(inbyte)
+  current_unit = 0
+  while outbyte > 1000:
+    outbyte /= 1000
+    current_unit += 1
+  return "%.2f %s" % (outbyte, units[current_unit])
+
+def sane_fn(filename):
+  import re
+  return re.sub(r"[\x00-\x1F\x7F\n\r]", "?", filename)
+
+def main(files):
+  for filename in files:
+    print "Recompressing %s:" % sane_fn(filename),
+    sys.stdout.flush()
+    try:
+      byte_orig = os.path.getsize(filename)
+      repng(filename)
+      byte_new = os.path.getsize(filename)
+      print "OK (%s => %s, %.2f%% saving)" % (hbytes(byte_orig), hbytes(byte_new), (byte_orig - byte_new)*100/float(byte_orig)),
+      re = 0
+    except:
+      print "Failed",
+      print "(%s: %s)" % (sys.exc_type, sys.exc_value),
+      re = 1
+    finally:
+      print "[%s]" % re
+
+if __name__ == "__main__":
+  main(sys.argv[1:])
--- a/bin/ren	Thu Aug 18 15:15:06 2011 +0700
+++ b/bin/ren	Thu Aug 18 15:20:54 2011 +0700
@@ -12,12 +12,59 @@
   #START HERE
   $newname =~ s/_/ /g;
   #TITLE AND NAMES
+  $newname =~ s/\[WPP & T-N\]/[WPP T-N]/;
+  $newname =~ s/\[Elysium\]K-ON!!\.EP(\d+)\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 [1080p BD]/i;
+  $newname =~ s/\[Elysium\]K-ON!!\.(ED|OP)(\d+)\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 $2 [1080p BD]/i;
+  $newname =~ s/\[Elysium\]K-ON!!\.SP\d+\[EP(\d+)\]\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 [1080p BD]/i;
+  $newname =~ s/^\[wpp\]digimon frontier /[wpp] Digimon Frontier /i;
+  $newname =~ s/^\[ACX\]Fantastic Children - (\d+) .*/[ACX] Fantastic Children - $1.mkv/i;
+  $newname =~ s/\[a-s\] sakigake!! cromartie high school - (\d+) - .* /[a-S] Sakigake!! Cromartie High School - $1 /;
+  $newname =~ s/zx\.tenchi-universe\./[zx] Tenchi Universe - /;
+  $newname =~ s/\[Saizen & Shinsen-Subs\]/[Saizen-SHS]/i;
+  $newname =~ s/ ro-kyu-bu! / Ro-Kyu-Bu! /i;
+  $newname =~ s/ Ore no Imouto ga Konna ni Kawaii Wake ga Nai / Ore no Imouto /i;
+  $newname =~ s/ no 6 / No. 6 /i;
+  $newname =~ s/ THE iDOLM\@STER / The iDOLM\@STER /i;
+  $newname =~ s/^- (\d+) - (\[neo1024\])/$2 Luping III S3 - $2/i;
+  $newname =~ s/ Luping III S3 / Lupin III S3 /i;
+  $newname =~ s/( Transformers Headmasters - \d+) - .*\[/$1 [/i;
+  $newname =~ s/^cor\.tv\.getbackers\.(\d+)\./[cor] GetBackers - $1 /;
+  $newname =~ s/^cor\.extras\.getbackers\.(opening|ending)(\d+)\./[cor] GetBackers - $1 $2 /;
+  $newname =~ s/^Revolutionary Girl Utena /[Henshin] Revolutionary Girl Utena /;
+  $newname =~ s/His and Her Circumstances/His and Her Circumstances/i;
+  $newname =~ s/Magical Girl Madoka Magica/Puella Magi Madoka Magica/i;
+  $newname =~ s/ Pretty Rhythm Aurora Dream / Pretty Rhythm - Aurora Dream /i;
+  $newname =~ s/(\[dvdrip\] Transformers \(1984\) -) E(\d+) .*(\.avi)/$1 $2 $3/;
+  $newname =~ s/ Highschool of the Dead / High School of the Dead /i;
+  $newname =~ s/LOGH Gaiden 2 E(\d+) .*(\.avi|\.mkv)/Legend of Galactic Heroes Gaiden 2 - $1$2/i;
+  $newname =~ s/^\[RaX\] *Kiba - (\d+) - .* (\[v2\] \[|\[)/[RaX] Kiba - $1 $2/;
+  $newname =~ s/ (Gosick - \d+) \(Batch\) / $1 /;
+  $newname =~ s/ Clannad - After Story - / Clannad After Story - /;
+  $newname =~ s/^Mahoujin Guruguru TV2 - Doki Doki Densetsu Ep(\d+) \((Chamelenia)\)/[Chamelenia] Mahoujin Guruguru 2 - Doki Doki Densetsu - $1/i;
+  $newname =~ s/\.divx5\.ogm$/.ogm/;
+  #$newname =~ s/\[(neo1024)\] Lupin III - (\d+) - .+ \[/[$1] Lupin III S2 - $2 [/;
+  $newname =~ s/ Lupin S2 - / Lupin III S2 - /;
+  $newname =~ s/ Prince of Tennis (\d+)/ Prince of Tennis - $1/i;
+  $newname =~ s/ Boogiepop - / Boogiepop Phantom - /i;
+  $newname =~ s/ Aika Zero OVA / Aika Zero /i;
+  $newname =~ s/^\[A-BT&Pakapuka\]PopoloCrois 2003 Ep/[A-BT Pakapuka] PopoloCrois (2003) - /;
+  $newname =~ s/^\[A-BT&Pakapuka\] PopoloCrois Story 1998 /[A-BT Pakapuka] PopoloCrois (1998) - /;
+  $newname =~ s/ (Pollyanna|Happy Kappi) Episode (\d+) / $1 - $2 /;
+  $newname =~ s/\(G P\) Now and Then Here and There \(R2J\)/[G P] Now and Then Here and There - /;
   $newname =~ s/^\[Jumonji-Giri\]\[Soldats\]\[AonE&HQA\] D\.C\. Da Capo /[Jumonji-Giri] Da Capo /i;
+  $newname =~ s/\[A-Flux&Lunar\]/[A-Flux Lunar]/i;
+  $newname =~ s/^(Mushishi) - (\d+) - .* - (\[niizk\])/$3 $1 - $1/;
+  $newname =~ s/^(Saikano) (\d+)\[h\.264-AAC\](\[SSP-Corp\])/$3 $1 - $2 /;
   $newname =~ s/^PitaTen.* Ep (\d+) .*\.avi/[Hnk] Pita Ten - $1.avi/;
   $newname =~ s/^\[a-S\] Inuyasha - (\d+|\d+-\d+) /Inuyasha - $1 [a-S]/;
   $newname =~ s/\[DVD\]\[AHQ\]/[AHQ][DVD]/;
+  $newname =~ s/\[subdesu\]/[SubDesu]/i;
+  $newname =~ s/ Zettai Shougeki - Platonic Heart / Zettai Shougeki /i;
+  $newname =~ s/ A-Channel / A Channel /i;
   $newname =~ s/^mars daybreak /[V-A] Mars Daybreak - /;
   $newname =~ s/ Shuffle! Episode / Shuffle! /;
+  $newname =~ s/ A-Channel / A Channel /;
+  $newname =~ s/ Moshidora \(Moshi Koko Yakyu no Joshi Manager ga Drucker no Management o Yondara\) / Moshidora /;
   $newname =~ s/^\[ZA\]\.Saint\.Seiya\.Episode\.(\d+)\.DVDrip\.\[X264\.AAC\(Jpn-Fre\)\.Sub\(Fre-Eng\)\.Chap\]\.mkv$/[D-YFI] Saint Seiya - $1 [DVD].mkv/;
   $newname =~ s/^HajimeNoIppo.*Round(\d+)-.*\(anime-mx\)/[Anime-MX] Fighting Spirit - $1 /;
   $newname =~ s/^(\[ACX\])(Final Fantasy Unlimited) - (\d+) .*\[ALI\] /$1 $2 - $3 /;
@@ -25,6 +72,7 @@
   $newname =~ s/^(\[Kira-Fansub\]) Uchuu no (Stellvia) /$1 $2 /;
   $newname =~ s/^(\[RaX\])(Chobits) - (\d+`\d) .*\(x264 aac\) /$1 $2 - $3 /;
   $newname =~ s/ Maria( |†)Holic / Maria+Holic /i;
+  $newname =~ s/ Pollyanna Episode / Pollyanna /;
   $newname =~ s/^Legend of Galactic Heroes - (\d+) \(([A-F0-9]{8})\) \[Central Anime\]/[Central Anime] Legend of Galactic Heroes - $1 [$2]/;
   $newname =~ s/\[Hnk\]/[HnK]/;
   $newname =~ s/^Inuyasha - (\d+|\d+-\d+)\[167\] - .*(\[DVD\]\[AHQ\])/Inuyasha - $1 $2/;
@@ -51,7 +99,7 @@
   $newname =~ s/ Brighter Than The Dawning Blue - Crescent Love - (\d+) Subbed / Brigher Than The Dawning Blue - Crescent Love - $1 /;
   $newname =~ s/ Character Monologue 0/ Character Monologue /;
   $newname =~ s/Ookami-san\.to\.Shichinin\.no\.Nakama-tachi\.EP(\d+)\(BD\.1080p\.AAC\)/Ookami-san - $1 [1080p BD]/;
-  $newname =~ s/Ore.?tachi ni tsubasa wa nai /Oretachi ni Tsubasa wa nai /i;
+  $newname =~ s/Ore.?tachi ni tsubasa wa nai /Oretachi ni Tsubasa wa Nai /i;
   $newname =~ s/\[anime-rg . ray=out\]/[anime-rg ray=out]/;
   $newname =~ s/^Arigatou\.Soul\.Eater\.Ep(\d+)\. \[x264\.AAC\]/[Arigatou] Soul Eater - $1 /;
   $newname =~ s/^\[Doremi\]\.HeartCatch\.PreCure!\.(\d+)\.\[1280x720\]\./[Doremi] HeartCatch PreCure! - $1 [720p]/;
@@ -136,12 +184,26 @@
   $newname =~ s/ ED(\d)/ - Ending $1 /;
   $newname =~ s/ OP(\d)/ - Opening $1 /;
   $newname =~ s/ ED / - Ending /;
-  $newname =~ s/ NCED / - Ending (Clean) /;
-  $newname =~ s/ NCOP / - Opening (Clean)/;
+  $newname =~ s/ NCED / - Ending (Clean) /i;
+  $newname =~ s/ NCED(\d+) / - Ending $1 (Clean) /i;
+  $newname =~ s/ NCOP / - Opening (Clean)/i;
   $newname =~ s/ OP / - Opening /;
   $newname =~ s/ - - / - /;
   $newname =~ s/ Ep / /ig;
   #GENERAL RULES
+  $newname =~ s/\(1280x720 x264 AAC\)/[720p]/i;
+  $newname =~ s/\( *(1920x1038 Blu-Ray FLAC|1920x1080 h264 BD FLAC|1920x1080 BD) *\)/[1080p BD]/i;
+  $newname =~ s/\(BD\.1080p\.FLAC\)/[1080p BD]/;
+  ##SLICED BREAD
+  $newname =~ s/\[(\d+th Release|xvid|divx5\.2\.1|divx5\.1|divx5\.05|divx5\.1\.1|h\.?264 AC3|848x480|H264 848x480|h264-480p AAC|h\.264-480p)\]//i;
+  $newname =~ s/\[(DVD 720x480|DVD H264 720x480)\]/[DVD]/i;
+  $newname =~ s/\[(1280x720 H264 AAC)\]/[720p]/i;
+  $newname =~ s/\[(BD 1280x720 H264 AAC)\]/[720p BD]/i;
+  $newname =~ s/\( *(BD 720p|BD 720p FLAC|BD 1280x720 H264 AAC) *\)/[720p BD]/i;
+  $newname =~ s/\( *(1280x720|1280x720 H\.?264 AAC) *\)/[720p]/i;
+  ##SLICED BREAD pt.2
+  $newname =~ s/(\d+)v(\d+)/$1 [v$2]/i;
+  $newname =~ s/\[BD\]\[1920x1080 H264-Flac\]/[1080p BD]/i;
   $newname =~ s/\.DVD/[DVD]/;
   $newname =~ s/ ~(.+)~ / - $1 /;
   $newname =~ s/v2 \(BD-1080p\) / [v2 1080p BD]/i;
@@ -155,9 +217,11 @@
   $newname =~ s/ \(h\.264\) //i;
   $newname =~ s/\(xvid-mp3\)//i;
   $newname =~ s/\(BD 1920x1080 *\)/[1080p BD]/i;
+  $newname =~ s/\[BD 1080p\]/[1080p BD]/i;
   $newname =~ s/v3 \(BD-1080p\) / [v3 1080p BD]/i;
   $newname =~ s/v0 \[720p\]/ [v0 720p]/i;
   $newname =~ s/v0 \[/ [v0 /i;
+  $newname =~ s/\[BD 1920x1080\]/[1080p BD]/;
   $newname =~ s/\[1080p - Bluray\]/[1080p BD]/;
   $newname =~ s/\[Bluray - 1080p\]/[1080p BD]/;
   $newname =~ s/\[BD 1080p AAC\]/[1080p BD]/;
@@ -184,13 +248,14 @@
   $newname =~ s/ \(1920x1080 Blu-Ray FLAC\) / [1080p BD]/i;
   $newname =~ s/ \(1280x720 Blu-Ray FLAC\) / [720p BD]/i;
   $newname =~ s/ \(1280x720 h264 BD FLAC\) / [720p BD]/i;
-  $newname =~ s/ \(704x480 DVD AAC\) / [DVD]/i;
+  $newname =~ s/\((704|720)x480 DVD (AC3|AAC)\)/ [DVD]/i;
   $newname =~ s/ \(960x720\) \[BD\]/ [720p BD]/i;
   $newname =~ s/\(704x396\)//;
   $newname =~ s/\(1280x720\)/ [720p]/i;
   $newname =~ s/\(1920x1080\)/ [1080p]/i;
-  $newname =~ s/\(720x480 DVD AC3\)/ [DVD]/i;
   $newname =~ s/\(1024x576\)/ [576p]/i;
+  $newname =~ s/\[1024x576\]/[576p]/i;
+  $newname =~ s/\[v(\d+) 1024x576\]/[v$1 576p]/i;
   $newname =~ s/\(1280x720 h264\)/ [720p]/i;
   $newname =~ s/\(1280x720 ?(h264|x264)?( aac)?\)/ [720p]/i;
   $newname =~ s/\(720p\)/[720p]/i;
@@ -203,7 +268,7 @@
   $newname =~ s/\[H264\]//i;
   $newname =~ s/\[DVD\]\[v2\]/[v2 DVD]/i;
   $newname =~ s/xvid//i;
-  $newname =~ s/\[AC3\]//i;
+  $newname =~ s/\[(AC3|AAC|H264|X264)\]//i;
   $newname =~ s/\[H264&MP3\]//i;
   $newname =~ s/\[H264-AAC\]//i;
   $newname =~ s/\+AAC//i;
@@ -224,11 +289,14 @@
   $newname =~ s/\[BD\]\[h264-1080p AC3\]/[1080p BD]/i;
   $newname =~ s/\[-/[/i;
   $newname =~ s/ \(1280x720 x264 AAC\)/ [720p]/i;
+  $newname =~ s/ *\( *\d+x(1080|960|720|576) *Blu-Ray *(FLAC|) *\) */[$1p BD]/i;
   $newname =~ s/\[720p\]\[v2\]/[v2 720p]/i;
   $newname =~ s/\[480p\]//i;
   $newname =~ s/\[v2\]\[720p\]/[v2 720p]/i;
   $newname =~ s/\[H264 - AAC\]//i;
   $newname =~ s/\[H264 1280x720 AAC\] /[720p]/i;
+  $newname =~ s/\[DVD 480p\]/[DVD]/i;
+  $newname =~ s/\[704x480 DVD\]/[DVD]/i;
   $newname =~ s/\[720p\]\[End\]/[End 720p]/i;
   $newname =~ s/ R2 DVD\(H264\.AC3\)/ [DVD]/i;
   $newname =~ s/ - Ep / - /i;
@@ -247,7 +315,11 @@
   $newname =~ s/ (\d+)v(2|3) / $1 [v${2}]/;
   $newname =~ s/\[720x480 AR FLAC\]//i;
   $newname =~ s/\[DVD 640x480\]/[DVD]/;
+  $newname =~ s/\[BD 1280x720\]/[720p BD]/i;
+  $newname =~ s/\[v(\d+) (1280x)(720)\]/[v$1 $3p]/i;
   $newname =~ s/ Episode (- )+(\d+) / - $2 /;
+  $newname =~ s/ - (\d+) *v(\d) / - $1 [v$2]/i;
+  $newname =~ s/\[V(\d)\]/[v$1]/;
   #DANGEROUS CLEANUPS
   $newname =~ s/ \[v(2|3)\]\[(.+)\]\[([0-9A-Fa-f]{8})\]/ [v$1 $2][$3]/;
   $newname =~ s/\]/] /g;
@@ -260,6 +332,7 @@
   $newname =~ s/ +(\.\w{3})$/$1/;
   $newname =~ s/\[\]//g;
   $newname =~ s/\(\)//g;
+  $newname =~ s/ - (\d+) - (\d+) / $1 - $2 /;
   #EXCEPTIONS
   $newname =~ s/^\[DB&L-E\]/[DB L-E]/;
   $newname =~ s/ VS Knight Lamune & - 40 fire / VS Knight Lamune & 40 fire /;
@@ -269,6 +342,7 @@
   $newname =~ s/ 07-GHOST / 07-Ghost /;
   $newname =~ s/ K-ON!! B-Side Theater - Uraon!! - / K-ON!! B-Side Theater - Uraon!! /;
   $newname =~ s/ Captain Tsubasa Road to - 2002 / Captain Tsubasa Road to 2002 /;
+  $newname =~ s/ Ultraviolet Code - 044 - / Ultraviolet Code 044 - /;
   $newname =~ s/ SP0/ - Special /;
   $newname =~ s/ Special - / - Special /;
   $newname =~ s/ Opening - / Opening /;
@@ -278,9 +352,14 @@
   $newname =~ s/ Canvas - 2 - / Canvas 2 - /;
   $newname =~ s/ Mitsudomoe - 2 - / Mitsudomoe 2 - /;
   $newname =~ s/ Eyeshield - 21 - / Eyeshield 21 - /;
+  $newname =~ s/ - opening - (\d+) / - Opening $1 /i;
+  $newname =~ s/ - ending - (\d+) / - Ending $1 /i;
   $newname =~ s/ Eyeshield 21 - (\d{2}) / Eyeshield 21 - 0$1 /;
   $newname =~ s/ Eyeshield 21 - (\d{2})-(\d{2}) / Eyeshield 21 - 0$1-0$2 /;
   $newname =~ s/ - 2010 Young Animator / 2010 Young Animator /;
+  $newname =~ s/ Mahoujin Guruguru - 2 - Doki Doki Densetsu - / Mahoujin Guruguru 2 - Doki Doki Densetsu - /;
+  $newname =~ s/ The World God Only Knows - 2 - / The World God Only Knows 2 - /;
+  $newname =~ s/ Legend of Galactic Heroes Gaiden - 2 - / Legend of Galactic Heroes Gaiden 2 - /;
   $newname =~ s/\[G P\]/[G_P]/i;
   #SAFE CLEANUPS
   $newname =~ s/ +/ /g;
@@ -288,7 +367,7 @@
   $newname =~ s/(- )+/- /;
   $newname =~ s/^\[N - F\]/[N-F]/;
   $newname =~ s/^\[K-F & AKUPX\]/[K-F AKUPX]/;
-  $newname =~ s/^\[([\s\w\- ]+)\] (Kyou Kara Maou|Bleach|Naruto|One Piece|Detective Conan) - (Opening \d+|Special \d+|\d+|\d+-\d+) /$2 - $3 [$1]/;
+  $newname =~ s/^\[([\.\s\w\- ]+)\] (Yawara|Ultraviolet Code 044|Gintama|Prince of Tennis|Lupin III S2|Kyou Kara Maou|Bleach|Naruto|One Piece|Detective Conan) - (Ending \d+|Opening \d+|Special \d+|\d+|\d+-\d+) /$2 - $3 [$1]/;
   $newname =~ s/^Naruto - (\d{2}) /Naruto - 0$1 /;
   $newname =~ s/^Naruto - (\d{2})-(\d{2}) /Naruto - 0$1-0$2 /;
   print(qq($_: $newname already exists, skipping\n)) and next() if -e $newname and $_ ne $newname;
--- a/hg	Thu Aug 18 15:15:06 2011 +0700
+++ b/hg	Thu Aug 18 15:20:54 2011 +0700
@@ -1,5 +1,5 @@
 [ui]
-username = Edho Prima Arief <me@myconan.net>
+username = Edho Prima Arief <edho@myconan.net>
 merge = vimdiff
 verbose = true
 
--- a/inputrc	Thu Aug 18 15:15:06 2011 +0700
+++ b/inputrc	Thu Aug 18 15:20:54 2011 +0700
@@ -24,6 +24,9 @@
 #Up/Down
 "\e[A": history-search-backward
 "\e[B": history-search-forward
+#GNOME Terminal
+"\eOA": history-search-backward
+"\eOB": history-search-forward
 
 #Misc
 "\C-w": backward-kill-word
--- a/setup	Thu Aug 18 15:15:06 2011 +0700
+++ b/setup	Thu Aug 18 15:20:54 2011 +0700
@@ -3,8 +3,9 @@
 install() {
   uninstall
   #create symlinks
-  linker "tcsh" ".tcsh_init"
+  linker "tcsh" ".ecos_tcsh"
   linker "bash" ".ecos_bash"
+  linker "zsh" ".ecos_zsh"
   linker "tmux" ".tmux.conf"
   linker "hg" ".hgrc"
   linker "vim" ".vimrc"
@@ -14,10 +15,12 @@
   linker "bin" ".ecos_bin"
 
   #modify cshrc
-  echo '[ -r "${HOME}/.tcsh_init" ] && source "${HOME}/.tcsh_init" #ECCORE_TCSH' >> "${HOME}/.cshrc"
+  echo '[ -r "${HOME}/.ecos_tcsh" ] && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' >> "${HOME}/.cshrc"
   #modify bash_profile and bashrc
   echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bash_profile"
   echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bashrc"
+  #modify zshrc
+  echo '[ -r "${HOME}/.ecos_zsh" ] && . "${HOME}/.ecos_zsh" #ECCORE_ZSH' >> "${HOME}/.zshrc"
 }
 
 linker() {
@@ -33,7 +36,7 @@
 }
 
 uninstall() {
-  for i in .tcsh_init .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin; do
+  for i in .ecos_tcsh .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin .ecos_bin .ecos_bash .ecos_zsh; do
     if [ -f "${HOME}/${i}" ]; then
       echo "Removing file: ~/${i}"
       rm -f "${HOME}/${i}"
@@ -44,8 +47,8 @@
 
 update() {
   if [ -f "${HOME}/.tcsh_exec" ]; then
-    mv -f "${HOME}/.tcsh_exec" "${HOME}/.tcsh_init.after"
-    echo "Moved: ${HOME}/.tcsh_exec => ${HOME}/.tcsh_init.after"
+    mv -f "${HOME}/.tcsh_exec" "${HOME}/.ecos_tcsh.after"
+    echo "Moved: ${HOME}/.tcsh_exec => ${HOME}/.ecos_tcsh.after"
   fi
 }
 
--- a/tcsh	Thu Aug 18 15:15:06 2011 +0700
+++ b/tcsh	Thu Aug 18 15:20:54 2011 +0700
@@ -1,10 +1,10 @@
 #!/usr/bin/env tcsh
-[ -e "${HOME}/.tcsh_init.before" ] && source "${HOME}/.tcsh_init.before"
+[ -e "${HOME}/.ecos_tcsh.before" ] && source "${HOME}/.ecos_tcsh.before"
 umask 22
 limit coredumpsize 0
 
 set prompt="[%B%n@%m %~%b]%# "
-set path=({,/usr}/{bin,sbin} "${HOME}"/{,.ecos.}bin)
+set path=({,/usr}/{bin,sbin} "${HOME}"/{,.ecos_}bin)
 set history=1000
 set savehist=1000
 set nobeep
@@ -22,6 +22,7 @@
 unset ignoreeof
 
 unalias \*
+alias rd "rdesktop -g 1280x700 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
 alias h history 25
 alias j jobs -l
 alias la ls -A
@@ -69,6 +70,7 @@
     ( which gnuls ) > /dev/null && alias ls gnuls ${gnuls_opts}
     alias man man -o
     alias rm rm -I
+    alias top top -P
   breaksw
   case NetBSD:
     set path=(${path} /usr/pkg/{bin,sbin})
@@ -95,4 +97,6 @@
 
 ( which vim ) > /dev/null && alias vi vim && setenv EDITOR vim
 
-[ -e "${HOME}/.tcsh_init.after" ] && source "${HOME}/.tcsh_init.after"
+[ -e "${HOME}/.ecos_tcsh.after" ] && source "${HOME}/.ecos_tcsh.after"
+
+[ -x "/usr/games/fortune" ] && "/usr/games/fortune"
--- a/tmux	Thu Aug 18 15:15:06 2011 +0700
+++ b/tmux	Thu Aug 18 15:20:54 2011 +0700
@@ -10,7 +10,7 @@
 set -g status-left-attr bold
 set -g status-left-fg yellow
 
-set -g status-right '#[fg=yellow,bold]#H | %b-%d %H:%M'
+set -g status-right '#[fg=yellow,bold]#H | %b-%d %H:%M '
 
 set -g status-utf8 on
 setw -g utf8 on
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zsh	Thu Aug 18 15:20:54 2011 +0700
@@ -0,0 +1,26 @@
+#!/usr/bin/env zsh
+[ -f "${HOME}/.ecos_zsh.before" ] && . "${HOME}/.ecos_zsh.before"
+case $TERM in
+  xterm*|screen*)
+    precmd () {print -Pn "\e]0;%n@%m: %~\a"}
+  ;;
+esac
+PS1='[%n@%m %~]%% '
+export PATH="${HOME}/.ecos_bin:${PATH}"
+HISTFILE=~/.histfile
+HISTSIZE=10000
+SAVEHIST=10000
+setopt appendhistory nomatch
+unsetopt autocd beep extendedglob notify
+bindkey -e
+bindkey '^[[A' history-search-backward
+bindkey '^[[B' history-search-forward
+
+autoload -Uz compinit
+compinit
+
+export EDITOR=vi
+export PAGER='less -Rins'
+alias less='less -Rins'
+alias ls='ls -F'
+[ -f "${HOME}/.ecos_zsh.after" ] && . "${HOME}/.ecos_zsh.after"