Merge pull request #637 from micahmo/fix/setting-episode-artwork
Fix an issue setting episode artwork
This commit is contained in:
@@ -219,8 +219,22 @@ class _MetadataEditScreenState extends State<MetadataEditScreen> {
|
||||
);
|
||||
|
||||
if (result == true && mounted) {
|
||||
// Reload metadata to get updated artwork paths
|
||||
_loadMetadata();
|
||||
// Re-fetch metadata to get updated artwork paths without resetting
|
||||
// any text field edits the user may have made.
|
||||
await _reloadArtwork();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _reloadArtwork() async {
|
||||
try {
|
||||
final meta = await _client.getMetadataWithImages(widget.metadata.ratingKey);
|
||||
if (!mounted) return;
|
||||
if (meta != null) {
|
||||
setState(() => _fullMetadata = meta);
|
||||
}
|
||||
} catch (_) {
|
||||
// Artwork was already saved by the picker; display will refresh next
|
||||
// time the editor is opened.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,16 @@ class _ArtworkPickerDialogState extends State<ArtworkPickerDialog> {
|
||||
}
|
||||
|
||||
Future<void> _selectArtwork(Map<String, dynamic> artwork) async {
|
||||
final key = artwork['key'] as String?;
|
||||
if (key == null || _isApplying) return;
|
||||
// Use ratingKey (the artwork provider identifier) rather than key (a
|
||||
// file-serving path that is already percent-encoded). Passing key through
|
||||
// Dio's query-parameter encoding double-encodes it, causing Plex to
|
||||
// silently ignore the selection despite returning 200.
|
||||
final url = artwork['ratingKey'] as String? ?? artwork['key'] as String?;
|
||||
if (url == null || _isApplying) return;
|
||||
|
||||
setState(() => _isApplying = true);
|
||||
|
||||
final success = await widget.client.setArtworkFromUrl(widget.ratingKey, widget.element, key);
|
||||
final success = await widget.client.setArtworkFromUrl(widget.ratingKey, widget.element, url);
|
||||
|
||||
if (!mounted) return;
|
||||
setState(() => _isApplying = false);
|
||||
|
||||
Reference in New Issue
Block a user