tidpd 0.0.2 → 0.0.5

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/tidpd.rb +44 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 921c10f1af7cc49560a10bbd11acef1c8af4ed397c10fecd9d8c25f6ca5213f4
4
- data.tar.gz: 328358b330a5cf3ba4eb062b91224f77818792fa5bd28ffb5e7b549d1feef3b4
3
+ metadata.gz: 1094791f487b569ec14630b2683d9e85bd408724f2388ed1ac3b4dfdba53088c
4
+ data.tar.gz: 111f7453b9a0261a2e15a4b96a692b900ff3f794c1cc47b2ba12507430a5197a
5
5
  SHA512:
6
- metadata.gz: d8fb9df2e049566cc93b65bc87a82bb744a032400d6e8788bb133b967dde4dded7ad725d4bd3952fb35ea23f33c8ae034f0732814a22e9f65253f8fa7d790f1a
7
- data.tar.gz: 7476b2720ecf860e18ade3f347646ef41225c0e2e6d86d6ccf443d89c99442929f45e9110497e36cc3c5be9cce7b747463fd2082269314547275ff8adaed00f3
6
+ metadata.gz: 4ebbec237118ff723a72320c01e0a8501a1894792e7b57b2be64de1e139c78efb1b5cea0dba7a87fd8045b0c95d9fb9242d0103c61d28baa5926d70e680c7f7d
7
+ data.tar.gz: 6c8313e42d5a8a3c8624ac57b932e50b91a4d77915485d2712742fb25c8f0d091523675f39140f6633d131bacaa9d505635a49cecdd25f731cf0ca2ffd13ed36
data/lib/tidpd.rb CHANGED
@@ -21,7 +21,37 @@ class Naver
21
21
  def initialize(data)
22
22
  @data = data # Wordpress에서 전달된 data 저장
23
23
  @seed = 1
24
+ kill_selenium_chrome #기존 창 모두 닫는 명령
25
+ sleep(1)
24
26
  end
27
+
28
+ def kill_selenium_chrome #기존 창 모두 닫는 코드
29
+ wmi = WIN32OLE.connect("winmgmts://")
30
+ chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
31
+
32
+ chrome_procs.each do |proc|
33
+ cmd = proc.CommandLine
34
+ if cmd && cmd.include?("user-data-dir=C:/tiktok_cookie")
35
+ puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
36
+ begin
37
+ proc.Terminate
38
+ rescue
39
+ #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
40
+ end
41
+ end
42
+ end
43
+
44
+ # chromedriver도 같이 종료
45
+ chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
46
+ chromedrivers.each do |proc|
47
+ puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
48
+ begin
49
+ proc.Terminate
50
+ rescue
51
+ #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
52
+ end
53
+ end
54
+ end
25
55
 
26
56
 
27
57
  def chrome_setup(user_id, proxy)
@@ -2127,32 +2157,32 @@ class Wordpress
2127
2157
  button(' 폴더째로 불러오기 ') {
2128
2158
 
2129
2159
  on_clicked {
2130
- begin
2131
2160
  path = @data['디엠설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2132
2161
 
2133
- if Dir.exists?(path) # 경로가 존재하는지 확인
2162
+ # 경로가 유효한지 확인
2163
+ if Dir.exist?(path)
2134
2164
  Dir.entries(path).each do |file|
2135
- # '.' '..'을 제외한 파일들만 처리
2136
- if file != '.' and file != '..'
2165
+ if file == '.' or file == '..'
2166
+ next
2167
+ else
2137
2168
  begin
2138
- file_data = File.open(path+'/'+file, 'r', encoding: 'utf-8').read()
2139
- @data['디엠설정']['내용'] << [false, file, file_data]
2169
+ # 파일을 열고 내용을 읽어서 추가
2170
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
2171
+ @data['디엠설정']['디엠'] << [false, file, file_data]
2140
2172
  rescue => e
2141
- # 파일 열기 오류 처리
2142
- puts "파일 '#{file}'을 열 수 없습니다: #{e.message}"
2173
+ # 파일을 수 없는 경우, 오류 메시지 출력
2174
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
2143
2175
  end
2144
2176
  end
2145
2177
  end
2178
+
2179
+ # 내용 배열에서 마지막 빈 항목 제거
2146
2180
  @data['디엠설정']['디엠'] << []
2147
2181
  @data['디엠설정']['디엠'].pop
2148
2182
  else
2149
- # 경로가 없으면 경고 메시지 출력
2150
- puts "경로 '#{path}'이 존재하지 않습니다."
2183
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
2184
+ puts "경로가 존재하지 않습니다: #{path}"
2151
2185
  end
2152
- rescue => e
2153
- # 경로 처리 중 발생한 오류 처리
2154
- puts "오류 발생: #{e.message}"
2155
- end
2156
2186
  }
2157
2187
  }
2158
2188
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-30 00:00:00.000000000 Z
10
+ date: 2025-05-29 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com