diff options
| author | AppleDash <[email protected]> | 2020-09-25 23:13:15 -0400 |
|---|---|---|
| committer | AppleDash <[email protected]> | 2020-09-25 23:13:15 -0400 |
| commit | 90feaa87abbd61178df8d3481fd66ee5e0bc8738 (patch) | |
| tree | 013c24e4b9432833c0dcc14501056c64e22d53e6 /lib/booru/image_processing/processor.rb | |
| parent | db3a4525ad4dbf5c88dee61c50143e43a426b349 (diff) | |
Incorporate logging into new image processing pipeline.
Diffstat (limited to 'lib/booru/image_processing/processor.rb')
| -rw-r--r-- | lib/booru/image_processing/processor.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/booru/image_processing/processor.rb b/lib/booru/image_processing/processor.rb index 59cae9d..cf342e6 100644 --- a/lib/booru/image_processing/processor.rb +++ b/lib/booru/image_processing/processor.rb @@ -1,12 +1,14 @@ module Booru module ImageProcessing class Processor - attr_reader :rasterized # actually rasterized or still previws + attr_reader :rasterized # actually rasterized or still previews + attr_reader :log def initialize(original_path, directory) @original_path = original_path @directory = directory @rasterized = original_path + @log = [] end # Apply pre-processing to the image. This is anything that should be done to the original @@ -41,6 +43,17 @@ module Booru def is_video? false end + + def write_log(message) + now = DateTime.now.strftime("%d/%m/%Y %H:%M:%S") + @log << "[#{now}] #{message}" + end + + def platform_link(source, destination) + FileUtils.ln_sf(source, destination) + rescue Errno::EPROTO + FileUtils.cp(source, destination) + end end end end |
