Fix iTunesStore importer.
This commit is contained in:
1 file changed
+9
@@ -233,7 +233,16 @@ extension Track {
|
|||||||
trackCensoredName = try container.decodeIfPresent(String.self, forKey: .trackCensoredName)
|
trackCensoredName = try container.decodeIfPresent(String.self, forKey: .trackCensoredName)
|
||||||
trackCount = try container.decodeIfPresent(Int.self, forKey: .trackCount)
|
trackCount = try container.decodeIfPresent(Int.self, forKey: .trackCount)
|
||||||
trackExplicitness = try container.decodeIfPresent(String.self, forKey: .trackExplicitness)
|
trackExplicitness = try container.decodeIfPresent(String.self, forKey: .trackExplicitness)
|
||||||
|
do {
|
||||||
trackId = try container.decodeIfPresent(Int.self, forKey: .trackId)
|
trackId = try container.decodeIfPresent(Int.self, forKey: .trackId)
|
||||||
|
} catch {
|
||||||
|
if let trackIdString = try container.decodeIfPresent(String.self, forKey: .trackId),
|
||||||
|
let trackIdInt = Int(trackIdString) {
|
||||||
|
trackId = trackIdInt
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
trackName = try container.decodeIfPresent(String.self, forKey: .trackName)
|
trackName = try container.decodeIfPresent(String.self, forKey: .trackName)
|
||||||
trackNumber = try container.decodeIfPresent(Int.self, forKey: .trackNumber)
|
trackNumber = try container.decodeIfPresent(Int.self, forKey: .trackNumber)
|
||||||
trackTimeMillis = try container.decodeIfPresent(Double.self, forKey: .trackTimeMillis)
|
trackTimeMillis = try container.decodeIfPresent(Double.self, forKey: .trackTimeMillis)
|
||||||
|
|||||||
Reference in new issue
Block a user