• 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

Révisionb38cde491eb89907472ec80029316634bf2fe21a (tree)
l'heure2017-08-06 16:25:55
Auteurmasakih <masakih@user...>
Commitermasakih

Message de Log

とりあえず動くようになった

Change Summary

Modification

--- a/ExtractKanMusu.xcodeproj/project.pbxproj
+++ b/ExtractKanMusu.xcodeproj/project.pbxproj
@@ -13,8 +13,27 @@
1313 F4EAFCC51F369E71007B7506 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCC31F369E71007B7506 /* Main.storyboard */; };
1414 F4EAFCCD1F36A28C007B7506 /* pickup.rb in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCCC1F36A28B007B7506 /* pickup.rb */; };
1515 F4EAFCCF1F36B8FE007B7506 /* PickUpSWF.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */; };
16+ F4EAFCD61F36D786007B7506 /* KanColleGraphicDivider in Resources */ = {isa = PBXBuildFile; fileRef = F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */; };
17+ F4EAFCE01F36D9E5007B7506 /* ExtractKanmusu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */; };
1618 /* End PBXBuildFile section */
1719
20+/* Begin PBXContainerItemProxy section */
21+ F4EAFCDB1F36D7C7007B7506 /* PBXContainerItemProxy */ = {
22+ isa = PBXContainerItemProxy;
23+ containerPortal = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
24+ proxyType = 2;
25+ remoteGlobalIDString = F44C14B71D84F07300ADE497;
26+ remoteInfo = KanColleGraphicDivider;
27+ };
28+ F4EAFCDD1F36D7D7007B7506 /* PBXContainerItemProxy */ = {
29+ isa = PBXContainerItemProxy;
30+ containerPortal = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
31+ proxyType = 1;
32+ remoteGlobalIDString = F44C14B61D84F07300ADE497;
33+ remoteInfo = KanColleGraphicDivider;
34+ };
35+/* End PBXContainerItemProxy section */
36+
1837 /* Begin PBXFileReference section */
1938 F4EAFCBA1F369E71007B7506 /* ExtractKanMusu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExtractKanMusu.app; sourceTree = BUILT_PRODUCTS_DIR; };
2039 F4EAFCBD1F369E71007B7506 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -24,6 +43,10 @@
2443 F4EAFCC61F369E71007B7506 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2544 F4EAFCCC1F36A28B007B7506 /* pickup.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = pickup.rb; sourceTree = "<group>"; };
2645 F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickUpSWF.swift; sourceTree = "<group>"; };
46+ F4EAFCD21F36D6C2007B7506 /* KanColleGraphicDivider */ = {isa = PBXFileReference; lastKnownFileType = text; name = KanColleGraphicDivider; path = KanColleGraphicDivider/build/Debug/KanColleGraphicDivider; sourceTree = "<group>"; };
47+ F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; path = KanColleGraphicDivider; sourceTree = BUILT_PRODUCTS_DIR; };
48+ F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = KanColleGraphicDivider.xcodeproj; path = KanColleGraphicDivider/KanColleGraphicDivider.xcodeproj; sourceTree = "<group>"; };
49+ F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtractKanmusu.swift; sourceTree = "<group>"; };
2750 /* End PBXFileReference section */
2851
2952 /* Begin PBXFrameworksBuildPhase section */
@@ -40,8 +63,11 @@
4063 F4EAFCB11F369E71007B7506 = {
4164 isa = PBXGroup;
4265 children = (
66+ F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */,
67+ F4EAFCD51F36D786007B7506 /* KanColleGraphicDivider */,
4368 F4EAFCBC1F369E71007B7506 /* ExtractKanMusu */,
4469 F4EAFCBB1F369E71007B7506 /* Products */,
70+ F4EAFCD11F36D6C1007B7506 /* Frameworks */,
4571 );
4672 sourceTree = "<group>";
4773 };
@@ -60,6 +86,7 @@
6086 F4EAFCBD1F369E71007B7506 /* AppDelegate.swift */,
6187 F4EAFCBF1F369E71007B7506 /* ViewController.swift */,
6288 F4EAFCCE1F36B8FE007B7506 /* PickUpSWF.swift */,
89+ F4EAFCDF1F36D9E5007B7506 /* ExtractKanmusu.swift */,
6390 F4EAFCC11F369E71007B7506 /* Assets.xcassets */,
6491 F4EAFCC31F369E71007B7506 /* Main.storyboard */,
6592 F4EAFCC61F369E71007B7506 /* Info.plist */,
@@ -67,6 +94,22 @@
6794 path = ExtractKanMusu;
6895 sourceTree = "<group>";
6996 };
97+ F4EAFCD11F36D6C1007B7506 /* Frameworks */ = {
98+ isa = PBXGroup;
99+ children = (
100+ F4EAFCD21F36D6C2007B7506 /* KanColleGraphicDivider */,
101+ );
102+ name = Frameworks;
103+ sourceTree = "<group>";
104+ };
105+ F4EAFCD81F36D7C6007B7506 /* Products */ = {
106+ isa = PBXGroup;
107+ children = (
108+ F4EAFCDC1F36D7C7007B7506 /* KanColleGraphicDivider */,
109+ );
110+ name = Products;
111+ sourceTree = "<group>";
112+ };
70113 /* End PBXGroup section */
71114
72115 /* Begin PBXNativeTarget section */
@@ -81,6 +124,7 @@
81124 buildRules = (
82125 );
83126 dependencies = (
127+ F4EAFCDE1F36D7D7007B7506 /* PBXTargetDependency */,
84128 );
85129 name = ExtractKanMusu;
86130 productName = ExtractKanMusu;
@@ -114,6 +158,12 @@
114158 mainGroup = F4EAFCB11F369E71007B7506;
115159 productRefGroup = F4EAFCBB1F369E71007B7506 /* Products */;
116160 projectDirPath = "";
161+ projectReferences = (
162+ {
163+ ProductGroup = F4EAFCD81F36D7C6007B7506 /* Products */;
164+ ProjectRef = F4EAFCD71F36D7C6007B7506 /* KanColleGraphicDivider.xcodeproj */;
165+ },
166+ );
117167 projectRoot = "";
118168 targets = (
119169 F4EAFCB91F369E71007B7506 /* ExtractKanMusu */,
@@ -121,11 +171,22 @@
121171 };
122172 /* End PBXProject section */
123173
174+/* Begin PBXReferenceProxy section */
175+ F4EAFCDC1F36D7C7007B7506 /* KanColleGraphicDivider */ = {
176+ isa = PBXReferenceProxy;
177+ fileType = "compiled.mach-o.executable";
178+ path = KanColleGraphicDivider;
179+ remoteRef = F4EAFCDB1F36D7C7007B7506 /* PBXContainerItemProxy */;
180+ sourceTree = BUILT_PRODUCTS_DIR;
181+ };
182+/* End PBXReferenceProxy section */
183+
124184 /* Begin PBXResourcesBuildPhase section */
125185 F4EAFCB81F369E71007B7506 /* Resources */ = {
126186 isa = PBXResourcesBuildPhase;
127187 buildActionMask = 2147483647;
128188 files = (
189+ F4EAFCD61F36D786007B7506 /* KanColleGraphicDivider in Resources */,
129190 F4EAFCCD1F36A28C007B7506 /* pickup.rb in Resources */,
130191 F4EAFCC21F369E71007B7506 /* Assets.xcassets in Resources */,
131192 F4EAFCC51F369E71007B7506 /* Main.storyboard in Resources */,
@@ -141,12 +202,21 @@
141202 files = (
142203 F4EAFCC01F369E71007B7506 /* ViewController.swift in Sources */,
143204 F4EAFCCF1F36B8FE007B7506 /* PickUpSWF.swift in Sources */,
205+ F4EAFCE01F36D9E5007B7506 /* ExtractKanmusu.swift in Sources */,
144206 F4EAFCBE1F369E71007B7506 /* AppDelegate.swift in Sources */,
145207 );
146208 runOnlyForDeploymentPostprocessing = 0;
147209 };
148210 /* End PBXSourcesBuildPhase section */
149211
212+/* Begin PBXTargetDependency section */
213+ F4EAFCDE1F36D7D7007B7506 /* PBXTargetDependency */ = {
214+ isa = PBXTargetDependency;
215+ name = KanColleGraphicDivider;
216+ targetProxy = F4EAFCDD1F36D7D7007B7506 /* PBXContainerItemProxy */;
217+ };
218+/* End PBXTargetDependency section */
219+
150220 /* Begin PBXVariantGroup section */
151221 F4EAFCC31F369E71007B7506 /* Main.storyboard */ = {
152222 isa = PBXVariantGroup;
@@ -296,6 +366,7 @@
296366 F4EAFCCB1F369E71007B7506 /* Release */,
297367 );
298368 defaultConfigurationIsVisible = 0;
369+ defaultConfigurationName = Release;
299370 };
300371 /* End XCConfigurationList section */
301372 };
--- a/ExtractKanMusu/Base.lproj/Main.storyboard
+++ b/ExtractKanMusu/Base.lproj/Main.storyboard
@@ -689,7 +689,7 @@
689689 <pathControl verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="71Q-c3-4la">
690690 <rect key="frame" x="63" y="132" width="399" height="22"/>
691691 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
692- <pathCell key="cell" selectable="YES" editable="YES" alignment="left" id="k0s-i9-gmv">
692+ <pathCell key="cell" selectable="YES" alignment="left" id="k0s-i9-gmv">
693693 <font key="font" metaFont="system"/>
694694 <url key="url" string="file:///Applications/"/>
695695 </pathCell>
@@ -703,12 +703,8 @@
703703 <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
704704 </textFieldCell>
705705 </textField>
706- <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="GBd-0D-yCZ">
707- <rect key="frame" x="11" y="121" width="451" height="5"/>
708- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
709- </box>
710706 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="B7G-JY-X3z">
711- <rect key="frame" x="22" y="98" width="89" height="17"/>
707+ <rect key="frame" x="20" y="97" width="89" height="17"/>
712708 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
713709 <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="出力フォルダ:" id="vkJ-JL-Cez">
714710 <font key="font" size="13" name=".HiraKakuInterface-W3"/>
@@ -719,7 +715,7 @@
719715 <pathControl verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gH1-Rc-sXz">
720716 <rect key="frame" x="63" y="70" width="397" height="22"/>
721717 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
722- <pathCell key="cell" selectable="YES" editable="YES" alignment="left" id="HrL-3G-mlv">
718+ <pathCell key="cell" selectable="YES" alignment="left" id="HrL-3G-mlv">
723719 <font key="font" metaFont="system"/>
724720 <url key="url" string="file:///Applications/"/>
725721 </pathCell>
@@ -746,10 +742,6 @@
746742 <action selector="chooseOutputFOlder:" target="XfG-lQ-9wD" id="Wjd-XM-nE7"/>
747743 </connections>
748744 </button>
749- <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="nsa-b3-99H">
750- <rect key="frame" x="11" y="59" width="451" height="5"/>
751- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
752- </box>
753745 <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6Iw-pN-vkY">
754746 <rect key="frame" x="353" y="13" width="113" height="32"/>
755747 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -761,6 +753,23 @@
761753 <action selector="extract:" target="XfG-lQ-9wD" id="nhf-pF-bQk"/>
762754 </connections>
763755 </button>
756+ <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="wCq-gn-ahC">
757+ <rect key="frame" x="13" y="121" width="449" height="5"/>
758+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
759+ </box>
760+ <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="WCG-o6-Xgb">
761+ <rect key="frame" x="13" y="59" width="449" height="5"/>
762+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
763+ </box>
764+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mse-3Q-V9C">
765+ <rect key="frame" x="20" y="14" width="323" height="33"/>
766+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
767+ <textFieldCell key="cell" sendsActionOnEndEditing="YES" title="ちゅーちゅーするとすごく時間がかかるし、Macがうなりだすよ。 それでもちゅーちゅーする?" id="v0k-Ou-jCB">
768+ <font key="font" metaFont="system"/>
769+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
770+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
771+ </textFieldCell>
772+ </textField>
764773 </subviews>
765774 </view>
766775 <connections>
--- /dev/null
+++ b/ExtractKanMusu/ExtractKanmusu.swift
@@ -0,0 +1,48 @@
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+ "-o",
32+ "\(dir.path)",
33+ "-c",
34+ "17,19",
35+ swf.path
36+ ]
37+
38+ process.environment = ["LC_ALL": "ja_JP.utf8"]
39+
40+ process.launch()
41+
42+ process.waitUntilExit()
43+
44+ guard process.terminationStatus == 0 else {
45+
46+ throw ExtractKanmusu.commandError(process.terminationStatus)
47+ }
48+}
--- a/ExtractKanMusu/ViewController.swift
+++ b/ExtractKanMusu/ViewController.swift
@@ -139,7 +139,7 @@ extension ViewController {
139139 existOriginalDir
140140 else { return }
141141
142- guard let destinationDir = cachePathField.url,
142+ guard let destinationDir = outputFolderField.url,
143143 let existDestinationDir = try? destinationDir.checkResourceIsReachable(),
144144 existDestinationDir
145145 else { return }
@@ -173,8 +173,46 @@ extension ViewController {
173173 }
174174 }
175175
176-
177-
176+ do {
177+
178+ let tempURL = originalDir.appendingPathComponent("___temp_chu-chu-_ship___")
179+ let destURL = destinationDir.appendingPathComponent("ちゅーちゅー")
180+
181+ let swfs = try FileManager.default
182+ .contentsOfDirectory(at: tempURL, includingPropertiesForKeys: nil)
183+ .filter { $0.pathExtension == "swf" }
184+
185+ let semaphone = DispatchSemaphore(value: 4)
186+ let group = DispatchGroup()
187+ let queue = DispatchQueue(label: "extract", attributes: .concurrent)
188+
189+ swfs.forEach { swf in
190+
191+ queue.async(group: group) {
192+
193+ semaphone.wait()
194+
195+ do {
196+
197+ try extractKanmusu(swf: swf, to: destURL)
198+
199+ } catch {
200+
201+ print(error)
202+ }
203+
204+ semaphone.signal()
205+ }
206+ }
207+
208+ group.wait()
209+
210+
211+ } catch {
212+
213+ print(error)
214+
215+ }
178216 }
179217
180218 @IBAction func extract(_ : Any?) {