fix: pin EPG titles, filter cloud channel list

close #614
This commit is contained in:
edde746
2026-04-17 04:28:19 +02:00
parent 2e429840d2
commit ee20965218
2 changed files with 63 additions and 34 deletions
+15 -3
View File
@@ -2316,11 +2316,23 @@ class PlexClient {
final allChannels = <LiveTvChannel>[];
for (final provider in _providerEpg) {
final isCloudGuide = provider.identifier.startsWith('tv.plex.providers.epg');
final primaryEndpoint = isCloudGuide
? '/lineups/plex/channels'
: '/${provider.identifier}/lineups/dvr/channels';
try {
final response = await _getWithFailover('/${provider.identifier}/lineups/dvr/channels');
allChannels.addAll(parseChannels(response));
final response = await _getWithFailover(primaryEndpoint);
final parsed = parseChannels(response);
if (parsed.isEmpty && isCloudGuide) {
// Fallback: the prefix matched but this server doesn't expose the
// cloud endpoint. Retry with the legacy DVR endpoint.
final fallback = await _getWithFailover('/${provider.identifier}/lineups/dvr/channels');
allChannels.addAll(parseChannels(fallback));
} else {
allChannels.addAll(parsed);
}
} catch (e) {
appLogger.e('Failed to get EPG channels from ${provider.identifier}', error: e);
appLogger.e('Failed to get EPG channels from ${provider.identifier} via $primaryEndpoint', error: e);
}
}
return allChannels;