Module: PhTools

Defined in:
lib/phtools/error.rb,
lib/phls.rb,
lib/phmove.rb,
lib/phevent.rb,
lib/phmtags.rb,
lib/phtools.rb,
lib/phbackup.rb,
lib/phfixfmd.rb,
lib/phrename.rb,
lib/phtagset.rb,
lib/phfixdate.rb,
lib/phtools/runner.rb,
lib/phtools/ph_file.rb,
lib/phtools/version.rb

Overview

Foto tools

Defined Under Namespace

Classes: Error, ExiftoolTagger, PhFile, Phbackup, Phevent, Phfixdate, Phfixfmd, Phls, Phmove, Phmtags, Phrename, Phtagset, Runner

Constant Summary collapse

FILE_TYPE_IMAGE_NORMAL =

media type constants

%w{jpg jpeg tif tiff png}
FILE_TYPE_IMAGE_RAW =
%w{orf arw dng}
FILE_TYPE_IMAGE =
FILE_TYPE_IMAGE_NORMAL + FILE_TYPE_IMAGE_RAW
FILE_TYPE_VIDEO =
%w{avi mp4 mpg mts dv mov mkv m2t m2ts}
FILE_TYPE_AUDIO =
%w{wav}
VERSION =
'0.7.7'

Class Method Summary collapse

Class Method Details

.aboutObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/phtools.rb', line 16

def self.about
  about = <<TEXT
phtools v#{VERSION} is a bundle of small CLI tools for arranging, renaming, tagging
of the photo and video files. Helps to keep your photo-video assets in order.
Please run phtools in a terminal via CLI commands:
  phls\t(#{Phls::about}),
  phmove\t(#{Phmove::about}),
  phbackup\t(#{Phbackup::about}),
  phrename\t(#{Phrename::about}),
  phevent\t(#{Phevent::about}),
  phfixdate\t(#{Phfixdate::about}),
  phfixfmd\t(#{Phfixfmd::about}),
  phmtags\t(#{Phmtags::about}),
  phtagset\t(#{Phtagset::about}).
For more information run these commands with -h option.
General info about phtools usage see at https://github.com/AndrewBiz/phtools.git
TEXT
end

.debugObject



11
12
13
# File 'lib/phtools/error.rb', line 11

def self.debug
  @debug
end

.debug=(val) ⇒ Object



7
8
9
# File 'lib/phtools/error.rb', line 7

def self.debug=(val)
  @debug = val
end

.drill_down_error(e, level, prefix) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/phtools/error.rb', line 15

def self.drill_down_error(e, level, prefix)
  return if e.nil?
  STDERR.puts "#{prefix}: CAUSE#{level}: #{e.class} - #{e.message}"
  e.backtrace.each do |b|
    STDERR.puts "#{prefix}: CAUSE#{level} BACKTRACE: #{b}"
  end
  drill_down_error(e.cause, level+1, prefix)
end

.puts_error(msg, e = nil) ⇒ Object



24
25
26
27
28
# File 'lib/phtools/error.rb', line 24

def self.puts_error(msg, e = nil)
  prefix = File.basename($PROGRAM_NAME, '.rb')
  STDERR.puts "#{prefix}: #{msg}"
  drill_down_error(e, 0, prefix) if @debug
end