fix: handle null ratingKey in folder browsing
This commit is contained in:
@@ -9,6 +9,9 @@ import '../utils/global_key_utils.dart';
|
||||
|
||||
part 'plex_metadata.g.dart';
|
||||
|
||||
Object? _readRatingKey(Map json, String key) =>
|
||||
json['ratingKey'] ?? json['key'] ?? '';
|
||||
|
||||
int? _flexibleInt(Object? v) => switch (v) {
|
||||
num n => n.toInt(),
|
||||
String s => int.tryParse(s),
|
||||
@@ -57,6 +60,7 @@ enum PlexMediaType {
|
||||
|
||||
@JsonSerializable()
|
||||
class PlexMetadata with MultiServerFields {
|
||||
@JsonKey(readValue: _readRatingKey)
|
||||
final String ratingKey;
|
||||
final String key;
|
||||
final String? guid;
|
||||
|
||||
@@ -7,7 +7,7 @@ part of 'plex_metadata.dart';
|
||||
// **************************************************************************
|
||||
|
||||
PlexMetadata _$PlexMetadataFromJson(Map<String, dynamic> json) => PlexMetadata(
|
||||
ratingKey: json['ratingKey'] as String,
|
||||
ratingKey: _readRatingKey(json, 'ratingKey') as String,
|
||||
key: json['key'] as String,
|
||||
guid: json['guid'] as String?,
|
||||
studio: json['studio'] as String?,
|
||||
|
||||
Reference in New Issue
Block a user