Skip to content

Commit

Permalink
skipping everything lighter than 2MB
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakilon committed Aug 17, 2020
1 parent 9b1a553 commit 53eb32e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/largeimages/Gemfile
Expand Up @@ -4,8 +4,8 @@ gem "json"

gem "nokogiri"

gem "nethttputils"
gem "directlink", "~>0.0.9.0"
gem "nethttputils", git: "git@github.com:nakilon/nethttputils.git"
gem "directlink", git: "git@github.com:nakilon/directlink.git"

gem "gcplogger", git: "git@github.com:nakilon/gcplogger.git", tag: "v0.1.1.0"
gem "gcplogger", git: "git@github.com:nakilon/gcplogger.git"
gem "google-cloud-error_reporting"
4 changes: 2 additions & 2 deletions examples/largeimages/main.rb
Expand Up @@ -12,7 +12,6 @@


require "directlink"
DirectLink.logger.level = Logger::INFO

require "nokogiri"

Expand Down Expand Up @@ -123,8 +122,9 @@
resolution = "[#{tt.first.width}x#{tt.first.height}]"
next logger.warn "already submitted #{resolution} #{id}: '#{url}'" unless Gem::Platform.local.os == "darwin" || search_url[url].empty?

system "curl -s '#{tt.first.url}' -o temp --retry 5" or fail
next logger.warn "skipped <2mb id=#{id}" if 2000000 > File.size("temp")
if "mapporn" == subreddit.downcase
system "curl -s '#{tt.first.url}' -o temp --retry 5" or fail
`vips pngsave temp temp.png`
next logger.warn "skipped /r/mapporn <10mb PNG id=#{id}" if 10000000 > File.size("temp.png")
end
Expand Down

0 comments on commit 53eb32e

Please sign in to comment.