-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some more fixes to make it work on the Raspi again #7
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9ddad02
Pin angular assets to v 1.4.5
ChrisBr a835cb4
Do not bind to port 3000
ChrisBr e3a7db3
Add picture_set rake task
ChrisBr f270142
rubocop fixes
digitaltom 7020e66
add Gemfile.lock changes
digitaltom ad7dd64
update ffi
digitaltom 4d8b7c0
suppress gpio errors
digitaltom 869e1e8
do not specify ip and port in unicorn config
digitaltom b0f1eaa
correctly reset $VERBOSE
digitaltom 4c82bc4
fix for rubocop
digitaltom b43c5a7
Skip combine image if it already exists
ChrisBr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
worker_processes 3 | ||
timeout 60 | ||
preload_app true | ||
listen '0.0.0.0:3000', tcp_nopush: true | ||
listen '0.0.0.0', tcp_nopush: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require 'fileutils' | ||
|
||
namespace :picture_set do | ||
COMBINED_SUFFIX = '_combined.jpg'.freeze | ||
|
||
desc "Combine all images into one" | ||
task :combine_images, [:path] => [:environment] do |task, args| | ||
path = args[:path] | ||
path = File.join(Rails.root, 'public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select {|f| File.directory? f} | ||
picture_sets.each do |date| | ||
puts "Processing #{date}..." | ||
combine_images(date, path) | ||
end | ||
end | ||
end | ||
|
||
desc "Remove combined images. Necessary before running combine_images task again." | ||
task :clean_combine_images, [:path] => [:environment] do |task, args| | ||
path = args[:path] | ||
path = File.join(Rails.root, 'public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select {|f| File.directory? f} | ||
picture_sets.each do |date| | ||
Dir.chdir(File.join(path, date)) do | ||
FileUtils.rm("#{date}#{COMBINED_SUFFIX}", force: true) | ||
end | ||
end | ||
end | ||
end | ||
|
||
desc "Copies all images into one directory (without the single polaroids)" | ||
task :copy, [:path, :output] => [:environment] do |task, args| | ||
path = args[:path] | ||
path = File.join(Rails.root, 'public', 'picture_sets') if path.blank? | ||
puts "Using directory #{path}." | ||
Dir.chdir(path) do | ||
picture_sets = Dir.glob('*').select {|f| File.directory?(f) && f != 'all'} | ||
picture_sets.each do |date| | ||
Syscall.execute("cp #{File.join(path, date, "*.jpg")} #{args[:output]}") | ||
Syscall.execute("cp #{File.join(path, date, "*.gif")} #{args[:output]}") | ||
rescue => e | ||
puts e | ||
end | ||
end | ||
|
||
def combine_images(date, path) | ||
dir = File.join(path, date) | ||
begin | ||
Syscall.execute("time montage -geometry '25%x25%+25+25<' -background '#{OPTS.background_color}' " \ | ||
"-title '#{OPTS.image_caption}' -font '#{OPTS.font}' -fill '#{OPTS.font_color}' " \ | ||
"-pointsize #{OPTS.combined_image_fontsize} -gravity 'Center' #{date}_*.jpg #{date}#{COMBINED_SUFFIX}", | ||
dir: dir) | ||
rescue => e | ||
puts "Can not process #{dir}: #{e}" | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better only do it when
#{date}#{COMBINED_SUFFIX}
does not exist yet.