Class: DashTimelineValidator::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/dash_timeline_validator/cli.rb

Class Method Summary collapse

Class Method Details

.error_exit(report) ⇒ Object



5
6
7
8
# File 'lib/dash_timeline_validator/cli.rb', line 5

def self.error_exit(report)
  DashTimelineValidator::Log.info(report)
  exit(-1)
end

.main(manifest) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dash_timeline_validator/cli.rb', line 10

def self.main(manifest)
  begin
    FileUtils.mkdir_p DashTimelineValidator::Options::ANALYZER_FOLDER
    DashTimelineValidator::Log.info("The manifest #{manifest} will be processed at #{DashTimelineValidator::Options::ANALYZER_FOLDER} folder.")

    mpd_content = DashTimelineValidator::DashFile.fetch_file(manifest)

    DashTimelineValidator::Log.info(DashTimelineValidator::Validator.analyze(manifest, mpd_content))
  rescue StandardError => e
    DashTimelineValidator::Log.error("There was an error: #{e.inspect}")
    DashTimelineValidator::Log.warn("Removing the folder #{DashTimelineValidator::Options::ANALYZER_FOLDER}")
    FileUtils.rm_rf DashTimelineValidator::Options::ANALYZER_FOLDER
  end
end