Module: MPlayer::SlaveSubCommands

Included in:
Slave
Defined in:
lib/mplayer-ruby/slave_sub_commands.rb

Instance Method Summary collapse

Instance Method Details

#forced_subs_only(value = nil) ⇒ Object

Toggle/set forced subtitles only



116
117
118
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 116

def forced_subs_only(value = nil)
  toggle :forced_subs_only, value
end

#sub_alignment(alignment = nil) ⇒ Object

Toggle/set subtitle alignment. [alignment] :top sets top alignment :center sets center alignment :bottom sets bottom alignment



31
32
33
34
35
36
37
38
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 31

def sub_alignment(alignment = nil)
  command case alignment
  when :top then "sub_alignment 0"
  when :center then "sub_alignment 1"
  when :bottom then "sub_alignment 2"
  else "sub_alignment"
  end
end

#sub_delay(value, type = :absolute) ⇒ Object

Adjust the subtitle delay :relative is adjust by +/- <value> seconds. :absolute is set it to <value>. (default)



7
8
9
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 7

def sub_delay(value,type = :absolute)
  adjust_set :sub_delay, value, type
end

#sub_demux(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_SUBTITLE_ID :off turns off sub :cycle will cycle all file subs. (Default)



104
105
106
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 104

def sub_demux(value = :cycle)
  select_cycle :sub_demux, value
end

#sub_file(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_VOBSUB_ID :off turns off sub :cycle will cycle all file subs. (Default)



97
98
99
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 97

def sub_file(value = :cycle)
  select_cycle :sub_file, value
end

#sub_load(file) ⇒ Object

Loads subtitles from <file>.

Raises:

  • (ArgumentError)


49
50
51
52
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 49

def sub_load(file)
  raise ArgumentError, "Invalid File" unless File.exists? file
  command("sub_load #{file}")
end

#sub_pos(value, type = :relative) ⇒ Object

Adjust/set subtitle position. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>.



23
24
25
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 23

def sub_pos(value,type = :relative)
  adjust_set :sub_pos, value, type
end

#sub_remove(value = :all) ⇒ Object

Removes the selected sub file :all removes all sub files. (Default) <value> removes the sub file at that index.



57
58
59
60
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 57

def sub_remove(value = :all)
  cmd = (value == :all ? -1 : value)
  command "sub_remove #{cmd}"
end

#sub_scale(value, type = :relative) ⇒ Object

Adjust the subtitle size by +/- <value> :set set it to <value> :relative adjusts it by value



111
112
113
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 111

def sub_scale(value,type = :relative)
  adjust_set :sub_scale, value, type
end

#sub_select(value = :cycle) ⇒ Object

Displays subtitle :cycle will cycle through all sub_titles. (Default) <value> will display the sub_title at that index.



65
66
67
68
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 65

def sub_select(value = :cycle)
  cmd = (value == :cycle ? -2 : value)
  command "sub_select #{cmd}"
end

#sub_source(value = :cycle) ⇒ Object

Display first subtitle from <value>

:sub for SUB_SOURCE_SUBS for file subs
:vobsub for  SUB_SOURCE_VOBSUB for VOBsub files
:demux SUB_SOURCE_DEMUX for subtitle embedded in the media file or DVD subs.
:off will turn off subtitle display.
:cycle will cycle between the first subtitle of each currently available sources.


76
77
78
79
80
81
82
83
84
85
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 76

def sub_source(value = :cycle)
  switch = case value
  when :sub then 0
  when :vobsub then 1
  when :demux then 2
  when :off then -1
  else -2
  end
  command "sub_source #{switch}"
end

#sub_step(value, type = :next) ⇒ Object

Step forward in the subtitle list by <value> steps step backwards if <value> is negative can also set type to :backward or :forward and return postive <value>



14
15
16
17
18
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 14

def sub_step(value, type = :next)
  val = value.abs
  type = :prev if value < 0
  command(type == :next ? "sub_step #{val}" : "sub_step #{-val}" )
end

#sub_visibility(value = nil) ⇒ Object

Toggle/set subtitle visibility. :on turns on visilibity. :off turns off visilibility. else toggles visibility.



44
45
46
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 44

def sub_visibility(value = nil)
  toggle :sub_visibility, value
end

#sub_vob(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_FILE_SUB_ID :off turns off sub :cycle will cycle all file subs. (Default)



90
91
92
# File 'lib/mplayer-ruby/slave_sub_commands.rb', line 90

def sub_vob(value = :cycle)
  select_cycle :sub_vob, value
end