@@ -11,7 +11,7 @@ import SwiftShell
11
11
12
12
public extension File {
13
13
14
- public func nameWithSuffix( _ suffix: String ) -> String {
14
+ func nameWithSuffix( _ suffix: String ) -> String {
15
15
if let unwrappedExtension = `extension` {
16
16
return nameExcludingExtension + suffix + " . " + unwrappedExtension
17
17
}
@@ -23,7 +23,7 @@ public extension File {
23
23
////////////////////////////////////////////////////////////////////////////////
24
24
// MARK: - Duplication
25
25
26
- @discardableResult public func createDuplicate( withName newName: String , keepExtension: Bool = true , overwrite: Bool = true ) throws -> File ? {
26
+ @discardableResult func createDuplicate( withName newName: String , keepExtension: Bool = true , overwrite: Bool = true ) throws -> File ? {
27
27
if !overwrite && FileManager . default. fileExists ( atPath: newName) { return nil }
28
28
29
29
guard let parent = parent else {
@@ -55,7 +55,7 @@ public extension File {
55
55
////////////////////////////////////////////////////////////////////////////////
56
56
// MARK: - Modification date
57
57
58
- public func modificationDate( ) throws -> Date {
58
+ func modificationDate( ) throws -> Date {
59
59
60
60
let fileAttributes = try FileManager . default. attributesOfItem ( atPath: path) as [ FileAttributeKey : Any ]
61
61
let modificationDate = fileAttributes [ . modificationDate] as! Date
@@ -66,7 +66,7 @@ public extension File {
66
66
////////////////////////////////////////////////////////////////////////////////
67
67
// MARK: - Tag file
68
68
69
- public func tag( copy: Bool ) throws {
69
+ func tag( copy: Bool ) throws {
70
70
let date = try modificationDate ( )
71
71
let suffix = ScriptToolkit . dateFormatter. string ( from: date)
72
72
for letter in " abcdefghijklmnopqrstuvwxyz " {
@@ -123,13 +123,13 @@ public extension File {
123
123
////////////////////////////////////////////////////////////////////////////////
124
124
// MARK: - Resize image
125
125
126
- @discardableResult public func resizeImage( newName: String , size: CGSize , overwrite: Bool = true ) throws -> File {
126
+ @discardableResult func resizeImage( newName: String , size: CGSize , overwrite: Bool = true ) throws -> File {
127
127
if !overwrite && FileManager . default. fileExists ( atPath: newName) { return try File ( path: newName) }
128
128
run ( ScriptToolkit . convertPath, path, " -resize " , " \( Int ( size. width) ) x \( Int ( size. height) ) " , newName)
129
129
return try File ( path: newName)
130
130
}
131
131
132
- public func resizeAt123x( width: Int , height: Int , outputDir: Folder , overwrite: Bool = true ) throws {
132
+ func resizeAt123x( width: Int , height: Int , outputDir: Folder , overwrite: Bool = true ) throws {
133
133
print ( name)
134
134
135
135
let res1name = outputDir. path. appendingPathComponent ( path: name)
@@ -145,7 +145,7 @@ public extension File {
145
145
////////////////////////////////////////////////////////////////////////////////
146
146
// MARK: - Audio Processing
147
147
148
- @discardableResult public func slowDownAudio( newName: String , percent: Float , overwrite: Bool = true ) throws -> File {
148
+ @discardableResult func slowDownAudio( newName: String , percent: Float , overwrite: Bool = true ) throws -> File {
149
149
if FileManager . default. fileExists ( atPath: newName) {
150
150
if !overwrite { return try File ( path: newName) }
151
151
try FileManager . default. removeItem ( atPath: newName)
@@ -155,7 +155,7 @@ public extension File {
155
155
return try File ( path: newName)
156
156
}
157
157
158
- @discardableResult public func convertToWav( newName: String , overwrite: Bool = true ) throws -> File {
158
+ @discardableResult func convertToWav( newName: String , overwrite: Bool = true ) throws -> File {
159
159
if FileManager . default. fileExists ( atPath: newName) {
160
160
if !overwrite { return try File ( path: newName) }
161
161
try FileManager . default. removeItem ( atPath: newName)
@@ -165,7 +165,7 @@ public extension File {
165
165
return try File ( path: newName)
166
166
}
167
167
168
- @discardableResult public func normalizeSampleRate( newName: String , overwrite: Bool = true ) throws -> File {
168
+ @discardableResult func normalizeSampleRate( newName: String , overwrite: Bool = true ) throws -> File {
169
169
if FileManager . default. fileExists ( atPath: newName) {
170
170
if !overwrite { return try File ( path: newName) }
171
171
try FileManager . default. removeItem ( atPath: newName)
@@ -175,7 +175,7 @@ public extension File {
175
175
return try File ( path: newName)
176
176
}
177
177
178
- @discardableResult public func convertToM4A( newName: String , overwrite: Bool = true ) throws -> File {
178
+ @discardableResult func convertToM4A( newName: String , overwrite: Bool = true ) throws -> File {
179
179
if FileManager . default. fileExists ( atPath: newName) {
180
180
if !overwrite { return try File ( path: newName) }
181
181
try FileManager . default. removeItem ( atPath: newName)
@@ -185,13 +185,13 @@ public extension File {
185
185
return try File ( path: newName)
186
186
}
187
187
188
- @discardableResult public func addSilence( newName: String , overwrite: Bool = true ) throws -> File {
188
+ @discardableResult func addSilence( newName: String , overwrite: Bool = true ) throws -> File {
189
189
if FileManager . default. fileExists ( atPath: newName) {
190
190
if !overwrite { return try File ( path: newName) }
191
191
try FileManager . default. removeItem ( atPath: newName)
192
192
}
193
193
194
- let result = runAndDebug ( ScriptToolkit . soxPath, ScriptToolkit . silenceFilePath, path, newName)
194
+ runAndDebug ( ScriptToolkit . soxPath, ScriptToolkit . silenceFilePath, path, newName)
195
195
return try File ( path: newName)
196
196
}
197
197
@@ -259,7 +259,7 @@ public extension File {
259
259
////////////////////////////////////////////////////////////////////////////////
260
260
// MARK: - Video Processing
261
261
262
- @discardableResult public func reduceVideo( newName: String , overwrite: Bool = true ) throws -> File {
262
+ @discardableResult func reduceVideo( newName: String , overwrite: Bool = true ) throws -> File {
263
263
if FileManager . default. fileExists ( atPath: newName) {
264
264
if !overwrite { return try File ( path: newName) }
265
265
try FileManager . default. removeItem ( atPath: newName)
@@ -272,7 +272,7 @@ public extension File {
272
272
////////////////////////////////////////////////////////////////////////////////
273
273
// MARK: - PDF
274
274
275
- @discardableResult public func cropPDF( newName: String , insets: NSEdgeInsets , overwrite: Bool = true ) throws -> File {
275
+ @discardableResult func cropPDF( newName: String , insets: NSEdgeInsets , overwrite: Bool = true ) throws -> File {
276
276
if FileManager . default. fileExists ( atPath: newName) {
277
277
if !overwrite { return try File ( path: newName) }
278
278
try FileManager . default. removeItem ( atPath: newName)
0 commit comments