cafe_basics 0.0.72 → 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.rb +63 -107
- 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: b856cedf8ca448a0adde15939f0d2bf5fb6ffdd82a1401cec0c34d64c24dc2b0
|
4
|
+
data.tar.gz: 934f814c108d7fa53335062fb2d3152b272e9e6c73d39071aaf00e0f1e502bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b767f73bc35199747d32247d79be6292232bd32da9f6a02fb504320fada48576a54fe1892d241039a0e97651fc94b607b276c8bb838685183008245541402ea3
|
7
|
+
data.tar.gz: db9c3da369b2abef780d2c65cefa08d4d773c35cbf8350830e3e7b1ffe336a8e791a9dfb11f60097277c82409494fb166896c8867e1b58d922863dd804718f32
|
data/lib/cafe_basics.rb
CHANGED
@@ -1975,20 +1975,27 @@ class Wordpress
|
|
1975
1975
|
|
1976
1976
|
def save_image
|
1977
1977
|
if @data['이미지설정']['이미지'].length == 0
|
1978
|
-
|
1978
|
+
return
|
1979
|
+
end
|
1980
|
+
|
1981
|
+
if @data['이미지설정']['순서사용'].checked?
|
1982
|
+
image_path = @data['이미지설정']['이미지'][@image_counter][2]
|
1983
|
+
@image_counter += 1
|
1984
|
+
if @image_counter > @data['이미지설정']['이미지'].length - 1
|
1985
|
+
@image_counter = 0
|
1986
|
+
end
|
1979
1987
|
else
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
@image_counter = 0
|
1985
|
-
end
|
1986
|
-
else
|
1987
|
-
image_path = @data['이미지설정']['이미지'].sample[2]
|
1988
|
+
# 초기화가 안됐거나 다 썼으면 새롭게 섞는다
|
1989
|
+
@shuffled_images ||= []
|
1990
|
+
if @shuffled_images.empty?
|
1991
|
+
@shuffled_images = @data['이미지설정']['이미지'].shuffle
|
1988
1992
|
end
|
1989
|
-
|
1990
|
-
|
1993
|
+
|
1994
|
+
image_path = @shuffled_images.shift[2]
|
1991
1995
|
end
|
1996
|
+
|
1997
|
+
img = Magick::Image.read(image_path).first
|
1998
|
+
img.write('./image/memory.png')
|
1992
1999
|
end
|
1993
2000
|
|
1994
2001
|
def change_image_size(w)
|
@@ -2762,128 +2769,77 @@ class Wordpress
|
|
2762
2769
|
puts '내용사진자동삽입...'
|
2763
2770
|
sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
2764
2771
|
en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
|
2772
|
+
|
2765
2773
|
begin
|
2766
2774
|
cn = rand(sn..en)
|
2767
2775
|
rescue
|
2768
2776
|
cn = 0
|
2769
2777
|
puts 'cn = rand(sn..en) error cn = 1'
|
2770
2778
|
end
|
2771
|
-
|
2779
|
+
|
2772
2780
|
if cn != 0
|
2773
|
-
|
2781
|
+
# content5 구성 및 위치 배열 생성
|
2774
2782
|
if @data['포스트설정']['내용과자동생성'].checked?
|
2775
|
-
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2776
|
-
for n in 1..cn
|
2777
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
2778
|
-
sleep(2)
|
2779
|
-
end
|
2780
|
-
else
|
2781
|
-
for n in 1..cn
|
2782
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
2783
|
-
sleep(2)
|
2784
|
-
end
|
2785
|
-
end
|
2786
|
-
# position.pop
|
2787
|
-
else
|
2788
|
-
for n in 1..cn
|
2789
|
-
position << rand(0..(content.split("\n").length-2))
|
2790
|
-
sleep(2)
|
2791
|
-
end
|
2792
|
-
end
|
2793
|
-
|
2794
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2795
2783
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2796
2784
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2797
2785
|
content55 = content.split("(자동생성글)")[1].to_s
|
2786
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2798
2787
|
else
|
2799
2788
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2800
2789
|
content55 = content.split("(자동생성글)")[1].to_s
|
2790
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2801
2791
|
end
|
2792
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
2793
|
+
content5 = content.split("(자동생성글)")[1].to_s.split("\n")
|
2794
|
+
content_prefix = content.split("(자동생성글)")[0].to_s
|
2795
|
+
content55 = ''
|
2796
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2802
2797
|
else
|
2798
|
+
content5 = content.split("\n")
|
2803
2799
|
content55 = ''
|
2804
|
-
|
2800
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
2805
2801
|
end
|
2806
|
-
|
2807
|
-
|
2808
|
-
puts content55
|
2809
|
-
p position
|
2810
|
-
|
2802
|
+
|
2803
|
+
# 중복 필터링 로직
|
2811
2804
|
while true
|
2812
2805
|
check11 = 0
|
2813
|
-
|
2814
|
-
if content5[
|
2806
|
+
position.each_with_index do |pos, idx|
|
2807
|
+
if content5[pos].to_s.include?('style') || content5[pos].to_s.include?('<') || content5[pos].to_s.include?('>')
|
2815
2808
|
check11 = 1
|
2816
|
-
position[
|
2809
|
+
position[idx] += 4
|
2817
2810
|
end
|
2818
2811
|
end
|
2819
|
-
if check11 == 0
|
2820
|
-
break
|
2821
|
-
end
|
2812
|
+
break if check11 == 0
|
2822
2813
|
end
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
# puts '사진넣는위치 => '+i.to_s
|
2835
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2836
|
-
# 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>'+""
|
2837
|
-
# content5.insert(i, '**image**')
|
2838
|
-
# else
|
2839
|
-
# image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
2840
|
-
# content5.insert(i, '**image**')
|
2841
|
-
# end
|
2842
|
-
# end
|
2843
|
-
|
2844
|
-
# if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2845
|
-
# content = content5.join("\n")+'(자동생성글)'+content55
|
2846
|
-
# iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
|
2847
|
-
# content = iconv.iconv(content)
|
2848
|
-
# content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
|
2849
|
-
# puts content
|
2850
|
-
# image_url = image_url22
|
2851
|
-
|
2852
|
-
# if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2853
|
-
|
2854
|
-
# else
|
2855
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2856
|
-
# content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2857
|
-
# else
|
2858
|
-
# content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2859
|
-
# end
|
2860
|
-
# end
|
2861
|
-
###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
|
2862
|
-
|
2863
|
-
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
2864
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2814
|
+
|
2815
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2816
|
+
sleep(2)
|
2817
|
+
puts '이미지 자동 세탁 중 · · · '
|
2818
|
+
end
|
2819
|
+
|
2820
|
+
p content5
|
2821
|
+
puts content55
|
2822
|
+
p position
|
2823
|
+
|
2865
2824
|
sleep(2)
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
content5.insert(i, '**image**')
|
2876
|
-
else
|
2877
|
-
image_memory << ""+'<img src="'+image_url22+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
2878
|
-
content5.insert(i, '**image**')
|
2825
|
+
position.each do |i|
|
2826
|
+
image_url22 = get_image_file().force_encoding('utf-8')
|
2827
|
+
if @data['포스트설정']['내용사진링크'].checked?
|
2828
|
+
image_tag = '<a href="' + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') +
|
2829
|
+
'"><img src="' + image_url22 + '" alt="' + keyword.force_encoding('utf-8') + '" class="aligncenter size-full"></a>'
|
2830
|
+
else
|
2831
|
+
image_tag = '<img src="' + image_url22 + '" alt="' + keyword + '" class="aligncenter size-full">'
|
2832
|
+
end
|
2833
|
+
content5.insert(i, image_tag)
|
2879
2834
|
end
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2835
|
+
|
2836
|
+
sleep(2)
|
2837
|
+
puts '이미지 자동 세탁 완료 · · · '
|
2838
|
+
|
2839
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
2840
|
+
content = content5.join("\n") + '(자동생성글)' + content55
|
2841
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
2842
|
+
content = content_prefix + "(자동생성글)" + content5.join("\n")
|
2887
2843
|
else
|
2888
2844
|
content = content5.join("\n")
|
2889
2845
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics
|
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: []
|