From 1c75517bf1dcf6cef4a85b8d938eebf92d7b03d0 Mon Sep 17 00:00:00 2001 From: AlexanderPavlenko Date: Tue, 10 Nov 2020 19:00:11 +0300 Subject: [PATCH] adds previews for GIF pages --- .gitignore | 1 + build.rb | 14 +++++++++++--- gif-mark.png | Bin 0 -> 2150 bytes 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 gif-mark.png diff --git a/.gitignore b/.gitignore index a611614..7c0d896 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.gif *.png *.cbz +!gif-mark.png diff --git a/build.rb b/build.rb index b68cee4..e079706 100755 --- a/build.rb +++ b/build.rb @@ -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 diff --git a/gif-mark.png b/gif-mark.png new file mode 100644 index 0000000000000000000000000000000000000000..b03bb99e65a4362ade0bae46225d89c7e552d3dd GIT binary patch literal 2150 zcmcIke@qi+7(S55U^#8k63gu@ZbCzMPLhs-pfbQ#0ju~q;NQd6~ba8TOHvDO0K|? zgfZ4&u;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