Skip to content

Commit

Permalink
Don't need to estimate the length of a track anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Fitzsimmons committed May 20, 2012
1 parent 07419eb commit 3554884
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/request_handlers/flac_to_mp3.rb
Expand Up @@ -9,7 +9,6 @@ class FlacToMP3 < AbstractHandler

require_tool "flac"
require_tool "lame"
require_tool "shntool"

config_name "flac_to_mp3"

Expand All @@ -32,21 +31,6 @@ def set_sinatra_http_response_properties
def transcode_flac_to_mp3
@toolman.pipe("flac", "-s -d -c \"#{@filepath}\"").pipe("lame", "--silent --preset standard - -").io
end

def estimate_transcoded_mp3_size
shntool = @toolman.invoke("shntool", "info \"#{@filepath}\"")
shnput = shntool.read()
data = Utils::shntool_parse(shnput)

length = data["Length"]
p = length.partition(":")
minutes = p[0].to_i
seconds = p[2].partition(".")[0].to_i
ms = p[2].partition(".")[2].to_i
total = ms + seconds * 1000 + minutes * 60 * 1000
size = total * @config['bitrate'].to_i
size = (size.to_f / 8.0).ceil
end
end
end
end

0 comments on commit 3554884

Please sign in to comment.