Tree: Format

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-06-13 00:23:36 -04:00 committed by Brian Dashore
parent c4edd5f687
commit e14c684b5f
10 changed files with 57 additions and 62 deletions

View file

@ -12,10 +12,10 @@ class Kodi {
// Used to add server to CoreData. Not part of API
func addServer(urlString: String,
friendlyName: String?,
username: String?,
password: String?,
existingServer: KodiServer? = nil) throws
friendlyName: String?,
username: String?,
password: String?,
existingServer: KodiServer? = nil) throws
{
let backgroundContext = PersistenceController.shared.backgroundContext

View file

@ -20,7 +20,7 @@ class TorBox: DebridSource, ObservableObject {
@Published var authProcessing: Bool = false
var isLoggedIn: Bool {
return getToken() != nil
getToken() != nil
}
var manualToken: String? {
@ -117,7 +117,7 @@ class TorBox: DebridSource, ObservableObject {
let rawResponse = try jsonDecoder.decode(TBResponse<InstantAvailabilityData>.self, from: data)
// If the data is a failure, return
guard case .links(let iaObjects) = rawResponse.data else {
guard case let .links(iaObjects) = rawResponse.data else {
return
}
@ -230,18 +230,14 @@ class TorBox: DebridSource, ObservableObject {
// MARK: - Cloud methods
// Unused
func getUserDownloads() async throws {
return
}
func getUserDownloads() async throws {}
func checkUserDownloads(link: String) async throws -> String? {
return nil
nil
}
func deleteDownload(downloadId: String) async throws {
return
}
func deleteDownload(downloadId: String) async throws {}
func getUserTorrents() async throws {
let torrentList = try await myTorrentList()
cloudTorrents = torrentList.map { torrent in

View file

@ -21,16 +21,16 @@ struct ActionJson: Codable, Hashable, PluginJson {
let tags: [PluginTagJson]?
init(name: String,
version: Int16,
minVersion: String?,
about: String?,
website: String?,
requires: [ActionRequirement],
deeplink: [DeeplinkActionJson]?,
author: String?,
listId: UUID?,
listName: String?,
tags: [PluginTagJson]?)
version: Int16,
minVersion: String?,
about: String?,
website: String?,
requires: [ActionRequirement],
deeplink: [DeeplinkActionJson]?,
author: String?,
listId: UUID?,
listName: String?,
tags: [PluginTagJson]?)
{
self.name = name
self.version = version

View file

@ -53,7 +53,7 @@ extension AllDebrid {
// MARK: - AddMagnetData
internal struct AddMagnetData: Codable {
struct AddMagnetData: Codable {
let magnet, hash, name, filenameOriginal: String
let size: Int
let ready: Bool
@ -103,7 +103,7 @@ extension AllDebrid {
// MARK: - MagnetStatusLink
// Abridged for required parameters
internal struct MagnetStatusLink: Codable {
struct MagnetStatusLink: Codable {
let link: String
let filename: String
let size: Int
@ -137,7 +137,7 @@ extension AllDebrid {
// MARK: - IAMagnetResponse
internal struct InstantAvailabilityMagnet: Codable {
struct InstantAvailabilityMagnet: Codable {
let magnet, hash: String
let instant: Bool
let files: [InstantAvailabilityFile]?
@ -145,7 +145,7 @@ extension AllDebrid {
// MARK: - IAFileResponse
internal struct InstantAvailabilityFile: Codable {
struct InstantAvailabilityFile: Codable {
let name: String
enum CodingKeys: String, CodingKey {

View file

@ -67,11 +67,11 @@ extension RealDebrid {
}
}
internal struct InstantAvailabilityData: Codable, Sendable {
struct InstantAvailabilityData: Codable, Sendable {
var rd: [[String: InstantAvailabilityInfo]]
}
internal struct InstantAvailabilityInfo: Codable, Sendable {
struct InstantAvailabilityInfo: Codable, Sendable {
var filename: String
var filesize: Int
}
@ -96,7 +96,7 @@ extension RealDebrid {
// MARK: - torrentInfo endpoint
internal struct TorrentInfoResponse: Codable, Sendable {
struct TorrentInfoResponse: Codable, Sendable {
let id, filename, originalFilename, hash: String
let bytes, originalBytes: Int
let host: String
@ -117,7 +117,7 @@ extension RealDebrid {
}
}
internal struct TorrentInfoFile: Codable, Sendable {
struct TorrentInfoFile: Codable, Sendable {
let id: Int
let path: String
let bytes, selected: Int
@ -136,7 +136,7 @@ extension RealDebrid {
// MARK: - unrestrictLink endpoint
internal struct UnrestrictLinkResponse: Codable, Sendable {
struct UnrestrictLinkResponse: Codable, Sendable {
let id, filename: String
let mimeType: String?
let filesize: Int

View file

@ -15,6 +15,7 @@ extension TorBox {
}
// MARK: - InstantAvailability
enum InstantAvailabilityData: Codable {
case links([InstantAvailabilityDataObject])
case failure(InstantAvailabilityDataFailure)
@ -34,9 +35,9 @@ extension TorBox {
func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case .links(let array):
case let .links(array):
try container.encode(array)
case .failure(let value):
case let .failure(value):
try container.encode(value)
}
}

View file

@ -91,8 +91,8 @@ struct Store<ObjectType> {
///
/// Use this init to schedule updates on a specific scheduler other than `DispatchQueue.main`.
init<S: Scheduler>(wrappedValue: ObjectType,
on scheduler: S,
schedulerOptions: S.SchedulerOptions? = nil)
on scheduler: S,
schedulerOptions: S.SchedulerOptions? = nil)
{
self.wrappedValue = wrappedValue

View file

@ -369,8 +369,6 @@ class DebridManager: ObservableObject {
await sendDebridError(error, prefix: "\(debridSource.id) download error", cancelString: "Download cancelled")
}
}
return
}
func unrestrictDownload() async {

View file

@ -71,7 +71,7 @@ class LoggingManager: ObservableObject {
// TODO: Maybe append to a constant logfile?
func info(_ message: String,
description: String? = nil)
description: String? = nil)
{
let log = Log(
level: .info,
@ -89,7 +89,7 @@ class LoggingManager: ObservableObject {
}
func warn(_ message: String,
description: String? = nil)
description: String? = nil)
{
let log = Log(
level: .warn,
@ -107,8 +107,8 @@ class LoggingManager: ObservableObject {
}
func error(_ message: String,
description: String? = nil,
showToast: Bool = true)
description: String? = nil,
showToast: Bool = true)
{
let log = Log(
level: .error,

View file

@ -313,11 +313,11 @@ class ScrapingViewModel: ObservableObject {
}
private func handleApiCredential(_ credential: SourceApiCredential,
replacement: String,
searchUrl: String,
apiUrl: String?,
website: String,
sourceName: String) async -> String?
replacement: String,
searchUrl: String,
apiUrl: String?,
website: String,
sourceName: String) async -> String?
{
// Is the credential expired
var isExpired = false
@ -354,8 +354,8 @@ class ScrapingViewModel: ObservableObject {
}
private func fetchApiCredential(urlString: String,
credential: SourceApiCredential,
sourceName: String) async -> String?
credential: SourceApiCredential,
sourceName: String) async -> String?
{
guard let url = URL(string: urlString) else {
await sendSourceError("\(sourceName): Token URL \(urlString) is invalid.")
@ -522,9 +522,9 @@ class ScrapingViewModel: ObservableObject {
// TODO: Add regex parsing for API
private func parseJsonResult(_ result: JSON,
jsonParser: SourceJsonParser,
source: Source,
existingSearchResult: SearchResult? = nil) -> SearchResult?
jsonParser: SourceJsonParser,
source: Source,
existingSearchResult: SearchResult? = nil) -> SearchResult?
{
// Enforce these parsers
guard let titleParser = jsonParser.title else {
@ -751,10 +751,10 @@ class ScrapingViewModel: ObservableObject {
// Complex query parsing for RSS scraping
private func runRssComplexQuery(item: Element,
query: String,
attribute: String,
discriminator: String?,
regexString: String?) throws -> String?
query: String,
attribute: String,
discriminator: String?,
regexString: String?) throws -> String?
{
var parsedValue: String?
@ -956,9 +956,9 @@ class ScrapingViewModel: ObservableObject {
// Complex query parsing for HTML scraping
private func runHtmlComplexQuery(row: Element,
query: String,
attribute: String,
regexString: String?) throws -> String?
query: String,
attribute: String,
regexString: String?) throws -> String?
{
var parsedValue: String?