From 0f4410499e0e526e42dc3ab425ccfc39c409d477 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Fri, 4 Aug 2017 11:15:05 +0200 Subject: [PATCH] Cosmetics --- .../MetadataImporters/MetadataHelper.swift | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Classes/MetadataImporters/MetadataHelper.swift b/Classes/MetadataImporters/MetadataHelper.swift index ccb586b..33cbf75 100644 --- a/Classes/MetadataImporters/MetadataHelper.swift +++ b/Classes/MetadataImporters/MetadataHelper.swift @@ -28,7 +28,7 @@ class MetadataSearchInternalTask : MetadataSearchTask { @discardableResult public func runAsync() -> MetadataSearchTask { DispatchQueue.global(priority: .background).async { - _ = self.run() + self.run() } return self } @@ -106,22 +106,18 @@ private func parseFilename(_ filename: String) -> FilenameType? { let lines = outputString.components(separatedBy: "\n") if lines.count > 0 { - if lines.first == "tv" { - if lines.count >= 4 { - let newSeriesName = lines[1].replacingOccurrences(of: ".", with: " ") - return FilenameType.tvShow(seriesName: newSeriesName, season: Int(lines[2]), episode: Int(lines[3])) - } + if lines.first == "tv" && lines.count >= 4 { + let newSeriesName = lines[1].replacingOccurrences(of: ".", with: " ") + return FilenameType.tvShow(seriesName: newSeriesName, season: Int(lines[2]), episode: Int(lines[3])) } - else if lines.first == "movie" { - if lines.count >= 2 { - let newTitle = lines[1].replacingOccurrences(of: ".", with: " ") - .replacingOccurrences(of: "(", with: " ") - .replacingOccurrences(of: ")", with: " ") - .replacingOccurrences(of: "[", with: " ") - .replacingOccurrences(of: "]", with: " ") - .trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - return FilenameType.movie(title: newTitle) - } + else if lines.first == "movie" && lines.count >= 2 { + let newTitle = lines[1].replacingOccurrences(of: ".", with: " ") + .replacingOccurrences(of: "(", with: " ") + .replacingOccurrences(of: ")", with: " ") + .replacingOccurrences(of: "[", with: " ") + .replacingOccurrences(of: "]", with: " ") + .trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) + return FilenameType.movie(title: newTitle) } }