Skip to content

Commit

Permalink
processes files passed from the command line
Browse files Browse the repository at this point in the history
  • Loading branch information
liamja committed Mar 3, 2012
1 parent 8ada5c2 commit 90031c9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions torrent-parser.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
require 'rubygems'
require 'bencode'
require 'digest/sha1'
require 'optparse'

# Hash to get
# 19f090af75ac25bcb3e1835624431a218874a3fd

torrent = BEncode.load_file( "the-muppets.torrent" )
info_hash = Digest::SHA1.hexdigest( torrent['info'].bencode )
puts info_hash
ARGV.each do|file|
puts "File: #{file}"
torrent = BEncode.load_file( file )
info_hash = Digest::SHA1.hexdigest( torrent['info'].bencode )
puts "Hash: #{info_hash}"
puts "---"
end

0 comments on commit 90031c9

Please sign in to comment.