changeset 86:4a22703b183c

Merge.
author Edho Prima Arief <me@myconan.net>
date Sat, 09 Jul 2011 15:39:00 +0700
parents b65925c07cf6 (diff) 14435bd3f01c (current diff)
children c884853b25d1 1057412834a5
files bin/ren
diffstat 7 files changed, 35 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/bin/cek	Sat Jul 09 15:35:04 2011 +0700
+++ b/bin/cek	Sat Jul 09 15:39:00 2011 +0700
@@ -2,7 +2,7 @@
 
 bn() { basename "/$*"; }
 #cs() { cksfv -- "$@"; }
-cs() { cek.pl "$@"; }
+cs() { cek.py "$@"; }
 if [ "$#" -lt 1 ]; then
 	cat <<EOF
 Usage: $(bn "$0") file1 file2 ... fileN
--- a/bin/cek.pl	Sat Jul 09 15:35:04 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#!/usr/bin/env perl
-
-use warnings;
-use strict;
-use Compress::Zlib;
-
-sub get_file_crc32 {
-  my $block_size = 1*2**20;
-  my $crc32_digest = 0;
-  my $return_code = 0;
-  my $file_name = $_[0];
-  if (!$file_name) {
-    #internal error, no file name passed to the function
-    $return_code = 10;
-  } elsif (!-f $file_name) {
-    #input file name is not a file
-    $return_code = 11;
-  } elsif (!-r $file_name) {
-    #input file is not readable
-    $return_code = 12;
-  }
-  if ($return_code == 0) {
-   open(my $file_handle, '<', $file_name);
-   binmode($file_handle);
-    while(sysread($file_handle, $_, $block_size)) {
-      $crc32_digest = crc32($_, $crc32_digest);
-    }
-    close($file_handle);
-  }
-  return ($return_code, sprintf('%08X', $crc32_digest));
-}
-
-foreach (@ARGV) {
-  my $file_name = $_;
-  my @crc32 = get_file_crc32($file_name);
-  printf("%s %s", $file_name, $crc32[1]);
-  if ($crc32[0] > 0) {
-    printf(" [ERR%02d]", $crc32[0]);
-  }
-  printf("\n");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/cek.py	Sat Jul 09 15:39:00 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/putcrc	Sat Jul 09 15:35:04 2011 +0700
+++ b/bin/putcrc	Sat Jul 09 15:39:00 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"
--- a/bin/ren	Sat Jul 09 15:35:04 2011 +0700
+++ b/bin/ren	Sat Jul 09 15:39:00 2011 +0700
@@ -51,12 +51,16 @@
   $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 /;
@@ -108,6 +112,7 @@
   $newname =~ s/Les Miserables Shoujo Cosette /Les Miserables /;
   $newname =~ s/\[Elysium\]Baka\.to\.Test\.to\.Shoukanjuu\.(EP)?/[Elysium] Baka to Test to Shokanju/;
   $newname =~ s/\[Elysium\] Baka to Test to Shokanju/[Elysium] Baka to Test to Shokanju /;
+  $newname =~ s/\(BD\.1080p\.FLAC\)/[1080p BD]/;
   $newname =~ s/Saizen & SD/Saizen-SD/;
   $newname =~ s/Bleach - (\d{2}) /Bleach - 0$1 /;
   $newname =~ s/Omamori Himari - ED \(Clean\) - 0(\d) / Omamori Himari - Ending $1 (Clean) /;
@@ -230,6 +235,8 @@
   $newname =~ s/\[BD\]\[720p FLAC\]/[720p BD]/;
   $newname =~ s/\[BD\]\[720p\]/[720p BD]/;
   $newname =~ s/\[BD\]\[1080p\]/[1080p BD]/;
+  $newname =~ s/\[h264-480p AAC\]//;
+  $newname =~ s/\[h.264-480p\]//i;
   $newname =~ s/ v3 \[720p\]/[v3 720p]/i;
   $newname =~ s/1280x720 H264 OGG/720p/;
   $newname =~ s/ \[BD 1080p FLAC\]/ [1080p BD]/i;
@@ -258,6 +265,7 @@
   $newname =~ s/\((BD 720p)\)/ [720p BD]/i;
   $newname =~ s/\(DVD\)/ [DVD]/i;
   $newname =~ s/\[h264-480p\]//i;
+  $newname =~ s/\[H264\]//i;
   $newname =~ s/\[DVD\]\[v2\]/[v2 DVD]/i;
   $newname =~ s/xvid//i;
   $newname =~ s/\[(AC3|AAC|H264|X264)\]//i;
@@ -342,10 +350,6 @@
   $newname =~ s/ Hidamari Sketch Hoshimittsu - Special / Hidamari Sketch Hoshimittsu Special - /;
   $newname =~ s/ Spice and Wolf S2 - BD Menu - 0/ Spice and Wolf S2 - BD Menu /;
   $newname =~ s/ Canvas - 2 - / Canvas 2 - /;
-  #$newname =~ s/ Prince of Tennis - (\d{2})/ Prince of Tennis - 0$1/i;
-  #$newname =~ s/ Prince of Tennis - (\d{3})-(\d{2}) / Prince of Tennis - $1-0$2 /i;
-  #$newname =~ s/ Prince of Tennis - 0(\d{3})/ Prince of Tennis - $1/i;
-  #$newname =~ s/ Prince of Tennis - 00(\d{3})/ Prince of Tennis - $1/i;
   $newname =~ s/ Mitsudomoe - 2 - / Mitsudomoe 2 - /;
   $newname =~ s/ Eyeshield - 21 - / Eyeshield 21 - /;
   $newname =~ s/ - opening - (\d+) / - Opening $1 /i;
--- a/tcsh	Sat Jul 09 15:35:04 2011 +0700
+++ b/tcsh	Sat Jul 09 15:39:00 2011 +0700
@@ -97,3 +97,5 @@
 ( which vim ) > /dev/null && alias vi vim && setenv EDITOR vim
 
 [ -e "${HOME}/.ecos_tcsh.after" ] && source "${HOME}/.ecos_tcsh.after"
+
+[ -x "/usr/games/fortune" ] && "/usr/games/fortune"
--- a/tmux	Sat Jul 09 15:35:04 2011 +0700
+++ b/tmux	Sat Jul 09 15:39:00 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