nblog_zon 0.0.101 → 111.113.777

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nblog_zon.rb +68 -72
  3. metadata +3 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 800ef8d32d384cad3b8bcf0cc75fa691c0f83e0efcc9f8c157ef3e55ba91e499
4
- data.tar.gz: a6ae5b52f7edf6def7c25e49997a2328c0670255fcd40e019e41c5c8f3138348
3
+ metadata.gz: 12b41759a6005b39dfc1b2c867c7f4a48bc0c1c975973baef98d8503937f03be
4
+ data.tar.gz: cf03b591242b7514d3086224499551e4562a77401917fe3689621c331c312664
5
5
  SHA512:
6
- metadata.gz: 7546506eff39f59be1ad66228106754d7a284d40048f5d1c3f06f3b8132b274037552849695b14d4532bde3fe3b6349b33dc4ef78031c4ad08e2e7bec376beca
7
- data.tar.gz: 42005f835e9583d08e31be158406219f9a21807690947501c2550f0320136ea80510875b8a1f5084e33a40966341aa3fdde6d7a390714da3026c3fa8533f04ef
6
+ metadata.gz: 9baef2b794c44c2b3311fd7e84a1608b54c278f6658b36318ffce4a1093aef0df76013ec3673a052d5be9db0e86157781c2234a291b4bcf1c63a1c6191247c54
7
+ data.tar.gz: e456183f6f1c6a51207fc19d6b1d4435e87c8933501fab2cad3ce8a1ab60644cb11ed0ef3cb98fbf042841829d42059a0fbe548184761f9e3af451039f567766
data/lib/nblog_zon.rb CHANGED
@@ -2164,20 +2164,27 @@ class Wordpress
2164
2164
 
2165
2165
  def save_image
2166
2166
  if @data['이미지설정']['이미지'].length == 0
2167
-
2167
+ return
2168
+ end
2169
+
2170
+ if @data['이미지설정']['순서사용'].checked?
2171
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
2172
+ @image_counter += 1
2173
+ if @image_counter > @data['이미지설정']['이미지'].length - 1
2174
+ @image_counter = 0
2175
+ end
2168
2176
  else
2169
- if @data['이미지설정']['순서사용'].checked?
2170
- image_path = @data['이미지설정']['이미지'][@image_counter][2]
2171
- @image_counter += 1
2172
- if @image_counter > @data['이미지설정']['이미지'].length-1
2173
- @image_counter = 0
2174
- end
2175
- else
2176
- image_path = @data['이미지설정']['이미지'].sample[2]
2177
+ # 초기화가 안됐거나 다 썼으면 새롭게 섞는다
2178
+ @shuffled_images ||= []
2179
+ if @shuffled_images.empty?
2180
+ @shuffled_images = @data['이미지설정']['이미지'].shuffle
2177
2181
  end
2178
- img = Magick::Image.read(image_path).first
2179
- img.write('./image/memory.png')
2182
+
2183
+ image_path = @shuffled_images.shift[2]
2180
2184
  end
2185
+
2186
+ img = Magick::Image.read(image_path).first
2187
+ img.write('./image/memory.png')
2181
2188
  end
2182
2189
 
2183
2190
  def change_image_size(w)
@@ -2985,94 +2992,83 @@ class Wordpress
2985
2992
  puts '내용사진자동삽입...'
2986
2993
  sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2987
2994
  en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2995
+
2988
2996
  begin
2989
2997
  cn = rand(sn..en)
2990
2998
  rescue
2991
2999
  cn = 0
2992
3000
  puts 'cn = rand(sn..en) error cn = 1'
2993
3001
  end
2994
-
3002
+
2995
3003
  if cn != 0
2996
- position = Array.new
3004
+ # content5 구성 및 위치 배열 생성
2997
3005
  if @data['포스트설정']['내용과자동생성'].checked?
2998
- if @data['포스트설정']['자동글 수식에 입력'].checked?
2999
- for n in 1..cn
3000
- position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
3001
- sleep(2)
3002
- end
3003
- else
3004
- for n in 1..cn
3005
- position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
3006
- sleep(2)
3007
- end
3008
- end
3009
- # position.pop
3010
- else
3011
- for n in 1..cn
3012
- position << rand(0..(content.split("\n").length-2))
3013
- sleep(2)
3014
- end
3015
- end
3016
-
3017
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3018
3006
  if @data['포스트설정']['자동글 수식에 입력'].checked?
3019
3007
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3020
3008
  content55 = content.split("(자동생성글)")[1].to_s
3009
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3021
3010
  else
3022
3011
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3023
3012
  content55 = content.split("(자동생성글)")[1].to_s
