mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-03-11 17:45:40 +00:00
Debrid: Add source to all models
Gives an ID of where the struct came from. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
f902142fee
commit
c641fdf300
4 changed files with 12 additions and 3 deletions
|
|
@ -169,6 +169,7 @@ public class AllDebrid: PollingDebridSource {
|
|||
|
||||
return DebridIA(
|
||||
magnet: Magnet(hash: magnetResp.hash, link: magnetResp.magnet),
|
||||
source: self.id,
|
||||
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
|
||||
files: files
|
||||
)
|
||||
|
|
@ -274,6 +275,7 @@ public class AllDebrid: PollingDebridSource {
|
|||
let torrents = rawResponse.magnets.map { magnetResponse in
|
||||
DebridCloudTorrent(
|
||||
torrentId: String(magnetResponse.id),
|
||||
source: self.id,
|
||||
fileName: magnetResponse.filename,
|
||||
status: magnetResponse.status,
|
||||
hash: magnetResponse.hash,
|
||||
|
|
@ -306,7 +308,7 @@ public class AllDebrid: PollingDebridSource {
|
|||
// The link is also the ID
|
||||
let downloads = rawResponse.links.map { link in
|
||||
DebridCloudDownload(
|
||||
downloadId: link.link, fileName: link.filename, link: link.link
|
||||
downloadId: link.link, source: self.id, fileName: link.filename, link: link.link
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ public class Premiumize: OAuthDebridSource {
|
|||
|
||||
return DebridIA(
|
||||
magnet: magnet,
|
||||
source: self.id,
|
||||
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
|
||||
files: files
|
||||
)
|
||||
|
|
@ -294,7 +295,7 @@ public class Premiumize: OAuthDebridSource {
|
|||
|
||||
// The "link" is the ID for Premiumize
|
||||
let downloads = rawResponse.files.map { file in
|
||||
DebridCloudDownload(downloadId: file.id, fileName: file.name, link: file.id)
|
||||
DebridCloudDownload(downloadId: file.id, source: self.id, fileName: file.name, link: file.id)
|
||||
}
|
||||
|
||||
return downloads
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ public class RealDebrid: PollingDebridSource {
|
|||
availableHashes.append(
|
||||
DebridIA(
|
||||
magnet: Magnet(hash: hash, link: nil),
|
||||
source: self.id,
|
||||
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
|
||||
files: files
|
||||
)
|
||||
|
|
@ -280,6 +281,7 @@ public class RealDebrid: PollingDebridSource {
|
|||
availableHashes.append(
|
||||
DebridIA(
|
||||
magnet: Magnet(hash: hash, link: nil),
|
||||
source: self.id,
|
||||
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
|
||||
files: []
|
||||
)
|
||||
|
|
@ -395,6 +397,7 @@ public class RealDebrid: PollingDebridSource {
|
|||
let torrents = rawResponse.map { response in
|
||||
DebridCloudTorrent(
|
||||
torrentId: response.id,
|
||||
source: self.id,
|
||||
fileName: response.filename,
|
||||
status: response.status,
|
||||
hash: response.hash,
|
||||
|
|
@ -420,7 +423,7 @@ public class RealDebrid: PollingDebridSource {
|
|||
let data = try await performRequest(request: &request, requestName: #function)
|
||||
let rawResponse = try jsonDecoder.decode([UserDownloadsResponse].self, from: data)
|
||||
let downloads = rawResponse.map { response in
|
||||
DebridCloudDownload(downloadId: response.id, fileName: response.filename, link: response.download)
|
||||
DebridCloudDownload(downloadId: response.id, source: self.id, fileName: response.filename, link: response.download)
|
||||
}
|
||||
|
||||
return downloads
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import Foundation
|
|||
|
||||
public struct DebridIA: Hashable, Sendable {
|
||||
let magnet: Magnet
|
||||
let source: String
|
||||
let expiryTimeStamp: Double
|
||||
var files: [DebridIAFile]
|
||||
}
|
||||
|
|
@ -29,12 +30,14 @@ public struct DebridIAFile: Hashable, Sendable {
|
|||
|
||||
public struct DebridCloudDownload: Hashable, Sendable {
|
||||
let downloadId: String
|
||||
let source: String
|
||||
let fileName: String
|
||||
let link: String
|
||||
}
|
||||
|
||||
public struct DebridCloudTorrent: Hashable, Sendable {
|
||||
let torrentId: String
|
||||
let source: String
|
||||
let fileName: String
|
||||
let status: String
|
||||
let hash: String
|
||||
|
|
|
|||
Loading…
Reference in a new issue