UI: Add ChannelTile with logos, search/filter, and design improvements
This commit is contained in:
@@ -60,16 +60,25 @@ class M3UService {
|
||||
final line = raw.trim();
|
||||
if (line.isEmpty) continue;
|
||||
if (line.startsWith('#EXTINF')) {
|
||||
// Format: #EXTINF:-1 tvg-id="" tvg-name="Channel" tvg-logo="" group-title="...") ,Display title
|
||||
// Format: #EXTINF:-1 tvg-id="" tvg-name="Channel" tvg-logo="https://..." group-title="...",Display title
|
||||
final parts = line.split(',');
|
||||
|
||||
// Try to extract attributes like tvg-logo="..."
|
||||
final logoMatch = RegExp(r'tvg-logo\s*=\s*"([^"]+)"').firstMatch(line);
|
||||
final logo = logoMatch?.group(1);
|
||||
|
||||
if (parts.length >= 2) {
|
||||
pendingTitle = parts.sublist(1).join(',').trim();
|
||||
} else {
|
||||
// Fallback: try to extract text after the last space
|
||||
final idx = line.indexOf(',');
|
||||
if (idx >= 0 && idx < line.length - 1)
|
||||
pendingTitle = line.substring(idx + 1).trim();
|
||||
}
|
||||
|
||||
// Attach logo information to the pending title token using a simple marker so the
|
||||
// subsequent URL line can pick it up.
|
||||
if (logo != null && pendingTitle != null)
|
||||
pendingTitle = '$pendingTitle||logo:$logo';
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -77,8 +86,14 @@ class M3UService {
|
||||
|
||||
// At this point 'line' is a URL
|
||||
final url = line;
|
||||
final title = pendingTitle ?? url;
|
||||
entries.add(StreamEntry(title: title, url: url));
|
||||
String title = pendingTitle ?? url;
|
||||
String? logo;
|
||||
if (title.contains('||logo:')) {
|
||||
final parts = title.split('||logo:');
|
||||
title = parts[0];
|
||||
logo = parts[1];
|
||||
}
|
||||
entries.add(StreamEntry(title: title, url: url, logo: logo));
|
||||
pendingTitle = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user