Skip to content

Commit

Permalink
configurable GB to go to LOL what a confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
rdp committed Feb 1, 2013
1 parent a16befd commit df134af
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
3 changes: 0 additions & 3 deletions TODO
Expand Up @@ -9,10 +9,7 @@ more massive renamings everywhere? sane USB, ask melissa why not :P
configurable global options, just for current behavior
a way to show how long I can record for based on my disk space? It would be nice if it tells me based on this configuration you have 2 days recording or 2 hrs, etc then I can select my settings better.

fix icon

the auto-start option, I constantly seem to wish for it...

== maybes/next ups/maybes ==

setup my network cam, since I do want it...
Expand Down
24 changes: 19 additions & 5 deletions lib/global.rb
@@ -1,4 +1,5 @@
require 'shared'

def do_global
global = SimpleGuiCreator::ParseTemplate.new.parse_setup_filename('lib\\global_options.sgc')
require 'win32/registry'
Expand All @@ -21,21 +22,34 @@ def do_global
if !jar_location || !java_root
show_message "huh? unable to get something for setting up start?"
end
# assume javaw, and bin\startup.rb :)
# assume javaw, and also assume bin\startup.rb :)
# no splash...
b.write_s name, "\"#{java_root}\\bin\\javaw.exe\" -jar \"#{jar_location}\" -C \"#{Dir.pwd}\" -Ilib bin/startup.rb --background-start" # avoid various jruby RbConfig.ruby bugz LOL
p 'wrote it to registry'
}

e[:run_at_startup].on_unchecked {
b.delete_value(name)
}
e[:record_to_dir_text].text = base_storage_dir

setup_global = proc {
e[:reaches_xx_gb].text = e[:reaches_xx_gb].original_text.gsub('XX', free_space_requested.g)
e[:record_to_dir_text].text = base_storage_dir
setup_ui
}

e[:record_to_dir_button].on_clicked {
got = SimpleGuiCreator.new_existing_dir_chooser_and_go "Select base root directory for saving", base_storage_dir
UsbStorage['storage_dir'] = File.expand_path got # save with /'s
e[:record_to_dir_text].text = base_storage_dir
UsbStorage['storage_dir'] = File.expand_path got # save with /'s
setup_global.call
}

e[:change_disk_space_used].on_clicked {
requested = get_input "how many GB free do you want to keep free, after recordings?", free_space_requested/1e9
UsbStorage['delete_if_we_have_less_than_this_much_free_space'] = requested.to_f*1e9
setup_global.call
}

setup_global.call

end

Expand Down
4 changes: 3 additions & 1 deletion lib/global_options.sgc
@@ -1,3 +1,5 @@
---------- Dirt Simple Surveillance Global Options -----------
[Change Record to directory:record_to_dir_button] "Currently" ":record_to_dir_text,width=350px"
"Currently set to record each camera at 500 kb/s, and to delete the oldest recordings"
"when it reaches XX GB remaining on the disk:reaches_xx_gb" [Change disk space it will use:change_disk_space_used]
[/:run_at_startup] "Auto-start at windows login time"
[Record to directory:record_to_dir_button] ":record_to_dir_text,width=350px"
6 changes: 3 additions & 3 deletions lib/go.rb
Expand Up @@ -32,7 +32,7 @@ def set_all_ffmpegs_as_lowest_prio
def delete_if_out_of_disk_space
free_space = java.io.File.new(base_storage_dir).freeSpace

if free_space < Delete_if_we_have_less_than_this_much_free_space
if free_space < free_space_requested
# lodo email instead? compact?
$thread_start.synchronize {
$deletor_thread ||= Thread.new {
Expand All @@ -43,15 +43,15 @@ def delete_if_out_of_disk_space
# at least show stats or something?
show_message "warning, maybe disk space is low?\nwant to delete #{oldest_day_dir} to keep disk space low, but that's today, not deleting it\nrecommend installing and using windirstat to examine and free up some disk space"
else
p "deleting old day dir #{oldest_day_dir} because free #{free_space.g} < #{Delete_if_we_have_less_than_this_much_free_space.g}"
p "deleting old day dir #{oldest_day_dir} because free #{free_space.g} < #{free_space_requested.g}"
FileUtils.rm_rf oldest_day_dir
p "done deleting " + oldest_day_dir
end
$deletor_thread = nil # let next guy through delete if more should be deleted...
}
}
else
#puts "have enough free space #{free_space.g} > #{Delete_if_we_have_less_than_this_much_free_space.g}"
#puts "have enough free space #{free_space.g} > #{free_space_requested.g}"
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/setup.rb
Expand Up @@ -40,8 +40,8 @@ def setup_ui
end

free_space = java.io.File.new(base_storage_dir).freeSpace
@a.elements[:options_message].text = "Will record to #{(base_storage_dir.split('/')[-4..-1] || [base_storage_dir]).join('/')} at 500 kb/s/camera until there is #{Delete_if_we_have_less_than_this_much_free_space.g} free"

@a.elements[:options_message].text = "Will record to #{(base_storage_dir.split('/')[-4..-1] || [base_storage_dir]).join('/')} at 500 kb/s/camera until there is #{free_space_requested.g} free"
p 'setup_ui done'
if(current_devices.size == 0)
@a.elements[:start_stop_capture].text = "add a camera 1st!"
else
Expand Down
5 changes: 4 additions & 1 deletion lib/shared.rb
Expand Up @@ -47,4 +47,7 @@ def gig
end
end

Delete_if_we_have_less_than_this_much_free_space = 10.gig
UsbStorage.set_default('delete_if_we_have_less_than_this_much_free_space', 10.gig)
def free_space_requested
UsbStorage['delete_if_we_have_less_than_this_much_free_space']
end
Binary file modified vendor/webcam-clipart-confused.png
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 df134af

Please sign in to comment.