25 lines
710 B
Swift
25 lines
710 B
Swift
//
|
|
// 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)
|
|
}
|
|
}
|
|
}
|