Skip to content

Identify a TV or a Radio channel #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions lib/src/models/song_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Status {
class Metadata {
List<Music>? music;
String? timestampUtc;
List<LiveACR>? custom_streams;

Metadata({this.music, this.timestampUtc});

Expand All @@ -76,6 +77,12 @@ class Metadata {
music?.add(Music.fromJson(v));
});
}
if (json['custom_streams'] != null) {
custom_streams = <LiveACR>[];
json['custom_streams'].forEach((v) {
custom_streams?.add(LiveACR.fromJson(v));
});
}
timestampUtc = json['timestamp_utc'];
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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<String, dynamic> json) {
acrid = json['acrid'];
result_type = json['result_type'];
score = json['score'];
timestamp_ms = json['timestamp_ms'];
title = json['title'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['acrid'] = acrid;
data['result_type'] = result_type;
data['score'] = score;
data['timestamp_ms'] = timestamp_ms;
data['title'] = title;
return data;
}
}