Module: PhTools

Defined in:
lib/phtools/error.rb,
lib/phls.rb,
lib/phmove.rb,
lib/phevent.rb,
lib/phtools.rb,
lib/phbackup.rb,
lib/phfixdto.rb,
lib/phfixfmd.rb,
lib/phrename.rb,
lib/phtagset.rb,
lib/phgettags.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, Phfixdto, Phfixfmd, Phgettags, Phls, Phmove, 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.10.0'.freeze

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 = "phtools v\#{VERSION} is a bundle of small CLI tools for arranging, renaming, tagging\nof the photo and video files. Helps to keep your photo-video assets in order.\nPlease run phtools in a terminal via CLI commands:\n  phls\\t(\#{Phls::about}),\n  phmove\\t(\#{Phmove::about}),\n  phbackup\\t(\#{Phbackup::about}),\n  phrename\\t(\#{Phrename::about}),\n  phevent\\t(\#{Phevent::about}),\n  phfixdto\\t(\#{Phfixdto::about}),\n  phfixfmd\\t(\#{Phfixfmd::about}),\n  phgettags\\t(\#{Phgettags::about}),\n  phtagset\\t(\#{Phtagset::about}).\nFor more information run these commands with -h option.\nGeneral info about phtools usage see at https://github.com/AndrewBiz/phtools.git\n"
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