mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-29 14:28:34 +02:00
Revert "Fixes missing LocalMediaProgress for downloads without existing progress"
This reverts commit 7745ccefab
.
This commit is contained in:
parent
85382d2bb4
commit
2321312427
1 changed files with 3 additions and 6 deletions
|
@ -186,15 +186,12 @@ public class AbsDownloader: CAPPlugin, URLSessionDownloadDelegate {
|
||||||
|
|
||||||
statusNotification["localLibraryItem"] = try? localLibraryItem.asDictionary()
|
statusNotification["localLibraryItem"] = try? localLibraryItem.asDictionary()
|
||||||
|
|
||||||
var localMediaProgress: LocalMediaProgress
|
|
||||||
if let progress = libraryItem.userMediaProgress {
|
if let progress = libraryItem.userMediaProgress {
|
||||||
let episode = downloadItem.media?.episodes.first(where: { $0.id == downloadItem.episodeId })
|
let episode = downloadItem.media?.episodes.first(where: { $0.id == downloadItem.episodeId })
|
||||||
localMediaProgress = LocalMediaProgress(localLibraryItem: localLibraryItem!, episode: episode, progress: progress)
|
let localMediaProgress = LocalMediaProgress(localLibraryItem: localLibraryItem!, episode: episode, progress: progress)
|
||||||
} else {
|
|
||||||
localMediaProgress = LocalMediaProgress.fetchOrCreateLocalMediaProgress(localMediaProgressId: nil, localLibraryItemId: localLibraryItem?.id, localEpisodeId: downloadItem.episodeId)!
|
|
||||||
}
|
|
||||||
Database.shared.saveLocalMediaProgress(localMediaProgress)
|
Database.shared.saveLocalMediaProgress(localMediaProgress)
|
||||||
statusNotification["localMediaProgress"] = try? localMediaProgress.asDictionary()
|
statusNotification["localMediaProgress"] = try? localMediaProgress.asDictionary()
|
||||||
|
}
|
||||||
|
|
||||||
self.notifyListeners("onItemDownloadComplete", data: statusNotification)
|
self.notifyListeners("onItemDownloadComplete", data: statusNotification)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue