cafe_basics_duo 0.0.71 → 0.1.30
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/cafe_basics_duo.rb +75 -109
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 590eaca433387806ae34f75fd178e6ebeab8fa753d976fd2e3c94adda0b11eac
|
4
|
+
data.tar.gz: d2d7e70e64d8c5a0e636d8ea7a5f8bdf352e6cdc61f1948b324fd015d4e364e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a003b6382da4f1d6ee0213d7d97c6cd36c698d6a2ecd0c2dc93cc687ca57287efbfb7d51f07382995c5fddffafe3a8bce4bc2c8579ec50d3b57f0f70e804b06
|
7
|
+
data.tar.gz: f0cf32ecc56ad4948673fbd159e1305736717c096b9f22b6a8677f76b2d64f70734a45bd66f4b7a2592fc98e50510b494d73e5aae1a9a0fd5700bd232ec34755
|
data/lib/cafe_basics_duo.rb
CHANGED
@@ -2042,20 +2042,27 @@ class Wordpress
|
|
2042
2042
|
|
2043
2043
|
def save_image
|
2044
2044
|
if @data['이미지설정']['이미지'].length == 0
|
2045
|
-
|
2045
|
+
return
|
2046
|
+
end
|
2047
|
+
|
2048
|
+
if @data['이미지설정']['순서사용'].checked?
|
2049
|
+
image_path = @data['이미지설정']['이미지'][@image_counter][2]
|
2050
|
+
@image_counter += 1
|
2051
|
+
if @image_counter > @data['이미지설정']['이미지'].length - 1
|
2052
|
+
@image_counter = 0
|
2053
|
+
end
|
2046
2054
|
else
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
@image_counter = 0
|
2052
|
-
end
|
2053
|
-
else
|
2054
|
-
image_path = @data['이미지설정']['이미지'].sample[2]
|
2055
|
+
# 초기화가 안됐거나 다 썼으면 새롭게 섞는다
|
2056
|
+
@shuffled_images ||= []
|
2057
|
+
if @shuffled_images.empty?
|
2058
|
+
@shuffled_images = @data['이미지설정']['이미지'].shuffle
|
2055
2059
|
end
|
2056
|
-
|
2057
|
-
|
2060
|
+
|
2061
|
+
image_path = @shuffled_images.shift[2]
|
2058
2062
|
end
|
2063
|
+
|
2064
|
+
img = Magick::Image.read(image_path).first
|
2065
|
+
img.write('./image/memory.png')
|
2059
2066
|
end
|
2060
2067
|
|
2061
2068
|
def change_image_size(w)
|
@@ -2829,128 +2836,77 @@ class Wordpress
|
|
2829
2836
|
puts '내용사진자동삽입...'
|
2830
2837
|
sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
2831
2838
|
en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
|
2839
|
+
|
2832
2840
|
begin
|
2833
2841
|
cn = rand(sn..en)
|
2834
2842
|
rescue
|
2835
2843
|
cn = 0
|
2836
2844
|
puts 'cn = rand(sn..en) error cn = 1'
|
2837
2845
|
end
|
2838
|
-
|
2846
|
+
|
2839
2847
|
if cn != 0
|
2840
|
-
|
2848
|
+
# content5 구성 및 위치 배열 생성
|
2841
2849
|
if @data['포스트설정']['내용과자동생성'].checked?
|
2842
|
-
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2843
|
-
for n in 1..cn
|
2844
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
2845
|
-
sleep(2)
|
2846
|
-
end
|
2847
|
-
else
|
2848
|
-
for n in 1..cn
|
2849
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
2850
|
-
sleep(2)
|
2851
|
-
end
|
2852
|
-
end
|
2853
|
-
# position.pop
|
2854
|
-
else
|
2855
|
-
for n in 1..cn
|
2856
|
-
position << rand(0..(content.split("\n").length-2))
|
2857
|
-
sleep(2)
|
2858
|
-
end
|
2859
|
-
end
|
2860
|
-
|
2861
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2862
2850
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2863
2851
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2864
2852
|
content55 = content.split("(자동생성글)")[1].to_s
|
2853
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2865
2854
|
else
|
2866
2855
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2867
2856
|
content55 = content.split("(자동생성글)")[1].to_s
|
2857
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2868
2858
|
end
|
2859
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
2860
|
+
content5 = content.split("(자동생성글)")[1].to_s.split("\n")
|
2861
|
+
content_prefix = content.split("(자동생성글)")[0].to_s
|
2862
|
+
content55 = ''
|
2863
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2869
2864
|
else
|
2865
|
+
content5 = content.split("\n")
|
2870
2866
|
content55 = ''
|
2871
|
-
|
2867
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2872
2868
|
end
|
2873
|
-
|
2874
|
-
|
2875
|
-
puts content55
|
2876
|
-
p position
|
2877
|
-
|
2869
|
+
|
2870
|
+
# 중복 필터링 로직
|
2878
2871
|
while true
|
2879
2872
|
check11 = 0
|
2880
|
-
|
2881
|
-
if content5[
|
2873
|
+
position.each_with_index do |pos, idx|
|
2874
|
+
if content5[pos].to_s.include?('style') || content5[pos].to_s.include?('<') || content5[pos].to_s.include?('>')
|
2882
2875
|
check11 = 1
|
2883
|
-
position[
|
2876
|
+
position[idx] += 4
|
2884
2877
|
end
|
2885
2878
|
end
|
2886
|
-
if check11 == 0
|
2887
|
-
break
|
2888
|
-
end
|
2879
|
+
break if check11 == 0
|
2889
2880
|
end
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
# puts '사진넣는위치 => '+i.to_s
|
2902
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2903
|
-
# image_memory << ""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword.force_encoding('utf-8')+'"></a>'+""
|
2904
|
-
# content5.insert(i, '**image**')
|
2905
|
-
# else
|
2906
|
-
# image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
2907
|
-
# content5.insert(i, '**image**')
|
2908
|
-
# end
|
2909
|
-
# end
|
2910
|
-
|
2911
|
-
# if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2912
|
-
# content = content5.join("\n")+'(자동생성글)'+content55
|
2913
|
-
# iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
|
2914
|
-
# content = iconv.iconv(content)
|
2915
|
-
# content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
|
2916
|
-
# puts content
|
2917
|
-
# image_url = image_url22
|
2918
|
-
|
2919
|
-
# if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2920
|
-
|
2921
|
-
# else
|
2922
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2923
|
-
# content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2924
|
-
# else
|
2925
|
-
# content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2926
|
-
# end
|
2927
|
-
# end
|
2928
|
-
###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
|
2929
|
-
|
2930
|
-
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
2931
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2881
|
+
|
2882
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2883
|
+
sleep(2)
|
2884
|
+
puts '이미지 자동 세탁 중 · · · '
|
2885
|
+
end
|
2886
|
+
|
2887
|
+
p content5
|
2888
|
+
puts content55
|
2889
|
+
p position
|
2890
|
+
|
2932
2891
|
sleep(2)
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
content5.insert(i, '**image**')
|
2943
|
-
else
|
2944
|
-
image_memory << ""+'<img src="'+image_url22+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
2945
|
-
content5.insert(i, '**image**')
|
2892
|
+
position.each do |i|
|
2893
|
+
image_url22 = get_image_file().force_encoding('utf-8')
|
2894
|
+
if @data['포스트설정']['내용사진링크'].checked?
|
2895
|
+
image_tag = '<a href="' + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') +
|
2896
|
+
'"><img src="' + image_url22 + '" alt="' + keyword.force_encoding('utf-8') + '" class="aligncenter size-full"></a>'
|
2897
|
+
else
|
2898
|
+
image_tag = '<img src="' + image_url22 + '" alt="' + keyword + '" class="aligncenter size-full">'
|
2899
|
+
end
|
2900
|
+
content5.insert(i, image_tag)
|
2946
2901
|
end
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2902
|
+
|
2903
|
+
sleep(2)
|
2904
|
+
puts '이미지 자동 세탁 완료 · · · '
|
2905
|
+
|
2906
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
2907
|
+
content = content5.join("\n") + '(자동생성글)' + content55
|
2908
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
2909
|
+
content = content_prefix + "(자동생성글)" + content5.join("\n")
|
2954
2910
|
else
|
2955
2911
|
content = content5.join("\n")
|
2956
2912
|
end
|
@@ -3280,9 +3236,19 @@ class Wordpress
|
|
3280
3236
|
end
|
3281
3237
|
|
3282
3238
|
|
3239
|
+
#if @data['포스트설정']['내용첫줄제목에입력'].checked?
|
3240
|
+
# title = content.split("\n")[0]
|
3241
|
+
#end
|
3283
3242
|
if @data['포스트설정']['내용첫줄제목에입력'].checked?
|
3284
|
-
|
3285
|
-
|
3243
|
+
# 콘텐츠를 줄 단위로 분리
|
3244
|
+
content_lines = content.split("\n")
|
3245
|
+
|
3246
|
+
# 첫 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
|
3247
|
+
title = content_lines.find { |line| !line.start_with?('<img src=') }
|
3248
|
+
|
3249
|
+
# 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
|
3250
|
+
title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
|
3251
|
+
|
3286
3252
|
end
|
3287
3253
|
|
3288
3254
|
if @data['포스트설정']['제목을내용첫줄입력'].checked?
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
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.
|
40
|
-
signing_key:
|
37
|
+
rubygems_version: 3.6.7
|
41
38
|
specification_version: 4
|
42
39
|
summary: file to clipboard
|
43
40
|
test_files: []
|