Class: Subconvtr::Monitor
- Inherits:
-
Object
- Object
- Subconvtr::Monitor
- Defined in:
- lib/subconvtr.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Monitor
constructor
A new instance of Monitor.
-
#run ⇒ Object
Converts the target file from windows-1254 to utf-8 encoding.
Constructor Details
#initialize ⇒ Monitor
Returns a new instance of Monitor.
5 6 |
# File 'lib/subconvtr.rb', line 5 def initialize end |
Class Method Details
.start ⇒ Object
26 27 28 29 30 |
# File 'lib/subconvtr.rb', line 26 def self.start loop do self.new.run end end |
Instance Method Details
#run ⇒ Object
Converts the target file from windows-1254 to utf-8 encoding.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/subconvtr.rb', line 8 def run output = `ls | grep -E ".srt"`.split("\n") # puts output output.each do |current| if !(`file -I "#{current}"`.include? "charset=utf-8") puts `file -I "#{current}"` `iconv -f windows-1254 -t utf-8 "#{current}" > temp24124eqqweqwrfsdf.srt && mv temp24124eqqweqwrfsdf.srt "#{current}"` puts `file -I "#{current}"` else # print '.' end end sleep 1 end |