61 lines
1.5 KiB
Swift
61 lines
1.5 KiB
Swift
import Foundation
|
|
import VelodyDomain
|
|
|
|
public struct LocalTrackMetadata: Hashable, Sendable {
|
|
public struct EmbeddedArtworkPayload: Hashable, Sendable {
|
|
public var data: Data
|
|
public var sha256: String
|
|
public var mimeType: String
|
|
public var width: Int?
|
|
public var height: Int?
|
|
|
|
public init(
|
|
data: Data,
|
|
sha256: String,
|
|
mimeType: String,
|
|
width: Int? = nil,
|
|
height: Int? = nil
|
|
) {
|
|
self.data = data
|
|
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 durationSeconds: Double?
|
|
public var artwork: EmbeddedArtworkPayload?
|
|
|
|
public init(
|
|
title: String? = nil,
|
|
artist: String? = nil,
|
|
album: String? = nil,
|
|
durationSeconds: Double? = nil,
|
|
artwork: EmbeddedArtworkPayload? = nil
|
|
) {
|
|
self.title = title
|
|
self.artist = artist
|
|
self.album = album
|
|
self.durationSeconds = durationSeconds
|
|
self.artwork = artwork
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
public protocol FolderAccessService: AnyObject {
|
|
func chooseFolder() -> URL?
|
|
func storedFolderURL() -> URL?
|
|
}
|
|
|
|
public protocol MetadataReader {
|
|
func readMetadata(for fileURL: URL) async throws -> LocalTrackMetadata
|
|
}
|
|
|
|
public protocol LocalMusicScanner {
|
|
func scanFolder(at folderURL: URL) async throws -> [ScannedLocalTrack]
|
|
}
|