nblog_duo 1.3.7 → 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_duo.rb +68 -72
  3. metadata +3 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6d9c02736a39545443c8259c08c610444632dd5989d763e9199641250e36baa
4
- data.tar.gz: d1107f1910273d620899cd3b9be1831509633100fd5781af9a55ec4f251815dc
3
+ metadata.gz: a4d26ac3e39b9dc65493756540b0ba309ed9150f0a5d71000ec59b7ff552e1e8
4
+ data.tar.gz: cfdf931537653db07de115df330ef6da84817a6604c155ff6031398b06d3fb2d
5
5
  SHA512:
6
- metadata.gz: ace975fa2259cad583a1ecdf5f42f5fb2774adb10c9d888f3c94b98ca8d483447ba8ab4fd34ad0be6bf0fc23265af6fca2e8d6eb7c6fa0b4920ec35d6fb5124c
7
- data.tar.gz: 7651bcf6b92840442b90350f3168741dff389eca1b49b5963c604fa7d2d657659a4a78fa79ed99e5115a04f95d18836ed9afe098c0d3c23f29a242b74c12ab66
6
+ metadata.gz: 8f2eb9751f1eea16a36da0a1f7a00224b835414aa90e9822a92f3c68c20cabecf52c8dd7ca0bf73698e56838bfc705da560aa7d5f528a470fdb9f4f73938a24c
7
+ data.tar.gz: 7f5c146ee8c3ae394a244fb1d0b3fa1f7ff2908967b9fe954a737a25a9800b4be53237d4ad8690595c39ea26f695b8e275df6dd415b8858ec67c81edfc038fd5
data/lib/nblog_duo.rb CHANGED
@@ -2233,20 +2233,27 @@ class Wordpress
2233
2233
 
2234
2234
  def save_image
2235
2235
  if @data['이미지설정']['이미지'].length == 0
2236
-
2236
+ return
2237
+ end
2238
+
2239
+ if @data['이미지설정']['순서사용'].checked?
2240
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
2241
+ @image_counter += 1
2242
+ if @image_counter > @data['이미지설정']['이미지'].length - 1
2243
+ @image_counter = 0
2244
+ end
2237
2245
  else
2238
- if @data['이미지설정']['순서사용'].checked?
2239
- image_path = @data['이미지설정']['이미지'][@image_counter][2]
2240
- @image_counter += 1
2241
- if @image_counter > @data['이미지설정']['이미지'].length-1
2242
- @image_counter = 0
2243
- end
2244
- else
2245
- image_path = @data['이미지설정']['이미지'].sample[2]
2246
+ # 초기화가 안됐거나 다 썼으면 새롭게 섞는다
2247
+ @shuffled_images ||= []
2248
+ if @shuffled_images.empty?
2249
+ @shuffled_images = @data['이미지설정']['이미지'].shuffle
2246
2250
  end
2247
- img = Magick::Image.read(image_path).first
2248
- img.write('./image/memory.png')
2251
+
2252
+ image_path = @shuffled_images.shift[2]
2249
2253
  end
2254
+
2255
+ img = Magick::Image.read(image_path).first
2256
+ img.write('./image/memory.png')
2250
2257
  end
2251
2258
 
2252
2259
  def change_image_size(w)
@@ -3054,94 +3061,83 @@ class Wordpress
3054
3061
  puts '내용사진자동삽입...'
3055
3062
  sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
3056
3063
  en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
3064
+
3057
3065
  begin
3058
3066
  cn = rand(sn..en)
3059
3067
  rescue
3060
3068
  cn = 0
3061
3069
  puts 'cn = rand(sn..en) error cn = 1'
3062
3070
  end
3063
-
3071
+
3064
3072
  if cn != 0
3065
- position = Array.new
3073
+ # content5 구성 및 위치 배열 생성
3066
3074
  if @data['포스트설정']['내용과자동생성'].checked?
3067
- if @data['포스트설정']['자동글 수식에 입력'].checked?
3068
- for n in 1..cn
3069
- position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
3070
- sleep(2)
3071
- end
3072
- else
3073
- for n in 1..cn
3074
- position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
3075
- sleep(2)
3076
- end
3077
- end
3078
- # position.pop
3079
- else
3080
- for n in 1..cn
3081
- position << rand(0..(content.split("\n").length-2))
3082
- sleep(2)
3083
- end
3084
- end
3085
-
3086
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3087
3075
  if @data['포스트설정']['자동글 수식에 입력'].checked?
