Class: RDvdSlideshow::SlideshowInput

Inherits:
Object
  • Object
show all
Defined in:
lib/rdvd-slideshow/slideshow_input.rb

Overview

A SlideshowInput is responsible for building the input file used by dvd-slideshow.

Instance Method Summary collapse

Constructor Details

#initialize(file_path = nil, &block) ⇒ SlideshowInput

Initializes the file path and write the content of the file. If no file path is given, a temp file is used (Tempfile). The provided block is used to build the content of the file. The file is flushed after writing.



16
17
18
19
20
21
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 16

def initialize(file_path=nil,&block)
  @file = file_path ? File.new(file_path,'w') : Tempfile.new('slideshow_input')
  
  block.call(self) if block
  @file.flush
end

Instance Method Details

#background(duration, options = {}) ⇒ Object



70
71
72
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 70

def background(duration,options={})
  write_line("background",duration,options,[:subtitle,:image])
end

#crossfade(duration, subtitle = nil) ⇒ Object



66
67
68
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 66

def crossfade(duration,subtitle=nil)
  write_line("crossfade",duration,{:subtitle=>subtitle},[:subtitle])
end

#exitObject

Adds an exit command



77
78
79
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 77

def exit
  @file.puts "exit"
end

#fadein(duration, subtitle = nil) ⇒ Object



58
59
60
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 58

def fadein(duration,subtitle=nil)
  write_line("fadein",duration,{:subtitle=>subtitle},[:subtitle])
end

#fadeout(duration, subtitle = nil) ⇒ Object



62
63
64
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 62

def fadeout(duration,subtitle=nil)
  write_line("fadeout",duration,{:subtitle=>subtitle},[:subtitle])
end

#file_pathObject

Path to the path where slideshow input configuration is written



24
25
26
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 24

def file_path
  @file.path
end

#image(path, duration, options = {}) ⇒ Object

Adds a new image



31
32
33
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 31

def image(path,duration,options={})
  write_line(path,duration,options,[:subtitle,:effect,:effect_params])
end

#musictitle(duration, options = {}) ⇒ Object

Adds a music Possible options are : subtitle



54
55
56
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 54

def musictitle(duration,options={})
  write_line("musictitle",duration,options,[:subtitle])
end

#title(duration, text) ⇒ Object

Adds a title



38
39
40
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 38

def title(duration,text)
  write_line("title",duration,{:text=>text},[:text])
end

#titlebar(duration, options = {}) ⇒ Object

Adds a title bar Possible options are : uppertitle_ and lowertitle_



46
47
48
# File 'lib/rdvd-slideshow/slideshow_input.rb', line 46

def titlebar(duration,options={})
  write_line("titlebar",duration,options,[:upper_title,:lower_title])
end