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>
57 lines
1.5 KiB
Swift
57 lines
1.5 KiB
Swift
//
|
|
// SearchResultRDView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 7/26/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SearchResultRDView: View {
|
|
@EnvironmentObject var debridManager: DebridManager
|
|
|
|
@AppStorage("RealDebrid.Enabled") var realDebridEnabled = false
|
|
|
|
var result: SearchResult
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Text(result.source)
|
|
|
|
Spacer()
|
|
|
|
if let seeders = result.seeders {
|
|
Text("S: \(seeders)")
|
|
}
|
|
|
|
if let leechers = result.leechers {
|
|
Text("L: \(leechers)")
|
|
}
|
|
|
|
Text(result.size)
|
|
|
|
if realDebridEnabled {
|
|
Text("RD")
|
|
.fontWeight(.bold)
|
|
.padding(2)
|
|
.background {
|
|
switch debridManager.matchSearchResult(result: result) {
|
|
case .full:
|
|
Color.green
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
case .partial:
|
|
Color.orange
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
case .none:
|
|
Color.red
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.font(.caption)
|
|
}
|
|
}
|