mirror of
https://github.com/tappollo/WWDC.git
synced 2026-01-13 08:50:53 +08:00
33 lines
934 B
Swift
33 lines
934 B
Swift
//
|
|
// TranscriptIndexingService.swift
|
|
// WWDC
|
|
//
|
|
// Created by Guilherme Rambo on 28/05/17.
|
|
// Copyright © 2017 Guilherme Rambo. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import ConfCore
|
|
import RealmSwift
|
|
|
|
final class TranscriptIndexingService: NSObject, TranscriptIndexingServiceProtocol {
|
|
|
|
private var transcriptIndexer: TranscriptIndexer!
|
|
|
|
func indexTranscriptsIfNeeded(storageURL: URL, schemaVersion: UInt64) {
|
|
if transcriptIndexer == nil {
|
|
do {
|
|
let config = Realm.Configuration(fileURL: storageURL, schemaVersion: schemaVersion)
|
|
let storage = try Storage(config)
|
|
transcriptIndexer = TranscriptIndexer(storage)
|
|
} catch {
|
|
NSLog("[TranscriptIndexingService] Error initializing: \(error)")
|
|
return
|
|
}
|
|
}
|
|
|
|
transcriptIndexer.downloadTranscriptsIfNeeded()
|
|
}
|
|
|
|
}
|