3013
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3024
3014
  end
3015
+ elsif @data['포스트설정']['gpt키워드'].checked?
3016
+ content5 = content.split("(자동생성글)")[1].to_s.split("\n")
3017
+ content_prefix = content.split("(자동생성글)")[0].to_s
3018
+ content55 = ''
3019
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3025
3020
  else
3021
+ content5 = content.split("\n")
3026
3022
  content55 = ''
3027
- content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3023
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3028
3024
  end
3029
-
3030
- p content5
3031
- puts content55
3032
- p position
3033
-
3025
+
3026
+ # 중복 필터링 로직
3034
3027
  while true
3035
3028
  check11 = 0
3036
- for nn in 0..position.length-1
3037
- if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
3029
+ position.each_with_index do |pos, idx|
3030
+ if content5[pos].to_s.include?('style') || content5[pos].to_s.include?('<') || content5[pos].to_s.include?('>')
3038
3031
  check11 = 1
3039
- position[nn] += 4
3032
+ position[idx] += 4
3040
3033
  end
3041
3034
  end
3042
- if check11 == 0
3043
- break
3035
+ break if check11 == 0
3036
+ end
3037
+
3038
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
3039
+ sleep(2)
3040
+ puts '이미지 자동 세탁 중 · · · '
3041
+ end
3042
+
3043
+ p content5
3044
+ puts content55
3045
+ p position
3046
+
3047
+ sleep(2)
3048
+ position.each do |i|
3049
+ image_url22 = get_image_file().force_encoding('utf-8')
3050
+ if @data['포스트설정']['내용사진링크'].checked?
3051
+ image_tag = '<a href="' + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') +
3052
+ '"><img src="' + image_url22 + '" alt="' + keyword.force_encoding('utf-8') + '" class="aligncenter size-full"></a>'
3053
+ else
3054
+ image_tag = '<img src="' + image_url22 + '" alt="' + keyword + '" class="aligncenter size-full">'
3044
3055
  end
3056
+ content5.insert(i, image_tag)
3057
+ end
3058
+
3059
+ sleep(2)
3060
+ puts '이미지 자동 세탁 완료 · · · '
3061
+
3062
+ if @data['포스트설정']['내용과자동생성'].checked?
3063
+ content = content5.join("\n") + '(자동생성글)' + content55
3064
+ elsif @data['포스트설정']['gpt키워드'].checked?
3065
+ content = content_prefix + "(자동생성글)" + content5.join("\n")
3066
+ else
3067
+ content = content5.join("\n")
3045
3068
  end
3046
-
3047
- position = position.sort
3048
-
3049
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3050
- sleep(2)
3051
- puts '이미지 자동 세탁 중 · · · '
3052
- end
3053
- sleep(2)
3054
- position.each do |i|
3055
- image_url22 = get_image_file().force_encoding('utf-8')
3056
- puts image_url22
3057
- puts '사진넣는위치 => '+i.to_s
3058
- if @data['포스트설정']['내용사진링크'].checked?
3059
- image_memory << ""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+'"><img src="'+image_url22+'" alt="'+keyword.force_encoding('utf-8')+'"></a>'+""
3060
- content5.insert(i, '**image**')
3061
- else
3062
- image_memory << ""+'<img src="'+image_url22+'" alt="'+keyword+'" class="aligncenter size-full">'+""
3063
- content5.insert(i, '**image**')
3064
- end
3065
- end
3066
- sleep(2)
3067
- puts '이미지 자동 세탁 완료 · · · '
3068
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3069
- content = content5.join("\n")+'(자동생성글)'+content55
3070
- puts content
3071
- else
3072
- content = content5.join("\n")
3073
3069
  end
3074
3070
  end
3075
- end
3071
+
3076
3072
 
3077
3073
 
3078
3074
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.101
4
+ version: 111.113.777
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-13 00:00:00.000000000 Z
10
+ date: 2025-04-17 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: File to Clipboard gem
14
13
  email: rnjstnswp123@naver.com
@@ -21,7 +20,6 @@ homepage: ''
21
20
  licenses:
22
21
  - zon
23
22
  metadata: {}
24
- post_install_message:
25
23
  rdoc_options: []
26
24
  require_paths:
27
25
  - lib
@@ -36,8 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
34
  - !ruby/object:Gem::Version
37
35
  version: '0'
38
36
  requirements: []
39
- rubygems_version: 3.3.7
40
- signing_key:
37
+ rubygems_version: 3.6.7
41
38
  specification_version: 4
42
39
  summary: file to clipboard
43
40
  test_files: []