Tree: Format

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-06-03 16:25:32 -04:00
parent c641fdf300
commit f9ecc746a1
5 changed files with 22 additions and 24 deletions

View file

@ -279,7 +279,7 @@ public class AllDebrid: PollingDebridSource {
fileName: magnetResponse.filename, fileName: magnetResponse.filename,
status: magnetResponse.status, status: magnetResponse.status,
hash: magnetResponse.hash, hash: magnetResponse.hash,
links: magnetResponse.links.map { $0.link } links: magnetResponse.links.map(\.link)
) )
} }

View file

@ -190,7 +190,7 @@ public class Premiumize: OAuthDebridSource {
return DebridIA( return DebridIA(
magnet: magnet, magnet: magnet,
source: self.id, source: id,
expiryTimeStamp: Date().timeIntervalSince1970 + 300, expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: files files: files
) )
@ -331,10 +331,8 @@ public class Premiumize: OAuthDebridSource {
// No user torrents for Premiumize // No user torrents for Premiumize
public func getUserTorrents() async throws -> [DebridCloudTorrent] { public func getUserTorrents() async throws -> [DebridCloudTorrent] {
return [] []
} }
public func deleteTorrent(torrentId: String) async throws { public func deleteTorrent(torrentId: String) async throws {}
return
}
} }

View file

@ -272,7 +272,7 @@ public class RealDebrid: PollingDebridSource {
availableHashes.append( availableHashes.append(
DebridIA( DebridIA(
magnet: Magnet(hash: hash, link: nil), magnet: Magnet(hash: hash, link: nil),
source: self.id, source: id,
expiryTimeStamp: Date().timeIntervalSince1970 + 300, expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: files files: files
) )
@ -281,7 +281,7 @@ public class RealDebrid: PollingDebridSource {
availableHashes.append( availableHashes.append(
DebridIA( DebridIA(
magnet: Magnet(hash: hash, link: nil), magnet: Magnet(hash: hash, link: nil),
source: self.id, source: id,
expiryTimeStamp: Date().timeIntervalSince1970 + 300, expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: [] files: []
) )

View file

@ -572,26 +572,26 @@ public class DebridManager: ObservableObject {
func fetchRdDownload(magnet: Magnet?, existingLink: String?) async { func fetchRdDownload(magnet: Magnet?, existingLink: String?) async {
// If an existing link is passed in args, set it to that. Otherwise, find one from RD cloud. // If an existing link is passed in args, set it to that. Otherwise, find one from RD cloud.
/* /*
let torrentLink: String? let torrentLink: String?
if let existingLink { if let existingLink {
torrentLink = existingLink torrentLink = existingLink
} else { } else {
// Bypass the TTL for up to date information // Bypass the TTL for up to date information
await fetchRdCloud(bypassTTL: true) await fetchRdCloud(bypassTTL: true)
let existingTorrent = realDebridCloudTorrents.first { $0.hash == selectedRealDebridItem?.magnet.hash && $0.status == "downloaded" } let existingTorrent = realDebridCloudTorrents.first { $0.hash == selectedRealDebridItem?.magnet.hash && $0.status == "downloaded" }
torrentLink = existingTorrent?.links[safe: selectedRealDebridFile?.batchFileIndex ?? 0] torrentLink = existingTorrent?.links[safe: selectedRealDebridFile?.batchFileIndex ?? 0]
} }
*/ */
do { do {
// If the links match from a user's downloads, no need to re-run a download // If the links match from a user's downloads, no need to re-run a download
/* /*
if let torrentLink, if let torrentLink,
let downloadLink = await checkRdUserDownloads(userTorrentLink: torrentLink) let downloadLink = await checkRdUserDownloads(userTorrentLink: torrentLink)
{ {
downloadUrl = downloadLink downloadUrl = downloadLink
} else */ } else */
if let magnet { if let magnet {
let downloadLink = try await realDebrid.getDownloadLink( let downloadLink = try await realDebrid.getDownloadLink(
magnet: magnet, ia: selectedRealDebridItem, iaFile: selectedRealDebridFile magnet: magnet, ia: selectedRealDebridItem, iaFile: selectedRealDebridFile

View file

@ -18,7 +18,7 @@ struct RealDebridCloudView: View {
Group { Group {
DisclosureGroup("Downloads") { DisclosureGroup("Downloads") {
ForEach(debridManager.realDebridCloudDownloads.filter { ForEach(debridManager.realDebridCloudDownloads.filter {
searchText.isEmpty ? true : $0.fileName .lowercased().contains(searchText.lowercased()) searchText.isEmpty ? true : $0.fileName.lowercased().contains(searchText.lowercased())
}, id: \.self) { cloudDownload in }, id: \.self) { cloudDownload in
Button(cloudDownload.fileName) { Button(cloudDownload.fileName) {
navModel.resultFromCloud = true navModel.resultFromCloud = true