nblog_zon 111.117.789 → 111.117.899
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 +107 -63
- 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: 3042209d1cdf1891eb123205e1654e8fb4703412602f4709cdc3458da3e69ca7
|
4
|
+
data.tar.gz: 2837fed48bec16b723f325bbde547b999a9eaec90d8874e471590e8b23b0db8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26a4779ec8e13b7cb5b33d09e0f9b8d214d5387e9b176a39c5c5cb30d0835fae3462dbd6c4b7fcbf53ac74ae7449bde58f60f63a52f27295dd70c50fc85d2fb8
|
7
|
+
data.tar.gz: 40b5e8eb499ab2a48483ccb06c014ee3241d064d969c612592c9b9fa9cc722318ac74eda16cd3623351516ceb497eb1aad114e91888bb0bc9f6f249f1b583750
|
data/lib/nblog_zon.rb
CHANGED
@@ -243,37 +243,37 @@ end
|
|
243
243
|
class Naver
|
244
244
|
def initialize
|
245
245
|
@seed = 1
|
246
|
-
kill_selenium_chrome #기존 창 모두 닫는 명령
|
247
|
-
sleep(1)
|
246
|
+
#kill_selenium_chrome #기존 창 모두 닫는 명령
|
247
|
+
#sleep(1)
|
248
248
|
end
|
249
249
|
|
250
|
-
def kill_selenium_chrome #기존 창 모두 닫는 코드
|
251
|
-
|
252
|
-
|
250
|
+
#def kill_selenium_chrome #기존 창 모두 닫는 코드
|
251
|
+
# wmi = WIN32OLE.connect("winmgmts://")
|
252
|
+
# chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
|
253
253
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
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
261
|
#puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
|
262
|
-
|
263
|
-
|
264
|
-
|
262
|
+
# end
|
263
|
+
# end
|
264
|
+
# end
|
265
265
|
|
266
266
|
# chromedriver도 같이 종료
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
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
273
|
#puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
|
274
|
-
|
275
|
-
|
276
|
-
end
|
274
|
+
# end
|
275
|
+
# end
|
276
|
+
#end
|
277
277
|
|
278
278
|
def chrome_setup(user_id, proxy)
|
279
279
|
naver_cookie_dir = "C:/naver_cookie"
|
@@ -2319,40 +2319,84 @@ class Wordpress
|
|
2319
2319
|
img.write('./image/memory.png')
|
2320
2320
|
end
|
2321
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
|
+
|
2322
2357
|
def image_text(text1, text2)
|
2323
2358
|
begin
|
2324
2359
|
color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
|
2325
|
-
|
2326
|
-
|
2327
|
-
text = Magick::Draw.new
|
2360
|
+
font_files = Dir.entries('./fonts').select { |f| f.downcase.end_with?('.ttf') }
|
2361
|
+
font2 = './fonts/' + font_files.sample
|
2328
2362
|
color2 = color.sample
|
2329
|
-
|
2330
|
-
|
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
|
+
|
2331
2371
|
begin
|
2332
2372
|
size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
|
2333
2373
|
rescue
|
2334
2374
|
size = 30
|
2335
2375
|
end
|
2376
|
+
|
2377
|
+
wrapped_message, adjusted_size = wrap_text_to_fit(draw, raw_message, max_width, max_height, font2, size)
|
2378
|
+
|
2336
2379
|
if @data['이미지설정']['글자그림자'].checked?
|
2337
|
-
img.annotate(
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
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
|
2342
2385
|
end
|
2343
2386
|
end
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
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
|
2348
2394
|
if @data['이미지설정']['글자테두리'].checked?
|
2349
|
-
|
2350
|
-
|
2395
|
+
draw2.stroke_width = 2
|
2396
|
+
draw2.stroke = '#000000'
|
2351
2397
|
end
|
2352
|
-
text.fill = color2
|
2353
|
-
text.font = font2
|
2354
2398
|
end
|
2355
|
-
|
2399
|
+
|
2356
2400
|
img.write('./image/memory.png')
|
2357
2401
|
rescue
|
2358
2402
|
puts '이미지 폰트 불러오기 오류 재시도...'
|
@@ -2417,33 +2461,33 @@ class Wordpress
|
|
2417
2461
|
|
2418
2462
|
if @data['이미지설정']['글자삽입1'].checked?
|
2419
2463
|
if @data['이미지설정']['이미지글자1'].length == 0
|
2420
|
-
|
2464
|
+
image_text_path1 = ''
|
2421
2465
|
else
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
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
|
2431
2475
|
end
|
2432
2476
|
end
|
2433
2477
|
|
2434
2478
|
if @data['이미지설정']['글자삽입2'].checked?
|
2435
2479
|
if @data['이미지설정']['이미지글자2'].length == 0
|
2436
|
-
|
2480
|
+
image_text_path2 = ''
|
2437
2481
|
else
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
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
|
2447
2491
|
end
|
2448
2492
|
end
|
2449
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.899
|
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-30 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: rnjstnswp123@naver.com
|