pixab 1.7.2 → 1.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4146df9c65aca34df839f71672eeafb17a87c0f11ce6e8da797be55254be3d0e
4
- data.tar.gz: b5a627d359ea03d2f0eaae853bf3370a46407d04f7c9e7e752628e9805a90108
3
+ metadata.gz: 84d54a1ab3a12281357538f78851d2b729803cf110e51570a17f2ee0e1c480de
4
+ data.tar.gz: 2223cb8f2541517bcde9f0490cc064061043ddfc964d42d93d4ea953eaf2e417
5
5
  SHA512:
6
- metadata.gz: 024a39ab63245acab281016dffc0dc663f13174ff4f12ee0d25a9981a0eb0de7f5a0c7dc1962f8a6b3a9dc2270058d577e9f93666a246c6641cf7f91831aa534
7
- data.tar.gz: 361c49c8054f9da6793a3089b77d3b4f076d80f5b6c20f504a18b40d5a14f912b7411e92c2eb2f4f4e1005b600d22be86da389577e5838ad3cbb0763ee392276
6
+ metadata.gz: feb82c51f413c5a117ef86728574aa5498f9d5a13181eef65c555fc10b525af202f94dddbbf13f08b5b56c105dbb9fa0eb7e2fa376a1d95b8706b36ee0767c62
7
+ data.tar.gz: 43ad564e1d758c1ed30bc929207af08c25e5426b33f8a59f80b731d8d055881f93afb37a0017428759ae511a37b00feaf140924c358594e15b6a3ca339b85390
@@ -14,6 +14,7 @@ module Pixab
14
14
  Localization_FILE_NAME = 'Localization.zip'
15
15
 
16
16
  Project_AirBrush = '6cd2db15-6325-43ae-9087-f78aca9bec9a'
17
+ Project_AirBrushVideo = '16cbeffd-bb6e-46e8-a32e-9c79d23a796f'
17
18
 
18
19
  attr_accessor :projects, :tags, :platform, :collections
19
20
 
@@ -34,6 +35,14 @@ module Pixab
34
35
  @platform = 'iOS'
35
36
  @tags = 'iOS'
36
37
  @collections = 'AirBrush'
38
+ when '--abv-iOS'
39
+ @projects = Project_AirBrushVideo
40
+ @platform = 'iOS'
41
+ @tags = 'iOS'
42
+ when '--abv-android'
43
+ @projects = Project_AirBrushVideo
44
+ @platform = 'android'
45
+ @tags = 'android'
37
46
  end
38
47
  end
39
48
 
@@ -83,17 +92,7 @@ module Pixab
83
92
  end
84
93
 
85
94
  # 第二步:循环尝试下载ZIP文件
86
- def download_zip_file_with_retry(download_url, export_id, max_retries=30)
87
- # 加载动画字符
88
- spinner = Enumerator.new do |e|
89
- loop do
90
- e.yield '|'
91
- e.yield '/'
92
- e.yield '-'
93
- e.yield '\\'
94
- end
95
- end
96
-
95
+ def download_zip_file_with_retry(download_url, export_id, max_retries=60)
97
96
  retries = 0
98
97
  while retries < max_retries
99
98
  uri = URI("#{download_url}/#{export_id}")
@@ -108,13 +107,11 @@ module Pixab
108
107
  File.open(Localization_FILE_NAME, "wb") { |file| file.write(response.body) }
109
108
  return true
110
109
  else
111
- # 等待1秒后重试
112
- # 打印动画字符
113
- print "\r#{spinner.next}"
114
- sleep 0.5
115
- print "\r#{spinner.next}"
116
- sleep 0.5
117
110
  retries += 1
111
+ dots = '.' * retries
112
+ print "\r#{dots}"
113
+ # 等待1秒后重试
114
+ sleep 1
118
115
  end
119
116
  end
120
117
 
@@ -144,10 +141,12 @@ module Pixab
144
141
  f_path = extract_localization_file_path(f.name)
145
142
  FileUtils.mkdir_p(File.dirname(f_path))
146
143
  content = f.get_input_stream.read
