nblog_zon 111.117.779 → 111.117.799
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 +4 -4
- data/lib/nblog_zon.rb +113 -39
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f01bbab47604da93c7a1b481dcba8015f4a28b6c9d004674a15c7942a649a462
|
4
|
+
data.tar.gz: 4e5563adc0adb337b30b332863ddc1d26e70294ebf4e70186282c643f1f0c927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfe81061d9bf7fec6c9846ad22f6f60ef153b8d53e5f08b1a5e192aae218bfe160c09867ce7eef3b9797eecff6f2204b4f46cd81aa43954dcdfe13e8e8a159b
|
7
|
+
data.tar.gz: bce9840707738019dc6748d64ea257f3228dae0c82a1a3f32d68c1eeeddbde567654fed972d734cd0297c6da9dec9707f7efdeefeda71a1599bd079c5e80cece
|
data/lib/nblog_zon.rb
CHANGED
@@ -18,6 +18,7 @@ require 'digest'
|
|
18
18
|
require 'auto_click'
|
19
19
|
require 'rainbow/refinement'
|
20
20
|
require 'httpclient'
|
21
|
+
require 'win32ole'
|
21
22
|
include AutoClickMethods
|
22
23
|
using Rainbow
|
23
24
|
include Glimmer
|
@@ -242,8 +243,37 @@ end
|
|
242
243
|
class Naver
|
243
244
|
def initialize
|
244
245
|
@seed = 1
|
246
|
+
kill_selenium_chrome #기존 창 모두 닫는 명령
|
247
|
+
sleep(1)
|
245
248
|
end
|
246
249
|
|
250
|
+
def kill_selenium_chrome #기존 창 모두 닫는 코드
|
251
|
+
wmi = WIN32OLE.connect("winmgmts://")
|
252
|
+
chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
|
253
|
+
|
254
|
+
chrome_procs.each do |proc|
|
255
|
+
cmd = proc.CommandLine
|
256
|
+
if cmd && cmd.include?("user-data-dir=C:/naver_cookie")
|
257
|
+
puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
|
258
|
+
begin
|
259
|
+
proc.Terminate
|
260
|
+
rescue
|
261
|
+
#puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# chromedriver도 같이 종료
|
267
|
+
chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
|
268
|
+
chromedrivers.each do |proc|
|
269
|
+
puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
|
270
|
+
begin
|
271
|
+
proc.Terminate
|
272
|
+
rescue
|
273
|
+
#puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
247
277
|
|
248
278
|
def chrome_setup(user_id, proxy)
|
249
279
|
naver_cookie_dir = "C:/naver_cookie"
|
@@ -2289,40 +2319,84 @@ class Wordpress
|
|
2289
2319
|
img.write('./image/memory.png')
|
2290
2320
|
end
|
2291
2321
|
|
2322
|
+
def wrap_text_to_fit(draw, text, max_width, max_height, font_path, initial_size)
|
2323
|
+
size = initial_size
|
2324
|
+
draw.font = font_path
|
2325
|
+
|
2326
|
+
loop do
|
2327
|
+
draw.pointsize = size
|
2328
|
+
words = text.chars # 글자 단위로 자름 (한국어 기준)
|
2329
|
+
lines = []
|
2330
|
+
line = ""
|
2331
|
+
|
2332
|
+
words.each do |char|
|
2333
|
+
test_line = line + char
|
2334
|
+
metrics = draw.get_type_metrics(test_line)
|
2335
|
+
if metrics.width > max_width
|
2336
|
+
lines << line
|
2337
|
+
line = char
|
2338
|
+
else
|
2339
|
+
line = test_line
|
2340
|
+
end
|
2341
|
+
end
|
2342
|
+
lines << line unless line.empty?
|
2343
|
+
|
2344
|
+
line_height = draw.get_type_metrics("가").height
|
2345
|
+
total_height = line_height * lines.size
|
2346
|
+
|
2347
|
+
# 세로 초과 안 하면 성공
|
2348
|
+
if total_height <= max_height || size <= 10
|
2349
|
+
return [lines.join("\n"), size]
|
2350
|
+
else
|
2351
|
+
size -= 2
|
2352
|
+
end
|
2353
|
+
end
|
2354
|
+
end
|
2355
|
+
|
2356
|
+
|
2292
2357
|
def image_text(text1, text2)
|
2293
2358
|
begin
|
2294
2359
|
color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
|
2295
|
-
|
2296
|
-
|
2297
|
-
text = Magick::Draw.new
|
2360
|
+
font_files = Dir.entries('./fonts').select { |f| f.downcase.end_with?('.ttf') }
|
2361
|
+
font2 = './fonts/' + font_files.sample
|
2298
2362
|
color2 = color.sample
|
2299
|
-
|
2300
|
-
|
2363
|
+
|
2364
|
+
img = Magick::Image.read('./image/memory.png').first
|
2365
|
+
draw = Magick::Draw.new
|
2366
|
+
|
2367
|
+
raw_message = "#{text1}\n#{text2}".strip
|
2368
|
+
max_width = img.columns * 0.85
|
2369
|
+
max_height = img.rows * 0.6
|
2370
|
+
|
2301
2371
|
begin
|
2302
2372
|
size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
|
2303
2373
|
rescue
|
2304
2374
|
size = 30
|
2305
2375
|
end
|
2376
|
+
|
2377
|
+
wrapped_message, adjusted_size = wrap_text_to_fit(draw, raw_message, max_width, max_height, font2, size)
|
2378
|
+
|
2306
2379
|
if @data['이미지설정']['글자그림자'].checked?
|
2307
|
-
img.annotate(
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2380
|
+
img.annotate(draw, 0, 0, 2, 2, wrapped_message) do
|
2381
|
+
draw.gravity = Magick::CenterGravity
|
2382
|
+
draw.pointsize = adjusted_size
|
2383
|
+
draw.fill = '#000000'
|
2384
|
+
draw.font = font2
|
2312
2385
|
end
|
2313
2386
|
end
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2387
|
+
|
2388
|
+
draw2 = Magick::Draw.new
|
2389
|
+
img.annotate(draw2, 0, 0, 0, 0, wrapped_message) do
|
2390
|
+
draw2.gravity = Magick::CenterGravity
|
2391
|
+
draw2.pointsize = adjusted_size
|
2392
|
+
draw2.fill = color2
|
2393
|
+
draw2.font = font2
|
2318
2394
|
if @data['이미지설정']['글자테두리'].checked?
|
2319
|
-
|
2320
|
-
|
2395
|
+
draw2.stroke_width = 2
|
2396
|
+
draw2.stroke = '#000000'
|
2321
2397
|
end
|
2322
|
-
text.fill = color2
|
2323
|
-
text.font = font2
|
2324
2398
|
end
|
2325
|
-
|
2399
|
+
|
2326
2400
|
img.write('./image/memory.png')
|
2327
2401
|
rescue
|
2328
2402
|
puts '이미지 폰트 불러오기 오류 재시도...'
|
@@ -2387,33 +2461,33 @@ class Wordpress
|
|
2387
2461
|
|
2388
2462
|
if @data['이미지설정']['글자삽입1'].checked?
|
2389
2463
|
if @data['이미지설정']['이미지글자1'].length == 0
|
2390
|
-
|
2391
|
-
else
|
2392
|
-
if @data['이미지설정']['글자랜덤'].checked?
|
2393
|
-
image_text_path1 = @data['이미지설정']['이미지글자1'].sample
|
2464
|
+
image_text_path1 = ''
|
2394
2465
|
else
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2466
|
+
if @data['이미지설정']['글자랜덤'].checked?
|
2467
|
+
image_text_path1 = @data['이미지설정']['이미지글자1'].sample
|
2468
|
+
else
|
2469
|
+
image_text_path1 = @data['이미지설정']['이미지글자1'][@image_text_soon1]
|
2470
|
+
@image_text_soon1 += 1
|
2471
|
+
if @image_text_soon1 > @data['이미지설정']['이미지글자1'].length - 1
|
2472
|
+
@image_text_soon1 = 0
|
2473
|
+
end
|
2474
|
+
end
|
2401
2475
|
end
|
2402
2476
|
end
|
2403
2477
|
|
2404
2478
|
if @data['이미지설정']['글자삽입2'].checked?
|
2405
2479
|
if @data['이미지설정']['이미지글자2'].length == 0
|
2406
|
-
|
2480
|
+
image_text_path2 = ''
|
2407
2481
|
else
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2482
|
+
if @data['이미지설정']['글자랜덤'].checked?
|
2483
|
+
image_text_path2 = @data['이미지설정']['이미지글자2'].sample
|
2484
|
+
else
|
2485
|
+
image_text_path2 = @data['이미지설정']['이미지글자2'][@image_text_soon2]
|
2486
|
+
@image_text_soon2 += 1
|
2487
|
+
if @image_text_soon2 > @data['이미지설정']['이미지글자2'].length - 1
|
2488
|
+
@image_text_soon2 = 0
|
2489
|
+
end
|
2490
|
+
end
|
2417
2491
|
end
|
2418
2492
|
end
|
2419
2493
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nblog_zon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 111.117.
|
4
|
+
version: 111.117.799
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-29 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: rnjstnswp123@naver.com
|