diff --git a/lib/src/models/song_model.dart b/lib/src/models/song_model.dart index 61662bb..426476d 100644 --- a/lib/src/models/song_model.dart +++ b/lib/src/models/song_model.dart @@ -66,6 +66,7 @@ class Status { class Metadata { List? music; String? timestampUtc; + List? custom_streams; Metadata({this.music, this.timestampUtc}); @@ -76,6 +77,12 @@ class Metadata { music?.add(Music.fromJson(v)); }); } + if (json['custom_streams'] != null) { + custom_streams = []; + json['custom_streams'].forEach((v) { + custom_streams?.add(LiveACR.fromJson(v)); + }); + } timestampUtc = json['timestamp_utc']; } @@ -84,6 +91,9 @@ class Metadata { if (music != null) { data['music'] = music?.map((v) => v.toJson()).toList(); } + if (custom_streams != null) { + data['custom_streams'] = custom_streams?.map((v) => v.toJson()).toList(); + } data['timestamp_utc'] = timestampUtc; return data; } @@ -411,3 +421,46 @@ class Track { return data; } } + +// This function serves us to take data from the array of the identified channel. +class LiveACR { + // ID + String? acrid; + + // Type of input + String? result_type; + + // Score + dynamic score; + + // Timestamp + dynamic timestamp_ms; + + // Title + String? title; + + LiveACR( + {this.acrid, + this.result_type, + this.score, + this.timestamp_ms, + this.title}); + + LiveACR.fromJson(Map json) { + acrid = json['acrid']; + result_type = json['result_type']; + score = json['score']; + timestamp_ms = json['timestamp_ms']; + title = json['title']; + } + + Map toJson() { + final Map data = {}; + data['acrid'] = acrid; + data['result_type'] = result_type; + data['score'] = score; + data['timestamp_ms'] = timestamp_ms; + data['title'] = title; + return data; + } +}