Closed Gaelan closed 8 years ago
How about a pull request, if it's so simple to implement? ;-)
I'll try to get one done tonight. No promises.
It seems to need a little more to do, especially to handle the case to have no filename. I have already adapted the master to use Open3 instead of direct calls via backticks, so it is easier to support IOs. I will have a look at it in the next week.
I have implemented support for reading from IOs now and by the way the -fast option. Please checkout release 2.6.0.
@Gaelan Could you give me an example of your use case? Maybe one we can add to the examples of mini_exiftool?
@janfri I was thinking of Exiftooling a file that was already saved to S3. Another simple use case would be getting metadata from a URL.
@Gaelan How do you get a non-blocking IO-object? If I use open-uri for example the whole file will be downloaded before I can read from the IO, so the fast option doesn't make any sense here. :-(
@janfri I found this:
uri = URI('http://example.com/large_file')
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri
http.request request do |response|
open 'large_file', 'w' do |io|
response.read_body do |chunk|
io.write chunk
end
end
end
end
It's "a bit" more verbose than open-uri, but perhaps you could adapt this to run on a separate thread and write into an IO which you then passed to EXIFtool. Surely there's a better way, right? I'll keep looking.
EDIT: also, you could just pipe out of curl.
@Gaelan Thanks a lot. I've added both to the new example show_speedup_with_fast_option. Checkout version 2.7.0.
@janfri Thanks for implementing this so quickly! I'll add it to my app soon.
This should be pretty simple to implement (just pipe the IO into
exiftool -
). Support for the-fast
option (see #15) could be a possible improvement, but isn't necessary.