Skip to content

Commit

Permalink
adds previews for GIF pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderPavlenko committed Nov 10, 2020
1 parent 8ae6d13 commit 1c75517
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.gif
*.png
*.cbz
!gif-mark.png
14 changes: 11 additions & 3 deletions build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
File.open('index.txt') do |f|
f.each_line.map(&:strip).reject { |url| url.empty? }.each_with_index do |url, i|
filename = "#{i}_#{File.basename(url)}"
filename_cli = Shellwords.shellescape(filename)
format = File.extname(filename)
puts filename
unless File.exists?(filename)
puts "downloading #{filename}"
system %(curl #{Shellwords.shellescape(url)} --retry 5 -o #{Shellwords.shellescape(filename)})
system %(curl #{Shellwords.shellescape(url)} --retry 5 -o #{filename_cli})
end
system %(ln -f #{filename_cli} drugsandwires.fail/#{i.to_s.rjust(4, '0')}#{format})
if format.downcase == '.gif'
filename_preview = "#{filename_cli[0..-4]}jpg"
unless File.exists?(filename_preview)
system %(ffmpeg -i #{filename_cli} -i gif-mark.png -filter_complex "overlay=0:0" -frames:v 1 -qscale:v 3 -y #{filename_preview})
end
system %(ln -f #{filename_preview} drugsandwires.fail/#{i.to_s.rjust(4, '0')}.jpg)
end
system %(ln -f #{Shellwords.shellescape(filename)} drugsandwires.fail/#{i.to_s.rjust(4, '0')}#{File.extname(filename)})
end
end

Expand Down
Binary file added gif-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1c75517

Please sign in to comment.