class MultimediaParadise::SrtRegex
Constants
- ARROW
#¶ ↑
ARROW
¶ ↑#¶ ↑
- MODIFIER_IN_MS
#¶ ↑
MODIFIER_IN_MS
¶ ↑Here, specify how many ms we shall add to our new .srt file Because it is in milliseconds, append 1000 to it, in order to know how many seconds you must add. So for example, 30.000 milliseconds means that we have 30 seconds.
#¶ ↑
- SHALL_WE_DEBUG
#¶ ↑
SHALL_WE_DEBUG
¶ ↑#¶ ↑
- THIS_FILE
#¶ ↑
THIS_FILE
¶ ↑#¶ ↑
Public Class Methods
Public Instance Methods
clear_new_dataset()
click to toggle source
create_new_file()
click to toggle source
#¶ ↑
create_new_file
¶ ↑
This method will create a new file, with the name being prepended to “NEW_”.
#¶ ↑
# File lib/multimedia_paradise/video/srt_regex.rb, line 190 def create_new_file _ = 'NEW_'+@input _ = @input if @shall_we_overwrite e 'We will create a new file `'+sfile(_)+'`.' save_file(@new_dataset, _) end
process_file()
click to toggle source
#¶ ↑
process_file
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/video/srt_regex.rb, line 159 def process_file clear_new_dataset @dataset.each {|line| line.chomp! e line ee ">>>>>>> #{line} <<<<<<<<" if @debug if line.include? ARROW splitted = line.split(ARROW) _ = LongFormatToMillisecondsConverter.new(splitted[0]) _.add @modifier_in_ms result1 = MillisecondsToLongFormatConverter.convert(_.ms.to_s) # result1 = _.ms.to_s _ = LongFormatToMillisecondsConverter.new(splitted[1]) _.add @modifier_in_ms result2 = MillisecondsToLongFormatConverter.convert(_.ms.to_s) # result2 = _.ms.to_s line = result1+' '+ARROW+' '+result2 end @new_dataset << line+N } end
read_in_file()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
set_input(i = nil)
click to toggle source
#¶ ↑
set_input
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/video/srt_regex.rb, line 98 def set_input(i = nil) if i.empty? i = try_to_find_srt_files_in_current_working_directory() if i.empty? e 'No arg given for '+sfile(__FILE__)+', exiting now.' exit end end if i.is_a? Array if i[1] @modifier_in_ms = i[1].to_f end @shall_we_overwrite = true if i[2] == 'OVERWRITE' i = i.first end case i # case tag # ======================================================================= # # === srt --help # ======================================================================= # when 'HELP','help','--help' show_help exit end @input = i end
show_help()
click to toggle source
#¶ ↑
show_help
(help tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/video/srt_regex.rb, line 127 def show_help opn; e 'How to use this class?' e e ' srtt *InfernalAff*.srt 7_250' e ' srtt *InfernalAff*.srt 1_250 OVERWRITE' e if ENV['IS_ROEBE'].to_s == '1' # We assume that we are on my system here, so we can display more stuff. _ = File.readlines(THIS_FILE).select {|entry| entry.start_with? '# rsub' } _.each {|line| line = line.gsub(/^# rsub/, 'srtt') e ' '+line } end; e end