Skip to content

Commit 0e5fdae

Browse files
committed
make newly optional audio analysis fields nullable
fix #195
1 parent 6117a5b commit 0e5fdae

File tree

1 file changed

+15
-15
lines changed
  • src/commonMain/kotlin/com.adamratzman.spotify/models

1 file changed

+15
-15
lines changed

src/commonMain/kotlin/com.adamratzman.spotify/models/Track.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ data class AudioAnalysisMeta(
226226
@SerialName("analyzer_version") val analyzerVersion: String,
227227
val platform: String,
228228
@SerialName("detailed_status") val detailedStatus: String,
229-
@SerialName("status_code") val statusCode: Int?,
229+
@SerialName("status_code") val statusCode: Int? = null,
230230
val timestamp: Long,
231231
@SerialName("analysis_time") val analysisTime: Float,
232232
@SerialName("input_process") val inputProcess: String
@@ -263,16 +263,16 @@ data class AudioAnalysisMeta(
263263
*/
264264
@Serializable
265265
data class AudioSection(
266-
val start: Float,
266+
val start: Float = 0f,
267267
val duration: Float,
268268
val confidence: Float,
269269
val loudness: Float,
270-
val tempo: Float,
271-
@SerialName("tempo_confidence") val tempoConfidence: Float,
270+
val tempo: Float?=null,
271+
@SerialName("tempo_confidence") val tempoConfidence: Float?=null,
272272
val key: Int,
273-
@SerialName("key_confidence") val keyConfidence: Float,
274-
val mode: Int,
275-
@SerialName("mode_confidence") val modeConfidence: Float,
273+
@SerialName("key_confidence") val keyConfidence: Float?=null,
274+
val mode: Int?=null,
275+
@SerialName("mode_confidence") val modeConfidence: Float?=null,
276276
@SerialName("time_signature") val timeSignature: Int,
277277
@SerialName("time_signature_confidence") val timeSignatureConfidence: Float
278278
)
@@ -300,11 +300,11 @@ data class AudioSection(
300300
*/
301301
@Serializable
302302
data class AudioSegment(
303-
val start: Float,
303+
val start: Float?=null,
304304
val duration: Float,
305-
val confidence: Float,
305+
val confidence: Float?=null,
306306
@SerialName("loudness_start") val loudnessStart: Float,
307-
@SerialName("loudness_max_time") val loudnessMaxTime: Float,
307+
@SerialName("loudness_max_time") val loudnessMaxTime: Float?=null,
308308
@SerialName("loudness_max") val loudnessMax: Float,
309309
@SerialName("loudness_end") val loudnessEnd: Float? = null,
310310
val pitches: List<Float>,
@@ -318,10 +318,10 @@ data class AudioSegment(
318318
data class TrackAnalysis(
319319
@SerialName("num_samples") val numSamples: Int,
320320
val duration: Float,
321-
@SerialName("sample_md5") val sampleMd5: String,
322-
@SerialName("offset_seconds") val offsetSeconds: Int,
323-
@SerialName("window_seconds") val windowSeconds: Int,
324-
@SerialName("analysis_sample_rate") val analysisSampleRate: Int,
321+
@SerialName("sample_md5") val sampleMd5: String? = null,
322+
@SerialName("offset_seconds") val offsetSeconds: Int?=null,
323+
@SerialName("window_seconds") val windowSeconds: Int?=null,
324+
@SerialName("analysis_sample_rate") val analysisSampleRate: Float,
325325
@SerialName("analysis_channels") val analysisChannels: Int,
326326
@SerialName("end_of_fade_in") val endOfFadeIn: Float,
327327
@SerialName("start_of_fade_out") val startOfFadeOut: Float,
@@ -332,7 +332,7 @@ data class TrackAnalysis(
332332
@SerialName("time_signature_confidence") val timeSignatureConfidence: Float,
333333
val key: Int,
334334
@SerialName("key_confidence") val keyConfidence: Float,
335-
val mode: Int,
335+
val mode: Int?=null,
336336
@SerialName("mode_confidence") val modeConfidence: Float,
337337
val codestring: String,
338338
@SerialName("code_version") val codeVersion: Float,

0 commit comments

Comments
 (0)