• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

艦娘をちゅーちゅーします


Commit MetaInfo

Revisão7301616ca24a560a6f3a7164bc85da966c623cf3 (tree)
Hora2018-08-20 22:48:14
Autormasakih <masakih@user...>
Commitermasakih

Mensagem de Log

艦これ2期用に改修

Mudança Sumário

Diff

--- a/ExtractKanMusu.xcodeproj/project.pbxproj
+++ b/ExtractKanMusu.xcodeproj/project.pbxproj
@@ -13,33 +13,15 @@
1313 F41A44D31F3A09C30066F83D /* ProgressPanelController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F41A44D51F3A09C30066F83D /* ProgressPanelController.xib */; };
1414 F41A44DC1F3B2B7F0066F83D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F41A44DE1F3B2B7F0066F83D /* InfoPlist.strings */; };
1515 F41A44E11F3B38C00066F83D /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = F41A44E01F3B38C00066F83D /* LICENSE */; };
16+ F473F0442129243800EAC987 /* PickupInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F473F0432129243800EAC987 /* PickupInformation.swift */; };
1617 F4EAFCBE1F369E71007B7506 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCBD1F369E71007B7506 /* AppDelegate.swift */; };
1718 F4EAFCC01F369E71007B7506 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCBF1F369E71007B7506 /* ViewController.swift */; };
1819 F4EAFCC21F369E71007B7506 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCC11F369E71007B7506 /* Assets.xcassets */; };
1920 F4EAFCC51F369E71007B7506 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCC31F369E71007B7506 /* Main.storyboard */; };
2021 F4EAFCCD1F36A28C007B7506 /* pickup.rb in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCCC1F36A28B007B7506 /* pickup.rb */; };
21- F4EAFCCF1F36B8FE007B7506 /* PickUpSWF.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */; };
22- F4EAFCD61F36D786007B7506 /* KanColleGraphicDivider in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */; };
23- F4EAFCE01F36D9E5007B7506 /* ExtractKanmusu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */; };
22+ F4EAFCCF1F36B8FE007B7506 /* PickupPNG.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCCE1F36B8FE007B7506 /* PickupPNG.swift */; };
2423 /* End PBXBuildFile section */
2524
26-/* Begin PBXContainerItemProxy section */
27- F4EAFCDB1F36D7C7007B7506 /* PBXContainerItemProxy */ = {
28- isa = PBXContainerItemProxy;
29- containerPortal = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
30- proxyType = 2;
31- remoteGlobalIDString = F44C14B71D84F07300ADE497;
32- remoteInfo = KanColleGraphicDivider;
33- };
34- F4EAFCDD1F36D7D7007B7506 /* PBXContainerItemProxy */ = {
35- isa = PBXContainerItemProxy;
36- containerPortal = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
37- proxyType = 1;
38- remoteGlobalIDString = F44C14B61D84F07300ADE497;
39- remoteInfo = KanColleGraphicDivider;
40- };
41-/* End PBXContainerItemProxy section */
42-
4325 /* Begin PBXFileReference section */
4426 F41A44C61F3710D10066F83D /* ProgressPanelController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressPanelController.swift; sourceTree = "<group>"; };
4527 F41A44CD1F38B8510066F83D /* ApplicationDirecrories.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationDirecrories.swift; sourceTree = "<group>"; };
@@ -48,6 +30,7 @@
4830 F41A44D61F3B29990066F83D /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = "<group>"; };
4931 F41A44DD1F3B2B7F0066F83D /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
5032 F41A44E01F3B38C00066F83D /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
33+ F473F0432129243800EAC987 /* PickupInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickupInformation.swift; sourceTree = "<group>"; };
5134 F4EAFCBA1F369E71007B7506 /* ExtractKanMusu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExtractKanMusu.app; sourceTree = BUILT_PRODUCTS_DIR; };
5235 F4EAFCBD1F369E71007B7506 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5336 F4EAFCBF1F369E71007B7506 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -55,11 +38,7 @@
5538 F4EAFCC41F369E71007B7506 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5639 F4EAFCC61F369E71007B7506 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5740 F4EAFCCC1F36A28B007B7506 /* pickup.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = pickup.rb; sourceTree = "<group>"; };
58- F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickUpSWF.swift; sourceTree = "<group>"; };
59- F4EAFCD21F36D6C2007B7506 /* KanColleGraphicDivider */ = {isa = PBXFileReference; lastKnownFileType = text; name = KanColleGraphicDivider; path = KanColleGraphicDivider/build/Debug/KanColleGraphicDivider; sourceTree = "<group>"; };
60- F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = KanColleGraphicDivider; sourceTree = BUILT_PRODUCTS_DIR; };
61- F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = KanColleGraphicDivider.xcodeproj; path = KanColleGraphicDivider/KanColleGraphicDivider.xcodeproj; sourceTree = "<group>"; };
62- F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtractKanmusu.swift; sourceTree = "<group>"; };
41+ F4EAFCCE1F36B8FE007B7506 /* PickupPNG.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickupPNG.swift; sourceTree = "<group>"; };
6342 /* End PBXFileReference section */
6443
6544 /* Begin PBXFrameworksBuildPhase section */
@@ -76,8 +55,6 @@
7655 F4EAFCB11F369E71007B7506 = {
7756 isa = PBXGroup;
7857 children = (
79- F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */,
80- F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */,
8158 F4EAFCBC1F369E71007B7506 /* ExtractKanMusu */,
8259 F4EAFCBB1F369E71007B7506 /* Products */,
8360 F4EAFCD11F36D6C1007B7506 /* Frameworks */,
@@ -103,8 +80,8 @@
10380 F41A44D51F3A09C30066F83D /* ProgressPanelController.xib */,
10481 F41A44D11F39E1450066F83D /* ChuuChuu.swift */,
10582 F4EAFCCC1F36A28B007B7506 /* pickup.rb */,
106- F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */,
107- F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */,
83+ F4EAFCCE1F36B8FE007B7506 /* PickupPNG.swift */,
84+ F473F0432129243800EAC987 /* PickupInformation.swift */,
10885 F4EAFCC11F369E71007B7506 /* Assets.xcassets */,
10986 F4EAFCC61F369E71007B7506 /* Info.plist */,
11087 F41A44DE1F3B2B7F0066F83D /* InfoPlist.strings */,
@@ -116,19 +93,10 @@
11693 F4EAFCD11F36D6C1007B7506 /* Frameworks */ = {
11794 isa = PBXGroup;
11895 children = (
119- F4EAFCD21F36D6C2007B7506 /* KanColleGraphicDivider */,
12096 );
12197 name = Frameworks;
12298 sourceTree = "<group>";
12399 };
124- F4EAFCD81F36D7C6007B7506 /* Products */ = {
125- isa = PBXGroup;
126- children = (
127- F4EAFCDC1F36D7C7007B7506 /* KanColleGraphicDivider */,
128- );
129- name = Products;
130- sourceTree = "<group>";
131- };
132100 /* End PBXGroup section */
133101
134102 /* Begin PBXNativeTarget section */
@@ -143,7 +111,6 @@
143111 buildRules = (
144112 );
145113 dependencies = (
146- F4EAFCDE1F36D7D7007B7506 /* PBXTargetDependency */,
147114 );
148115 name = ExtractKanMusu;
149116 productName = ExtractKanMusu;
@@ -177,12 +144,6 @@
177144 mainGroup = F4EAFCB11F369E71007B7506;
178145 productRefGroup = F4EAFCBB1F369E71007B7506 /* Products */;
179146 projectDirPath = "";
180- projectReferences = (
181- {
182- ProductGroup = F4EAFCD81F36D7C6007B7506 /* Products */;
183- ProjectRef = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
184- },
185- );
186147 projectRoot = "";
187148 targets = (
188149 F4EAFCB91F369E71007B7506 /* ExtractKanMusu */,
@@ -190,22 +151,11 @@
190151 };
191152 /* End PBXProject section */
192153
193-/* Begin PBXReferenceProxy section */
194- F4EAFCDC1F36D7C7007B7506 /* KanColleGraphicDivider */ = {
195- isa = PBXReferenceProxy;
196- fileType = "compiled.mach-o.executable";
197- path = KanColleGraphicDivider;
198- remoteRef = F4EAFCDB1F36D7C7007B7506 /* PBXContainerItemProxy */;
199- sourceTree = BUILT_PRODUCTS_DIR;
200- };
201-/* End PBXReferenceProxy section */
202-
203154 /* Begin PBXResourcesBuildPhase section */
204155 F4EAFCB81F369E71007B7506 /* Resources */ = {
205156 isa = PBXResourcesBuildPhase;
206157 buildActionMask = 2147483647;
207158 files = (
208- F4EAFCD61F36D786007B7506 /* KanColleGraphicDivider in Resources */,
209159 F41A44DC1F3B2B7F0066F83D /* InfoPlist.strings in Resources */,
210160 F4EAFCCD1F36A28C007B7506 /* pickup.rb in Resources */,
211161 F4EAFCC21F369E71007B7506 /* Assets.xcassets in Resources */,
@@ -224,8 +174,8 @@
224174 files = (
225175 F41A44CE1F38B8510066F83D /* ApplicationDirecrories.swift in Sources */,
226176 F4EAFCC01F369E71007B7506 /* ViewController.swift in Sources */,
227- F4EAFCCF1F36B8FE007B7506 /* PickUpSWF.swift in Sources */,
228- F4EAFCE01F36D9E5007B7506 /* ExtractKanmusu.swift in Sources */,
177+ F4EAFCCF1F36B8FE007B7506 /* PickupPNG.swift in Sources */,
178+ F473F0442129243800EAC987 /* PickupInformation.swift in Sources */,
229179 F41A44D21F39E1450066F83D /* ChuuChuu.swift in Sources */,
230180 F4EAFCBE1F369E71007B7506 /* AppDelegate.swift in Sources */,
231181 F41A44C81F3710D10066F83D /* ProgressPanelController.swift in Sources */,
@@ -234,14 +184,6 @@
234184 };
235185 /* End PBXSourcesBuildPhase section */
236186
237-/* Begin PBXTargetDependency section */
238- F4EAFCDE1F36D7D7007B7506 /* PBXTargetDependency */ = {
239- isa = PBXTargetDependency;
240- name = KanColleGraphicDivider;
241- targetProxy = F4EAFCDD1F36D7D7007B7506 /* PBXContainerItemProxy */;
242- };
243-/* End PBXTargetDependency section */
244-
245187 /* Begin PBXVariantGroup section */
246188 F41A44D51F3A09C30066F83D /* ProgressPanelController.xib */ = {
247189 isa = PBXVariantGroup;
--- a/ExtractKanMusu/ChuuChuu.swift
+++ b/ExtractKanMusu/ChuuChuu.swift
@@ -18,9 +18,16 @@ protocol MessageObserver: class {
1818 func increse()
1919 }
2020
21+private enum ImageType: String {
22+
23+ case full
24+
25+ case full_dmg
26+}
27+
2128 class ChuuChuu {
2229
23- static let chuchu = "ちゅーちゅー"
30+ static let chuchu = "ちゅーちゅー2"
2431 static let tempDirName = "___temp_chu-chu-_ship___"
2532
2633 let observer: MessageObserver
@@ -42,23 +49,6 @@ class ChuuChuu {
4249 destinationDir = destination
4350 }
4451
45-
46- private func createTempDir() throws {
47-
48- let tempURL = originalDir.appendingPathComponent(ChuuChuu.tempDirName)
49-
50- try FileManager.default
51- .createDirectory(at: tempURL, withIntermediateDirectories: true, attributes: nil)
52-
53- }
54-
55- private func deleteTempDir() throws {
56-
57- let tempURL = originalDir.appendingPathComponent(ChuuChuu.tempDirName)
58-
59- try FileManager.default.removeItem(at: tempURL)
60- }
61-
6252 private func createDestDir() throws {
6353
6454 let destURL = destinationDir.appendingPathComponent(ChuuChuu.chuchu)
@@ -68,67 +58,79 @@ class ChuuChuu {
6858
6959 }
7060
71- private func moveSWF(from originalDir: URL, to destinationDir: URL) {
61+ private func movePNG(from originalDir: URL, to destinationDir: URL) {
7262
73- observer.message = "Picking up SWF file from Cache Directory."
63+ observer.message = "Checking Cache Directory."
7464
7565 do {
7666
77- try pickUpSWF(from: originalDir, to: destinationDir)
67+ let informations = try getPickUpInformations(from: originalDir)
7868
79- } catch {
69+ observer.message = "Picking up PNG file from Cache Directory."
8070
81- print("Can not pickup.", terminator: " : ")
71+ observer.count = informations.count
8272
83- guard let error = error as? PickUPSWFError else {
84-
85- print("Unkown error.")
86- return
73+ let fm = FileManager.default
74+
75+ try informations
76+ .compactMap { info -> (URL, URL)? in
77+
78+ observer.increse()
79+
80+ let url = info.url
81+ let name = url.deletingPathExtension().lastPathComponent
82+ guard let type = url.deletingPathExtension().pathComponents.dropLast().last else { return nil }
83+ guard let _ = ImageType(rawValue: type) else { return nil }
84+ guard let id = Int(name.prefix(4)), id < 1500 else { return nil }
85+
86+ let destFilename: String
87+ if let query = url.query {
88+
89+ destFilename = type + "-" + name + "_" + query
90+
91+ } else {
92+
93+ destFilename = type + "-" + name
94+ }
95+
96+ let destination = destinationDir
97+ .appendingPathComponent(ChuuChuu.chuchu)
98+ .appendingPathComponent(destFilename)
99+ .appendingPathExtension("png")
100+
101+ let original = originalDir
102+ .appendingPathComponent("fsCachedData")
103+ .appendingPathComponent(info.filename)
104+
105+ return (destination, original)
106+
107+ }
108+ .filter { destination, _ in
109+
110+ (try? !destination.checkResourceIsReachable()) ?? true
111+
112+ }
113+ .forEach { destination, original in
114+
115+ try fm.copyItem(at: original, to: destination)
87116 }
88117
118+ } catch let error as PickupPNGError {
119+
89120 switch error {
90121 case .scriptNotFound: print("Script not found.")
91122
92123 case let .commandFail(status): print("Command faile status \(status).")
93124 }
94- }
95- }
96-
97- private func extractKanmusus(swfs: [URL], to destURL: URL) {
98-
99- observer.message = "Extracting KanMusu Image from SWF file."
100-
101- let semaphone = DispatchSemaphore(value: useCoreCount)
102- let group = DispatchGroup()
103- let queue = DispatchQueue(label: "extract", attributes: .concurrent)
104-
105- swfs.forEach { swf in
106125
107- queue.async(group: group) {
108-
109- semaphone.wait()
110-
111- do {
112-
113- try extractKanmusu(swf: swf, to: destURL)
114-
115- } catch {
116-
117- print(error)
118- }
119-
120- semaphone.signal()
121-
122- self.observer.increse()
123-
124- }
126+ } catch {
127+
128+ print("Can not pickup.", terminator: " : ")
125129
130+ print("Unkown error.", error)
126131 }
127-
128- group.wait()
129132 }
130133
131-
132134 func execute(maxPower: Bool, completeHandler: @escaping () -> Void) {
133135
134136 guard let existOriginalDir = try? originalDir.checkResourceIsReachable(),
@@ -152,23 +154,9 @@ class ChuuChuu {
152154
153155 do {
154156
155- try self.createTempDir()
156157 try self.createDestDir()
157158
158- self.moveSWF(from: self.originalDir, to: self.destinationDir)
159-
160- let tempURL = self.originalDir.appendingPathComponent(ChuuChuu.tempDirName)
161- let destURL = self.destinationDir.appendingPathComponent(ChuuChuu.chuchu)
162-
163- let swfs = try FileManager.default
164- .contentsOfDirectory(at: tempURL, includingPropertiesForKeys: nil)
165- .filter { $0.pathExtension.lowercased() == "swf" }
166-
167- self.observer.count = swfs.count
168-
169- self.extractKanmusus(swfs: swfs, to: destURL)
170-
171- try self.deleteTempDir()
159+ self.movePNG(from: self.originalDir, to: self.destinationDir)
172160
173161 } catch {
174162
--- a/ExtractKanMusu/ExtractKanmusu.swift
+++ /dev/null
@@ -1,47 +0,0 @@
1-//
2-// ExtractKanmusu.swift
3-// ExtractKanMusu
4-//
5-// Created by Hori,Masaki on 2017/08/06.
6-// Copyright © 2017年 Hori,Masaki. All rights reserved.
7-//
8-
9-import Foundation
10-
11-
12-enum ExtractKanmusu: Error {
13-
14- case commandNotFound
15-
16- case commandError(Int32)
17-}
18-
19-func extractKanmusu(swf: URL, to dir: URL) throws {
20-
21- guard let divider = Bundle.main.path(forResource: "KanColleGraphicDivider", ofType: nil)
22- else {
23-
24- throw ExtractKanmusu.commandNotFound
25- }
26-
27- let process = Process()
28- process.launchPath = divider
29-
30- process.arguments = [
31- "-s",
32- "-o",
33- "\(dir.path)",
34- "-c",
35- "17,19",
36- swf.path
37- ]
38-
39- process.launch()
40-
41- process.waitUntilExit()
42-
43- guard process.terminationStatus == 0 else {
44-
45- throw ExtractKanmusu.commandError(process.terminationStatus)
46- }
47-}
--- a/ExtractKanMusu/PickUpSWF.swift
+++ /dev/null
@@ -1,36 +0,0 @@
1-//
2-// PickUpSWF.swift
3-// ExtractKanMusu
4-//
5-// Created by Hori,Masaki on 2017/08/06.
6-// Copyright © 2017年 Hori,Masaki. All rights reserved.
7-//
8-
9-import Foundation
10-
11-
12-enum PickUPSWFError: Error {
13-
14- case scriptNotFound
15- case commandFail(Int32)
16-}
17-
18-
19-func pickUpSWF(from origin: URL, to copy: URL) throws {
20-
21- let pickup = Bundle.main.path(forResource: "pickup", ofType: "rb")
22- guard let pickupPath = pickup
23- else { throw PickUPSWFError.scriptNotFound }
24-
25- let process = Process()
26- process.currentDirectoryPath = origin.path
27- process.launchPath = "/usr/bin/ruby"
28- process.arguments = [pickupPath]
29-
30- process.launch()
31- process.waitUntilExit()
32-
33- guard process.terminationStatus == 0
34- else { throw PickUPSWFError.commandFail(process.terminationStatus) }
35-
36-}
--- /dev/null
+++ b/ExtractKanMusu/PickupInformation.swift
@@ -0,0 +1,26 @@
1+//
2+// PickupInformation.swift
3+// ExtractKanMusu
4+//
5+// Created by Hori,Masaki on 2018/08/19.
6+// Copyright © 2018年 Hori,Masaki. All rights reserved.
7+//
8+
9+import Foundation
10+
11+struct PickupInformation: Codable {
12+
13+ let urlString: String
14+ let filename: String
15+
16+ var url: URL {
17+
18+ return URL(string: urlString)!
19+ }
20+
21+ enum CodingKeys: String, CodingKey {
22+
23+ case urlString = "url"
24+ case filename
25+ }
26+}
--- /dev/null
+++ b/ExtractKanMusu/PickupPNG.swift
@@ -0,0 +1,45 @@
1+//
2+// PickupPNG.swift
3+// ExtractKanMusu
4+//
5+// Created by Hori,Masaki on 2017/08/06.
6+// Copyright © 2017年 Hori,Masaki. All rights reserved.
7+//
8+
9+import Foundation
10+
11+
12+enum PickupPNGError: Error {
13+
14+ case scriptNotFound
15+ case commandFail(Int32)
16+}
17+
18+
19+func getPickUpInformations(from origin: URL) throws -> [PickupInformation] {
20+
21+ let pickup = Bundle.main.path(forResource: "pickup", ofType: "rb")
22+ guard let pickupPath = pickup else { throw PickupPNGError.scriptNotFound }
23+
24+ let process = Process()
25+ process.currentDirectoryPath = origin.path
26+ process.launchPath = "/usr/bin/ruby"
27+ process.arguments = [pickupPath]
28+
29+ let pipe = Pipe()
30+ process.standardOutput = pipe
31+
32+ process.launch()
33+
34+ let data = pipe.fileHandleForReading.readDataToEndOfFile()
35+
36+ process.waitUntilExit()
37+
38+ guard process.terminationStatus == 0 else {
39+
40+ throw PickupPNGError.commandFail(process.terminationStatus)
41+ }
42+
43+ return try JSONDecoder().decode([PickupInformation].self, from: data)
44+
45+}
--- a/ExtractKanMusu/pickup.rb
+++ b/ExtractKanMusu/pickup.rb
@@ -1,33 +1,21 @@
1-
2-
3-
4-require 'rubygems'
51 require 'sqlite3'
6-require 'uri'
7-
8-db = SQLite3::Database.new("Cache.db")
9-
10-cursor = db.execute("select request_key, receiver_data from cfurl_cache_response INNER JOIN cfurl_cache_receiver_data ON cfurl_cache_response.entry_ID = cfurl_cache_receiver_data.entry_ID where cfurl_cache_response.request_key LIKE '%resources/swf/ships/%';")
112
3+db = SQLite3::Database.new("Cache.db")
124
13-currentPath = File.expand_path('fsCachedData/')
14-tempDir = File.expand_path('___temp_chu-chu-_ship___')
5+cursor = db.execute("SELECT request_key, receiver_data FROM cfurl_cache_response INNER JOIN cfurl_cache_receiver_data ON cfurl_cache_response.entry_ID = cfurl_cache_receiver_data.entry_ID where cfurl_cache_response.request_key LIKE '%resources/ship/%' AND NOT cfurl_cache_response.request_key LIKE '%album_status%';")
156
7+print "[\n"
168 cursor.each do |row|
17- aURI = URI.split(row[0])
18-# p aURI
19- fullpath = aURI[5]
20- dir, file = File::split(fullpath)
21- param = aURI[7]
22- unless param
23- filename = file
24- else
25- filename = param + "_" + file
26- end
27-
28- original = File.expand_path(row[1], currentPath)
29- copy = File.expand_path(filename, tempDir)
30-
31- command = 'cp ' + '"' + original + '"' + " " + '"' + copy + '"'
32- system(command)
9+ print "\t{\n"
10+
11+ print "\t\t\"url\": \""
12+ print row[0]
13+ print "\",\n"
14+
15+ print "\t\t\"filename\": \""
16+ print row[1]
17+ print "\"\n"
18+
19+ print "\t},\n"
3320 end
21+print "]\n"