tidpz 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/tidpz.rb +54 -24
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 859e8a2b079e05d9958c048575ebde70a1a8e197c826ec01a3f84eeb3e1f6447
4
- data.tar.gz: dea7a89fadd0ee07b4dc1579e9de425fceef8d3f9b1d762b050345094a210bc2
3
+ metadata.gz: 4a521f91f8d15cce13a91a662829311ca7a9db87bc7271f740df4a162d7d19a8
4
+ data.tar.gz: b8c5d90145cca5db3594bbe91bfc9cd1b0406f01349078f74ceca891c3bed1e6
5
5
  SHA512:
6
- metadata.gz: 65cb48f7fc54e083d233eae4f8b4b6be8f617d6db1589325eff1e9557e8e6dbbc469fd7697527ed5f8a01c32cc94ad8107c31ca9247edbdab54b72c85a3b7361
7
- data.tar.gz: aa87cab2ba6a80fc04a3a3df6ca289dd52ec7d938243e66e38952203c7d8f952725ebb28a8defc3c852ec6ae5b7e815c9f77484eb8d198a949ad903a8626c636
6
+ metadata.gz: e1567d344fbe6737188f78c5b963e93679e1431785ba9b2e9676632eb63e7ec0120eb9bf326c46bb58fd883ed8cb5a88252322760eb819924ddb0586d5a4485a
7
+ data.tar.gz: fbe5540b00cf0d87caaa5f5626ccabdc26c7ba7f3aeb693adbc846b58cd75f9a624a6da1e15a11eb882a8bd57eb15b4ae8495a0edaace76b724172844095873b
data/lib/tidpz.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)
@@ -2046,33 +2076,33 @@ end
2046
2076
  }
2047
2077
  button(' 폴더째로 불러오기 ') {
2048
2078
 
2049
- on_clicked {
2050
- begin
2051
- path = @data['디엠설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2052
-
2053
- if Dir.exists?(path) # 경로가 존재하는지 확인
2054
- Dir.entries(path).each do |file|
2055
- # '.' '..'을 제외한 파일들만 처리
2056
- if file != '.' and file != '..'
2057
- begin
2058
- file_data = File.open(path+'/'+file, 'r', encoding: 'utf-8').read()
2059
- @data['디엠설정']['내용'] << [false, file, file_data]
2060
- rescue => e
2061
- # 파일 열기 오류 처리
2062
- puts "파일 '#{file}'을 열 수 없습니다: #{e.message}"
2063
- end
2064
- end
2065
- end
2066
- @data['디엠설정']['디엠'] << []
2067
- @data['디엠설정']['디엠'].pop
2079
+ on_clicked {
2080
+ path = @data['디엠설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2081
+
2082
+ # 경로가 유효한지 확인
2083
+ if Dir.exist?(path)
2084
+ Dir.entries(path).each do |file|
2085
+ if file == '.' or file == '..'
2086
+ next
2068
2087
  else
2069
- # 경로가 없으면 경고 메시지 출력
2070
- puts "경로 '#{path}'이 존재하지 않습니다."
2088
+ begin
2089
+ # 파일을 열고 내용을 읽어서 추가
2090
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
2091
+ @data['디엠설정']['디엠'] << [false, file, file_data]
2092
+ rescue => e
2093
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
2094
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
2095
+ end
2071
2096
  end
2072
- rescue => e
2073
- # 경로 처리 중 발생한 오류 처리
2074
- puts "오류 발생: #{e.message}"
2075
2097
  end
2098
+
2099
+ # 내용 배열에서 마지막 빈 항목 제거
2100
+ @data['디엠설정']['디엠'] << []
2101
+ @data['디엠설정']['디엠'].pop
2102
+ else
2103
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
2104
+ puts "경로가 존재하지 않습니다: #{path}"
2105
+ end
2076
2106
  }
2077
2107
  }
2078
2108
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidpz
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