Created
February 20, 2014 13:54
-
-
Save xdite/9114077 to your computer and use it in GitHub Desktop.
This file contains 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
require 'digest' | |
filename = "House.Of.Cards.2013.S02E01.720p.WEB-DL.x264-Sohu.mp4" | |
f = File.new(filename, "rb") | |
puts f.stat.inspect | |
file_size = File.size?(filename) | |
offset = [] | |
offset[0] = 4096 | |
offset[1] = file_size / 3 * 2 | |
offset[2] = file_size / 3 | |
offset[3] = file_size - 8192 | |
vhash = [] | |
offset.each do |position| | |
#length , offset | |
vblock = IO.binread(filename, 4096, position) | |
md5 = Digest::MD5.hexdigest(vblock) | |
vhash << md5 | |
end | |
hash = vhash.join(";") | |
require 'rubygems' | |
require 'httparty' | |
class SVPlayer | |
include HTTParty | |
base_uri 'www.shooter.cn' | |
def post(hash,filename) | |
options = { :body => {'filehash' => hash , 'pathinfo' => filename , 'format' => 'json', 'lang' => 'Chn'} } | |
self.class.post('/api/subapi.php', options) | |
end | |
end | |
puts SVPlayer.new.post(hash,filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
提供链接可供参考:
https://docs.google.com/document/d/1w5MCBO61rKQ6hI5m9laJLWse__yTYdRugpVyz4RzrmM/preview
https://docs.google.com/document/d/1ufdzy6jbornkXxsD-OGl3kgWa4P9WO5NZb6_QYZiGI0/preview