mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-17 23:06:20 +00:00
chore: removed code
This commit is contained in:
@@ -25,14 +25,6 @@ function downloadHLSAsset(
|
||||
HlsDownloaderModule.downloadHLSAsset(id, url, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for existing downloads.
|
||||
* Returns an array of downloads with additional fields:
|
||||
*/
|
||||
async function checkForExistingDownloads(): Promise<DownloadInfo[]> {
|
||||
return HlsDownloaderModule.checkForExistingDownloads();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels an ongoing download.
|
||||
* @param id - The unique identifier for the download.
|
||||
@@ -105,7 +97,6 @@ function useDownloadError(): string | null {
|
||||
|
||||
export {
|
||||
downloadHLSAsset,
|
||||
checkForExistingDownloads,
|
||||
useDownloadError,
|
||||
useDownloadProgress,
|
||||
addCompleteListener,
|
||||
|
||||
@@ -144,30 +144,6 @@ public class HlsDownloaderModule: Module {
|
||||
}
|
||||
}
|
||||
|
||||
Function("checkForExistingDownloads") {
|
||||
() -> [[String: Any]] in
|
||||
var downloads: [[String: Any]] = []
|
||||
for (id, pair) in self.activeDownloads {
|
||||
let task = pair.task
|
||||
let delegate = pair.delegate
|
||||
let metadata = pair.metadata
|
||||
let startTime = pair.startTime
|
||||
let downloaded = delegate.downloadedSeconds
|
||||
let total = delegate.totalSeconds
|
||||
let progress = total > 0 ? downloaded / total : 0
|
||||
downloads.append([
|
||||
"id": delegate.providedId.isEmpty ? String(id) : delegate.providedId,
|
||||
"progress": progress,
|
||||
"secondsDownloaded": downloaded,
|
||||
"secondsTotal": total,
|
||||
"state": self.mappedState(for: task),
|
||||
"metadata": metadata,
|
||||
"startTime": startTime,
|
||||
])
|
||||
}
|
||||
return downloads
|
||||
}
|
||||
|
||||
Function("cancelDownload") { (providedId: String) -> Void in
|
||||
guard
|
||||
let entry = self.activeDownloads.first(where: { $0.value.delegate.providedId == providedId }
|
||||
|
||||
Reference in New Issue
Block a user