Fix artwork upload pipeline
This commit is contained in:
@@ -13,6 +13,28 @@ public enum LocalUploadStatus: String, Codable, Hashable, Sendable, CaseIterable
|
||||
case failed
|
||||
}
|
||||
|
||||
public struct LocalTrackArtwork: Codable, Hashable, Sendable {
|
||||
public var localFilePath: String
|
||||
public var sha256: String
|
||||
public var mimeType: String
|
||||
public var width: Int?
|
||||
public var height: Int?
|
||||
|
||||
public init(
|
||||
localFilePath: String,
|
||||
sha256: String,
|
||||
mimeType: String,
|
||||
width: Int? = nil,
|
||||
height: Int? = nil
|
||||
) {
|
||||
self.localFilePath = localFilePath
|
||||
self.sha256 = sha256
|
||||
self.mimeType = mimeType
|
||||
self.width = width
|
||||
self.height = height
|
||||
}
|
||||
}
|
||||
|
||||
public struct LibraryTrack: Identifiable, Codable, Hashable, Sendable {
|
||||
public let id: String
|
||||
public var title: String
|
||||
@@ -21,6 +43,7 @@ public struct LibraryTrack: Identifiable, Codable, Hashable, Sendable {
|
||||
public var durationSeconds: Double?
|
||||
public var localFilePath: String
|
||||
public var sha256: String?
|
||||
public var artwork: LocalTrackArtwork?
|
||||
public var uploadStatus: LocalUploadStatus?
|
||||
public var remoteTrackId: String?
|
||||
public var lastUploadError: String?
|
||||
@@ -33,6 +56,7 @@ public struct LibraryTrack: Identifiable, Codable, Hashable, Sendable {
|
||||
durationSeconds: Double? = nil,
|
||||
localFilePath: String = "",
|
||||
sha256: String? = nil,
|
||||
artwork: LocalTrackArtwork? = nil,
|
||||
uploadStatus: LocalUploadStatus? = nil,
|
||||
remoteTrackId: String? = nil,
|
||||
lastUploadError: String? = nil
|
||||
@@ -44,6 +68,7 @@ public struct LibraryTrack: Identifiable, Codable, Hashable, Sendable {
|
||||
self.durationSeconds = durationSeconds
|
||||
self.localFilePath = localFilePath
|
||||
self.sha256 = sha256
|
||||
self.artwork = artwork
|
||||
self.uploadStatus = uploadStatus
|
||||
self.remoteTrackId = remoteTrackId
|
||||
self.lastUploadError = lastUploadError
|
||||
@@ -187,21 +212,46 @@ public struct UploadSessionStatusResponse: Codable, Hashable, Sendable {
|
||||
}
|
||||
|
||||
public struct UploadFinalizeRequest: Codable, Hashable, Sendable {
|
||||
public struct ArtworkPayload: Codable, Hashable, Sendable {
|
||||
public var dataBase64: String
|
||||
public var sha256: String
|
||||
public var mimeType: String
|
||||
public var width: Int?
|
||||
public var height: Int?
|
||||
|
||||
public init(
|
||||
dataBase64: String,
|
||||
sha256: String,
|
||||
mimeType: String,
|
||||
width: Int? = nil,
|
||||
height: Int? = nil
|
||||
) {
|
||||
self.dataBase64 = dataBase64
|
||||
self.sha256 = sha256
|
||||
self.mimeType = mimeType
|
||||
self.width = width
|
||||
self.height = height
|
||||
}
|
||||
}
|
||||
|
||||
public var title: String
|
||||
public var artist: String
|
||||
public var album: String?
|
||||
public var durationMs: Int?
|
||||
public var artwork: ArtworkPayload?
|
||||
|
||||
public init(
|
||||
title: String,
|
||||
artist: String,
|
||||
album: String? = nil,
|
||||
durationMs: Int? = nil
|
||||
durationMs: Int? = nil,
|
||||
artwork: ArtworkPayload? = nil
|
||||
) {
|
||||
self.title = title
|
||||
self.artist = artist
|
||||
self.album = album
|
||||
self.durationMs = durationMs
|
||||
self.artwork = artwork
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user