Project import generated by Copybara.

GitOrigin-RevId: c98cbef0b5aa7b1f49fe1709c39517a64973f72b
This commit is contained in:
Madari Developers 2025-01-05 17:16:50 +00:00
parent f6de4ed23d
commit 757bdf6b76

View file

@ -32,10 +32,6 @@ class StremioConnectionService extends BaseConnectionService {
for (final addon in config.addons) { for (final addon in config.addons) {
final manifest = await _getManifest(addon); final manifest = await _getManifest(addon);
print(manifest);
print(addon);
if (manifest.resources == null) { if (manifest.resources == null) {
continue; continue;
} }
@ -261,6 +257,8 @@ class StremioConnectionService extends BaseConnectionService {
final url = final url =
"${_getAddonBaseURL(addon)}/stream/${meta.type}/${Uri.encodeComponent(id.id)}.json"; "${_getAddonBaseURL(addon)}/stream/${meta.type}/${Uri.encodeComponent(id.id)}.json";
print(url);
final result = await http.get(Uri.parse(url), headers: {}); final result = await http.get(Uri.parse(url), headers: {});
if (result.statusCode == 404) { if (result.statusCode == 404) {
@ -291,7 +289,8 @@ class StremioConnectionService extends BaseConnectionService {
callback(streams, null); callback(streams, null);
} }
} }
}).catchError((error) { }).catchError((error, stacktrace) {
print(stacktrace);
if (callback != null) callback(null, error); if (callback != null) callback(null, error);
}); });
@ -321,6 +320,10 @@ class StremioConnectionService extends BaseConnectionService {
return false; return false;
} }
if ((idPrefixes ?? []).isEmpty == true) {
return true;
}
final hasIdPrefix = (idPrefixes ?? []).where( final hasIdPrefix = (idPrefixes ?? []).where(
(item) => meta.id.startsWith(item), (item) => meta.id.startsWith(item),
); );
@ -348,11 +351,15 @@ class StremioConnectionService extends BaseConnectionService {
streamTitle = utf8.decode(streamTitle.runes.toList()); streamTitle = utf8.decode(streamTitle.runes.toList());
} catch (e) {} } catch (e) {}
final streamDescription = item.description != null String? streamDescription = item.description;
? utf8.decode(
(item.description!).runes.toList(), try {
) streamDescription = item.description != null
: null; ? utf8.decode(
(item.description!).runes.toList(),
)
: null;
} catch (e) {}
String title = meta.name ?? item.title ?? "No title"; String title = meta.name ?? item.title ?? "No title";