Class: YoutubeDL::State

Inherits:
Object
  • Object
show all
Defined in:
lib/youtube_dl/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def destination
  @destination
end

#errorObject

Returns the value of attribute error.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def error
  @error
end

#infoObject

Returns the value of attribute info.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def info
  @info
end

#info_jsonObject

Returns the value of attribute info_json.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def info_json
  @info_json
end

#mergerObject

Returns the value of attribute merger.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def merger
  @merger
end

#progressObject

Returns the value of attribute progress.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def progress
  @progress
end

#speedObject

Returns the value of attribute speed.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def speed
  @speed
end

#total_sizeObject

Returns the value of attribute total_size.



5
6
7
# File 'lib/youtube_dl/state.rb', line 5

def total_size
  @total_size
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/youtube_dl/state.rb', line 21

def complete?
  destination&.exist? && (info || info_json&.exist?)
end

#error?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/youtube_dl/state.rb', line 17

def error?
  !error.nil?
end

#load_and_delete_info_jsonObject



25
26
27
28
# File 'lib/youtube_dl/state.rb', line 25

def load_and_delete_info_json
  self.info = JSON.parse(info_json.read())
  info_json.unlink()
end