147
- localization_content = content.gsub(/=\s*".*";/) do |match|
148
- match.gsub('%s', '%@')
144
+ if projects == Project_AirBrush
145
+ content = content.gsub(/=\s*".*";/) do |match|
146
+ match.gsub('%s', '%@')
147
+ end
149
148
  end
150
- File.write(f_path, localization_content)
149
+ File.write(f_path, content)
151
150
  end
152
151
  end
153
152
 
@@ -183,7 +182,11 @@ module Pixab
183
182
  template = nil
184
183
  if platform == 'android'
185
184
  format = 'android-xml'
186
- template = '{LOCALE:ANDROID}/strings_ph.xml'
185
+ if projects == Project_AirBrush
186
+ template = '{LOCALE:ANDROID}/strings_ph.xml'
187
+ else
188
+ template = '{LOCALE:ANDROID}/strings.xml'
189
+ end
187
190
  else
188
191
  format = 'ios-strings'
189
192
  template = '{LOCALE:IOS}.lproj/Localizable.strings'
@@ -200,39 +203,75 @@ module Pixab
200
203
  end
201
204
 
202
205
  def extract_localization_file_path(zip_file_path)
203
- if platform.nil? || platform != 'android'
204
- return zip_file_path
205
- end
206
+ case projects
207
+ when Project_AirBrush
208
+ if platform.nil? || platform != 'android'
209
+ return zip_file_path
210
+ end
206
211
 
207
-
208
- path = File.dirname(zip_file_path)
209
- localization = ''
210
- case path
211
- when 'en'
212
+ path = File.dirname(zip_file_path)
212
213
  localization = ''
213
- when 'fr'
214
- localization = '-fr-rFR'
215
- when 'ru'
216
- localization = '-ru-rRU'
217
- when 'zh-rHans'
218
- localization = '-zh-rCN'
219
- when 'tr'
220
- localization = '-tr-rTR'
221
- when 'pt-rBR'
222
- localization = '-pt'
223
- else
224
- localization = "-#{path}"
214
+ case path
215
+ when 'en'
216
+ localization = ''
217
+ when 'fr'
218
+ localization = '-fr-rFR'
219
+ when 'ru'
220
+ localization = '-ru-rRU'
221
+ when 'zh-rHans'
222
+ localization = '-zh-rCN'
223
+ when 'tr'
224
+ localization = '-tr-rTR'
225
+ when 'pt-rBR'
226
+ localization = '-pt'
227
+ else
228
+ localization = "-#{path}"
229
+ end
230
+ return "values#{localization}/#{File.basename(zip_file_path)}"
231
+
232
+ when Project_AirBrushVideo
233
+ if platform.nil?
234
+ return zip_file_path
235
+ end
236
+
237
+ case platform
238
+ when 'android'
239
+ path = File.dirname(zip_file_path)
240
+ localization = ''
241
+ case path
242
+ when 'en'
243
+ localization = ''
244
+ when 'zh-rHans'
245
+ localization = '-zh-rCN'
246
+ when 'zh-rHant'
247
+ localization = '-zh-rHK'
248
+ else
249
+ localization = "-#{path}"
250
+ end
251
+ return "values#{localization}/#{File.basename(zip_file_path)}"
252
+ when 'iOS'
253
+ path = File.dirname(zip_file_path)
254
+ localization = zip_file_path
255
+ case path
256
+ when 'pt-PT.lproj'
257
+ localization = File.join('pt.lproj', File.basename(zip_file_path))
258
+ end
259
+ return localization
260
+ end
225
261
  end
226
- return "values#{localization}/#{File.basename(zip_file_path)}"
262
+
227
263
  end
228
264
 
229
265
  def is_ignored_file_path(file_path)
230
- if platform != 'android'
231
- return false
266
+ case projects
267
+ when Project_AirBrush
268
+ return false unless platform == 'android'
269
+
270
+ path = File.dirname(file_path)
271
+ return path == 'zh-rHant' ? true : false
232
272
  end
233
273
 
234
- path = File.dirname(file_path)
235
- return path == 'zh-rHant' ? true : false
274
+ return false
236
275
  end
237
276
 
238
277
  end
data/lib/pixab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pixab
4
- VERSION = "1.7.2"
4
+ VERSION = "1.7.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - 廖再润
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2