Migrate the chapter importer to Swift.
This commit is contained in:
1 parent
514ab21fb7
commit
23f626be9f
10 files changed
+317
-44
No files matched your search
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// ChapterImporter.swift
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 31/07/2017.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol ChapterService {
|
||||
func search(title: String, duration: UInt64) -> [ChapterResult]
|
||||
}
|
||||
|
||||
public enum ChapterSearch {
|
||||
case movieSeach(service: ChapterService, title: String, duration: UInt64)
|
||||
|
||||
public func search(completionHandler: @escaping ([ChapterResult]) -> Void) -> MetadataSearchTask {
|
||||
switch self {
|
||||
case let .movieSeach(service, title, duration):
|
||||
return MetadataSearchInternalTask(search: service.search(title: title, duration: duration),
|
||||
completionHandler: completionHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user