diff --git a/lib/features/connection/services/stremio_service.dart b/lib/features/connection/services/stremio_service.dart index a025c68..01bf4e1 100644 --- a/lib/features/connection/services/stremio_service.dart +++ b/lib/features/connection/services/stremio_service.dart @@ -87,10 +87,10 @@ class StremioService extends BaseConnectionService { }, ).toList(); - if (resources.contains("catalog")) { + if (resources.contains("catalog") || + manifest.catalogs?.isNotEmpty == true) { for (final item in (manifest.catalogs ?? [] as List)) { - print(item.toJson()); result.add( FolderItem( title: item.name == null diff --git a/lib/features/connections/service/stremio_connection_service.dart b/lib/features/connections/service/stremio_connection_service.dart index 75a7b88..1cfaa56 100644 --- a/lib/features/connections/service/stremio_connection_service.dart +++ b/lib/features/connections/service/stremio_connection_service.dart @@ -175,9 +175,14 @@ class StremioConnectionService extends BaseConnectionService { cacheDuration: const Duration(hours: 8), ), queryFn: () async { - _logger.finer('Fetching catalog from URL: $url'); - final httpBody = await http.get(Uri.parse(url)); - return StrmioMeta.fromJson(jsonDecode(httpBody.body)); + try { + _logger.finer('Fetching catalog from URL: $url'); + final httpBody = await http.get(Uri.parse(url)); + return StrmioMeta.fromJson(jsonDecode(httpBody.body)); + } catch (e, stack) { + _logger.severe('Error parsing catalog', e, stack); + rethrow; + } }, key: url, ) @@ -186,7 +191,7 @@ class StremioConnectionService extends BaseConnectionService { .first .then((docs) { if (docs.error != null) { - _logger.severe('Error fetching catalog: ${docs.error}'); + _logger.severe('Error fetching catalog', docs.error); throw docs.error!; } return docs.data!; diff --git a/lib/features/connections/types/stremio/stremio_base.types.dart b/lib/features/connections/types/stremio/stremio_base.types.dart index c70faf7..b4b0d06 100644 --- a/lib/features/connections/types/stremio/stremio_base.types.dart +++ b/lib/features/connections/types/stremio/stremio_base.types.dart @@ -489,7 +489,7 @@ class Meta extends LibraryItem { class BehaviorHints { @JsonKey(name: "defaultVideoId") final dynamic defaultVideoId; - @JsonKey(name: "hasScheduledVideos") + @JsonKey(name: "hasScheduledVideos", defaultValue: false) final bool hasScheduledVideos; BehaviorHints({