import_remotecontrol 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/import_code.rb +14 -5
- data/lib/import_remotecontrol.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODYzZTU0ODYxN2ZkYTYxYTEzODAxNmU3MTRlYWIyNzdlODRjOGNiMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmY0YTQ5MjMxNWFlOWM2ZjhjNzZmMTllOGYzMjNhOWU2OTc5NTUxNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzI1N2E5NzJkOTYwYTk3OTRiZjE4ZDgwNmMxYjY4YmRkN2EwNGQwNjdmOWIx
|
10
|
+
ZGE0YmEwZWE5NDI0YTJmOGM4NmZhYjFjMjM3OTMyZmM5MDZhM2NkZjdkM2My
|
11
|
+
YTY2NTk5MmI3YTc3OWJiZjMwZjU3MDQ3OGM4MjVjOGI2YmNkZTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTZjMDE3ODQ1Zjc4ODdlNDYzZjI0ZTU4NzlkMTk5YmZlNDRmODRiYTdjMWNk
|
14
|
+
Y2RkZWJkNzJkNDA5YWNkOTQ3OGRkNjU5MDAyNGRiMGNkZTI5ODc2N2E1YTQz
|
15
|
+
ZWIxYmI3ZmVlZmYxOTM3YWQzM2NjMGEwMzM0NTI3N2M3MTE1ZDQ=
|
data/lib/import_code.rb
CHANGED
@@ -6,21 +6,28 @@ module ImportCode
|
|
6
6
|
attr_accessor :remote_code_array
|
7
7
|
attr_accessor :protocol_hash
|
8
8
|
|
9
|
+
#不是按键编码的KEY
|
9
10
|
DEFAULT_UNCLUDE = ["FileFormat","Remotecontroldescripe","Device","Brand","Model","Button'scounts"]
|
11
|
+
#不进行导入的对应KEY
|
10
12
|
DEFAULT_NOIMPORT = ["FileFormat","Remotecontroldescripe","Button'scounts"]
|
11
13
|
|
12
14
|
METHOD_NAME = "method_name"
|
13
15
|
|
16
|
+
#用于将按键编码中的KEY的中文转为英文表示
|
14
17
|
DEFAULT_CODENAME = {"机顶盒电源"=>"power","静音"=>"voice_quiet","菜单"=>"menu",
|
15
18
|
"上"=>"up","下"=>"down","左"=>"left","右"=>"right",
|
16
19
|
"音量+"=>'voice_up',"音量-"=>"voice_down",
|
17
20
|
"频道+"=>"channel_up","频道-"=>"channel_down"}
|
21
|
+
|
22
|
+
|
23
|
+
#需要将属性值进行转换的
|
18
24
|
DEFAULT_VALUE = { "电视"=>"tv"}
|
19
25
|
|
20
26
|
BRAND ="Brand"
|
21
27
|
MODEL = "model"
|
22
28
|
|
23
29
|
|
30
|
+
#获取错误信息用于抛出错误
|
24
31
|
def self.get_error_msg(error,options={})
|
25
32
|
ret = ""
|
26
33
|
ret = ret + "ClassName: import_remotecontrol gem "
|
@@ -60,17 +67,17 @@ module ImportCode
|
|
60
67
|
@file_path_array
|
61
68
|
end
|
62
69
|
|
63
|
-
|
70
|
+
#判断是否是按键编码对应的KEY
|
64
71
|
def self.isProcolCode?(key)
|
65
72
|
!DEFAULT_UNCLUDE.include?(key)
|
66
73
|
end
|
67
74
|
|
75
|
+
#判断是不是品牌对应的KEY
|
68
76
|
def self.isBrand?(key)
|
69
77
|
key.eql?("Brand")
|
70
78
|
end
|
71
79
|
|
72
|
-
|
73
|
-
|
80
|
+
#从文件中读入编码并转换为hash的格式来处理
|
74
81
|
def self.getHashRemoteCode(file_path)
|
75
82
|
ret = {}
|
76
83
|
brand = ""
|
@@ -110,6 +117,7 @@ module ImportCode
|
|
110
117
|
ret
|
111
118
|
end
|
112
119
|
|
120
|
+
#将协议名从不同的协议编码转为了数据库对应的字符串
|
113
121
|
def self.getProtocolList(file_path)
|
114
122
|
@protocol_hash = {}
|
115
123
|
protocol_lines = File.read(file_path)
|
@@ -125,6 +133,7 @@ module ImportCode
|
|
125
133
|
end
|
126
134
|
|
127
135
|
|
136
|
+
#对按键的编码进行了处理
|
128
137
|
def self.disposeProtocolCode(codes,brand)
|
129
138
|
protocol = ""
|
130
139
|
codelist = codes.split(" ")
|
@@ -145,7 +154,7 @@ module ImportCode
|
|
145
154
|
{protocol_name:protocol,code:code}
|
146
155
|
end
|
147
156
|
|
148
|
-
|
157
|
+
#导入遥控编码
|
149
158
|
def self.importRemoteCode(file_msg)
|
150
159
|
remote_code_hash = {}
|
151
160
|
begin
|
@@ -169,7 +178,7 @@ module ImportCode
|
|
169
178
|
|
170
179
|
|
171
180
|
|
172
|
-
|
181
|
+
#获取遥控编码数组
|
173
182
|
def self.getRemoteCodeArray(dir_path)
|
174
183
|
@remote_code_array = []
|
175
184
|
if FileTest.directory?(dir_path)
|
data/lib/import_remotecontrol.rb
CHANGED