Created
April 2, 2009 18:01
-
-
Save meqif/89319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Generates a SFV file from the filename, since anime fansubs usually add the | |
# CRC32 checksum to the end of the filename. This allows one to check the | |
# checksums with a common SFV checker. | |
# | |
# (C)opyright 2009 Ricardo Martins <ricardo at scarybox dot net> | |
# Licensed under the MIT/X11 License. See LICENSE file for license details. | |
require 'date' | |
def getCRC32(filename) | |
filename.split(' ').last.split('.').first.split('')[1..-2].join('') | |
end | |
def header | |
now = DateTime.now | |
"; Generated by generate_sfv v0.1 on #{now.year}-#{now.month}-#{now.day} \ | |
at #{now.hour}:#{now.min}:#{now.sec}" | |
end | |
def main | |
puts header | |
files = Dir.entries(".").sort - [".", ".."] | |
files.each do |filename| | |
puts filename + " " + getCRC32(filename) | |
end | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment