-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecksetting.rb
More file actions
71 lines (59 loc) · 1.48 KB
/
checksetting.rb
File metadata and controls
71 lines (59 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- encoding: utf-8 -*-
require 'rubygems'
require 'json'
require 'kconv'
require 'open-uri'
def checkString(str)
return false if str == nil
return false if str == ""
return true
end
# 設定ファイルが正しい状態にあるかどうか確認
unless File.exist?("setting.json")
puts "setting.json doesn't exist"
exit 1
end
begin
config = JSON.parse(File.open('setting.json').read.toutf8)
rescue JSON::ParserError => e
puts "JSON::ParserError #{e}"
exit 1
end
wrong = false
if checkString(config["RecordDirPath"]) == false
puts "RecordDirPath is wrong: #{config['RecordDirPath']}"
wrong = true
end
if config["ServiceIDs"] == nil
puts "ServiceIDs is nil"
wrong = true
end
if checkString(config["TVRockURL"]) == false
puts "TVRockURL is wrong"
wrong = true
end
begin
open(config["TVRockURL"])
rescue
puts "TVRock is not available. Please launch it."
wrong = true
end
if File.exist?(config["TVRockPath"]) == false
puts "TVRockPath is wrong. File.exist?(config['TVRockPath']) = false"
wrong = true
end
if File.exist?(config["VLCPath"]) == false
puts "VLCPath is wrong. File.exist?(config['VLCPath']) = false"
wrong = true
end
if !`#{config["ImageMagickConvertPath"]} -v`.include?("ImageMagick")
puts "ImageMagickConvertPath is wrong. I can't start it."
wrong = true
end
if !`#{config["FFMpegPath"]} -version`.include?("ffmpeg")
puts "FFMpegPath is wrong. I can't start it."
wrong = true
end
exit 1 if wrong
puts "All settings are correct."
exit 0