mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-10 21:59:23 +02:00
Handle download complete lifecycle
This commit is contained in:
@@ -75,6 +75,7 @@ extension LocalFile {
|
||||
self.init()
|
||||
self.id = "\(libraryItemId)_\(filename.toBase64())"
|
||||
self.filename = filename
|
||||
self.mimeType = mimeType
|
||||
self.contentUrl = localUrl.absoluteString
|
||||
self.absolutePath = localUrl.path
|
||||
self.size = Int(localUrl.fileSize)
|
||||
@@ -90,3 +91,27 @@ extension LocalFile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension LocalMediaProgress {
|
||||
init(localLibraryItem: LocalLibraryItem, episode: LocalPodcastEpisode?, progress: MediaProgress) {
|
||||
self.id = localLibraryItem.id
|
||||
self.localLibraryItemId = localLibraryItem.id
|
||||
self.libraryItemId = localLibraryItem.libraryItemId
|
||||
|
||||
if let episode = episode {
|
||||
self.id += "-\(episode.id)"
|
||||
self.episodeId = episode.id
|
||||
}
|
||||
|
||||
self.serverAddress = localLibraryItem.serverAddress
|
||||
self.serverUserId = localLibraryItem.serverUserId
|
||||
self.serverConnectionConfigId = localLibraryItem.serverConnectionConfigId
|
||||
|
||||
self.duration = progress.duration
|
||||
self.currentTime = progress.currentTime
|
||||
self.isFinished = false
|
||||
self.lastUpdate = progress.lastUpdate
|
||||
self.startedAt = progress.startedAt
|
||||
self.finishedAt = progress.finishedAt
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user