3088
3076
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3089
3077
  content55 = content.split("(자동생성글)")[1].to_s
3078
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3090
3079
  else
3091
3080
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3092
3081
  content55 = content.split("(자동생성글)")[1].to_s
3082
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3093
3083
  end
3084
+ elsif @data['포스트설정']['gpt키워드'].checked?
3085
+ content5 = content.split("(자동생성글)")[1].to_s.split("\n")
3086
+ content_prefix = content.split("(자동생성글)")[0].to_s
3087
+ content55 = ''
3088
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3094
3089
  else
3090
+ content5 = content.split("\n")
3095
3091
  content55 = ''
3096
- content5 = content.split("(자동생성글)")[0].to_s.split("\n")
3092
+ position = content5.length.times.to_a.sample(cn).sort.reverse
3097
3093
  end
3098
-
3099
- p content5
3100
- puts content55
3101
- p position
3102
-
3094
+
3095
+ # 중복 필터링 로직
3103
3096
  while true
3104
3097
  check11 = 0
3105
- for nn in 0..position.length-1
3106
- if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
3098
+ position.each_with_index do |pos, idx|
3099
+ if content5[pos].to_s.include?('style') || content5[pos].to_s.include?('<') || content5[pos].to_s.include?('>')
3107
3100
  check11 = 1
3108
- position[nn] += 4
3101
+ position[idx] += 4
3109
3102
  end
3110
3103
  end
3111
- if check11 == 0
3112
- break
3104
+ break if check11 == 0
3105
+ end
3106
+
3107
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
3108
+ sleep(2)
3109
+ puts '이미지 자동 세탁 중 · · · '
3110
+ end
3111
+
3112
+ p content5
3113
+ puts content55
3114
+ p position
3115
+
3116
+ sleep(2)
3117
+ position.each do |i|
3118
+ image_url22 = get_image_file().force_encoding('utf-8')
3119
+ if @data['포스트설정']['내용사진링크'].checked?
3120
+ image_tag = '<a href="' + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') +
3121
+ '"><img src="' + image_url22 + '" alt="' + keyword.force_encoding('utf-8') + '" class="aligncenter size-full"></a>'
3122
+ else
3123
+ image_tag = '<img src="' + image_url22 + '" alt="' + keyword + '" class="aligncenter size-full">'
3113
3124
  end
3125
+ content5.insert(i, image_tag)
3126
+ end
3127
+
3128
+ sleep(2)
3129
+ puts '이미지 자동 세탁 완료 · · · '
3130
+
3131
+ if @data['포스트설정']['내용과자동생성'].checked?
3132
+ content = content5.join("\n") + '(자동생성글)' + content55
3133
+ elsif @data['포스트설정']['gpt키워드'].checked?
3134
+ content = content_prefix + "(자동생성글)" + content5.join("\n")
3135
+ else
3136
+ content = content5.join("\n")
3114
3137
  end
3115
-
3116
- position = position.sort
3117
-
3118
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3119
- sleep(2)
3120
- puts '이미지 자동 세탁 중 · · · '
3121
- end
3122
- sleep(2)
3123
- position.each do |i|
3124
- image_url22 = get_image_file().force_encoding('utf-8')
3125
- puts image_url22
3126
- puts '사진넣는위치 => '+i.to_s
3127
- if @data['포스트설정']['내용사진링크'].checked?
3128
- 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>'+""
3129
- content5.insert(i, '**image**')
3130
- else
3131
- image_memory << ""+'<img src="'+image_url22+'" alt="'+keyword+'" class="aligncenter size-full">'+""
3132
- content5.insert(i, '**image**')
3133
- end
3134
- end
3135
- sleep(2)
3136
- puts '이미지 자동 세탁 완료 · · · '
3137
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3138
- content = content5.join("\n")+'(자동생성글)'+content55
3139
- puts content
3140
- else
3141
- content = content5.join("\n")
3142
3138
  end
3143
3139
  end
3144
- end
3140
+
3145
3141
 
3146
3142
 
3147
3143
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
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-04-11 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: mymin26@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: []