Sources are now completely changed to use a more flexible API. This uses a fully native source system, so there will be 0 overhead on resource usage and performance. JSON objects specify what is fetched and displayed by Ferrite when searching torrents. Sources now include sizes, seeders, and leechers for any site that specifies them. The versioning and repo naming framework has been added, but will be displayed in another update. API support will be included in another update. Signed-off-by: kingbri <bdashore3@gmail.com>
58 lines
1.2 KiB
Swift
58 lines
1.2 KiB
Swift
//
|
|
// SourceModels.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 7/24/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct SourceListJson: Codable {
|
|
let repoName: String?
|
|
let repoAuthor: String?
|
|
let sources: [SourceJson]
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case repoName = "name"
|
|
case repoAuthor = "author"
|
|
case sources
|
|
}
|
|
}
|
|
|
|
public struct SourceJson: Codable, Hashable {
|
|
let name: String
|
|
let version: String
|
|
let baseUrl: String
|
|
let htmlParser: SourceHtmlParserJson?
|
|
}
|
|
|
|
public struct SourceHtmlParserJson: Codable, Hashable {
|
|
let searchUrl: String
|
|
let rows: String
|
|
let magnet: SourceMagnetJson
|
|
let title: SouceComplexQuery?
|
|
let size: SouceComplexQuery?
|
|
let sl: SourceSLJson?
|
|
}
|
|
|
|
public struct SouceComplexQuery: Codable, Hashable {
|
|
let query: String
|
|
let attribute: String
|
|
let regex: String?
|
|
}
|
|
|
|
public struct SourceMagnetJson: Codable, Hashable {
|
|
let query: String
|
|
let attribute: String
|
|
let regex: String?
|
|
let externalLinkQuery: String?
|
|
}
|
|
|
|
public struct SourceSLJson: Codable, Hashable {
|
|
let seeders: String?
|
|
let leechers: String?
|
|
let combined: String?
|
|
let attribute: String
|
|
let seederRegex: String?
|
|
let leecherRegex: String?
|
|
}
|