master
nixo 2019-05-21 19:14:21 +02:00
parent 08d1ae5113
commit 915d21eff2
1 changed files with 3 additions and 4 deletions

View File

@ -514,12 +514,11 @@ function getCoverArt(req::Dict)
end
function giveconverted(file, bitrate, format)
(iodata, proc) = convert(file, bitrate = bitrate, format = format)
iodata = convert(file, bitrate = bitrate, format = format)
headers = Dict{String,String}()
suffix = format
mime = suffix in keys(Mux.mimetypes) ? Mux.mimetypes[suffix] : suffix
headers["Content-Type"] = mime
wait(proc)
# headers["Content-Length"] = string(length(data))
return Dict(:body => read(iodata), :headers => headers)
end
@ -528,8 +527,8 @@ function convert(infile; bitrate = 64, format = "oga")
global ffmpeg_threads
io = IOBuffer()
p = run(pipeline(`ffmpeg -i $infile -y -c:a libvorbis -b:a $(bitrate)k -threads $(ffmpeg_threads) -f $format pipe:1`,
stderr=devnull, stdout=io), wait = false)
(io, p)
stderr=devnull, stdout=io), wait = true)
io
end
canstream(u::User) = u.stream