diff --git a/lib/screens/media_detail_screen.dart b/lib/screens/media_detail_screen.dart index 9fd2313c..0f357a37 100644 --- a/lib/screens/media_detail_screen.dart +++ b/lib/screens/media_detail_screen.dart @@ -713,11 +713,11 @@ class _MediaDetailScreenState extends State with WatchStateAw const SizedBox(width: 12), IconButton.filledTonal( onPressed: () async { - final result = await Navigator.push( + await Navigator.push( context, MaterialPageRoute(builder: (context) => MetadataEditScreen(metadata: metadata)), ); - if (result == true && mounted) { + if (mounted) { _loadFullMetadata(); } }, diff --git a/lib/services/plex_client.dart b/lib/services/plex_client.dart index 86eb09c6..7aac83c8 100644 --- a/lib/services/plex_client.dart +++ b/lib/services/plex_client.dart @@ -1577,19 +1577,24 @@ class PlexClient { /// Set artwork from a URL (can be a Plex internal path or external URL) Future setArtworkFromUrl(String ratingKey, String element, String url) { + final setElement = element.endsWith('s') ? element.substring(0, element.length - 1) : element; return _wrapBoolApiCall( - () => _dio.post('/library/metadata/$ratingKey/$element', queryParameters: {'url': url}), + () => _dio.put('/library/metadata/$ratingKey/$setElement', queryParameters: {'url': url}), 'Failed to set artwork from URL', ); } /// Upload artwork from binary data Future uploadArtwork(String ratingKey, String element, List bytes) { + final setElement = element.endsWith('s') ? element.substring(0, element.length - 1) : element; return _wrapBoolApiCall( - () => _dio.post( - '/library/metadata/$ratingKey/$element', + () => _dio.put( + '/library/metadata/$ratingKey/$setElement', data: bytes, - options: Options(headers: {'Content-Length': bytes.length}), + options: Options( + headers: {'Content-Length': bytes.length}, + contentType: 'application/octet-stream', + ), ), 'Failed to upload artwork', ); diff --git a/lib/widgets/artwork_picker_dialog.dart b/lib/widgets/artwork_picker_dialog.dart index a93ce810..6ede9cb6 100644 --- a/lib/widgets/artwork_picker_dialog.dart +++ b/lib/widgets/artwork_picker_dialog.dart @@ -187,37 +187,40 @@ class _ArtworkPickerDialogState extends State { return FocusableWrapper( borderRadius: 8, onSelect: () => _selectArtwork(artwork), - child: Stack( - fit: StackFit.expand, - children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surfaceContainerHighest, - borderRadius: const BorderRadius.all(Radius.circular(8)), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(8)), - child: PlexOptimizedImage( - client: widget.client, - imagePath: thumbUrl, - fit: BoxFit.contain, + child: GestureDetector( + onTap: () => _selectArtwork(artwork), + child: Stack( + fit: StackFit.expand, + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + borderRadius: const BorderRadius.all(Radius.circular(8)), ), - ), - ), - if (isSelected) - Positioned( - right: 6, - bottom: 6, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primary, - shape: BoxShape.circle, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(8)), + child: PlexOptimizedImage( + client: widget.client, + imagePath: thumbUrl, + fit: BoxFit.contain, ), - child: Icon(Symbols.check_rounded, size: 16, color: Theme.of(context).colorScheme.onPrimary), ), ), - ], + if (isSelected) + Positioned( + right: 6, + bottom: 6, + child: Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + shape: BoxShape.circle, + ), + child: Icon(Symbols.check_rounded, size: 16, color: Theme.of(context).colorScheme.onPrimary), + ), + ), + ], + ), ), ); },